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

Merge pull request #6960 from weseek/fix/108858-normalize-vrt

fix: Normalize VRT (20-basic-features/use-tools.spec.ts/Modal for page operation -- Trying to create template page under the root page fail (failed).png)
Shun Miyazawa 3 лет назад
Родитель
Сommit
2bcf33701e

+ 3 - 2
packages/app/src/components/PageCreateModal.jsx

@@ -267,13 +267,13 @@ const PageCreateModal = () => {
 
           <h3 className="grw-modal-head pb-2">
             {t('template.modal_label.Create template under')}<br />
-            <code className="h6">{pathname}</code>
+            <code className="h6" data-testid="grw-page-create-modal-path-name">{pathname}</code>
           </h3>
 
           <div className="d-sm-flex align-items-center justify-items-between">
 
             <UncontrolledButtonDropdown id="dd-template-type" className='flex-fill text-center'>
-              <DropdownToggle caret>
+              <DropdownToggle id="template-type" caret>
                 {template == null && t('template.option_label.select')}
                 {template === 'children' && t('template.children.label')}
                 {template === 'decendants' && t('template.decendants.label')}
@@ -292,6 +292,7 @@ const PageCreateModal = () => {
 
             <div className="d-flex justify-content-end mt-1 mt-sm-0">
               <button
+                data-testid="grw-btn-edit-page"
                 type="button"
                 className='grw-btn-create-page btn btn-outline-primary rounded-pill text-nowrap ml-3'
                 onClick={createTemplatePage}

+ 9 - 2
packages/app/test/cypress/integration/20-basic-features/use-tools.spec.ts

@@ -80,21 +80,28 @@ context('Modal for page operation', () => {
 
   it('Trying to create template page under the root page fail', () => {
     cy.visit('/');
+
+    cy.waitUntilSkeletonDisappear();
+
     cy.getByTestid('newPageBtn').click();
 
     cy.getByTestid('page-create-modal').should('be.visible').within(() => {
+
+      cy.getByTestid('grw-page-create-modal-path-name').should('have.text', '/');
+
       cy.get('#template-type').click();
       cy.get('#template-type').next().find('button:eq(0)').click({force: true});
-      cy.get('#dd-template-type').next().find('button').click({force: true});
+      cy.getByTestid('grw-btn-edit-page').should('be.visible').click();
     });
     cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
     cy.screenshot(`${ssPrefix}create-template-for-children-error`, {capture: 'viewport'});
     cy.get('.toast-error').should('be.visible').click();
+    cy.get('.toast-error').should('not.exist');
 
     cy.getByTestid('page-create-modal').should('be.visible').within(() => {
       cy.get('#template-type').click();
       cy.get('#template-type').next().find('button:eq(1)').click({force: true});
-      cy.get('#dd-template-type').next().find('button').click({force: true});
+      cy.getByTestid('grw-btn-edit-page').should('be.visible').click();
     });
     cy.get('.toast-error').should('be.visible').invoke('attr', 'style', 'opacity: 1');
     cy.screenshot(`${ssPrefix}create-template-for-descendants-error`, {capture: 'viewport'});