[ARVADOS-WORKBENCH2] updated: 2.1.0-188-ga45fc1ed

Git user git at public.arvados.org
Fri Feb 5 22:47:49 UTC 2021


Summary of changes:
 cypress/integration/favorites.js                   |  53 --------
 cypress/integration/favorites.spec.js              | 144 +++++++++++++++++++++
 src/store/tree-picker/tree-picker-actions.ts       |   9 +-
 .../sharing-dialog/sharing-dialog-component.tsx    |   1 +
 4 files changed, 153 insertions(+), 54 deletions(-)
 delete mode 100644 cypress/integration/favorites.js
 create mode 100644 cypress/integration/favorites.spec.js

       via  a45fc1ed0f5e0385e3741cca6c0b48284ae6f8bb (commit)
      from  87d9f6d4a643e5a5ec381f221d376b66c1f3cb29 (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 a45fc1ed0f5e0385e3741cca6c0b48284ae6f8bb
Author: Daniel Kutyła <daniel.kutyla at contractors.roche.com>
Date:   Fri Feb 5 23:46:38 2021 +0100

    17306: Added browser tests, filtering writable entities
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla at contractors.roche.com>

diff --git a/cypress/integration/favorites.js b/cypress/integration/favorites.js
deleted file mode 100644
index 0855c94e..00000000
--- a/cypress/integration/favorites.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-describe('Favorites 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('collectionuser1', 'Collection', 'User', false, true)
-            .as('activeUser').then(function() {
-                activeUser = this.activeUser;
-            }
-        );
-    })
-
-    beforeEach(function() {
-        cy.clearCookies()
-        cy.clearLocalStorage()
-    })
-
-    it('checks that Public favorites does not appear under shared with me', function() {
-        cy.loginAs(adminUser);
-        cy.contains('Shared with me').click();
-        cy.get('main').contains('Public favorites').should('not.exist');
-    })
-
-    it('creates and removes a public favorite', function() {
-        cy.loginAs(adminUser);
-            cy.createGroup(adminUser.token, {
-                name: `my-favorite-project`,
-                group_class: 'project',
-            }).as('myFavoriteProject').then(function() {
-                cy.contains('Refresh').click();
-                cy.get('main').contains('my-favorite-project').rightclick();
-                cy.contains('Add to public favorites').click();
-                cy.contains('Public Favorites').click();
-                cy.get('main').contains('my-favorite-project').rightclick();
-                cy.contains('Remove from public favorites').click();
-                cy.get('main').contains('my-favorite-project').should('not.exist');
-                cy.trashGroup(adminUser.token, this.myFavoriteProject.uuid);
-            });
-    })
-})
diff --git a/cypress/integration/favorites.spec.js b/cypress/integration/favorites.spec.js
new file mode 100644
index 00000000..695812ca
--- /dev/null
+++ b/cypress/integration/favorites.spec.js
@@ -0,0 +1,144 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+describe('Favorites 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('collectionuser1', 'Collection', 'User', false, true)
+            .as('activeUser').then(function () {
+                activeUser = this.activeUser;
+            }
+            );
+    })
+
+    beforeEach(function () {
+        cy.clearCookies()
+        cy.clearLocalStorage()
+    })
+
+    it('checks that Public favorites does not appear under shared with me', function () {
+        cy.loginAs(adminUser);
+        cy.contains('Shared with me').click();
+        cy.get('main').contains('Public favorites').should('not.exist');
+    });
+
+    it('creates and removes a public favorite', function () {
+        cy.loginAs(adminUser);
+        cy.createGroup(adminUser.token, {
+            name: `my-favorite-project`,
+            group_class: 'project',
+        }).as('myFavoriteProject').then(function () {
+            cy.contains('Refresh').click();
+            cy.get('main').contains('my-favorite-project').rightclick();
+            cy.contains('Add to public favorites').click();
+            cy.contains('Public Favorites').click();
+            cy.get('main').contains('my-favorite-project').rightclick();
+            cy.contains('Remove from public favorites').click();
+            cy.get('main').contains('my-favorite-project').should('not.exist');
+            cy.trashGroup(adminUser.token, this.myFavoriteProject.uuid);
+        });
+    });
+
+    it.only('can copy collection to favorites', () => {
+        cy.loginAs(adminUser);
+
+        cy.createGroup(adminUser.token, {
+            name: `my-shared-writable-project ${Math.floor(Math.random() * 999999)}`,
+            group_class: 'project',
+        }).as('mySharedProject1').then(function () {
+            cy.contains('Refresh').click();
+            cy.get('main').contains(this.mySharedProject1.name).rightclick();
+            cy.get('[data-cy=context-menu]').within(() => {
+                cy.contains('Share').click();
+            });
+            cy.wait(1000);
+            cy.get('[id="select-permissions"]').as('selectPermissions');
+            cy.get('@selectPermissions').click();
+            cy.contains('Write').click();
+            cy.get('.sharing-dialog').as('sharingDialog');
+            cy.get('@sharingDialog').find('input').first().type(activeUser.user.email);
+            cy.get('[role=tooltip]').click();
+            cy.get('@sharingDialog').find('button').last().click();
+        });
+
+        cy.createGroup(adminUser.token, {
+            name: `my-shared-readonly-project ${Math.floor(Math.random() * 999999)}`,
+            group_class: 'project',
+        }).as('mySharedProject2').then(function () {
+            cy.contains('Refresh').click();
+            cy.get('main').contains(this.mySharedProject2.name).rightclick();
+            cy.get('[data-cy=context-menu]').within(() => {
+                cy.contains('Share').click();
+            });
+            cy.wait(1000);
+            cy.get('.sharing-dialog').as('sharingDialog');
+            cy.get('@sharingDialog').find('input').first().type(activeUser.user.email);
+            cy.get('[role=tooltip]').click();
+            cy.get('@sharingDialog').find('button').last().click();
+        });
+
+        cy.createGroup(activeUser.token, {
+            name: `my-project ${Math.floor(Math.random() * 999999)}`,
+            group_class: 'project',
+        }).as('myProject1');
+
+        cy.get('@mySharedProject1').then(function () {
+            cy.get('@mySharedProject2').then(function () {
+                cy.get('@myProject1').then(function () {
+                    cy.createCollection(adminUser.token, {
+                        name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+                        owner_uuid: activeUser.user.uuid,
+                        manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+                    })
+                        .as('testCollection').then(function () {
+                            cy.loginAs(activeUser);
+
+                            cy.contains('Shared with me').click();
+
+                            cy.get('main').contains(this.mySharedProject1.name).rightclick();
+                            cy.get('[data-cy=context-menu]').within(() => {
+                                cy.contains('Add to favorites').click();
+                            });
+
+                            cy.get('main').contains(this.mySharedProject2.name).rightclick();
+                            cy.get('[data-cy=context-menu]').within(() => {
+                                cy.contains('Add to favorites').click();
+                            });
+
+                            cy.doSearch(`${activeUser.user.uuid}`);
+
+                            cy.get('main').contains(this.myProject1.name).rightclick();
+                            cy.get('[data-cy=context-menu]').within(() => {
+                                cy.contains('Add to favorites').click();
+                            });    
+
+                            cy.contains(this.testCollection.name).rightclick();
+                            cy.get('[data-cy=context-menu]').within(() => {
+                                cy.contains('Move to').click();
+                            });
+
+                            cy.get('[data-cy=form-dialog]').within(function() {
+                                cy.get('ul').last().find('i').click();
+                                cy.contains(this.myProject1.name);
+                                cy.contains(this.mySharedProject1.name);
+                                cy.get('ul').last()
+                                    .should('not.contain', this.mySharedProject2.name);
+                            });
+                        });
+                });
+            });
+        });
+    });
+})
diff --git a/src/store/tree-picker/tree-picker-actions.ts b/src/store/tree-picker/tree-picker-actions.ts
index 08f356f0..2d9ec32d 100644
--- a/src/store/tree-picker/tree-picker-actions.ts
+++ b/src/store/tree-picker/tree-picker-actions.ts
@@ -21,6 +21,7 @@ import { mapTree } from '../../models/tree';
 import { LinkResource, LinkClass } from "~/models/link";
 import { mapTreeValues } from "~/models/tree";
 import { sortFilesTree } from "~/services/collection-service/collection-service-files-response";
