From: Daniel Kutyła Date: Fri, 10 Sep 2021 16:59:45 +0000 (+0200) Subject: 17585: FIxed tests X-Git-Tag: 2.3.0~1^2~3 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/9054e09b4751fb7dfb2fa8837f5febb8da5a7eb8 17585: FIxed tests Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- diff --git a/cypress/integration/delete-multiple-files.spec.js b/cypress/integration/delete-multiple-files.spec.js index deb56f66..f01eeccf 100644 --- a/cypress/integration/delete-multiple-files.spec.js +++ b/cypress/integration/delete-multiple-files.spec.js @@ -41,13 +41,14 @@ describe('Multi-file deletion tests', function () { cy.get('[data-cy=collection-files-panel-options-btn]').click(); cy.get('[data-cy=context-menu] div').contains('Remove selected').click(); cy.get('[data-cy=confirmation-dialog-ok-btn]').click(); + cy.wait(1000); cy.get('[data-cy=collection-files-panel]') .should('not.contain', 'baz') .and('not.contain', 'bar'); }); }); - it('deletes all files from non root dir', function () { + it.skip('deletes all files from non root dir', function () { cy.createCollection(adminUser.token, { name: `Test collection ${Math.floor(Math.random() * 999999)}`, owner_uuid: activeUser.user.uuid, @@ -73,4 +74,32 @@ describe('Multi-file deletion tests', function () { .and('contain', 'baz'); }); }); + + it.only('deletes all files from non root dir', function () { + cy.createCollection(adminUser.token, { + name: `Test collection ${Math.floor(Math.random() * 999999)}`, + owner_uuid: activeUser.user.uuid, + manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n" + }) + .as('testCollection').then(function () { + cy.loginAs(activeUser); + cy.goToPath(`/collections/${this.testCollection.uuid}`); + + cy.get('[data-cy=collection-files-panel]').contains('subdir').click(); + cy.wait(1000); + cy.get('[data-cy=collection-files-panel]') + .should('contain', 'foo'); + + cy.get('[data-cy=collection-files-panel]') + .contains('foo').parent().find('[type="checkbox"]').click(); + + cy.get('[data-cy=collection-files-panel-options-btn]').click(); + cy.get('[data-cy=context-menu] div').contains('Remove selected').click(); + cy.get('[data-cy=confirmation-dialog-ok-btn]').click(); + + cy.get('[data-cy=collection-files-panel]') + .should('not.contain', 'foo') + .and('contain', 'subdir'); + }); + }); }) diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index 70c72107..238b2c7b 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -189,7 +189,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState const [path, setPath]: any = React.useState([]); const [pathData, setPathData]: any = React.useState({}); const [isLoading, setIsLoading] = React.useState(false); - const [rightClickUsed, setRightClickUsed] = React.useState(false); + const [collectionAutofetchEnabled, setCollectionAutofetchEnabled] = React.useState(false); const [leftSearch, setLeftSearch] = React.useState(''); const [rightSearch, setRightSearch] = React.useState(''); @@ -269,7 +269,7 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState React.useEffect(() => { const hash = (collectionPanel.item || {}).portableDataHash; - if (hash && rightClickUsed) { + if (hash && collectionAutofetchEnabled) { fetchData([leftKey, rightKey], true); } }, [(collectionPanel.item || {}).portableDataHash]); // eslint-disable-line react-hooks/exhaustive-deps @@ -300,8 +300,8 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState if (id) { onItemMenuOpen(event, item, isWritable); - if (!rightClickUsed) { - setRightClickUsed(true); + if (!collectionAutofetchEnabled) { + setCollectionAutofetchEnabled(true); } } }, @@ -414,14 +414,19 @@ export const CollectionPanelFiles = withStyles(styles)(connect((state: RootState className={classes.pathPanelItem} data-breadcrumb-path={p} > - {index === 0 ? 'Home' : p} /  + {index === 0 ? 'Home' : p} /  ) } onOptionsMenuOpen(ev, isWritable)}> + onClick={(ev) => { + if (!collectionAutofetchEnabled) { + setCollectionAutofetchEnabled(true); + } + onOptionsMenuOpen(ev, isWritable); + }}>