[ARVADOS-WORKBENCH2] updated: 1.4.1-359-g839ecb35

Git user git at public.arvados.org
Wed Jun 3 21:33:20 UTC 2020


Summary of changes:
 cypress/integration/side-panel.spec.js             | 64 ++++++++++++++++++++++
 src/components/form-dialog/form-dialog.tsx         |  3 +-
 .../form-fields/collection-form-fields.tsx         |  4 +-
 .../form-fields/project-form-fields.tsx            |  4 +-
 .../form-fields/resource-form-fields.tsx           |  4 +-
 5 files changed, 72 insertions(+), 7 deletions(-)

       via  839ecb358915757aa564460943e44caf4cbbebc8 (commit)
      from  fcbcbbb978fbb0d381c23a2ac204940c1c80dda3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 839ecb358915757aa564460943e44caf4cbbebc8
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Jun 3 18:32:33 2020 -0300

    16439: Adds e2e tests for creating collections & projects.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/side-panel.spec.js b/cypress/integration/side-panel.spec.js
index 95b56400..2e7b7f36 100644
--- a/cypress/integration/side-panel.spec.js
+++ b/cypress/integration/side-panel.spec.js
@@ -75,4 +75,68 @@ describe('Side panel tests', function() {
                 .and('be.disabled');
         })
     })
+
+    it('creates new collection on home project', function() {
+        cy.loginAs(activeUser);
+        cy.visit(`/projects/${activeUser.user.uuid}`);
+        cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
+        cy.get('[data-cy=breadcrumb-last]').should('not.exist');
+        // Create new collection
+        cy.get('[data-cy=side-panel-button]').click();
+        cy.get('[data-cy=side-panel-new-collection]').click();
+        const collName = `Test collection (${Math.floor(999999 * Math.random())})`;
+        cy.get('[data-cy=form-dialog]')
+            .should('contain', 'New collection')
+            .within(() => {
+                cy.get('[data-cy=parent-field]').within(() => {
+                    cy.get('input').should('have.value', 'Home project');
+                })
+                cy.get('[data-cy=name-field]').within(() => {
+                    cy.get('input').type(collName);
+                })
+            })
+        cy.get('[data-cy=form-submit-btn]').click();
+        // Confirm that the user was taken to the newly created thing
+        cy.get('[data-cy=form-dialog]').should('not.exist');
+        cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
+        cy.get('[data-cy=breadcrumb-last]').should('contain', collName);
+    })
+
+    it.only('creates new project on home project and then a subproject inside it', function() {
+        const createProject = function(name, parentName) {
+            cy.get('[data-cy=side-panel-button]').click();
+            cy.get('[data-cy=side-panel-new-project]').click();
+            cy.get('[data-cy=form-dialog]')
+                .should('contain', 'New project')
+                .within(() => {
+                    cy.get('[data-cy=parent-field]').within(() => {
+                        cy.get('input').invoke('val').then((val) => {
+                            expect(val).to.include(parentName);
+                        })
+                    })
+                    cy.get('[data-cy=name-field]').within(() => {
+                        cy.get('input').type(name);
+                    })
+                })
+            cy.get('[data-cy=form-submit-btn]').click();
+        }
+
+        cy.loginAs(activeUser);
+        cy.visit(`/projects/${activeUser.user.uuid}`);
+        cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
+        cy.get('[data-cy=breadcrumb-last]').should('not.exist');
+        // Create new project
+        const projName = `Test project (${Math.floor(999999 * Math.random())})`;
+        createProject(projName, 'Home project');
+        // Confirm that the user was taken to the newly created thing
+        cy.get('[data-cy=form-dialog]').should('not.exist');
+        cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
+        cy.get('[data-cy=breadcrumb-last]').should('contain', projName);
+        // Create a subproject
+        const subProjName = `Test project (${Math.floor(999999 * Math.random())})`;
+        createProject(subProjName, projName);
+        cy.get('[data-cy=form-dialog]').should('not.exist');
+        cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
+        cy.get('[data-cy=breadcrumb-last]').should('contain', subProjName);
+    })
 })
\ No newline at end of file
diff --git a/src/components/form-dialog/form-dialog.tsx b/src/components/form-dialog/form-dialog.tsx
index 3df874b7..b37ec68d 100644
--- a/src/components/form-dialog/form-dialog.tsx
+++ b/src/components/form-dialog/form-dialog.tsx
@@ -54,7 +54,7 @@ export const FormDialog = withStyles(styles)((props: DialogProjectProps) =>
         disableEscapeKeyDown={props.submitting}
         fullWidth
         maxWidth='md'>
-        <form>
+        <form data-cy='form-dialog'>
             <DialogTitle className={props.classes.dialogTitle}>
                 {props.dialogTitle}
             </DialogTitle>
@@ -70,6 +70,7 @@ export const FormDialog = withStyles(styles)((props: DialogProjectProps) =>
                     {props.cancelLabel || 'Cancel'}
                 </Button>
                 <Button
+                    data-cy='form-submit-btn'
                     type="submit"
                     onClick={props.handleSubmit}
                     className={props.classes.lastButton}
diff --git a/src/views-components/form-fields/collection-form-fields.tsx b/src/views-components/form-fields/collection-form-fields.tsx
index b3a3c224..623cb317 100644
--- a/src/views-components/form-fields/collection-form-fields.tsx
+++ b/src/views-components/form-fields/collection-form-fields.tsx
@@ -27,12 +27,12 @@ export const CollectionNameField = connect(
                 COLLECTION_NAME_VALIDATION : COLLECTION_NAME_VALIDATION_ALLOW_SLASH)
         };
     })((props: CollectionNameFieldProps) =>
-        <Field
+        <span data-cy='name-field'><Field
             name='name'
             component={TextField}
             validate={props.validate}
             label="Collection Name"
-            autoFocus={true} />
+            autoFocus={true} /></span>
     );
 
 export const CollectionDescriptionField = () =>
diff --git a/src/views-components/form-fields/project-form-fields.tsx b/src/views-components/form-fields/project-form-fields.tsx
index 64386ea0..dc1e1612 100644
--- a/src/views-components/form-fields/project-form-fields.tsx
+++ b/src/views-components/form-fields/project-form-fields.tsx
@@ -28,12 +28,12 @@ export const ProjectNameField = connect(
                 PROJECT_NAME_VALIDATION : PROJECT_NAME_VALIDATION_ALLOW_SLASH)
         };
     })((props: ProjectNameFieldProps) =>
-        <Field
+        <span data-cy='name-field'><Field
             name='name'
             component={TextField}
             validate={props.validate}
             label="Project Name"
-            autoFocus={true} />
+            autoFocus={true} /></span>
     );
 
 export const ProjectDescriptionField = () =>
diff --git a/src/views-components/form-fields/resource-form-fields.tsx b/src/views-components/form-fields/resource-form-fields.tsx
index 0c4ae64a..343831bf 100644
--- a/src/views-components/form-fields/resource-form-fields.tsx
+++ b/src/views-components/form-fields/resource-form-fields.tsx
@@ -24,7 +24,7 @@ export const ResourceParentField = connect(
         };
     })
     ((props: ResourceParentFieldProps) =>
-        <Field
+        <span data-cy='parent-field'><Field
             name='ownerUuid'
             disabled={true}
             label='Parent project'
@@ -40,5 +40,5 @@ export const ResourceParentField = connect(
                     return value;
                 }
             }
-            component={TextField} />
+            component={TextField} /></span>
     );

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list