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

Merge pull request #7021 from weseek/feat/update-cypress-10-install

feat: Update cypress 10 install
Shun Miyazawa 3 лет назад
Родитель
Сommit
99a2b78c49

+ 21 - 24
packages/app/test/cypress/integration/10-install/install.spec.ts

@@ -1,47 +1,42 @@
-context('Installer', () => {
-
+describe('Install', () => {
   const ssPrefix = 'installer-';
 
   beforeEach(() => {
     cy.visit('/');
-  })
+  });
 
-  it('successfully loads', () => {
-    cy.screenshot(`${ssPrefix}-on-load`);
+  it('Successfully show installer', () => {
     cy.getByTestid('installerForm').should('be.visible');
+    cy.screenshot(`${ssPrefix}-redirect-to-installer-page`);
   });
 
-  it('the dropdown for language works', () => {
+  it('Sccessfully choose languages', () => {
+    cy.getByTestid('installerForm').should('be.visible');
     cy.getByTestid('dropdownLanguage').should('be.visible');
+    // TODO: should not use wait.
+    // eslint-disable-next-line cypress/no-unnecessary-waiting
+    cy.wait(1000); // waiting for load
 
     cy.getByTestid('dropdownLanguage').click();
-    cy.screenshot(`${ssPrefix}-open-dropdownLanguage`);
-    cy.getByTestid('dropdownLanguage').click(); // close
-
-    cy.getByTestid('dropdownLanguage').click();
+    cy.get('.dropdown-menu').should('be.visible');
     cy.getByTestid('dropdownLanguageMenu-en_US').click();
+    cy.get('.alert-success').should('be.visible');
     cy.screenshot(`${ssPrefix}-select-en_US`);
 
     cy.getByTestid('dropdownLanguage').click();
+    cy.get('.dropdown-menu').should('be.visible');
     cy.getByTestid('dropdownLanguageMenu-ja_JP').click();
+    cy.get('.alert-success').should('be.visible');
     cy.screenshot(`${ssPrefix}-select-ja_JP`);
 
     cy.getByTestid('dropdownLanguage').click();
+    cy.get('.dropdown-menu').should('be.visible');
     cy.getByTestid('dropdownLanguageMenu-zh_CN').click();
+    cy.get('.alert-success').should('be.visible');
     cy.screenshot(`${ssPrefix}-select-zh_CN`);
   });
 
-});
-
-context('Installing', () => {
-
-  const ssPrefix = 'installing-';
-
-  beforeEach(() => {
-    cy.visit('/');
-  })
-
-  it('has succeeded', () => {
+  it('Successfully installing and redirect to root page', () => {
     cy.fixture("user-admin.json").then(user => {
       cy.getByTestid('tiUsername').type(user.username);
       cy.getByTestid('tiName').type(user.name);
@@ -52,9 +47,11 @@ context('Installing', () => {
 
     cy.getByTestid('btnSubmit').click();
 
-    cy.screenshot(`${ssPrefix}-installed`, {
-      blackout: ['#grw-sidebar-contents-wrapper','[data-line="2"]:eq(0) > a > img', '[data-hide-in-vrt=true]'],
+    // Redirects to the root page take a long time (more than 10000ms)
+    cy.waitUntilSkeletonDisappear();
+    cy.getByTestid('grw-pagetree-item-container').should('be.visible');
+    cy.screenshot(`${ssPrefix}-installed-redirect-to-root-page`, {
+      blackout: ['[data-hide-in-vrt=true]']
     });
   });
-
 });

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

@@ -18,7 +18,7 @@ describe('Access to sidebar', () => {
 
       describe('Test show/collapse button', () => {
         it('Successfully show sidebar', () => {
-          cy.get('.grw-pagetree').should('be.visible');
+          cy.getByTestid('grw-pagetree-item-container').should('be.visible');
           cy.screenshot(`${ssPrefix}1-sidebar-shown`, {
             capture: 'viewport',
             // Blackout for recalculation of toc content hight
@@ -39,7 +39,7 @@ describe('Access to sidebar', () => {
       describe('Test page tree tab', () => {
         it('Successfully access to page tree', () => {
           cy.getByTestid('grw-contextual-navigation-sub').within(() => {
-            cy.get('.grw-pagetree').should('be.visible');
+            cy.getByTestid('grw-pagetree-item-container').should('be.visible');
             cy.screenshot(`${ssPrefix}page-tree-1-access-to-page-tree`);
           });
         });