From 9087d6b1286bdb72236e9a55c04982414d3ed50e Mon Sep 17 00:00:00 2001 From: cgoodwin90 Date: Fri, 26 Jul 2024 17:04:34 +1000 Subject: [PATCH] Further expands tests --- cypress/support/actions/settings/SettingsAction.ts | 2 +- .../repositories/settings/SettingsRepository.ts | 13 +++++++++++-- src/components/SshKeys/index.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cypress/support/actions/settings/SettingsAction.ts b/cypress/support/actions/settings/SettingsAction.ts index b7e5fad3..ecf9bf59 100644 --- a/cypress/support/actions/settings/SettingsAction.ts +++ b/cypress/support/actions/settings/SettingsAction.ts @@ -17,7 +17,7 @@ export default class SettingAction { } deleteSshKey(name: string) { - settings.getDeleteBtn().click(); + settings.getDeleteBtn(name); cy.log('enter the name and confirm'); cy.getBySel('confirm-input').type(name); cy.getBySel('deleteConfirm').click(); diff --git a/cypress/support/repositories/settings/SettingsRepository.ts b/cypress/support/repositories/settings/SettingsRepository.ts index 48e178b2..6f7a3a37 100644 --- a/cypress/support/repositories/settings/SettingsRepository.ts +++ b/cypress/support/repositories/settings/SettingsRepository.ts @@ -10,7 +10,16 @@ export default class SettingsRepository { getSubmitBtn() { return cy.getBySel('sshKey').parent().next(); } - getDeleteBtn() { - return cy.getBySel('deleteKey').getBySel('delete'); + + getKeyToDelete() { + return cy.getBySel('data-row'); + } + getDeleteBtn(name: string) { + this.getKeyToDelete() + .contains(name) + .parent() + .within(() => { + cy.getBySel('deleteKey').getBySel('delete').click(); + }); } } diff --git a/src/components/SshKeys/index.js b/src/components/SshKeys/index.js index 647f62e1..196581a5 100644 --- a/src/components/SshKeys/index.js +++ b/src/components/SshKeys/index.js @@ -69,7 +69,7 @@ const SshKeys = ({ me: { id, email, sshKeys: keys }, loading, handleRefetch }) = {keys && keys.map(key => ( -
+
{key.id} - {key.name}