+import { GroupResource } from "~/models/group";
 
 export const treePickerActions = unionize({
     LOAD_TREE_PICKER_NODE: ofType<{ id: string, pickerId: string }>(),
@@ -253,7 +254,13 @@ export const loadFavoritesProject = (params: LoadFavoritesProjectParams) =>
             dispatch<any>(receiveTreePickerData<GroupContentsResource>({
                 id: 'Favorites',
                 pickerId,
-                data: items,
+                data: items.filter((item) => {
+                    if ((item as GroupResource).writableBy && (item as GroupResource).writableBy.indexOf(uuid) === -1) {
+                        return false;
+                    }
+
+                    return true;
+                }),
                 extractNodeData: item => ({
                     id: item.uuid,
                     value: item,
diff --git a/src/views-components/sharing-dialog/sharing-dialog-component.tsx b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
index 1792bd67..2038ad96 100644
--- a/src/views-components/sharing-dialog/sharing-dialog-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-dialog-component.tsx
@@ -25,6 +25,7 @@ export default (props: SharingDialogDataProps & SharingDialogActionProps) => {
     const { children, open, loading, advancedEnabled, saveEnabled, onAdvanced, onClose, onExited, onSave } = props;
     return <Dialog
         {...{ open, onClose, onExited }}
+        className="sharing-dialog"
         fullWidth
         maxWidth='sm'
         disableBackdropClick

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list