jam411 3 роки тому
батько
коміт
3b69f285f4

+ 23 - 6
packages/app/test/cypress/integration/50-sidebar/50-sidebar--access-to-side-bar.spec.ts

@@ -13,12 +13,14 @@ describe('Access to sidebar', () => {
       beforeEach(() => {
         cy.visit('/');
         cy.waitUntilSkeletonDisappear();
+        // Since this is a sidebar test, call collapseSidebar in beforeEach.
         cy.collapseSidebar(false);
       });
 
       describe('Test show/collapse button', () => {
         it('Successfully show sidebar', () => {
           cy.getByTestid('grw-pagetree-item-container').should('be.visible');
+
           cy.screenshot(`${ssPrefix}1-sidebar-shown`, {
             capture: 'viewport',
             // Blackout for recalculation of toc content hight
@@ -28,6 +30,7 @@ describe('Access to sidebar', () => {
 
         it('Successfully collapse sidebar', () => {
           cy.getByTestid('grw-navigation-resize-button').click({force: true});
+
           cy.screenshot(`${ssPrefix}2-sidebar-collapsed`, {
             capture: 'viewport',
             // Blackout for recalculation of toc content hight
@@ -40,6 +43,7 @@ describe('Access to sidebar', () => {
         it('Successfully access to page tree', () => {
           cy.getByTestid('grw-contextual-navigation-sub').within(() => {
             cy.getByTestid('grw-pagetree-item-container').should('be.visible');
+
             cy.screenshot(`${ssPrefix}page-tree-1-access-to-page-tree`);
           });
         });
@@ -50,17 +54,19 @@ describe('Access to sidebar', () => {
 
             // hide page tree tiems
             cy.get('.grw-pagetree-triangle-btn').eq(0).click();
+
             cy.screenshot(`${ssPrefix}page-tree-2-hide-page-tree-items`);
           });
         });
 
         it('Successfully click Add to Bookmarks button', () => {
           // click three dots
-          cy.get('.grw-pagetree-item-children').eq(0).within(() => {
+          cy.get('.grw-pagetree-item-children').first().within(() => {
             cy.getByTestid('open-page-item-control-btn').find('button').eq(0).invoke('css','display','block').click();
           });
 
           cy.getByTestid('page-item-control-menu').should('have.class', 'show');
+
           cy.screenshot(`${ssPrefix}page-tree-3-before-click-button`, {
             // Blackout for recalculation of toc content hight
             blackout: ['.grw-side-contents-container', '[data-hide-in-vrt=true]'],
@@ -72,11 +78,12 @@ describe('Access to sidebar', () => {
           });
 
           // show dropdown again
-          cy.get('.grw-pagetree-item-children').eq(0).within(() => {
+          cy.get('.grw-pagetree-item-children').first().within(() => {
             cy.getByTestid('open-page-item-control-btn').find('button').eq(0).invoke('css','display','block').click();
           });
 
           cy.getByTestid('page-item-control-menu').should('have.class', 'show');
+
           cy.screenshot(`${ssPrefix}page-tree-4-after-click-button`, {
             // Blackout for recalculation of toc content hight
             blackout: ['.grw-side-contents-container', '[data-hide-in-vrt=true]'],
@@ -92,7 +99,9 @@ describe('Access to sidebar', () => {
           });
           cy.getByTestid('page-duplicate-modal').should('be.visible').within(() => {
             cy.get('.rbt-input-main').type('_test');
+
             cy.screenshot(`${ssPrefix}page-tree-5-duplicate-page-modal`);
+
             cy.get('.modal-header > button').click();
           });
         });
@@ -108,6 +117,7 @@ describe('Access to sidebar', () => {
             cy.get('.grw-pagetree-item-children').eq(0).within(() => {
               cy.getByTestid('closable-text-input').type('_newname');
             });
+
             cy.screenshot(`${ssPrefix}page-tree-6-rename-page`);
           });
         });
@@ -122,7 +132,9 @@ describe('Access to sidebar', () => {
             });
           });
           cy.getByTestid('page-delete-modal').should('be.visible').within(() => {
+
             cy.screenshot(`${ssPrefix}page-tree-7-delete-page-modal`);
+
             cy.get('.modal-header > button').click();
           });
         });
@@ -137,6 +149,7 @@ describe('Access to sidebar', () => {
 
           cy.getByTestid('grw-contextual-navigation-sub').within(() => {
             cy.get('.grw-sidebar-content-header.h5').find('a');
+
             cy.screenshot(`${ssPrefix}custom-sidebar-1-access-to-custom-sidebar`);
           });
         });
@@ -146,7 +159,9 @@ describe('Access to sidebar', () => {
 
           cy.get('.grw-sidebar-content-header.h5').find('a').click();
           cy.get('.CodeMirror textarea').type(content, {force: true});
+
           cy.screenshot(`${ssPrefix}custom-sidebar-2-redirect-to-editor`);
+
           cy.getByTestid('save-page-btn').click();
           cy.get('.layout-root').should('not.have.class', 'editing');
         });
@@ -154,6 +169,7 @@ describe('Access to sidebar', () => {
         it('Successfully create custom sidebar content', () => {
           cy.getByTestid('grw-contextual-navigation-sub').within(() => {
             cy.get('.grw-custom-sidebar-content').should('be.visible');
+
             cy.screenshot(`${ssPrefix}custom-sidebar-3-content-created`);
           });
         });
@@ -169,7 +185,7 @@ describe('Access to sidebar', () => {
           cy.getByTestid('grw-recent-changes').should('be.visible');
           cy.get('.list-group-item').should('be.visible');
 
-          // The scope of the capture is not narrowed because the blackout is shifted
+          // The scope of the screenshot is not narrowed because the blackout is shifted
           cy.screenshot(`${ssPrefix}recent-changes-1-access-to-recent-changes`, {
             // Blackout for recalculation of toc content hight
             blackout: ['.grw-side-contents-container', '[data-hide-in-vrt=true]'],
@@ -182,7 +198,7 @@ describe('Access to sidebar', () => {
             cy.get('.list-group-item').should('be.visible');
           });
 
-          // The scope of the capture is not narrowed because the blackout is shifted
+          // The scope of the screenshot is not narrowed because the blackout is shifted
           cy.screenshot(`${ssPrefix}recent-changes-2-switch-content-size`, {
             // Blackout for recalculation of toc content hight
             blackout: ['.grw-side-contents-container', '[data-hide-in-vrt=true]'],
@@ -199,14 +215,15 @@ describe('Access to sidebar', () => {
 
           cy.getByTestid('grw-contextual-navigation-sub').within(() => {
             cy.getByTestid('grw-tags-list').should('be.visible');
+
             cy.screenshot(`${ssPrefix}tags-1-access-to-tags`);
           });
         });
 
         it('Succesfully click all tags button', () => {
           cy.get('.grw-container-convertible > div > .btn-primary').click({force: true});
-          cy.collapseSidebar(true);
           cy.getByTestid('grw-tags-list').should('be.visible');
+
           cy.screenshot(`${ssPrefix}tags-2-click-all-tags-button`);
         });
       });
@@ -234,13 +251,13 @@ describe('Access to sidebar', () => {
 
       describe('Test access to trash page', () => {
         it('Successfully access to trash page', () => {
-          cy.collapseSidebar(true);
           cy.get('.grw-sidebar-nav-secondary-container').within(() => {
             cy.get('a[href*="/trash"]').click();
           });
 
           cy.get('.grw-page-path-hierarchical-link').should('be.visible');
           cy.get('.grw-custom-nav-tab').should('be.visible');
+
           cy.screenshot(`${ssPrefix}access-to-trash-page`);
         });
       });

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

@@ -21,6 +21,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.get('.grw-apperance-mode-dropdown').first().click();