[ARVADOS-WORKBENCH2] created: 1.4.1-359-g662c6eec

Git user git at public.arvados.org
Wed Jun 3 21:47:26 UTC 2020


        at  662c6eecb507aa8dc4d253630c82aa06a57b0162 (commit)


commit 662c6eecb507aa8dc4d253630c82aa06a57b0162
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Jun 3 18:46:59 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..40f39144 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('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>
     );

commit fcbcbbb978fbb0d381c23a2ac204940c1c80dda3
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Jun 2 19:14:19 2020 -0300

    16439: Adds SidePanelButton clickability tests.
    
    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
new file mode 100644
index 00000000..95b56400
--- /dev/null
+++ b/cypress/integration/side-panel.spec.js
@@ -0,0 +1,78 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+describe('Side panel tests', function() {
+    let activeUser;
+    let adminUser;
+
+    before(function() {
+        // Only set up common users once. These aren't set up as aliases because
+        // aliases are cleaned up after every test. Also it doesn't make sense
+        // to set the same users on beforeEach() over and over again, so we
+        // separate a little from Cypress' 'Best Practices' here.
+        cy.getUser('admin', 'Admin', 'User', true, true)
+            .as('adminUser').then(function() {
+                adminUser = this.adminUser;
+            }
+        );
+        cy.getUser('user', 'Active', 'User', false, true)
+            .as('activeUser').then(function() {
+                activeUser = this.activeUser;
+            }
+        );
+    })
+
+    beforeEach(function() {
+        cy.clearCookies()
+        cy.clearLocalStorage()
+    })
+
+    it('enables the +NEW side panel button on users home project', function() {
+        cy.loginAs(activeUser);
+        cy.visit(`/projects/${activeUser.user.uuid}`);
+        cy.get('[data-cy=side-panel-button]')
+            .should('exist')
+            .and('not.be.disabled');
+    })
+
+    it('disables or enables the +NEW side panel button on depending on project permissions', function() {
+        cy.loginAs(activeUser);
+        [true, false].map(function(isWritable) {
+            cy.createGroup(adminUser.token, {
+                name: `Test ${isWritable ? 'writable' : 'read-only'} project`,
+                group_class: 'project',
+            }).as('sharedGroup').then(function() {
+                cy.createLink(adminUser.token, {
+                    name: isWritable ? 'can_write' : 'can_read',
+                    link_class: 'permission',
+                    head_uuid: this.sharedGroup.uuid,
+                    tail_uuid: activeUser.user.uuid
+                })
+                cy.visit(`/projects/${this.sharedGroup.uuid}`);
+                cy.get('[data-cy=side-panel-button]')
+                    .should('exist')
+                    .and(`${isWritable ? 'not.' : ''}be.disabled`);
+            })
+        })
+    })
+
+    it('disables the +NEW side panel button on appropriate sections', function() {
+        cy.loginAs(activeUser);
+        [
+            {url: '/shared-with-me', label: 'Shared with me'},
+            {url: '/public-favorites', label: 'Public Favorites'},
+            {url: '/favorites', label: 'My Favorites'},
+            {url: '/workflows', label: 'Workflows'},
+            {url: '/all_processes', label: 'All Processes'},
+            {url: '/trash', label: 'Trash'},
+        ].map(function(section) {
+            cy.visit(section.url);
+            cy.get('[data-cy=breadcrumb-first]')
+                .should('contain', section.label);
+            cy.get('[data-cy=side-panel-button]')
+                .should('exist')
+                .and('be.disabled');
+        })
+    })
+})
\ No newline at end of file
diff --git a/src/components/breadcrumbs/breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx
index 20782330..8ed0f0c4 100644
--- a/src/components/breadcrumbs/breadcrumbs.tsx
+++ b/src/components/breadcrumbs/breadcrumbs.tsx
@@ -34,7 +34,7 @@ export interface BreadcrumbsProps {
 
 export const Breadcrumbs = withStyles(styles)(
     ({ classes, onClick, onContextMenu, items }: BreadcrumbsProps & WithStyles<CssRules>) =>
-    <Grid container alignItems="center" wrap="nowrap">
+    <Grid container data-cy='breadcrumbs' alignItems="center" wrap="nowrap">
     {
         items.map((item, index) => {
             const isLastItem = index === items.length - 1;
@@ -44,6 +44,12 @@ export const Breadcrumbs = withStyles(styles)(
                     {isFirstItem ? null : <IllegalNamingWarning name={item.label} />}
                     <Tooltip title={item.label}>
                         <Button
+                            data-cy={
+                                isFirstItem
+                                ? 'breadcrumb-first'
+                                : isLastItem
+                                    ? 'breadcrumb-last'
+                                    : false}
                             color="inherit"
                             className={isLastItem ? classes.currentItem : classes.item}
                             onClick={() => onClick(item)}
diff --git a/src/views-components/side-panel-button/side-panel-button.tsx b/src/views-components/side-panel-button/side-panel-button.tsx
index 5e547740..07784c5e 100644
--- a/src/views-components/side-panel-button/side-panel-button.tsx
+++ b/src/views-components/side-panel-button/side-panel-button.tsx
@@ -93,7 +93,7 @@ export const SidePanelButton = withStyles(styles)(
                 return <Toolbar>
                     <Grid container>
                         <Grid container item xs alignItems="center" justify="flex-start">
-                            <Button variant="contained" disabled={!enabled}
+                            <Button data-cy="side-panel-button" variant="contained" disabled={!enabled}
                                 color="primary" size="small" className={classes.button}
                                 aria-owns={anchorEl ? 'aside-menu-list' : undefined}
                                 aria-haspopup="true"
@@ -108,13 +108,13 @@ export const SidePanelButton = withStyles(styles)(
                                 onClose={this.handleClose}
                                 onClick={this.handleClose}
                                 transformOrigin={transformOrigin}>
-                                <MenuItem className={classes.menuItem} onClick={this.handleNewCollectionClick}>
+                                <MenuItem data-cy='side-panel-new-collection' className={classes.menuItem} onClick={this.handleNewCollectionClick}>
                                     <CollectionIcon className={classes.icon} /> New collection
                                 </MenuItem>
-                                <MenuItem className={classes.menuItem} onClick={this.handleRunProcessClick}>
+                                <MenuItem data-cy='side-panel-run-process' className={classes.menuItem} onClick={this.handleRunProcessClick}>
                                     <ProcessIcon className={classes.icon} /> Run a process
                                 </MenuItem>
-                                <MenuItem className={classes.menuItem} onClick={this.handleNewProjectClick}>
+                                <MenuItem data-cy='side-panel-new-project' className={classes.menuItem} onClick={this.handleNewProjectClick}>
                                     <ProjectIcon className={classes.icon} /> New project
                                 </MenuItem>
                             </Menu>

commit 6ad3586e61737306f61a330eca545ca494f16304
Merge: 0cfd92cc 78fc0875
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Tue Jun 2 16:14:27 2020 -0300

    16439: Merge branch 'master' into 16439-objects-creation-placement-fix
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list