[ARVADOS-WORKBENCH2] updated: 1.4.1-341-gce0ff64f

Git user git at public.arvados.org
Fri May 22 18:57:31 UTC 2020


Summary of changes:
 cypress/integration/collection-panel.spec.js | 158 ++++++++++++++-------------
 cypress/support/commands.js                  |  43 ++++++--
 2 files changed, 113 insertions(+), 88 deletions(-)

       via  ce0ff64f2b49090e595bf1a614d811b161fbbfbb (commit)
      from  4bed7c3d982b8d9198186a37a1edbdf746b1e0e2 (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 ce0ff64f2b49090e595bf1a614d811b161fbbfbb
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Fri May 22 15:29:54 2020 -0300

    16118: Enhances tests. Adds custom commands for resource creation.
    
    * Checks that the properties editor form doesn't get shown on readonly colls.
    * Creates collections inside a shared group to check for writability.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js
index 0ae72809..ff55e050 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -31,86 +31,88 @@ describe('Collection panel tests', function() {
     it('shows collection by URL', function() {
         cy.loginAs(activeUser);
         [true, false].map(function(isWritable) {
-            // Creates the collection using the admin token so we can set up
-            // a bogus manifest text without block signatures.
-            cy.createCollection(adminUser.token, {
-                name: 'Test collection',
-                owner_uuid: isWritable
-                    ? activeUser.user.uuid
-                    : adminUser.user.uuid,
-                properties: {someKey: 'someValue'},
-                manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
-            .as('testCollection').then(function() {
-                if (isWritable === false) {
-                    // Share collection as read-only
-                    cy.do_request('POST', '/arvados/v1/links', {
-                        link: JSON.stringify({
-                            name: 'can_read',
-                            link_class: 'permission',
-                            head_uuid: this.testCollection.uuid,
-                            tail_uuid: activeUser.user.uuid
-                        })
-                    }, null, adminUser.token, null);
-                }
-                cy.visit(`/collections/${this.testCollection.uuid}`);
-                // Check that name & uuid are correct.
-                cy.get('[data-cy=collection-info-panel]')
-                    .should('contain', this.testCollection.name)
-                    .and(`${isWritable ? 'not.': ''}contain`, 'Read-only')
-                    .and('contain', this.testCollection.uuid);
-                // Check that both read and write operations are available on
-                // the 'More options' menu.
-                cy.get('[data-cy=collection-panel-options-btn]')
-                    .click()
-                cy.get('[data-cy=context-menu]')
-                    .should('contain', 'Add to favorites')
-                    .and(`${isWritable ? '' : 'not.'}contain`, 'Edit collection')
-                    .type('{esc}'); // Collapse the options menu
-                cy.get('[data-cy=collection-properties-panel]')
-                    .should('contain', 'someKey')
-                    .and('contain', 'someValue')
-                    .and('not.contain', 'anotherKey')
-                    .and('not.contain', 'anotherValue')
-                // Check that properties can be added.
-                if (isWritable === true) {
-                    cy.get('[data-cy=collection-properties-form]').within(() => {
-                        cy.get('[data-cy=property-field-key]').within(() => {
-                            cy.get('input').type('anotherKey');
-                        });
-                        cy.get('[data-cy=property-field-value]').within(() => {
-                            cy.get('input').type('anotherValue');
-                        });
-                        cy.root().submit();
+            cy.createGroup(adminUser.token, {
+                name: 'Shared project',
+                group_class: 'project',
+            }).as('sharedGroup').then(function() {
+                // Creates the collection using the admin token so we can set up
+                // a bogus manifest text without block signatures.
+                cy.createCollection(adminUser.token, {
+                    name: 'Test collection',
+                    owner_uuid: this.sharedGroup.uuid,
+                    properties: {someKey: 'someValue'},
+                    manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
+                .as('testCollection').then(function() {
+                    // Share the group with active user.
+                    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(`/collections/${this.testCollection.uuid}`);
+                    // Check that name & uuid are correct.
+                    cy.get('[data-cy=collection-info-panel]')
+                        .should('contain', this.testCollection.name)
+                        .and(`${isWritable ? 'not.': ''}contain`, 'Read-only')
+                        .and('contain', this.testCollection.uuid);
+                    // Check that both read and write operations are available on
+                    // the 'More options' menu.
+                    cy.get('[data-cy=collection-panel-options-btn]')
+                        .click()
+                    cy.get('[data-cy=context-menu]')
+                        .should('contain', 'Add to favorites')
+                        .and(`${isWritable ? '' : 'not.'}contain`, 'Edit collection')
+                        .type('{esc}'); // Collapse the options menu
                     cy.get('[data-cy=collection-properties-panel]')
-                        .should('contain', 'anotherKey')
-                        .and('contain', 'anotherValue')
-                }
-                // Check that the file listing show both read & write operations
-                cy.get('[data-cy=collection-files-panel]').within(() => {
-                    cy.root().should('contain', 'bar');
-                    cy.get('[data-cy=upload-button]')
-                        .should(`${isWritable ? '' : 'not.'}contain`, 'Upload data');
-                });
-                // Hamburger 'more options' menu button
-                cy.get('[data-cy=collection-files-panel-options-btn]')
-                    .click()
-                cy.get('[data-cy=context-menu]')
-                    .should('contain', 'Select all')
-                    .click()
-                cy.get('[data-cy=collection-files-panel-options-btn]')
-                    .click()
-                cy.get('[data-cy=context-menu]')
-                    .should('contain', 'Download selected')
-                    .and(`${isWritable ? '' : 'not.'}contain`, 'Remove selected')
-                    .type('{esc}'); // Collapse the options menu
-                // File item 'more options' button
-                cy.get('[data-cy=file-item-options-btn')
-                    .click()
-                cy.get('[data-cy=context-menu]')
-                    .should('contain', 'Download')
-                    .and(`${isWritable ? '' : 'not.'}contain`, 'Remove')
-                    .type('{esc}'); // Collapse
+                        .should('contain', 'someKey')
+                        .and('contain', 'someValue')
+                        .and('not.contain', 'anotherKey')
+                        .and('not.contain', 'anotherValue')
+                    if (isWritable === true) {
+                        // Check that properties can be added.
+                        cy.get('[data-cy=collection-properties-form]').within(() => {
+                            cy.get('[data-cy=property-field-key]').within(() => {
+                                cy.get('input').type('anotherKey');
+                            });
+                            cy.get('[data-cy=property-field-value]').within(() => {
+                                cy.get('input').type('anotherValue');
+                            });
+                            cy.root().submit();
+                        })
+                        cy.get('[data-cy=collection-properties-panel]')
+                            .should('contain', 'anotherKey')
+                            .and('contain', 'anotherValue')
+                    } else {
+                        // Properties form shouldn't be displayed.
+                        cy.get('[data-cy=collection-properties-form]').should('not.exist');
+                    }
+                    // Check that the file listing show both read & write operations
+                    cy.get('[data-cy=collection-files-panel]').within(() => {
+                        cy.root().should('contain', 'bar');
+                        cy.get('[data-cy=upload-button]')
+                            .should(`${isWritable ? '' : 'not.'}contain`, 'Upload data');
+                    });
+                    // Hamburger 'more options' menu button
+                    cy.get('[data-cy=collection-files-panel-options-btn]')
+                        .click()
+                    cy.get('[data-cy=context-menu]')
+                        .should('contain', 'Select all')
+                        .click()
+                    cy.get('[data-cy=collection-files-panel-options-btn]')
+                        .click()
+                    cy.get('[data-cy=context-menu]')
+                        .should('contain', 'Download selected')
+                        .and(`${isWritable ? '' : 'not.'}contain`, 'Remove selected')
+                        .type('{esc}'); // Collapse the options menu
+                    // File item 'more options' button
+                    cy.get('[data-cy=file-item-options-btn')
+                        .click()
+                    cy.get('[data-cy=context-menu]')
+                        .should('contain', 'Download')
+                        .and(`${isWritable ? '' : 'not.'}contain`, 'Remove')
+                        .type('{esc}'); // Collapse
+                })
             })
         })
     })
diff --git a/cypress/support/commands.js b/cypress/support/commands.js
index 8c6fd462..8baa2db6 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.js
@@ -32,7 +32,7 @@ const controllerURL = Cypress.env('controller_url');
 const systemToken = Cypress.env('system_token');
 
 Cypress.Commands.add(
-    "do_request", (method='GET', path='', data=null, qs=null,
+    "doRequest", (method='GET', path='', data=null, qs=null,
                    token=systemToken, auth=false, followRedirect=true) => {
         return cy.request({
             method: method,
@@ -56,7 +56,7 @@ Cypress.Commands.add(
 Cypress.Commands.add(
     "getUser", (username, first_name='', last_name='', is_admin=false, is_active=true) => {
         // Create user if not already created
-        return cy.do_request('POST', '/auth/controller/callback', {
+        return cy.doRequest('POST', '/auth/controller/callback', {
             auth_info: JSON.stringify({
                 email: `${username}@example.local`,
                 username: username,
@@ -71,13 +71,13 @@ Cypress.Commands.add(
         .then(function() {
             this.userToken = this.location.split("=")[1]
             assert.isString(this.userToken)
-            return cy.do_request('GET', '/arvados/v1/users', null, {
+            return cy.doRequest('GET', '/arvados/v1/users', null, {
                 filters: `[["username", "=", "${username}"]]`
             })
             .its('body.items.0')
             .as('aUser')
             .then(function() {
-                cy.do_request('PUT', `/arvados/v1/users/${this.aUser.uuid}`, {
+                cy.doRequest('PUT', `/arvados/v1/users/${this.aUser.uuid}`, {
                     user: {
                         is_admin: is_admin,
                         is_active: is_active
@@ -94,14 +94,37 @@ Cypress.Commands.add(
 )
 
 Cypress.Commands.add(
-    "createCollection", (token, collection) => {
-        return cy.do_request('POST', '/arvados/v1/collections', {
-            collection: JSON.stringify(collection),
+    "createLink", (token, data) => {
+        return cy.createResource(token, 'links', {
+            link: JSON.stringify(data)
+        })
+    }
+)
+
+Cypress.Commands.add(
+    "createGroup", (token, data) => {
+        return cy.createResource(token, 'groups', {
+            group: JSON.stringify(data),
+            ensure_unique_name: true
+        })
+    }
+)
+
+Cypress.Commands.add(
+    "createCollection", (token, data) => {
+        return cy.createResource(token, 'collections', {
+            collection: JSON.stringify(data),
             ensure_unique_name: true
-        }, null, token, true)
-        .its('body').as('collection')
+        })
+    }
+)
+
+Cypress.Commands.add(
+    "createResource", (token, suffix, data) => {
+        return cy.doRequest('POST', '/arvados/v1/'+suffix, data, null, token, true)
+        .its('body').as('resource')
         .then(function() {
-            return this.collection;
+            return this.resource;
         })
     }
 )

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list