Просмотр исходного кода

Merge pull request #8399 from weseek/fix/138955-20-basic-features--access-to-pagelist

fix: Normalization of 20-basic-features--access-to-pagelist.cy.ts
Shun Miyazawa 2 лет назад
Родитель
Сommit
3ce8933bb8

+ 26 - 18
apps/app/test/cypress/e2e/20-basic-features/20-basic-features--access-to-pagelist.cy.ts

@@ -1,3 +1,22 @@
+const openPageAccessoriesModal = () => {
+  cy.visit('/');
+  cy.collapseSidebar(true);
+  cy.waitUntilSkeletonDisappear();
+
+  // open PageAccessoriesModal
+  cy.getByTestid('pageListButton').should('be.visible').click();
+  cy.getByTestid('descendants-page-list-modal').then($elem => $elem.is(':visible'));
+
+  // cy.waitUntil(() => {
+  //   // do
+  //   cy.getByTestid('pageListButton').click();
+  //   // wait until
+  //   return cy.getByTestid('descendants-page-list-modal').then($elem => $elem.is(':visible'));
+  // });
+
+  cy.waitUntilSpinnerDisappear();
+}
+
 context('Access to pagelist', () => {
 context('Access to pagelist', () => {
   const ssPrefix = 'access-to-pagelist-';
   const ssPrefix = 'access-to-pagelist-';
   beforeEach(() => {
   beforeEach(() => {
@@ -5,19 +24,8 @@ context('Access to pagelist', () => {
     cy.fixture("user-admin.json").then(user => {
     cy.fixture("user-admin.json").then(user => {
       cy.login(user.username, user.password);
       cy.login(user.username, user.password);
     });
     });
-    cy.visit('/');
-    cy.collapseSidebar(true);
-    cy.waitUntilSkeletonDisappear();
-
-    // open PageAccessoriesModal
-    cy.waitUntil(() => {
-      // do
-      cy.getByTestid('pageListButton').click({force: true});
-      // wait until
-      return cy.getByTestid('descendants-page-list-modal').then($elem => $elem.is(':visible'));
-    });
 
 
-    cy.waitUntilSpinnerDisappear();
+    openPageAccessoriesModal();
   });
   });
 
 
   it('Page list modal is successfully opened ', () => {
   it('Page list modal is successfully opened ', () => {
@@ -53,13 +61,14 @@ context('Access to pagelist', () => {
   });
   });
 
 
   it('Successfully expand and close modal', () => {
   it('Successfully expand and close modal', () => {
-    cy.get('button.close').eq(0).click();
+    cy.get('.btn-close').eq(0).click();
 
 
     cy.waitUntilSkeletonDisappear();
     cy.waitUntilSkeletonDisappear();
     cy.waitUntilSpinnerDisappear();
     cy.waitUntilSpinnerDisappear();
     cy.screenshot(`${ssPrefix}7-page-list-modal-size-fullscreen`);
     cy.screenshot(`${ssPrefix}7-page-list-modal-size-fullscreen`);
 
 
-    cy.get('button.close').eq(1).click();
+    // Check that the modal has been closed
+    cy.getByTestid('descendants-page-list-modal').should('not.be.visible')
     cy.screenshot(`${ssPrefix}8-close-page-list-modal`);
     cy.screenshot(`${ssPrefix}8-close-page-list-modal`);
   });
   });
 });
 });
@@ -71,12 +80,11 @@ context('Access to timeline', () => {
     cy.fixture("user-admin.json").then(user => {
     cy.fixture("user-admin.json").then(user => {
       cy.login(user.username, user.password);
       cy.login(user.username, user.password);
     });
     });
+
+    openPageAccessoriesModal();
   });
   });
-  it('Timeline list successfully openend', () => {
-    cy.visit('/');
-    cy.collapseSidebar(true);
 
 
-    cy.getByTestid('pageListButton').click({force: true});
+  it('Timeline list successfully openend', () => {
     cy.getByTestid('descendants-page-list-modal').parent().should('have.class','show').within(() => {
     cy.getByTestid('descendants-page-list-modal').parent().should('have.class','show').within(() => {
       cy.get('.nav-title > li').eq(1).find('a').click();
       cy.get('.nav-title > li').eq(1).find('a').click();
     });
     });