Преглед изворни кода

cy.screenshot(`${ssPrefix}-sandbox`);
improve

Yuki Takei пре 3 година
родитељ
комит
9cee3b98f7

+ 1 - 1
packages/app/test/cypress/integration/20-basic-features/20-basic-features--access-to-page.spec.ts

@@ -15,7 +15,7 @@ context('Access to page', () => {
     // for check download toc data
     cy.get('.toc-link').eq(0).contains('Table of Contents');
 
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     cy.screenshot(`${ssPrefix}-sandbox`);
   });
 

+ 1 - 1
packages/app/test/cypress/integration/20-basic-features/20-basic-features--click-page-icons.spec.ts

@@ -10,7 +10,7 @@ context('Click page icons button', () => {
 
   it('Successfully subscribe/unsubscribe a page', () => {
     cy.visit('/Sandbox');
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
 
     // Subscribe
     cy.get('#subscribe-button').click({force: true});

+ 2 - 2
packages/app/test/cypress/integration/20-basic-features/20-basic-features--use-tools.spec.ts

@@ -24,7 +24,7 @@ context('Modal for page operation', () => {
       cy.get('button.close').click();
     });
 
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     cy.screenshot(`${ssPrefix}page-create-modal-closed`);
   });
 
@@ -231,7 +231,7 @@ context('Page Accessories Modal', () => {
 
     cy.getByTestid('page-history').should('be.visible');
 
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     cy.waitUntilSpinnerDisappear();
     cy.screenshot(`${ssPrefix}-open-page-history-bootstrap4`);
   });

+ 2 - 2
packages/app/test/cypress/integration/21-basic-features-for-guest/21-basic-features-for-guest--access-to-page.spec.ts

@@ -4,7 +4,7 @@ context('Access to page by guest', () => {
   it('/Sandbox is successfully loaded', () => {
     cy.visit('/Sandbox');
     cy.getByTestid('grw-pagetree-item-container').should('be.visible');
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     cy.screenshot(`${ssPrefix}-sandbox`);
   });
 
@@ -18,7 +18,7 @@ context('Access to page by guest', () => {
     // hide fab // disable fab for sticky-events warning
     // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
 
-    cy.collapseSidebar(true, true);
+    cy.collapseSidebar(true);
     cy.screenshot(`${ssPrefix}-sandbox-headers`);
   });
 

+ 2 - 2
packages/app/test/cypress/integration/30-search/30-search--search.spec.ts

@@ -19,7 +19,7 @@ context('Access to search result page', () => {
     // for avoid mismatch by auto scrolling
     cy.get('.search-result-content-body-container').scrollTo('top');
 
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     cy.waitUntilSkeletonDisappear();
     cy.screenshot(`${ssPrefix}with-q`);
   });
@@ -97,7 +97,7 @@ context('Search all pages', () => {
 
     cy.visit('/');
 
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     cy.waitUntilSkeletonDisappear();
 
     cy.get('.rbt-input').click();

+ 1 - 1
packages/app/test/cypress/integration/50-sidebar/50-sidebar--switching-sidebar-mode.spec.ts

@@ -22,7 +22,7 @@ context('Switch sidebar mode', () => {
   it('Switching sidebar mode', () => {
     cy.visit('/');
     // This test uses collapseSidebar here, because this test for the sidebar.
-    cy.collapseSidebar(true, true)
+    cy.collapseSidebar(true)
     cy.get('.grw-apperance-mode-dropdown').first().click();
 
     cy.get('[for="swSidebarMode"]').click({force: true});

+ 1 - 1
packages/app/test/cypress/integration/60-home/60-home--home.spec.ts

@@ -45,7 +45,7 @@ context('Access User settings', () => {
       cy.login(user.username, user.password);
     });
     cy.visit('/me');
-    cy.collapseSidebar(true);
+    cy.collapseSidebar(true, true);
     // hide fab // disable fab for sticky-events warning
     // cy.getByTestid('grw-fab-container').invoke('attr', 'style', 'display: none');
   });

+ 5 - 3
packages/app/test/cypress/support/commands.ts

@@ -69,7 +69,7 @@ Cypress.Commands.add('waitUntilSpinnerDisappear', () => {
   cy.get('.fa-spinner').should('not.exist');
 });
 
-Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean) => {
+Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean, waitUntilSaving = false) => {
   cy.getByTestid('grw-sidebar-wrapper', { timeout: 5000 }).within(() => {
     // process only when Dock Mode
     cy.get('.grw-sidebar-dock').within(() => {
@@ -82,8 +82,10 @@ Cypress.Commands.add('collapseSidebar', (isCollapsed: boolean) => {
         // do
         cy.getByTestid("grw-navigation-resize-button").click({force: true});
         // wait until saving UserUISettings
-        // eslint-disable-next-line cypress/no-unnecessary-waiting
-        cy.wait(1500);
+        if (waitUntilSaving) {
+          // eslint-disable-next-line cypress/no-unnecessary-waiting
+          cy.wait(1500);
+        }
 
         // wait until
         return cy.getByTestid('grw-contextual-navigation-sub').then($contents => isHidden($contents) === isCollapsed);