[arvados] created: 2.7.0-6841-g999a178f1b
git repository hosting
git at public.arvados.org
Mon Jun 3 18:39:24 UTC 2024
at 999a178f1b661e1221a035b4454de1b24231dde1 (commit)
commit 999a178f1b661e1221a035b4454de1b24231dde1
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Mon Jun 3 14:39:09 2024 -0400
21811: wrote tests for side panel fave displays
Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/services/workbench2/cypress/e2e/favorites.cy.js b/services/workbench2/cypress/e2e/favorites.cy.js
index 2898c22cba..aa1ece51ef 100644
--- a/services/workbench2/cypress/e2e/favorites.cy.js
+++ b/services/workbench2/cypress/e2e/favorites.cy.js
@@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: AGPL-3.0
+const kebabCase = require('lodash/kebabCase');
+
describe('Favorites tests', function () {
let activeUser;
let adminUser;
@@ -252,4 +254,66 @@ describe('Favorites tests', function () {
});
});
});
+
+ it.only('shows the correct favorites and public favorites in the side panel', () => {
+ cy.createProject({
+ owningUser: adminUser,
+ projectName: 'myFavoriteProject1',
+ }).as('myFavoriteProject1');
+ cy.createProject({
+ owningUser: adminUser,
+ projectName: 'myFavoriteProject2',
+ }).as('myFavoriteProject2');
+ cy.createProject({
+ owningUser: adminUser,
+ projectName: 'myPublicFavoriteProject1',
+ }).as('myPublicFavoriteProject1');
+ cy.createProject({
+ owningUser: adminUser,
+ projectName: 'myPublicFavoriteProject2',
+ }).as('myPublicFavoriteProject2');
+
+ cy.getAll('@myFavoriteProject1', '@myFavoriteProject2', '@myPublicFavoriteProject1', '@myPublicFavoriteProject2')
+ .then(function ([myFavoriteProject1, myFavoriteProject2, myPublicFavoriteProject1, myPublicFavoriteProject2]) {
+ cy.loginAs(adminUser);
+
+ //add two projects to favorites
+ cy.get('[data-cy=side-panel-tree]').contains('myFavoriteProject1').rightclick();
+ cy.contains('Add to favorites').click();
+ cy.get('[data-cy=side-panel-tree]').contains('myFavoriteProject2').rightclick();
+ cy.contains('Add to favorites').click();
+
+ //add two projects to public favorites
+ cy.get('[data-cy=side-panel-tree]').contains('myPublicFavoriteProject1').rightclick();
+ cy.contains('Add to public favorites').click();
+ cy.get('[data-cy=side-panel-tree]').contains('myPublicFavoriteProject2').rightclick();
+ cy.contains('Add to public favorites').click();
+
+ //close "Home Projects", which is open by default
+ cy.get(`[data-cy=tree-item-toggle-${kebabCase(adminUser.user.uuid)}]`).click();
+
+ //check if the favorites are displayed in the side panel
+ cy.get(`[data-cy=tree-item-toggle-my-favorites]`).click();
+ cy.get('span').contains('myFavoriteProject1').should('exist');
+ cy.get('span').contains('myFavoriteProject2').should('exist');
+ cy.get(`[data-cy=tree-item-toggle-my-favorites]`).click();
+
+ //check if the public favorites are displayed in the side panel
+ cy.get(`[data-cy=tree-item-toggle-public-favorites]`).click();
+ cy.get('span').contains('myPublicFavoriteProject1').should('exist');
+ cy.get('span').contains('myPublicFavoriteProject2').should('exist');
+ cy.get(`[data-cy=tree-item-toggle-public-favorites]`).click();
+
+ //double check both sets
+ cy.get(`[data-cy=tree-item-toggle-my-favorites]`).click();
+ cy.get('span').contains('myFavoriteProject1').should('exist');
+ cy.get('span').contains('myFavoriteProject2').should('exist');
+ cy.get(`[data-cy=tree-item-toggle-my-favorites]`).click();
+
+ cy.get(`[data-cy=tree-item-toggle-public-favorites]`).click();
+ cy.get('span').contains('myPublicFavoriteProject1').should('exist');
+ cy.get('span').contains('myPublicFavoriteProject2').should('exist');
+ cy.get(`[data-cy=tree-item-toggle-public-favorites]`).click();
+ });
+ });
});
diff --git a/services/workbench2/src/components/tree/tree.tsx b/services/workbench2/src/components/tree/tree.tsx
index 1f7aa8326d..b7842d717e 100644
--- a/services/workbench2/src/components/tree/tree.tsx
+++ b/services/workbench2/src/components/tree/tree.tsx
@@ -15,6 +15,7 @@ import { SidePanelRightArrowIcon } from '../icon/icon';
import { ResourceKind } from 'models/resource';
import { GroupClass } from 'models/group';
import { SidePanelTreeCategory } from 'store/side-panel-tree/side-panel-tree-actions';
+import { kebabCase } from 'lodash';
type CssRules = 'list'
| 'listItem'
@@ -299,7 +300,7 @@ export const Tree = withStyles(styles)(
: () => props.showSelection ? true : false;
const getProperArrowAnimation = (status: string, items: Array<TreeItem<T>>) => {
- return isSidePanelIconNotNeeded(status, items) ? <span /> : <SidePanelRightArrowIcon style={{ fontSize: '14px' }} />;
+ return isSidePanelIconNotNeeded(status, items) ? <span /> : <SidePanelRightArrowIcon style={{ fontSize: '14px' }} data-cy="side-panel-arrow-icon" />;
}
const isSidePanelIconNotNeeded = (status: string, items: Array<TreeItem<T>>) => {
@@ -361,7 +362,9 @@ export const Tree = withStyles(styles)(
<CircularProgress size={10} className={loader} /> : null}
<i onClick={(e) => handleToggleItemOpen(it, e)}
className={toggableIconContainer}>
- <ListItemIcon className={getToggableIconClassNames(it.open, it.active)}>
+ <ListItemIcon className={getToggableIconClassNames(it.open, it.active)}
+ data-cy={`tree-item-toggle-${kebabCase(it.id.toString())}`}
+ >
{getProperArrowAnimation(it.status, it.items!)}
</ListItemIcon>
</i>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list