From 17048236a8bd8e53680d9632ff3eafa8cdf21b01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Kuty=C5=82a?= Date: Thu, 4 Nov 2021 20:04:53 +0100 Subject: [PATCH] 18195: Added multiple action dispatch in order to refresh left panel MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła --- cypress/integration/side-panel.spec.js | 33 +++++++++++++++++++ .../refresh-button/refresh-button.tsx | 9 ++++- .../main-content-bar/main-content-bar.tsx | 17 +++++++--- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/cypress/integration/side-panel.spec.js b/cypress/integration/side-panel.spec.js index 912e68eb..59e143ee 100644 --- a/cypress/integration/side-panel.spec.js +++ b/cypress/integration/side-panel.spec.js @@ -114,4 +114,37 @@ describe('Side panel tests', function() { }); }); + it('side panel react to refresh when project data changes', () => { + const project1 = 'writableProject1'; + const project2 = 'writableProject2'; + + cy.createProject({ + owningUser: activeUser, + targetUser: activeUser, + projectName: project1, + canWrite: true, + addToFavorites: false + }); + + cy.createProject({ + owningUser: activeUser, + targetUser: activeUser, + projectName: project2, + canWrite: true, + addToFavorites: false + }); + + cy.getAll('@writableProject1', '@writableProject2') + .then(function ([writableProject1, writableProject2]) { + cy.loginAs(activeUser); + + cy.get('[data-cy=side-panel-tree]').contains('Projects').click(); + + cy.trashGroup(activeUser.token, writableProject2.uuid); + + cy.contains('Refresh').click(); + + cy.contains(writableProject2.name).should('not.exist'); + }); + }); }) diff --git a/src/components/refresh-button/refresh-button.tsx b/src/components/refresh-button/refresh-button.tsx index f2c41d28..9971547b 100644 --- a/src/components/refresh-button/refresh-button.tsx +++ b/src/components/refresh-button/refresh-button.tsx @@ -22,13 +22,20 @@ const styles: StyleRulesCallback = theme => ({ }, }); -export const RefreshButton = ({ history, classes }: RouteComponentProps & WithStyles) => +interface RefreshButtonProps { + onClick?: () => void; +} + +export const RefreshButton = ({ history, classes, onClick }: RouteComponentProps & WithStyles & RefreshButtonProps) =>