From d473b4ac4ae8f14cf26fe4a530b6f545af5f1fbb Mon Sep 17 00:00:00 2001 From: Kerry Date: Tue, 25 Oct 2022 10:39:48 +0200 Subject: [PATCH] Device manager - confirm sign out of other sessions (PSG-921) (#9487) * change testid attribute for dialog buttons to rtl friendly * add confirm dialog for signing out sessions * cleanup commented * update cypress tets * clear modals before test * missing modal in jest tests on ci only --- .../e2e/settings/device-management.spec.ts | 3 + .../views/elements/DialogButtons.tsx | 4 +- .../settings/tabs/user/SessionManagerTab.tsx | 24 +++ src/i18n/strings/en_EN.json | 4 +- .../AccessSecretStorageDialog-test.tsx | 6 +- .../views/dialogs/ExportDialog-test.tsx | 4 +- .../ChangelogDialog-test.tsx.snap | 4 +- .../__snapshots__/ExportDialog-test.tsx.snap | 40 ++--- .../tabs/user/SessionManagerTab-test.tsx | 169 ++++++++++++------ 9 files changed, 174 insertions(+), 84 deletions(-) diff --git a/cypress/e2e/settings/device-management.spec.ts b/cypress/e2e/settings/device-management.spec.ts index 1709475e17c..da4d12e35d9 100644 --- a/cypress/e2e/settings/device-management.spec.ts +++ b/cypress/e2e/settings/device-management.spec.ts @@ -78,6 +78,7 @@ describe("Device manager", () => { cy.get('.mx_FilteredDeviceList_list .mx_FilteredDeviceList_listItem .mx_Checkbox').last().click(); // sign out from list selection action buttons cy.get('[data-testid="sign-out-selection-cta"]').click(); + cy.get('[data-testid="dialog-primary-button"]').click(); // list updated after sign out cy.get('.mx_FilteredDeviceList_list').find('.mx_FilteredDeviceList_listItem').should('have.length', 1); // security recommendation count updated @@ -106,6 +107,8 @@ describe("Device manager", () => { // sign out using the device details sign out cy.get('[data-testid="device-detail-sign-out-cta"]').click(); }); + // confirm the signout + cy.get('[data-testid="dialog-primary-button"]').click(); // no other sessions or security recommendations sections when only one session cy.contains('Other sessions').should('not.exist'); diff --git a/src/components/views/elements/DialogButtons.tsx b/src/components/views/elements/DialogButtons.tsx index bf018e14f49..522d847e1b1 100644 --- a/src/components/views/elements/DialogButtons.tsx +++ b/src/components/views/elements/DialogButtons.tsx @@ -82,7 +82,7 @@ export default class DialogButtons extends React.Component { cancelButton =