| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- context('PageCreateButton', () => {
- const ssPrefix = 'page-create-modal-';
- beforeEach(() => {
- // login
- cy.fixture("user-admin.json").then(user => {
- cy.login(user.username, user.password);
- });
- });
- it("DropendMenu is shown successfully", () => {
- cy.visit('/');
- cy.collapseSidebar(true, true);
- cy.getByTestid('grw-page-create-button').trigger('mouseover');
- cy.waitUntil(() => {
- // do
- cy.getByTestid('grw-page-create-button-dropend-toggle').click({force: true});
- // wait until
- return cy.getByTestid('grw-page-create-button-dropend-menu').then($elem => $elem.is(':visible'));
- });
- cy.screenshot(`${ssPrefix}page-create-button-dropend-menu-shown`);
- });
- it("Successfully Create Today's page", () => {
- cy.visit('/');
- cy.collapseSidebar(true);
- cy.getByTestid('grw-page-create-button').trigger('mouseover');
- cy.waitUntil(() => {
- // do
- cy.getByTestid('grw-page-create-button-dropend-toggle').click({force: true});
- // wait until
- return cy.getByTestid('grw-page-create-button-dropend-menu').then($elem => $elem.is(':visible'));
- });
- cy.getByTestid('grw-page-create-button-dropend-menu').should('be.visible').within(() => {
- cy.get('button').eq(1).click();
- });
- cy.getByTestid('page-editor').should('be.visible');
- cy.getByTestid('save-page-btn').as('save-page-btn').should('be.visible');
- cy.waitUntil(() => {
- // do
- cy.get('@save-page-btn').click();
- // wait until
- return cy.get('@save-page-btn').then($elem => $elem.is(':disabled'));
- });
- cy.get('.layout-root').should('not.have.class', 'editing');
- cy.waitUntilSkeletonDisappear();
- cy.screenshot(`${ssPrefix}create-today-page`);
- });
- it.skip('Successfully create page under specific path', () => {
- const pageName = 'child';
- cy.visit('/foo/bar');
- cy.collapseSidebar(true);
- cy.waitUntil(() => {
- // do
- cy.getByTestid('newPageBtn').click({force: true});
- // wait until
- return cy.get('body').within(() => {
- return Cypress.$('[data-testid=page-create-modal]').is(':visible');
- });
- });
- cy.getByTestid('page-create-modal').should('be.visible').within(() => {
- cy.get('.rbt-input-main').should('have.value', '/foo/bar/');
- cy.get('.rbt-input-main').type(pageName);
- cy.screenshot(`${ssPrefix}under-path-add-page-name`);
- cy.getByTestid('btn-create-page-under-below').click();
- });
- cy.getByTestid('page-editor').should('be.visible');
- cy.getByTestid('save-page-btn').as('save-page-btn').should('be.visible');
- cy.waitUntil(() => {
- // do
- cy.get('@save-page-btn').click();
- // wait until
- return cy.get('@save-page-btn').then($elem => $elem.is(':disabled'));
- });
- cy.get('.layout-root').should('not.have.class', 'editing');
- cy.getByTestid('grw-contextual-sub-nav').should('be.visible');
- cy.waitUntilSkeletonDisappear();
- cy.screenshot(`${ssPrefix}create-page-under-specific-page`);
- });
- it.skip('Trying to create template page under the root page fail', () => {
- cy.visit('/');
- cy.collapseSidebar(true);
- cy.waitUntil(() => {
- // do
- cy.getByTestid('newPageBtn').click({force: true});
- // wait until
- return cy.getByTestid('page-create-modal').then($elem => $elem.is(':visible'));
- });
- cy.getByTestid('page-create-modal').should('be.visible').within(() => {
- cy.getByTestid('grw-page-create-modal-path-name').should('have.text', '/');
- cy.get('#template-type').click();
- cy.get('#template-type').next().find('button:eq(0)').click({force: true});
- cy.getByTestid('grw-btn-edit-page').should('be.visible').click();
- });
- cy.get('.Toastify__toast').should('be.visible');
- cy.screenshot(`${ssPrefix}create-template-for-children-error`);
- cy.get('.Toastify__toast').should('be.visible').within(() => {
- cy.get('.Toastify__close-button').should('be.visible').click();
- cy.get('.Toastify__progress-bar').invoke('attr', 'style', 'display: none')
- });
- cy.getByTestid('page-create-modal').should('be.visible').within(() => {
- cy.get('#template-type').click();
- cy.get('#template-type').next().find('button:eq(1)').click({force: true});
- cy.getByTestid('grw-btn-edit-page').should('be.visible').click();
- });
- cy.get('.Toastify__toast').should('be.visible');
- cy.screenshot(`${ssPrefix}create-template-for-descendants-error`);
- });
- });
- context.skip('Shortcuts', () => {
- const ssPrefix = 'shortcuts';
- beforeEach(() => {
- // login
- cy.fixture("user-admin.json").then(user => {
- cy.login(user.username, user.password);
- });
- });
- it('Successfully updating a page using a shortcut on a previously created page', { scrollBehavior: false }, () => {
- const body1 = 'hello';
- const body2 = ' world!';
- const savePageShortcutKey = '{ctrl+s}';
- cy.visit('/Sandbox/child');
- cy.get('#grw-page-editor-mode-manager').as('pageEditorModeManager').should('be.visible');
- cy.waitUntil(() => {
- // do
- cy.get('@pageEditorModeManager').within(() => {
- cy.get('button:nth-child(2)').click();
- });
- // until
- return cy.get('.layout-root').then($elem => $elem.hasClass('editing'));
- })
- cy.get('.grw-editor-navbar-bottom').should('be.visible');
- // 1st
- cy.get('.CodeMirror').type(body1);
- cy.get('.CodeMirror').contains(body1);
- cy.get('.page-editor-preview-body').contains(body1);
- cy.get('.CodeMirror').type(savePageShortcutKey);
- cy.get('.Toastify__toast').should('be.visible').within(() => {
- cy.get('.Toastify__close-button').should('be.visible').click();
- cy.get('.Toastify__progress-bar').invoke('attr', 'style', 'display: none')
- });
- cy.screenshot(`${ssPrefix}-update-page-1`);
- cy.get('.Toastify').should('not.be.visible');
- // 2nd
- cy.get('.CodeMirror').type(body2);
- cy.get('.CodeMirror').contains(body2);
- cy.get('.page-editor-preview-body').contains(body2);
- cy.get('.CodeMirror').type(savePageShortcutKey);
- cy.get('.Toastify__toast').should('be.visible').within(() => {
- cy.get('.Toastify__close-button').should('be.visible').click();
- cy.get('.Toastify__progress-bar').invoke('attr', 'style', 'display: none')
- });
- cy.screenshot(`${ssPrefix}-update-page-2`);
- });
- });
|