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

Merge branch 'master' into fix/create-modal-style

jam411 3 лет назад
Родитель
Сommit
d027ef90aa

+ 4 - 5
packages/app/src/components/PageDuplicateModal.tsx

@@ -151,7 +151,7 @@ const PageDuplicateModal = (): JSX.Element => {
   }, [isOpened]);
 
 
-  const bodyContent = () => {
+  const renderBodyContent = () => {
     if (!isOpened || page == null) {
       return <></>;
     }
@@ -238,7 +238,7 @@ const PageDuplicateModal = (): JSX.Element => {
     );
   };
 
-  const footerContent = () => {
+  const renderFooterContent = () => {
     if (!isOpened || page == null) {
       return <></>;
     }
@@ -268,11 +268,10 @@ const PageDuplicateModal = (): JSX.Element => {
         { t('modal_duplicate.label.Duplicate page') }
       </ModalHeader>
       <ModalBody>
-        {bodyContent()}
+        {renderBodyContent()}
       </ModalBody>
       <ModalFooter>
-        <ApiErrorMessageList errs={errs} targetPath={pageNameInput} />
-        {footerContent()}
+        {renderFooterContent()}
       </ModalFooter>
     </Modal>
   );

+ 1 - 1
packages/app/src/components/Sidebar/RecentChanges.tsx

@@ -112,7 +112,7 @@ const SmallPageItem = memo(({ page }: PageItemProps): JSX.Element => {
   }
 
   return (
-    <li className="list-group-item py-2 px-0">
+    <li className={`list-group-item ${styles['list-group-item']} py-2 px-0`}>
       <div className="d-flex w-100">
         <UserPicture user={page.lastUpdateUser} size="md" noTooltip />
         <div className="flex-grow-1 ml-2">

+ 1 - 0
packages/app/src/components/TableOfContents.tsx

@@ -60,6 +60,7 @@ const TableOfContents = (): JSX.Element => {
       >
         <div
           id="revision-toc-content"
+          data-testid="revision-toc-content"
           className="revision-toc-content mb-3"
         >
           {/* parse blank to show toc (https://github.com/weseek/growi/pull/6277) */}

+ 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]']
     });
   });
-
 });

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

@@ -25,6 +25,7 @@ context('Access to page by guest', () => {
 
   it('/Sandbox/Math is successfully loaded', () => {
     cy.visit('/Sandbox/Math');
+    cy.getByTestid('revision-toc-content').should('be.visible');
     cy.collapseSidebar(true, true);
 
     cy.get('.math').should('be.visible');

+ 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`);
           });
         });