Răsfoiți Sursa

divide tests

jam411 3 ani în urmă
părinte
comite
784f72e5cc

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

@@ -12,20 +12,16 @@ context('Access to sidebar', () => {
 
   it('Successfully show/collapse sidebar', () => {
     cy.visit('/');
-
     cy.waitUntilSkeletonDisappear();
 
     cy.screenshot(`${ssPrefix}-1-sidebar-shown`, {capture: 'viewport'});
-    cy.getByTestid('grw-navigation-resize-button').click({force: true});
-
-    cy.waitUntilSkeletonDisappear();
 
+    cy.getByTestid('grw-navigation-resize-button').click({force: true});
     cy.screenshot(`${ssPrefix}-2-sidebar-collapsed`, {capture: 'viewport'});
-
   });
+
   it('Successfully access recent changes side bar ', () => {
     cy.visit('/');
-
     cy.waitUntilSkeletonDisappear();
 
     cy.getByTestid('grw-sidebar-nav-primary-recent-changes').click();
@@ -52,6 +48,8 @@ context('Access to sidebar', () => {
 
   it('Successfully create a custom sidebar page', () => {
     cy.visit('/');
+    cy.waitUntilSkeletonDisappear();
+
     cy.getByTestid('grw-sidebar-nav-primary-custom-sidebar').click();
     cy.getByTestid('grw-contextual-navigation-sub').then(($el) => {
       if($el.hasClass('d-none')){
@@ -59,15 +57,16 @@ context('Access to sidebar', () => {
       }
     });
 
-    cy.getByTestid('grw-contextual-navigation-sub').screenshot(`${ssPrefix}custom-sidebar-1-click-on-custom-sidebar`);
+    cy.getByTestid('grw-contextual-navigation-sub');
+    cy.screenshot(`${ssPrefix}custom-sidebar-1-click-on-custom-sidebar`);
 
     // create /Sidebar contents
     const content = '# HELLO \n ## Hello\n ### Hello';
-    cy.get('.grw-sidebar-content-header.h5').find('a').click();
+    cy.get('.grw-sidebar-content-header > h3').find('a').click();
     cy.get('.CodeMirror textarea').type(content, {force: true});
     cy.screenshot(`${ssPrefix}custom-sidebar-2-custom-sidebar-editor`);
     cy.getByTestid('save-page-btn').click();
-    cy.get('.layout-root', { timeout: 10000 }).should('not.have.class', 'editing');
+    cy.get('.layout-root').should('not.have.class', 'editing');
 
     // What to do when UserUISettings is not saved in time
     cy.getByTestid('grw-sidebar-nav-primary-custom-sidebar').then(($el) => {
@@ -82,79 +81,78 @@ context('Access to sidebar', () => {
 
   it('Successfully performed page operation from "page tree"', () => {
     cy.visit('/');
-
     cy.waitUntilSkeletonDisappear();
 
+    //
     cy.getByTestid('grw-sidebar-nav-primary-page-tree').click();
     cy.getByTestid('grw-contextual-navigation-sub').then(($el) => {
       if($el.hasClass('d-none')){
         cy.getByTestid('grw-navigation-resize-button').click({force: true});
       }
     });
-
-    cy.waitUntilSkeletonDisappear();
-
     cy.getByTestid('grw-contextual-navigation-sub').should('be.visible')
-    // cy.get('.grw-pagetree-item-children').eq(0).should('be.visible');
     cy.screenshot(`${ssPrefix}page-tree-1-access-to-page-tree`);
 
-    cy.getByTestid('grw-contextual-navigation-sub').screenshot(`${ssPrefix}page-tree-2-hide-page-tree-item`);
+    // hide page tree items
     cy.get('.grw-pagetree-triangle-btn').eq(0).click();
+    cy.getByTestid('grw-contextual-navigation-sub').screenshot(`${ssPrefix}page-tree-2-hide-page-tree-item`);
 
+    //
+    cy.get('.grw-pagetree-triangle-btn').eq(0).click();
     cy.get('.grw-pagetree-item-children').eq(0).within(() => {
       cy.getByTestid('open-page-item-control-btn').find('button').eq(0).invoke('css','display','block').click();
     });
-
     cy.screenshot(`${ssPrefix}page-tree-3-click-three-dots-menu`);
+
+    //
     cy.get('.dropdown-menu.show').should('be.visible').within(() => {
       cy.getByTestid('add-remove-bookmark-btn').click();
     });
     cy.screenshot(`${ssPrefix}page-tree-4-add-bookmark`);
 
-
+    //
     cy.get('.grw-pagetree-item-children').eq(0).within(() => {
       cy.getByTestid('open-page-item-control-btn').find('button').eq(0).invoke('css','display','block').click();
     });
     cy.get('.dropdown-menu.show').should('be.visible').within(() => {
       cy.getByTestid('open-page-duplicate-modal-btn').click();
     });
-
     cy.getByTestid('page-duplicate-modal').should('be.visible').within(() => {
       cy.get('.rbt-input-main').type('_test');
       cy.screenshot(`${ssPrefix}page-tree-5-duplicate-page`);
       cy.get('.modal-header > button').click();
     });
 
+    //
     cy.get('.grw-pagetree-item-children').eq(0).within(() => {
       cy.getByTestid('open-page-item-control-btn').find('button').eq(0).invoke('css','display','block').click()
     });
     cy.get('.dropdown-menu.show').should('be.visible').within(() => {
       cy.getByTestid('open-page-move-rename-modal-btn').click();
     });
-
     cy.get('.grw-pagetree-item-children').eq(0).within(() => {
       cy.getByTestid('closable-text-input').type('_newname');
     });
-
     cy.getByTestid('grw-contextual-navigation-sub').screenshot(`${ssPrefix}page-tree-6-rename-page`);
-    cy.get('body').click(0,0);
 
+    //
+    cy.get('body').click(0,0);
     cy.get('.grw-pagetree-item-children').eq(0).within(() => {
       cy.getByTestid('open-page-item-control-btn').find('button').eq(0).invoke('css','display','block').click()
     });
     cy.get('.dropdown-menu.show').should('be.visible').within(() => {
       cy.getByTestid('open-page-delete-modal-btn').click();
     });
-
     cy.getByTestid('page-delete-modal').should('be.visible').within(() => {
       cy.screenshot(`${ssPrefix}page-tree-7-delete-page`);
       cy.get('.modal-header > button').click();
     });
-
   });
 
   it('Successfully performed page operation from "Tags" ', () => {
     cy.visit('/');
+    cy.waitUntilSkeletonDisappear();
+
     cy.getByTestid('grw-sidebar-nav-primary-tags').click();
     cy.getByTestid('grw-contextual-navigation-sub').then(($el) => {
       if($el.hasClass('d-none')){
@@ -179,8 +177,11 @@ context('Access to sidebar', () => {
   //   });
   //   cy.screenshot(`${ssPrefix}access-to-drafts-page`);
   // });
+
   it('Successfully access to GROWI Docs page', () => {
     cy.visit('/');
+    cy.waitUntilSkeletonDisappear();
+
     cy.get('.grw-sidebar-nav-secondary-container').within(() => {
       cy.get('a[href*="https://docs.growi.org"]').then(($a) => {
         const url = $a.prop('href')
@@ -191,15 +192,15 @@ context('Access to sidebar', () => {
 
   it('Successfully access to trash page', () => {
     cy.visit('/');
+    cy.waitUntilSkeletonDisappear();
+
     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`);
   });
 });