[arvados-workbench2] updated: 2.7.0-252-g6d2f10b6

git repository hosting git at public.arvados.org
Tue Dec 12 14:30:12 UTC 2023


Summary of changes:
 cypress/integration/multiselect-toolbar.spec.js    | 63 ++++++++++++++++++++++
 .../multiselect-toolbar/MultiselectToolbar.tsx     | 56 +++++++++++--------
 2 files changed, 96 insertions(+), 23 deletions(-)
 create mode 100644 cypress/integration/multiselect-toolbar.spec.js

       via  6d2f10b6bd29751bf71c38a40d56f806bf894ad9 (commit)
      from  4529d3902679b7cb4753cb0c478856e4acb77147 (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 6d2f10b6bd29751bf71c38a40d56f806bf894ad9
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Tue Dec 12 09:29:47 2023 -0500

    21128: added first test Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/cypress/integration/multiselect-toolbar.spec.js b/cypress/integration/multiselect-toolbar.spec.js
new file mode 100644
index 00000000..72df1e5d
--- /dev/null
+++ b/cypress/integration/multiselect-toolbar.spec.js
@@ -0,0 +1,63 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+describe('Multiselect Toolbar Tests', () => {
+    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('exists in DOM', () => {
+        cy.loginAs(activeUser);
+        cy.get('[data-cy=multiselect-toolbar]').should('exist');
+        cy.get('[data-cy=multiselect-button]').should('not.exist');
+        cy.get('[data-cy=multiselect-alt-button]').should('not.exist');
+    });
+
+    it('can manipulate a project resource', () => {
+        cy.loginAs(activeUser);
+        const projName = `Test project (${Math.floor(999999 * Math.random())})`;
+        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=name-field]').within(() => {
+                    cy.get('input').type(projName);
+                });
+            })
+        cy.get("[data-cy=form-submit-btn]").click();
+        cy.waitForDom()
+        cy.go('back')
+
+        cy.get('[data-cy=data-table-row]').contains(projName).should('exist').parent().parent().parent().click()
+        cy.get('[data-cy=multiselect-button]').should('have.length', 12).eq(3).trigger('mouseover');
+        cy.get('body').contains('Edit project').should('exist')
+        cy.get('[data-cy=multiselect-button]').eq(3).click()
+        cy.get("[data-cy=form-dialog]").within(() => {
+            cy.get("div[contenteditable=true]").click().type('this is a test');
+            cy.get("[data-cy=form-submit-btn]").click();
+        });
+    });
+});
diff --git a/src/components/multiselect-toolbar/MultiselectToolbar.tsx b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
index 5ce53ab5..bc0e56eb 100644
--- a/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -90,7 +90,7 @@ export const MultiselectToolbar = connect(
     mapDispatchToProps
 )(
     withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
-        const { classes, checkedList, singleSelectedUuid, iconProps, user , disabledButtons} = props;
+        const { classes, checkedList, singleSelectedUuid, iconProps, user, disabledButtons } = props;
         const singleResourceKind = singleSelectedUuid ? [resourceToMsResourceKind(singleSelectedUuid, iconProps.resources, user)] : null
         const currentResourceKinds = singleResourceKind ? singleResourceKind : Array.from(selectedToKindSet(checkedList));
         const currentPathIsTrash = window.location.pathname === "/trash";
@@ -106,35 +106,45 @@ export const MultiselectToolbar = connect(
                 <Toolbar
                     className={classes.root}
                     style={{ width: `${(actions.length * 2.5) + 1}rem` }}
+                    data-cy='multiselect-toolbar'
                     >
                     {actions.length ? (
                         actions.map((action, i) =>{
                             const { hasAlts, useAlts, name, altName, icon, altIcon } = action;
                         return hasAlts ? (
                             <Tooltip
-                            className={classes.button}
-                            title={currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altName : name}
-                            key={i}
-                            disableFocusListener
+                                className={classes.button}
+                                title={currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altName : name}
+                                key={i}
+                                disableFocusListener
                             >
-                                    <span className={classes.iconContainer}>
-                                        <IconButton disabled={disabledButtons.has(name)} onClick={() => props.executeMulti(action, checkedList, iconProps.resources)}>
-                                            {currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altIcon && altIcon({}) : icon({})}
-                                        </IconButton>
-                                    </span>
-                                </Tooltip>
-                            ) : (
-                                <Tooltip
-                                    className={classes.button}
-                                    title={action.name}
-                                    key={i}
-                                    disableFocusListener
-                                >
-                                    <span className={classes.iconContainer}>
-                                        <IconButton onClick={() => props.executeMulti(action, checkedList, iconProps.resources)}>{action.icon({})}</IconButton>
-                                    </span>
-                                </Tooltip>
-                            )
+                                <span className={classes.iconContainer}>
+                                    <IconButton
+                                        data-cy='multiselect-button'
+                                        disabled={disabledButtons.has(name)}
+                                        onClick={() => props.executeMulti(action, checkedList, iconProps.resources)}
+                                    >
+                                        {currentPathIsTrash || (useAlts && useAlts(singleSelectedUuid, iconProps)) ? altIcon && altIcon({}) : icon({})}
+                                    </IconButton>
+                                </span>
+                            </Tooltip>
+                        ) : (
+                            <Tooltip
+                                className={classes.button}
+                                title={action.name}
+                                key={i}
+                                disableFocusListener
+                            >
+                                <span className={classes.iconContainer}>
+                                    <IconButton
+                                        data-cy='multiselect-button'
+                                        onClick={() => props.executeMulti(action, checkedList, iconProps.resources)}
+                                    >
+                                        {action.icon({})}
+                                    </IconButton>
+                                </span>
+                            </Tooltip>
+                        );
                         })
                     ) : (
                         <></>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list