From d3a604b3bcd81901bbff59b7969c02d8f2d9bb88 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Fri, 13 Jun 2025 18:47:58 -0600 Subject: [PATCH] Continued work on standardizing button selectors (#30972) * download-button * remaining data-test-button- * manual cherry pick * more * fix test --- .../components/transit-key-action/decrypt.hbs | 2 +- .../components/transit-key-action/encrypt.hbs | 2 +- ui/app/templates/vault/cluster/init.hbs | 6 +- .../core/addon/components/confirm-modal.hbs | 4 +- .../core/addon/components/download-button.hbs | 2 +- .../addon/components/form-save-buttons.hbs | 2 +- ui/lib/core/addon/components/masked-input.hbs | 2 +- .../components/replication-action-demote.hbs | 2 +- .../components/replication-action-disable.hbs | 2 +- .../replication-action-generate-token.hbs | 2 +- .../components/replication-action-promote.hbs | 2 +- .../components/replication-action-recover.hbs | 2 +- .../components/replication-action-reindex.hbs | 2 +- .../replication-action-update-primary.hbs | 2 +- .../components/enable-replication-form.hbs | 2 +- .../access/identity/entities/index-test.js | 9 ++- .../access/namespaces/index-test.js | 4 +- ui/tests/acceptance/dashboard-test.js | 2 +- ui/tests/acceptance/enterprise-kmip-test.js | 63 ++++++++++--------- .../acceptance/enterprise-replication-test.js | 28 ++++----- .../acceptance/enterprise-transform-test.js | 15 ++--- ui/tests/acceptance/init-test.js | 12 ++-- ui/tests/acceptance/leases-test.js | 5 +- .../acceptance/mfa-login-enforcement-test.js | 12 ++-- ui/tests/acceptance/mfa-method-test.js | 10 +-- .../acceptance/oidc-config/clients-test.js | 6 +- .../oidc-config/providers-scopes-test.js | 6 +- .../acceptance/pki/pki-configuration-test.js | 6 +- .../pki/pki-engine-workflow-test.js | 6 +- ui/tests/acceptance/policies/index-test.js | 13 ++-- ui/tests/acceptance/policy/edit-test.js | 19 +++--- ui/tests/acceptance/raft-storage-test.js | 5 +- .../acceptance/reduced-disclosure-test.js | 5 +- .../backend/azure/azure-configuration-test.js | 2 +- .../secrets/backend/database/secret-test.js | 2 +- .../secrets/backend/kubernetes/roles-test.js | 4 +- .../secrets/backend/kv/secret-test.js | 17 ++--- .../secrets/backend/ldap/libraries-test.js | 3 +- .../secrets/backend/ssh/roles-test.js | 12 ++-- ui/tests/acceptance/transit-test.js | 9 ++- ui/tests/acceptance/unseal-test.js | 3 +- ui/tests/helpers/general-selectors.ts | 2 +- ui/tests/helpers/kv/kv-selectors.js | 1 - ui/tests/helpers/pki/pki-selectors.ts | 2 - ui/tests/helpers/replication.js | 2 +- .../secret-engine/secret-engine-selectors.ts | 2 - .../components/confirm-action-test.js | 50 ++++++++------- .../components/confirm-modal-test.js | 11 ++-- .../components/confirmation-modal-test.js | 6 +- .../components/download-button-test.js | 19 +++--- .../integration/components/edit-form-test.js | 2 +- .../enable-replication-form-test.js | 36 ++++++----- .../components/keymgmt/provider-edit-test.js | 4 +- .../kubernetes/page/role/details-test.js | 3 +- .../components/kubernetes/page/roles-test.js | 2 +- .../components/kv/page/kv-page-list-test.js | 3 +- .../kv/page/kv-page-secret-details-test.js | 2 +- .../ldap/page/configuration-test.js | 5 +- .../ldap/page/library/check-out-test.js | 2 +- .../ldap/page/library/details-test.js | 3 +- .../components/ldap/page/role/details-test.js | 2 +- .../components/ldap/page/roles-test.js | 3 +- .../components/masked-input-test.js | 33 +++++----- .../components/oidc-consent-block-test.js | 6 +- .../components/oidc/client-list-test.js | 3 +- .../components/oidc/provider-list-test.js | 3 +- .../components/page/mode-index-test.js | 14 ++--- .../pki/page/pki-certificate-details-test.js | 12 ++-- .../components/raft-storage-restore-test.js | 5 +- .../replication-action-generate-token-test.js | 3 +- .../components/replication-actions-test.js | 14 ++--- .../components/seal-action-test.js | 5 +- .../secret-engine/configure-wif-test.js | 4 +- .../components/sidebar/user-menu-test.js | 2 +- .../components/transform-list-item-test.js | 5 +- ui/tests/pages/access/identity/index.js | 3 +- ui/tests/pages/components/edit-form.js | 5 +- ui/tests/pages/components/list-view.js | 6 -- ui/tests/pages/init.js | 6 +- ui/tests/pages/policy/edit.js | 3 +- .../pages/secrets/backend/kmip/credentials.js | 1 - ui/tests/pages/secrets/backend/kmip/roles.js | 1 - ui/tests/pages/secrets/backend/kmip/scopes.js | 1 - ui/tests/pages/secrets/backend/kv/show.js | 5 -- ui/tests/pages/secrets/backend/list.js | 2 - .../pages/secrets/backend/ssh/edit-role.js | 15 ----- ui/tests/pages/secrets/backend/ssh/show.js | 5 -- ui/tests/pages/secrets/backends.js | 2 - 88 files changed, 300 insertions(+), 340 deletions(-) delete mode 100644 ui/tests/pages/secrets/backend/ssh/edit-role.js diff --git a/ui/app/templates/components/transit-key-action/decrypt.hbs b/ui/app/templates/components/transit-key-action/decrypt.hbs index dc090ec61a..4419199d38 100644 --- a/ui/app/templates/components/transit-key-action/decrypt.hbs +++ b/ui/app/templates/components/transit-key-action/decrypt.hbs @@ -73,7 +73,7 @@
- +
diff --git a/ui/app/templates/components/transit-key-action/encrypt.hbs b/ui/app/templates/components/transit-key-action/encrypt.hbs index 89274c21f2..1169cb24c8 100644 --- a/ui/app/templates/components/transit-key-action/encrypt.hbs +++ b/ui/app/templates/components/transit-key-action/encrypt.hbs @@ -94,7 +94,7 @@
- +
diff --git a/ui/app/templates/vault/cluster/init.hbs b/ui/app/templates/vault/cluster/init.hbs index 66a59c1c74..ed17013793 100644 --- a/ui/app/templates/vault/cluster/init.hbs +++ b/ui/app/templates/vault/cluster/init.hbs @@ -85,7 +85,7 @@ @color="primary" @route="vault.cluster.unseal" @model={{this.model.name}} - data-test-advance-button + data-test-button="Continue to Unseal" /> {{else}} {{/if}} diff --git a/ui/lib/core/addon/components/confirm-modal.hbs b/ui/lib/core/addon/components/confirm-modal.hbs index a3e762b222..c176b3eb5e 100644 --- a/ui/lib/core/addon/components/confirm-modal.hbs +++ b/ui/lib/core/addon/components/confirm-modal.hbs @@ -25,7 +25,7 @@ {{@disabledMessage}} - + {{else}} @@ -44,7 +44,7 @@ @text="Confirm" {{on "click" @onConfirm}} /> - + {{/if}} diff --git a/ui/lib/core/addon/components/download-button.hbs b/ui/lib/core/addon/components/download-button.hbs index e684b26f87..92deac8106 100644 --- a/ui/lib/core/addon/components/download-button.hbs +++ b/ui/lib/core/addon/components/download-button.hbs @@ -4,7 +4,7 @@ }} {{#if this.cancelLink}} diff --git a/ui/lib/core/addon/components/masked-input.hbs b/ui/lib/core/addon/components/masked-input.hbs index 62fa76c69d..760ab4d273 100644 --- a/ui/lib/core/addon/components/masked-input.hbs +++ b/ui/lib/core/addon/components/masked-input.hbs @@ -52,7 +52,7 @@ @isIconOnly={{true}} @color="tertiary" class="has-padding-xxs" - data-test-download-icon + data-test-button="Download secret value" {{on "click" (fn (mut this.modalOpen) true)}} /> {{/if}} diff --git a/ui/lib/core/addon/templates/components/replication-action-demote.hbs b/ui/lib/core/addon/templates/components/replication-action-demote.hbs index 044403af8c..7a63ad5825 100644 --- a/ui/lib/core/addon/templates/components/replication-action-demote.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-demote.hbs @@ -19,7 +19,7 @@ @text="Demote" @color="secondary" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger="demote" + data-test-button="demote" /> diff --git a/ui/lib/core/addon/templates/components/replication-action-disable.hbs b/ui/lib/core/addon/templates/components/replication-action-disable.hbs index 00c95af253..44d5d07bda 100644 --- a/ui/lib/core/addon/templates/components/replication-action-disable.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-disable.hbs @@ -20,7 +20,7 @@ @text="Disable Replication" @color="critical" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger="disable" + data-test-button="disable" /> diff --git a/ui/lib/core/addon/templates/components/replication-action-generate-token.hbs b/ui/lib/core/addon/templates/components/replication-action-generate-token.hbs index 0d6bcac22a..e5943037cd 100644 --- a/ui/lib/core/addon/templates/components/replication-action-generate-token.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-generate-token.hbs @@ -18,7 +18,7 @@ @text="Generate token" @color="secondary" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger + data-test-button="Generate token" /> diff --git a/ui/lib/core/addon/templates/components/replication-action-promote.hbs b/ui/lib/core/addon/templates/components/replication-action-promote.hbs index 82be8f034d..4548f25dee 100644 --- a/ui/lib/core/addon/templates/components/replication-action-promote.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-promote.hbs @@ -20,7 +20,7 @@ @text="Promote" @color="secondary" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger="promote" + data-test-button="promote" /> diff --git a/ui/lib/core/addon/templates/components/replication-action-recover.hbs b/ui/lib/core/addon/templates/components/replication-action-recover.hbs index 9fc91f1653..fd833df018 100644 --- a/ui/lib/core/addon/templates/components/replication-action-recover.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-recover.hbs @@ -18,7 +18,7 @@ @text="Recover" @color="secondary" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger="recover" + data-test-button="recover" /> diff --git a/ui/lib/core/addon/templates/components/replication-action-reindex.hbs b/ui/lib/core/addon/templates/components/replication-action-reindex.hbs index 2027e5da27..b20e2a4ad1 100644 --- a/ui/lib/core/addon/templates/components/replication-action-reindex.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-reindex.hbs @@ -17,7 +17,7 @@ @text="Reindex" @color="secondary" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger="reindex" + data-test-button="reindex" /> diff --git a/ui/lib/core/addon/templates/components/replication-action-update-primary.hbs b/ui/lib/core/addon/templates/components/replication-action-update-primary.hbs index b080c8dcd4..bb183d5279 100644 --- a/ui/lib/core/addon/templates/components/replication-action-update-primary.hbs +++ b/ui/lib/core/addon/templates/components/replication-action-update-primary.hbs @@ -18,7 +18,7 @@ @text="Update" @color="secondary" {{on "click" (action (mut this.isModalActive) true)}} - data-test-replication-action-trigger="update-primary" + data-test-button="update-primary" /> diff --git a/ui/lib/replication/addon/components/enable-replication-form.hbs b/ui/lib/replication/addon/components/enable-replication-form.hbs index a74fb4383a..46ff339673 100644 --- a/ui/lib/replication/addon/components/enable-replication-form.hbs +++ b/ui/lib/replication/addon/components/enable-replication-form.hbs @@ -172,7 +172,7 @@ (or (and (eq this.data.mode "primary") @canEnablePrimary) (and (eq this.data.mode "secondary") @canEnableSecondary)) }}
- +
{{/if}} \ No newline at end of file diff --git a/ui/tests/acceptance/access/identity/entities/index-test.js b/ui/tests/acceptance/access/identity/entities/index-test.js index 71ac1b8874..e784a0d585 100644 --- a/ui/tests/acceptance/access/identity/entities/index-test.js +++ b/ui/tests/acceptance/access/identity/entities/index-test.js @@ -16,7 +16,6 @@ const SELECTORS = { listItem: (name) => `[data-test-identity-row="${name}"]`, menu: `[data-test-popup-menu-trigger]`, menuItem: (element) => `[data-test-popup-menu="${element}"]`, - confirm: '[data-test-confirm-button]', }; module('Acceptance | /access/identity/entities', function (hooks) { setupApplicationTest(hooks); @@ -54,7 +53,7 @@ module('Acceptance | /access/identity/entities', function (hooks) { .dom('.hds-dropdown ul') .hasText('Details Create alias Edit Disable Delete', 'all actions render for entities'); await click(`${SELECTORS.listItem(name)} ${SELECTORS.menuItem('delete')}`); - await click(SELECTORS.confirm); + await click(GENERAL.confirmButton); }); test('it renders popup menu for external groups', async function (assert) { @@ -68,7 +67,7 @@ module('Acceptance | /access/identity/entities', function (hooks) { .dom('.hds-dropdown ul') .hasText('Details Create alias Edit Delete', 'all actions render for external groups'); await click(`${SELECTORS.listItem(name)} ${SELECTORS.menuItem('delete')}`); - await click(SELECTORS.confirm); + await click(GENERAL.confirmButton); }); test('it renders popup menu for external groups with alias', async function (assert) { @@ -86,7 +85,7 @@ module('Acceptance | /access/identity/entities', function (hooks) { .dom('.hds-dropdown ul') .hasText('Details Edit Delete', 'no "Create alias" option for external groups with an alias'); await click(`${SELECTORS.listItem(name)} ${SELECTORS.menuItem('delete')}`); - await click(SELECTORS.confirm); + await click(GENERAL.confirmButton); }); test('it renders popup menu for internal groups', async function (assert) { @@ -98,6 +97,6 @@ module('Acceptance | /access/identity/entities', function (hooks) { .dom('.hds-dropdown ul') .hasText('Details Edit Delete', 'no "Create alias" option for internal groups'); await click(`${SELECTORS.listItem(name)} ${SELECTORS.menuItem('delete')}`); - await click(SELECTORS.confirm); + await click(GENERAL.confirmButton); }); }); diff --git a/ui/tests/acceptance/access/namespaces/index-test.js b/ui/tests/acceptance/access/namespaces/index-test.js index 522fedc006..65da29e80b 100644 --- a/ui/tests/acceptance/access/namespaces/index-test.js +++ b/ui/tests/acceptance/access/namespaces/index-test.js @@ -220,8 +220,8 @@ module('Acceptance | Enterprise | /access/namespaces', function (hooks) { await click(GENERAL.linkTo('create-namespace')); assert.dom(GENERAL.inputByAttr('path')).exists('Create namespace input field is displayed'); await fillIn(GENERAL.inputByAttr('path'), testNS); - assert.dom('[data-test-edit-form-submit]').exists('Save button is displayed'); - await click('[data-test-edit-form-submit]'); + assert.dom(GENERAL.submitButton).exists('Save button is displayed'); + await click(GENERAL.submitButton); // Verify test-create-ns exists in the Manage Namespace page await fillIn(GENERAL.filterInputExplicit, testNS); diff --git a/ui/tests/acceptance/dashboard-test.js b/ui/tests/acceptance/dashboard-test.js index 2cdbcd1f69..061d1a16d2 100644 --- a/ui/tests/acceptance/dashboard-test.js +++ b/ui/tests/acceptance/dashboard-test.js @@ -459,7 +459,7 @@ module('Acceptance | landing page dashboard', function (hooks) { assert.strictEqual(currentURL(), '/vault/replication'); await click('[data-test-replication-type-select="performance"]'); await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); assert.ok( await waitUntil(() => find('[data-test-replication-dashboard]')), diff --git a/ui/tests/acceptance/enterprise-kmip-test.js b/ui/tests/acceptance/enterprise-kmip-test.js index 271422bad3..9e5f0807a4 100644 --- a/ui/tests/acceptance/enterprise-kmip-test.js +++ b/ui/tests/acceptance/enterprise-kmip-test.js @@ -130,8 +130,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { ); const addr = `127.0.0.1:${getRandomPort()}`; await fillIn('[data-test-string-list-input="0"]', addr); - await scopesPage.submit(); - await settled(); + await click(GENERAL.submitButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/kmip/configuration`, @@ -144,19 +143,26 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { test('it can revoke from the credentials show page', async function (assert) { const { backend, scope, role, serial } = await generateCreds(this.backend); await settled(); - await credentialsPage.visitDetail({ backend, scope, role, serial }); - await settled(); - await waitUntil(() => find('[data-test-confirm-action-trigger]')); - assert.dom('[data-test-confirm-action-trigger]').exists('delete button exists'); - await credentialsPage.delete().confirmDelete(); - await settled(); + await visit(`/vault/secrets/${backend}/kmip/scopes/${scope}/roles/${role}/credentials/${serial}`); + + // Wait for the delete/revoke button to appear + await waitUntil(() => find(GENERAL.confirmTrigger)); + assert.dom(GENERAL.confirmTrigger).exists('Confirm trigger exists before clicking'); + await click(GENERAL.confirmTrigger); + + // Wait for the confirm delete button to appear + await waitUntil(() => find(GENERAL.confirmButton)); + assert.dom(GENERAL.confirmButton).exists('Confirm delete exists before clicking'); + await click(GENERAL.confirmButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/kmip/scopes/${scope}/roles/${role}/credentials`, 'redirects to the credentials list' ); - assert.ok(credentialsPage.isEmpty, 'renders an empty credentials page'); + assert + .dom(GENERAL.emptyStateTitle) + .hasText('No credentials yet for this role', 'renders an empty credentials page'); }); test('it can create a scope', async function (assert) { @@ -174,8 +180,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { // create scope await scopesPage.scopeName('foo'); await settled(); - await scopesPage.submit(); - await settled(); + await click(GENERAL.submitButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/kmip/scopes`, @@ -204,10 +209,8 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { // delete the scope await scopesPage.listItemLinks.objectAt(0).menuToggle(); await settled(); - await scopesPage.delete(); - await settled(); - await scopesPage.confirmDelete(); - await settled(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual(scopesPage.listItemLinks.length, 0, 'no scopes'); assert.ok(scopesPage.isEmpty, 'renders the empty state'); }); @@ -282,10 +285,8 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { // delete the role await rolesPage.listItemLinks.objectAt(0).menuToggle(); await settled(); - await rolesPage.delete(); - await settled(); - await rolesPage.confirmDelete(); - await settled(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual(rolesPage.listItemLinks.length, 0, 'renders no roles'); assert.ok(rolesPage.isEmpty, 'renders empty'); }); @@ -309,8 +310,8 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { `/vault/secrets/${backend}/kmip/scopes/${scope}/roles/${role}`, 'cancel navigates to role show' ); - await rolesPage.delete().confirmDelete(); - await settled(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/kmip/scopes/${scope}/roles`, @@ -331,8 +332,7 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { `/vault/secrets/${backend}/kmip/scopes/${scope}/roles/${role}/credentials/generate`, 'navigates to generate credentials' ); - await credentialsPage.submit(); - await settled(); + await click(GENERAL.submitButton); assert.strictEqual( currentRouteName(), 'vault.cluster.secrets.backend.kmip.credentials.generate', @@ -353,12 +353,12 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { const { backend, scope, role } = await createRole(this.backend); await credentialsPage.visit({ backend, scope, role }); await credentialsPage.generateCredentialsLink(); - await credentialsPage.submit(); + await click(GENERAL.submitButton); + await waitUntil(() => find(GENERAL.confirmTrigger)); + assert.dom(GENERAL.confirmTrigger).exists('delete button exists'); // revoke the credentials - await waitUntil(() => find('[data-test-confirm-action-trigger]')); - assert.dom('[data-test-confirm-action-trigger]').exists('delete button exists'); - await credentialsPage.delete().confirmDelete(); - await settled(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/kmip/scopes/${scope}/roles/${role}/credentials`, @@ -374,8 +374,11 @@ module('Acceptance | Enterprise | KMIP secrets', function (hooks) { await settled(); await credentialsPage.listItemLinks.objectAt(0).menuToggle(); await settled(); - await credentialsPage.delete().confirmDelete(); - await settled(); + await waitUntil(() => find(GENERAL.confirmTrigger)); + assert.dom(GENERAL.confirmTrigger).exists('delete button exists'); + // revoke the credentials + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual(credentialsPage.listItemLinks.length, 0, 'renders no credentials'); assert.ok(credentialsPage.isEmpty, 'renders empty'); }); diff --git a/ui/tests/acceptance/enterprise-replication-test.js b/ui/tests/acceptance/enterprise-replication-test.js index 51b5afcbe1..56df5e3723 100644 --- a/ui/tests/acceptance/enterprise-replication-test.js +++ b/ui/tests/acceptance/enterprise-replication-test.js @@ -23,7 +23,8 @@ import { create } from 'ember-cli-page-object'; import flashMessage from 'vault/tests/pages/components/flash-message'; import ss from 'vault/tests/pages/components/search-select'; import { disableReplication } from 'vault/tests/helpers/replication'; -import { GENERAL } from '../helpers/general-selectors'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; + const searchSelect = create(ss); const flash = create(flashMessage); @@ -75,7 +76,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); @@ -99,7 +100,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { // click into the added secondary's mount filter config await click('[data-test-replication-link="secondaries"]'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-replication-path-filter-link]'); @@ -195,7 +196,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { // enable perf replication await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); @@ -204,13 +205,12 @@ module('Acceptance | Enterprise | replication', function (hooks) { await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); await visit('/vault/replication/dr/manage'); - await click('[data-test-demote-replication] [data-test-replication-action-trigger]'); - + await click(GENERAL.button('demote')); assert.ok(findAll('[data-test-demote-warning]').length, 'displays the demotion warning'); }); @@ -220,7 +220,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await visit('/vault/replication/dr'); await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await settled(); // eslint-disable-line await pollCluster(this.owner); await visit('/vault/replication-dr-promote/details'); @@ -243,7 +243,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await click('[data-test-replication-type-select="performance"]'); await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); await settled(); @@ -301,7 +301,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await click('[data-test-replication-type-select="performance"]'); await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); await settled(); @@ -316,7 +316,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await click('[data-test-sidebar-nav-link="Disaster Recovery"]'); // let the controller set replicationMode in afterModel await waitFor('[data-test-replication-enable-form]'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); await settled(); @@ -347,7 +347,7 @@ module('Acceptance | Enterprise | replication', function (hooks) { await click('[data-test-replication-type-select="performance"]'); await fillIn('[data-test-replication-cluster-mode-select]', 'primary'); - await click('[data-test-replication-enable]'); + await click(GENERAL.submitButton); await pollCluster(this.owner); await settled(); @@ -356,12 +356,12 @@ module('Acceptance | Enterprise | replication', function (hooks) { await click('[data-test-replication-link="manage"]'); // open demote modal - await click('[data-test-demote-replication] [data-test-replication-action-trigger]'); + await click(GENERAL.button('demote')); // enter confirmation text await fillIn('[data-test-confirmation-modal-input="Demote to secondary?"]', 'Performance'); // Click confirm button - await click('[data-test-confirm-button="Demote to secondary?"]'); + await click(GENERAL.confirmButton); await pollCluster(this.owner); await settled(); diff --git a/ui/tests/acceptance/enterprise-transform-test.js b/ui/tests/acceptance/enterprise-transform-test.js index b23fe7d3f1..1dca7ff4da 100644 --- a/ui/tests/acceptance/enterprise-transform-test.js +++ b/ui/tests/acceptance/enterprise-transform-test.js @@ -37,8 +37,7 @@ const newTransformation = async (backend, name, submit = false) => { await settled(); // Don't automatically choose role because we might be testing that if (submit) { - await transformationsPage.submit(); - await settled(); + await click(GENERAL.submitButton); } return transformationName; }; @@ -53,8 +52,7 @@ const newRole = async (backend, name) => { await settled(); await selectChoose('#transformations', '.ember-power-select-option', 0); await settled(); - await rolesPage.submit(); - await settled(); + await click(GENERAL.submitButton); return roleName; }; @@ -138,8 +136,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { await settled(); await selectChoose('#allowed_roles', '.ember-power-select-option', 0); await settled(); - await transformationsPage.submit(); - await settled(); + await click(GENERAL.submitButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/show/${transformationName}`, @@ -179,8 +176,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { await clickTrigger('#transformations'); assert.strictEqual(searchSelectComponent.options.length, 1, 'lists the transformation'); await selectChoose('#transformations', '.ember-power-select-option', 0); - await rolesPage.submit(); - await settled(); + await click(GENERAL.submitButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/show/role/${roleName}`, @@ -271,8 +267,7 @@ module('Acceptance | Enterprise | Transform secrets', function (hooks) { assert.ok(searchSelectComponent.options.length > 0, 'lists built-in alphabets'); await selectChoose('#alphabet', '.ember-power-select-option', 0); assert.dom('#alphabet .ember-power-select-trigger').doesNotExist('Alphabet input no longer searchable'); - await templatesPage.submit(); - await settled(); + await click(GENERAL.submitButton); assert.strictEqual( currentURL(), `/vault/secrets/${backend}/show/template/${templateName}`, diff --git a/ui/tests/acceptance/init-test.js b/ui/tests/acceptance/init-test.js index 8e2719cdd7..c9c7b923f8 100644 --- a/ui/tests/acceptance/init-test.js +++ b/ui/tests/acceptance/init-test.js @@ -8,6 +8,8 @@ import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; import { setRunOptions } from 'ember-a11y-testing/test-support'; import { setupMirage } from 'ember-cli-mirage/test-support'; +import { click } from '@ember/test-helpers'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; import initPage from 'vault/tests/pages/init'; const CLOUD_SEAL_RESPONSE = { @@ -91,13 +93,14 @@ module('Acceptance | init', function (hooks) { }); await initPage.init(5, 3); - await waitFor('[data-test-advance-button]'); + await click(GENERAL.submitButton); + await waitFor(GENERAL.button('Continue to Authenticate')); assert.strictEqual( initPage.keys.length, CLOUD_SEAL_RESPONSE.recovery_keys.length, 'shows all of the recovery keys' ); - assert.strictEqual(initPage.buttonText, 'Continue to Authenticate', 'links to authenticate'); + assert.dom(GENERAL.button('Continue to Authenticate')).exists('links to authenticate'); }); test('shamir seal init', async function (assert) { @@ -112,8 +115,9 @@ module('Acceptance | init', function (hooks) { }); await initPage.init(3, 2); - await waitFor('[data-test-advance-button]'); + await click(GENERAL.submitButton); + await waitFor(GENERAL.button('Continue to Unseal')); assert.strictEqual(initPage.keys.length, SEAL_RESPONSE.keys.length, 'shows all of the recovery keys'); - assert.strictEqual(initPage.buttonText, 'Continue to Unseal', 'links to unseal'); + assert.dom(GENERAL.button('Continue to Unseal')).exists('links to unseal'); }); }); diff --git a/ui/tests/acceptance/leases-test.js b/ui/tests/acceptance/leases-test.js index ed95ae1109..b089ba5b78 100644 --- a/ui/tests/acceptance/leases-test.js +++ b/ui/tests/acceptance/leases-test.js @@ -16,6 +16,7 @@ import { v4 as uuidv4 } from 'uuid'; import secretList from 'vault/tests/pages/secrets/backend/list'; import secretEdit from 'vault/tests/pages/secrets/backend/kv/edit-secret'; import { SECRET_ENGINE_SELECTORS as SES } from 'vault/tests/helpers/secret-engine/secret-engine-selectors'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; // import mountSecrets from 'vault/tests/pages/settings/mount-secret-backend'; // import { login } from 'vault/tests/helpers/auth/auth-helpers'; @@ -79,7 +80,7 @@ module('Acceptance | leases', function (hooks) { createSecret(this); navToDetail(this); await click('[data-test-lease-revoke] button'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.strictEqual( currentRouteName(), 'vault.cluster.access.leases.list-root', @@ -96,7 +97,7 @@ module('Acceptance | leases', function (hooks) { createSecret(this); await visit(`/vault/access/leases/list/${this.enginePath}`); await click('[data-test-lease-revoke-prefix] button'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.strictEqual( currentRouteName(), 'vault.cluster.access.leases.list-root', diff --git a/ui/tests/acceptance/mfa-login-enforcement-test.js b/ui/tests/acceptance/mfa-login-enforcement-test.js index 6472e9b562..c7dbf51dba 100644 --- a/ui/tests/acceptance/mfa-login-enforcement-test.js +++ b/ui/tests/acceptance/mfa-login-enforcement-test.js @@ -110,7 +110,7 @@ module('Acceptance | mfa-login-enforcement', function (hooks) { .hasClass('hds-icon-lock', 'Lock icon renders for list item'); assert.dom(`[data-test-list-item-title="${item.name}"]`).hasText(item.name, 'Enforcement name renders'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-list-item-link="details"]'); assert.strictEqual( currentRouteName(), @@ -118,7 +118,7 @@ module('Acceptance | mfa-login-enforcement', function (hooks) { 'Details more menu action transitions to enforcement route' ); await click('.hds-breadcrumb a'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-list-item-link="edit"]'); assert.strictEqual( currentRouteName(), @@ -175,7 +175,7 @@ module('Acceptance | mfa-login-enforcement', function (hooks) { `${method.name} ${method.id} Namespace: ${method.namespace_path}`, 'Method list item renders' ); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert .dom(`[data-test-mfa-method-menu-link="details"]`) .hasAttribute('href', `/ui/vault/access/mfa/methods/${method.id}`, `Details link renders for method`); @@ -191,9 +191,9 @@ module('Acceptance | mfa-login-enforcement', function (hooks) { 'Toolbar edit action has link to edit route' ); await click('[data-test-enforcement-delete]'); - assert.dom('[data-test-confirm-button]').isDisabled('Delete button disabled with no confirmation'); + assert.dom(GENERAL.confirmButton).isDisabled('Delete button disabled with no confirmation'); await fillIn('[data-test-confirmation-modal-input]', enforcement.name); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.strictEqual( currentRouteName(), 'vault.cluster.access.mfa.enforcements.index', @@ -204,7 +204,7 @@ module('Acceptance | mfa-login-enforcement', function (hooks) { test('it should edit login enforcement', async function (assert) { await visit('/vault/access/mfa/enforcements'); const enforcement = this.server.db.mfaLoginEnforcements.where({})[0]; - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-list-item-link="edit"]'); assert.dom('h1').hasText('Update enforcement', 'Title renders'); diff --git a/ui/tests/acceptance/mfa-method-test.js b/ui/tests/acceptance/mfa-method-test.js index 6b789090b1..de5acc737f 100644 --- a/ui/tests/acceptance/mfa-method-test.js +++ b/ui/tests/acceptance/mfa-method-test.js @@ -70,7 +70,7 @@ module('Acceptance | mfa-method', function (hooks) { 'Copy renders for list item' ); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-mfa-method-menu-link="details"]'); assert.strictEqual( currentRouteName(), @@ -78,7 +78,7 @@ module('Acceptance | mfa-method', function (hooks) { 'Details more menu action transitions to method route' ); await click('.hds-breadcrumb a'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-mfa-method-menu-link="edit"]'); assert.strictEqual( currentRouteName(), @@ -165,8 +165,8 @@ module('Acceptance | mfa-method', function (hooks) { await visit('/vault/access/mfa/methods'); const methodCount = this.element.querySelectorAll('[data-test-mfa-method-list-item]').length; await click('[data-test-mfa-method-list-item]'); - await click('[data-test-confirm-action-trigger]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.dom('[data-test-mfa-method-list-item]').exists({ count: methodCount - 1 }, 'Method was deleted'); }); @@ -292,7 +292,7 @@ module('Acceptance | mfa-method', function (hooks) { await fillIn('[data-test-input="max_validation_attempts"]', 10); await click('[data-test-mfa-save]'); await fillIn('[data-test-confirmation-modal-input]', model.type); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.dom('[data-test-row-value="Issuer"]').hasText('foo', 'Issuer field is updated'); assert.dom('[data-test-row-value="Algorithm"]').hasText('SHA1', 'Algorithm field is updated'); diff --git a/ui/tests/acceptance/oidc-config/clients-test.js b/ui/tests/acceptance/oidc-config/clients-test.js index 27807c5e3a..a9b6845363 100644 --- a/ui/tests/acceptance/oidc-config/clients-test.js +++ b/ui/tests/acceptance/oidc-config/clients-test.js @@ -77,7 +77,7 @@ module('Acceptance | oidc-config clients', function (hooks) { .hasText('default', 'index page lists default key'); // navigate to default key details from pop-up menu - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-oidc-key-menu-link="details"]'); assert.dom(SELECTORS.keyDeleteButton).doesNotExist('delete button is hidden for default key'); await click(SELECTORS.keyEditButton); @@ -600,7 +600,7 @@ module('Acceptance | oidc-config clients', function (hooks) { 'create form navigates back to assignment index on cancel' ); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-oidc-assignment-menu-link="edit"]'); assert.strictEqual( currentRouteName(), @@ -615,7 +615,7 @@ module('Acceptance | oidc-config clients', function (hooks) { ); // navigate to details from index page await visit('/vault/access/oidc/assignments'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-oidc-assignment-menu-link="details"]'); assert.strictEqual( currentRouteName(), diff --git a/ui/tests/acceptance/oidc-config/providers-scopes-test.js b/ui/tests/acceptance/oidc-config/providers-scopes-test.js index f47049bffd..6aab93dc9b 100644 --- a/ui/tests/acceptance/oidc-config/providers-scopes-test.js +++ b/ui/tests/acceptance/oidc-config/providers-scopes-test.js @@ -93,7 +93,7 @@ module('Acceptance | oidc-config providers and scopes', function (hooks) { 'create form navigates back to index on cancel' ); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-oidc-scope-menu-link="edit"]'); assert.strictEqual( currentRouteName(), @@ -109,7 +109,7 @@ module('Acceptance | oidc-config providers and scopes', function (hooks) { // navigate to details from index page await click('[data-test-breadcrumb-link="oidc-scopes"] a'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-oidc-scope-menu-link="details"]'); assert.strictEqual( currentRouteName(), @@ -348,7 +348,7 @@ module('Acceptance | oidc-config providers and scopes', function (hooks) { assert .dom('[data-test-oidc-provider-linked-block="default"]') .exists('index page lists default provider'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click('[data-test-oidc-provider-menu-link="edit"]'); assert.strictEqual( diff --git a/ui/tests/acceptance/pki/pki-configuration-test.js b/ui/tests/acceptance/pki/pki-configuration-test.js index 5ecb23cf65..8aef5f987c 100644 --- a/ui/tests/acceptance/pki/pki-configuration-test.js +++ b/ui/tests/acceptance/pki/pki-configuration-test.js @@ -68,7 +68,7 @@ module('Acceptance | pki configuration test', function (hooks) { await waitFor(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal, { timeout: 5000 }); assert.dom(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal).exists(); await fillIn(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerInput, 'delete-all'); - await click(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerButton); + await click(GENERAL.confirmButton); await settled(); await waitUntil(() => !find(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal)); @@ -106,7 +106,7 @@ module('Acceptance | pki configuration test', function (hooks) { await waitFor(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal); assert.dom(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal).exists(); await fillIn(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerInput, 'delete-all'); - await click(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerButton); + await click(GENERAL.confirmButton); await waitUntil(() => !find(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal)); assert.dom(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal).doesNotExist('delete all issuers modal closes'); assert.strictEqual( @@ -183,7 +183,7 @@ module('Acceptance | pki configuration test', function (hooks) { await waitFor(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal); assert.dom(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal).exists(); await fillIn(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerInput, 'delete-all'); - await click(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerButton); + await click(GENERAL.confirmButton); await settled(); await waitUntil(() => !find(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal)); assert.dom(PKI_DELETE_ALL_ISSUERS.deleteAllIssuerModal).doesNotExist(); diff --git a/ui/tests/acceptance/pki/pki-engine-workflow-test.js b/ui/tests/acceptance/pki/pki-engine-workflow-test.js index 7f074aef67..76933c1b86 100644 --- a/ui/tests/acceptance/pki/pki-engine-workflow-test.js +++ b/ui/tests/acceptance/pki/pki-engine-workflow-test.js @@ -152,7 +152,7 @@ module('Acceptance | pki workflow', function (hooks) { await visit(`/vault/secrets/${this.mountPath}/pki/roles/some-role/details`); assert.dom(PKI_ROLE_DETAILS.deleteRoleButton).exists('Delete role button is shown'); await click(PKI_ROLE_DETAILS.deleteRoleButton); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.strictEqual( currentURL(), `/vault/secrets/${this.mountPath}/pki/roles`, @@ -276,7 +276,7 @@ module('Acceptance | pki workflow', function (hooks) { await click('.linked-block'); // details page assert.strictEqual(currentURL(), `/vault/secrets/${this.mountPath}/pki/keys/${keyId}/details`); - assert.dom(PKI_KEYS.downloadButton).doesNotExist('does not download button for private key'); + assert.dom(GENERAL.button('Download')).doesNotExist('does not download button for private key'); // edit page await click(PKI_KEYS.keyEditLink); @@ -317,7 +317,7 @@ module('Acceptance | pki workflow', function (hooks) { 'Next steps This private key material will only be available once. Copy or download it now.', 'renders banner to save private key' ); - assert.dom(PKI_KEYS.downloadButton).exists('renders download button'); + assert.dom(GENERAL.button('Download')).exists('renders download button'); await click(PKI_KEYS.keyDeleteButton); await click(GENERAL.confirmButton); assert.strictEqual( diff --git a/ui/tests/acceptance/policies/index-test.js b/ui/tests/acceptance/policies/index-test.js index e774039915..e43421b876 100644 --- a/ui/tests/acceptance/policies/index-test.js +++ b/ui/tests/acceptance/policies/index-test.js @@ -25,8 +25,6 @@ import { GENERAL } from 'vault/tests/helpers/general-selectors'; const SELECT = { policyByName: (name) => `[data-test-policy-link="${name}"]`, filterBar: '[data-test-component="navigate-input"]', - delete: '[data-test-confirm-action-trigger]', - confirmDelete: '[data-test-confirm-button]', createPolicy: '[data-test-policy-create-link]', nameInput: '[data-test-policy-input="name"]', createError: '[data-test-message-error]', @@ -72,8 +70,8 @@ module('Acceptance | policies/acl', function (hooks) { await waitFor(SELECT.policyByName(policyName)); assert.dom(SELECT.policyByName(policyName)).exists('policy is shown in list'); await click(`${SELECT.policyByName(policyName)} [data-test-popup-menu-trigger]`); - await click(SELECT.delete); - await click(SELECT.confirmDelete); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.dom(SELECT.policyByName(policyName)).doesNotExist('policy is deleted successfully'); }); @@ -133,12 +131,9 @@ module('Acceptance | policies/acl', function (hooks) { // policy deletion await click(SELECT.policyByName(policyLower)); - await click('[data-test-policy-edit-toggle]'); - - await click('[data-test-confirm-action-trigger]'); - - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); await waitUntil(() => currentURL() === `/vault/policies/acl`); assert.strictEqual( currentURL(), diff --git a/ui/tests/acceptance/policy/edit-test.js b/ui/tests/acceptance/policy/edit-test.js index a1b3deaf39..914dea7218 100644 --- a/ui/tests/acceptance/policy/edit-test.js +++ b/ui/tests/acceptance/policy/edit-test.js @@ -3,35 +3,36 @@ * SPDX-License-Identifier: BUSL-1.1 */ -import { currentURL } from '@ember/test-helpers'; +import { currentURL, click, visit } from '@ember/test-helpers'; import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; -import page from 'vault/tests/pages/policy/edit'; import { login } from 'vault/tests/helpers/auth/auth-helpers'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Acceptance | policy/acl/:name/edit', function (hooks) { setupApplicationTest(hooks); - hooks.beforeEach(function () { - return login(); + hooks.beforeEach(async function () { + await login(); }); test('it redirects to list if navigating to root', async function (assert) { - await page.visit({ type: 'acl', name: 'root' }); + await visit(`vault/policy/acl/root/edit`); assert.strictEqual( currentURL(), '/vault/policies/acl', - 'navigation to root show redirects you to policy list' + 'navigation to root redirects you to policy list' ); }); test('it does not show delete for default policy', async function (assert) { - await page.visit({ type: 'acl', name: 'default' }); - assert.notOk(page.deleteIsPresent, 'there is no delete button'); + await visit(`vault/policy/acl/default/edit`); + assert.dom(GENERAL.confirmButton).doesNotExist('there is no delete button'); }); test('it navigates to show when the toggle is clicked', async function (assert) { - await page.visit({ type: 'acl', name: 'default' }).toggleEdit(); + await visit(`vault/policy/acl/default/edit`); + await click('[data-test-policy-edit-toggle]'); assert.strictEqual(currentURL(), '/vault/policy/acl/default', 'toggle navigates from edit to show'); }); }); diff --git a/ui/tests/acceptance/raft-storage-test.js b/ui/tests/acceptance/raft-storage-test.js index a849b32068..c6d6c354ef 100644 --- a/ui/tests/acceptance/raft-storage-test.js +++ b/ui/tests/acceptance/raft-storage-test.js @@ -8,6 +8,7 @@ import { setupApplicationTest } from 'ember-qunit'; import { setupMirage } from 'ember-cli-mirage/test-support'; import { click, visit } from '@ember/test-helpers'; import { login } from 'vault/tests/helpers/auth/auth-helpers'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Acceptance | raft storage', function (hooks) { setupApplicationTest(hooks); @@ -68,8 +69,8 @@ module('Acceptance | raft storage', function (hooks) { await visit('/vault/storage/raft'); assert.dom('[data-raft-row]').exists({ count: 2 }, '2 raft peers render in table'); await click(`${row} button`); - await click(`${row} [data-test-confirm-action-trigger]`); - await click('[data-test-confirm-button]'); + await click(`${row} ${GENERAL.confirmTrigger}`); + await click(GENERAL.confirmButton); assert.dom('[data-raft-row]').exists({ count: 1 }, 'Raft peer successfully removed'); }); }); diff --git a/ui/tests/acceptance/reduced-disclosure-test.js b/ui/tests/acceptance/reduced-disclosure-test.js index 3586f0a1f8..928a6a1495 100644 --- a/ui/tests/acceptance/reduced-disclosure-test.js +++ b/ui/tests/acceptance/reduced-disclosure-test.js @@ -13,6 +13,7 @@ import { pollCluster } from 'vault/tests/helpers/poll-cluster'; import VAULT_KEYS from 'vault/tests/helpers/vault-keys'; import reducedDisclosureHandlers from 'vault/mirage/handlers/reduced-disclosure'; import { overrideResponse } from 'vault/tests/helpers/stubs'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const { unsealKeys } = VAULT_KEYS; const SELECTORS = { @@ -92,9 +93,7 @@ module('Acceptance | reduced disclosure test', function (hooks) { // seal await click('[data-test-seal]'); - - await click('[data-test-confirm-button]'); - + await click(GENERAL.confirmButton); await pollCluster(this.owner); await settled(); assert.strictEqual(currentURL(), '/vault/unseal', 'vault is on the unseal page'); diff --git a/ui/tests/acceptance/secrets/backend/azure/azure-configuration-test.js b/ui/tests/acceptance/secrets/backend/azure/azure-configuration-test.js index f80793eb97..b0002c8c03 100644 --- a/ui/tests/acceptance/secrets/backend/azure/azure-configuration-test.js +++ b/ui/tests/acceptance/secrets/backend/azure/azure-configuration-test.js @@ -205,7 +205,7 @@ module('Acceptance | Azure | configuration', function (hooks) { }); await fillIn(GENERAL.inputByAttr('subscriptionId'), 'subscription-id-updated-again'); await click(GENERAL.enableField('clientSecret')); - await click('[data-test-button="toggle-masked"]'); + await click(GENERAL.button('toggle-masked')); await fillIn(GENERAL.inputByAttr('clientSecret'), 'client-secret-updated'); await click(GENERAL.submitButton); // cleanup diff --git a/ui/tests/acceptance/secrets/backend/database/secret-test.js b/ui/tests/acceptance/secrets/backend/database/secret-test.js index d8bdaaf899..b7f4355972 100644 --- a/ui/tests/acceptance/secrets/backend/database/secret-test.js +++ b/ui/tests/acceptance/secrets/backend/database/secret-test.js @@ -490,7 +490,7 @@ module('Acceptance | secrets/database/*', function (hooks) { .dom('[data-test-confirmation-modal-title]') .hasText('Delete connection?', 'Modal appears asking to confirm delete action'); await fillIn('[data-test-confirmation-modal-input="Delete connection?"]', connectionDetails.id); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.strictEqual(currentURL(), `/vault/secrets/${backend}/list`, 'Redirects to connection list page'); assert diff --git a/ui/tests/acceptance/secrets/backend/kubernetes/roles-test.js b/ui/tests/acceptance/secrets/backend/kubernetes/roles-test.js index a745359b64..70da8c7280 100644 --- a/ui/tests/acceptance/secrets/backend/kubernetes/roles-test.js +++ b/ui/tests/acceptance/secrets/backend/kubernetes/roles-test.js @@ -62,7 +62,7 @@ module('Acceptance | kubernetes | roles', function (hooks) { await click('[data-test-list-item-popup] button'); await click(`[data-test-${action}]`); if (action === 'delete') { - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.dom('[data-test-list-item-link]').exists({ count: 2 }, 'Deleted role removed from list'); } else { this.validateRoute( @@ -103,7 +103,7 @@ module('Acceptance | kubernetes | roles', function (hooks) { await click('[data-test-cancel]'); await click('[data-test-list-item-link]'); await click('[data-test-delete]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert .dom('[data-test-list-item-link]') .exists({ count: 2 }, 'Transitions to roles route and deleted role removed from list'); diff --git a/ui/tests/acceptance/secrets/backend/kv/secret-test.js b/ui/tests/acceptance/secrets/backend/kv/secret-test.js index 0096c6dc01..39eeef2d28 100644 --- a/ui/tests/acceptance/secrets/backend/kv/secret-test.js +++ b/ui/tests/acceptance/secrets/backend/kv/secret-test.js @@ -183,21 +183,21 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { // delete the items await click(SS.secretLinkMenu('1/2/3/4')); - await click(SS.secretLinkMenuDelete('1/2/3/4')); - await listPage.confirmDelete(); - await settled(); + await click(`[data-test-secret-link="1/2/3/4"] ${GENERAL.confirmTrigger}`); + await click(GENERAL.confirmButton); assert.strictEqual(currentRouteName(), 'vault.cluster.secrets.backend.list'); assert.strictEqual(currentURL(), `/vault/secrets/${enginePath}/list/1/2/3/`, 'remains on the page'); - assert.dom('[data-test-secret-link]').exists({ count: 1 }); + await listPage.secrets.objectAt(0).menuToggle(); - await listPage.delete(); - await listPage.confirmDelete(); - await settled(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual(currentURL(), `/vault/secrets/${enginePath}/list/1/2/3/`, 'remains on the page'); assert.dom(GENERAL.emptyStateTitle).hasText('No secrets under "1/2/3/".'); + await fillIn('[data-test-component="navigate-input"]', '1/2/'); assert.dom(GENERAL.emptyStateTitle).hasText('No secrets under "1/2/".'); + await click('[data-test-list-root-link]'); assert.strictEqual(currentURL(), `/vault/secrets/${enginePath}/list`); assert.dom('[data-test-secret-link]').exists({ count: 1 }); @@ -207,7 +207,8 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) { const secretPath = 'test'; await click(SS.createSecretLink); await createSecret(secretPath, 'foo', 'bar'); - await showPage.deleteSecretV1(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.strictEqual( currentRouteName(), 'vault.cluster.secrets.backend.list-root', diff --git a/ui/tests/acceptance/secrets/backend/ldap/libraries-test.js b/ui/tests/acceptance/secrets/backend/ldap/libraries-test.js index 4ec05e163d..88b53bc349 100644 --- a/ui/tests/acceptance/secrets/backend/ldap/libraries-test.js +++ b/ui/tests/acceptance/secrets/backend/ldap/libraries-test.js @@ -14,6 +14,7 @@ import { click, currentURL } from '@ember/test-helpers'; import { isURL, visitURL } from 'vault/tests/helpers/ldap/ldap-helpers'; import { deleteEngineCmd, mountEngineCmd, runCmd } from 'vault/tests/helpers/commands'; import { LDAP_SELECTORS } from 'vault/tests/helpers/ldap/ldap-selectors'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Acceptance | ldap | libraries', function (hooks) { setupApplicationTest(hooks); @@ -82,7 +83,7 @@ module('Acceptance | ldap | libraries', function (hooks) { assert.expect(2); for (const action of ['edit', 'details']) { - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); await click(`[data-test-${action}]`); const uri = action === 'details' ? 'details/accounts' : action; assert.true( diff --git a/ui/tests/acceptance/secrets/backend/ssh/roles-test.js b/ui/tests/acceptance/secrets/backend/ssh/roles-test.js index c2dbaa23fc..5f1e1c9c3e 100644 --- a/ui/tests/acceptance/secrets/backend/ssh/roles-test.js +++ b/ui/tests/acceptance/secrets/backend/ssh/roles-test.js @@ -12,6 +12,7 @@ import { waitUntil, currentRouteName, waitFor, + visit, } from '@ember/test-helpers'; import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; @@ -20,7 +21,6 @@ import { v4 as uuidv4 } from 'uuid'; import { login } from 'vault/tests/helpers/auth/auth-helpers'; import enablePage from 'vault/tests/pages/settings/mount-secret-backend'; import listPage from 'vault/tests/pages/secrets/backend/list'; -import editPage from 'vault/tests/pages/secrets/backend/ssh/edit-role'; import showPage from 'vault/tests/pages/secrets/backend/ssh/show'; import generatePage from 'vault/tests/pages/secrets/backend/ssh/generate-otp'; import { runCmd } from 'vault/tests/helpers/commands'; @@ -187,13 +187,14 @@ module('Acceptance | ssh | roles', function (hooks) { const path = `ssh-${this.uid}`; await enablePage.enable('ssh', path); await settled(); - await editPage.visitRoot({ backend: path }); + await visit(`/vault/secrets/${path}/create`); await createOTPRole('role'); await settled(); await showPage.visit({ backend: path, id: 'role' }); await settled(); - await showPage.deleteRole(); - await settled(); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); + assert.strictEqual( currentRouteName(), 'vault.cluster.secrets.backend.list-root', @@ -208,8 +209,7 @@ module('Acceptance | ssh | roles', function (hooks) { assert.expect(6); const path = `ssh-${this.uid}`; await enablePage.enable('ssh', path); - await settled(); - await editPage.visitRoot({ backend: path }); + await visit(`/vault/secrets/${path}/create`); await createOTPRole('role'); await settled(); assert.strictEqual( diff --git a/ui/tests/acceptance/transit-test.js b/ui/tests/acceptance/transit-test.js index 1d31cd41cc..b9213e9494 100644 --- a/ui/tests/acceptance/transit-test.js +++ b/ui/tests/acceptance/transit-test.js @@ -25,7 +25,6 @@ const SELECTORS = { versionRow: (version) => `[data-test-transit-version="${version}"]`, rotate: { trigger: '[data-test-transit-key-rotate]', - confirm: '[data-test-confirm-button]', }, }; @@ -162,7 +161,7 @@ const testConvergentEncryption = async function (assert, keyName) { await click('[data-test-transit-b64-toggle="context"]'); } assert.dom('[data-test-encrypt-modal]').doesNotExist(`${keyName}: is not open before encrypt`); - await click('[data-test-button-encrypt]'); + await click(GENERAL.submitButton); if (testCase.assertAfterEncrypt) { await settled(); @@ -181,7 +180,7 @@ const testConvergentEncryption = async function (assert, keyName) { } codemirror('#ciphertext-control').setValue(copiedCiphertext); - await click('[data-test-button-decrypt]'); + await click(GENERAL.submitButton); if (testCase.assertAfterDecrypt) { await settled(); @@ -352,7 +351,7 @@ module('Acceptance | transit', function (hooks) { assert.dom(SELECTORS.versionRow(1)).hasTextContaining('Version 1', `${name}: only one key version`); await click(SELECTORS.rotate.trigger); - await click(SELECTORS.rotate.confirm); + await click(GENERAL.confirmButton); assert.dom(SELECTORS.versionRow(2)).exists('two key versions after rotate'); @@ -473,7 +472,7 @@ module('Acceptance | transit', function (hooks) { assert.dom('[data-test-transit-version]').exists({ count: 1 }, `${name}: only one key version`); await click(SELECTORS.rotate.trigger); - await click(SELECTORS.rotate.confirm); + await click(GENERAL.confirmButton); assert .dom('[data-test-transit-version]') .exists({ count: 2 }, `${name}: two key versions after rotate`); diff --git a/ui/tests/acceptance/unseal-test.js b/ui/tests/acceptance/unseal-test.js index 0c25eb2ac9..209518ce39 100644 --- a/ui/tests/acceptance/unseal-test.js +++ b/ui/tests/acceptance/unseal-test.js @@ -12,6 +12,7 @@ import VAULT_KEYS from 'vault/tests/helpers/vault-keys'; import { login } from 'vault/tests/helpers/auth/auth-helpers'; import { pollCluster } from 'vault/tests/helpers/poll-cluster'; import { overrideResponse } from 'vault/tests/helpers/stubs'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const { unsealKeys } = VAULT_KEYS; @@ -57,7 +58,7 @@ module('Acceptance | unseal', function (hooks) { // seal await click('[data-test-seal]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); await pollCluster(this.owner); await settled(); diff --git a/ui/tests/helpers/general-selectors.ts b/ui/tests/helpers/general-selectors.ts index 3482a0e2e0..bffb2dde4a 100644 --- a/ui/tests/helpers/general-selectors.ts +++ b/ui/tests/helpers/general-selectors.ts @@ -25,11 +25,11 @@ export const GENERAL = { backButton: '[data-test-back-button]', cancelButton: '[data-test-cancel]', confirmButton: '[data-test-confirm-button]', // used most often on modal or confirm popups + confirmTrigger: '[data-test-confirm-action-trigger]', copyButton: '[data-test-copy-button]', // there should only be one save button per view (e.g. one per form) so this does not need to be dynamic // this button should be used for any kind of "submit" on a form or "save" action. submitButton: '[data-test-submit]', - confirmTrigger: '[data-test-confirm-action-trigger]', button: (label: string) => `[data-test-button="${label}"]`, /* ────── Menus & Lists ────── */ diff --git a/ui/tests/helpers/kv/kv-selectors.js b/ui/tests/helpers/kv/kv-selectors.js index cf0eb7fda2..3ff7c53c39 100644 --- a/ui/tests/helpers/kv/kv-selectors.js +++ b/ui/tests/helpers/kv/kv-selectors.js @@ -94,7 +94,6 @@ export const FORM = { inputByAttr: (attr) => `[data-test-input="${attr}"]`, fieldByAttr: (attr) => `[data=test=field="${attr}"]`, // formfield toggleJson: '[data-test-toggle-input="json"]', - toggleMasked: '[data-test-button="toggle-masked"]', toggleMetadata: '[data-test-metadata-toggle]', jsonEditor: '[data-test-component="code-mirror-modifier"]', ttlValue: (name) => `[data-test-ttl-value="${name}"]`, diff --git a/ui/tests/helpers/pki/pki-selectors.ts b/ui/tests/helpers/pki/pki-selectors.ts index 9b8d6e3490..33340fc2c0 100644 --- a/ui/tests/helpers/pki/pki-selectors.ts +++ b/ui/tests/helpers/pki/pki-selectors.ts @@ -42,7 +42,6 @@ export const PKI_DELETE_ALL_ISSUERS = { issuerLink: '[data-test-delete-all-issuers-link]', deleteAllIssuerModal: '#confirmation-modal', deleteAllIssuerInput: '[data-test-confirmation-modal-input="Delete all issuers?"]', - deleteAllIssuerButton: '[data-test-confirm-button="Delete all issuers?"]', }; export const PKI_GENERATE_ROOT = { @@ -173,7 +172,6 @@ export const PKI_KEYS = { popupMenuEdit: '[data-test-key-menu-link="edit"]', // key details keyDeleteButton: '[data-test-pki-key-delete]', - downloadButton: '[data-test-download-button]', keyEditLink: '[data-test-pki-key-edit]', nextStepsAlert: '[data-test-pki-key-next-steps]', }; diff --git a/ui/tests/helpers/replication.js b/ui/tests/helpers/replication.js index 6a3d46b937..ab8bd60b9d 100644 --- a/ui/tests/helpers/replication.js +++ b/ui/tests/helpers/replication.js @@ -17,7 +17,7 @@ export const disableReplication = async (type, assert) => { const typeDisplay = type === 'dr' ? 'Disaster Recovery' : 'Performance'; await fillIn('[data-test-confirmation-modal-input="Disable Replication?"]', typeDisplay); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); await settled(); // eslint-disable-line if (assert) { diff --git a/ui/tests/helpers/secret-engine/secret-engine-selectors.ts b/ui/tests/helpers/secret-engine/secret-engine-selectors.ts index 82a17f3038..1d7dda4c6f 100644 --- a/ui/tests/helpers/secret-engine/secret-engine-selectors.ts +++ b/ui/tests/helpers/secret-engine/secret-engine-selectors.ts @@ -23,8 +23,6 @@ export const SECRET_ENGINE_SELECTORS = { secretHeader: '[data-test-secret-header]', secretLink: (name: string) => (name ? `[data-test-secret-link="${name}"]` : '[data-test-secret-link]'), secretLinkMenu: (name: string) => `[data-test-secret-link="${name}"] [data-test-popup-menu-trigger]`, - secretLinkMenuDelete: (name: string) => - `[data-test-secret-link="${name}"] [data-test-confirm-action-trigger]`, secretLinkATag: (name: string) => name ? `[data-test-secret-item-link="${name}"]` : '[data-test-secret-item-link]', viewBackend: '[data-test-backend-view-link]', diff --git a/ui/tests/integration/components/confirm-action-test.js b/ui/tests/integration/components/confirm-action-test.js index 0883b8e153..366e265a4b 100644 --- a/ui/tests/integration/components/confirm-action-test.js +++ b/ui/tests/integration/components/confirm-action-test.js @@ -9,13 +9,11 @@ import { render, click } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import sinon from 'sinon'; import { setRunOptions } from 'ember-a11y-testing/test-support'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const SELECTORS = { - modalToggle: '[data-test-confirm-action-trigger]', title: '[data-test-confirm-action-title]', message: '[data-test-confirm-action-message]', - confirm: '[data-test-confirm-button]', - cancel: '[data-test-confirm-cancel-button]', }; module('Integration | Component | confirm-action', function (hooks) { setupRenderingTest(hooks); @@ -32,20 +30,22 @@ module('Integration | Component | confirm-action', function (hooks) { /> `); - assert.dom(SELECTORS.modalToggle).hasText('DELETE', 'renders button text'); - await click(SELECTORS.modalToggle); + assert.dom(GENERAL.confirmTrigger).hasText('DELETE', 'renders button text'); + await click(GENERAL.confirmTrigger); assert .dom('#confirm-action-modal') .hasClass('hds-modal--color-critical', 'renders critical modal color by default'); - assert.dom(SELECTORS.confirm).hasClass('hds-button--color-critical', 'renders critical confirm button'); + assert + .dom(GENERAL.confirmButton) + .hasClass('hds-button--color-critical', 'renders critical confirm button'); assert.dom(SELECTORS.title).hasText('Are you sure?', 'renders default title'); assert .dom(SELECTORS.message) .hasText('You will not be able to recover it later.', 'renders default body text'); - await click(SELECTORS.cancel); + await click(GENERAL.cancelButton); assert.false(this.onConfirm.called, 'does not call the action when Cancel is clicked'); - await click(SELECTORS.modalToggle); - await click(SELECTORS.confirm); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.true(this.onConfirm.called, 'calls the action when Confirm is clicked'); assert.dom(SELECTORS.title).doesNotExist('modal closes after confirm is clicked'); }); @@ -65,17 +65,17 @@ module('Integration | Component | confirm-action', function (hooks) { /> `); - assert.dom(`li ${SELECTORS.modalToggle}`).exists('element renders inside
  • '); - assert.dom(SELECTORS.modalToggle).hasClass('hds-confirm-action-critical', 'button has dropdown styling'); - await click(SELECTORS.modalToggle); + assert.dom(`li ${GENERAL.confirmTrigger}`).exists('element renders inside
  • '); + assert.dom(GENERAL.confirmTrigger).hasClass('hds-confirm-action-critical', 'button has dropdown styling'); + await click(GENERAL.confirmTrigger); assert.dom(SELECTORS.title).hasText('Are you sure?', 'renders default title'); assert .dom(SELECTORS.message) .hasText('You will not be able to recover it later.', 'renders default body text'); - await click('[data-test-confirm-cancel-button]'); + await click(GENERAL.cancelButton); assert.false(this.onConfirm.called, 'does not call the action when Cancel is clicked'); - await click(SELECTORS.modalToggle); - await click(SELECTORS.confirm); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.true(this.onConfirm.called, 'calls the action when Confirm is clicked'); assert.dom(SELECTORS.title).doesNotExist('modal closes after confirm is clicked'); }); @@ -89,9 +89,9 @@ module('Integration | Component | confirm-action', function (hooks) { /> `); - await click(SELECTORS.modalToggle); + await click(GENERAL.confirmTrigger); - assert.dom(SELECTORS.confirm).isDisabled('disables confirm button when loading'); + assert.dom(GENERAL.confirmButton).isDisabled('disables confirm button when loading'); assert.dom('[data-test-confirm-button] [data-test-icon="loading"]').exists('it renders loading icon'); }); @@ -106,7 +106,7 @@ module('Integration | Component | confirm-action', function (hooks) { /> `); - await click(SELECTORS.modalToggle); + await click(GENERAL.confirmTrigger); assert .dom('#confirm-action-modal') .hasClass('hds-modal--color-neutral', 'renders neutral modal because disabledMessage is present'); @@ -114,8 +114,8 @@ module('Integration | Component | confirm-action', function (hooks) { assert .dom(SELECTORS.message) .hasText('This is the reason you cannot do the thing', 'renders disabled message as body text'); - assert.dom(SELECTORS.confirm).doesNotExist('does not render confirm action button'); - assert.dom(SELECTORS.cancel).hasText('Close'); + assert.dom(GENERAL.confirmButton).doesNotExist('does not render confirm action button'); + assert.dom(GENERAL.cancelButton).hasText('Close'); }); test('it renders passed args', async function (assert) { @@ -132,12 +132,14 @@ module('Integration | Component | confirm-action', function (hooks) { /> `); - assert.dom(SELECTORS.modalToggle).hasClass('hds-button--color-secondary', 'renders @buttonColor classes'); - await click(SELECTORS.modalToggle); + assert + .dom(GENERAL.confirmTrigger) + .hasClass('hds-button--color-secondary', 'renders @buttonColor classes'); + await click(GENERAL.confirmTrigger); assert.dom('#confirm-action-modal').hasClass('hds-modal--color-warning', 'renders warning modal'); - assert.dom(SELECTORS.confirm).hasClass('hds-button--color-primary', 'renders primary confirm button'); + assert.dom(GENERAL.confirmButton).hasClass('hds-button--color-primary', 'renders primary confirm button'); assert.dom(SELECTORS.title).hasText('Do this?', 'renders passed title'); assert.dom(SELECTORS.message).hasText('Are you really, really sure?', 'renders passed body text'); - assert.dom(SELECTORS.confirm).hasText('Confirm'); + assert.dom(GENERAL.confirmButton).hasText('Confirm'); }); }); diff --git a/ui/tests/integration/components/confirm-modal-test.js b/ui/tests/integration/components/confirm-modal-test.js index 54e4923b4c..5603ff70d6 100644 --- a/ui/tests/integration/components/confirm-modal-test.js +++ b/ui/tests/integration/components/confirm-modal-test.js @@ -8,6 +8,7 @@ import { setupRenderingTest } from 'vault/tests/helpers'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import sinon from 'sinon'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | confirm-modal', function (hooks) { setupRenderingTest(hooks); @@ -23,9 +24,7 @@ module('Integration | Component | confirm-modal', function (hooks) { assert .dom('[data-test-confirm-modal]') .hasClass('hds-modal--color-warning', 'renders warning modal color'); - assert - .dom('[data-test-confirm-button]') - .hasClass('hds-button--color-primary', 'renders primary confirm button'); + assert.dom(GENERAL.confirmButton).hasClass('hds-button--color-primary', 'renders primary confirm button'); assert.dom('[data-test-confirm-action-title]').hasText('Are you sure?', 'renders default title'); assert .dom('[data-test-confirm-action-message]') @@ -50,15 +49,13 @@ module('Integration | Component | confirm-modal', function (hooks) { assert.dom('[data-test-confirm-action-message]').hasText('Nope', 'renders disabled message'); - assert - .dom('[data-test-confirm-button]') - .doesNotExist('confirm button is not rendered when action is disabled'); + assert.dom(GENERAL.confirmButton).doesNotExist('confirm button is not rendered when action is disabled'); }); test('it calls onConfirm when the modal is confirmed', async function (assert) { await render(hbs``); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.true(this.onConfirm.called); }); }); diff --git a/ui/tests/integration/components/confirmation-modal-test.js b/ui/tests/integration/components/confirmation-modal-test.js index c30ebbc279..9726ed0c4d 100644 --- a/ui/tests/integration/components/confirmation-modal-test.js +++ b/ui/tests/integration/components/confirmation-modal-test.js @@ -29,9 +29,9 @@ module('Integration | Component | confirmation-modal', function (hooks) { /> `); - assert.dom('[data-test-confirm-button]').isDisabled(); + assert.dom(GENERAL.confirmButton).isDisabled(); assert.dom('#confirmation-modal').exists('modal is active'); - assert.dom('[data-test-confirm-button]').hasText('Plz Continue', 'Confirm button has specified value'); + assert.dom(GENERAL.confirmButton).hasText('Plz Continue', 'Confirm button has specified value'); assert .dom('[data-test-confirmation-modal-title] [data-test-icon="alert-triangle"]') .exists('title has with warning icon'); @@ -40,7 +40,7 @@ module('Integration | Component | confirmation-modal', function (hooks) { await click(GENERAL.cancelButton); assert.true(closeAction.called, 'executes passed in onClose function'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.true(confirmAction.called, 'executes passed in onConfirm function'); }); }); diff --git a/ui/tests/integration/components/download-button-test.js b/ui/tests/integration/components/download-button-test.js index e5f67ccf4c..416c2a2d51 100644 --- a/ui/tests/integration/components/download-button-test.js +++ b/ui/tests/integration/components/download-button-test.js @@ -6,13 +6,10 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { click, render, resetOnerror, setupOnerror } from '@ember/test-helpers'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; import hbs from 'htmlbars-inline-precompile'; import sinon from 'sinon'; -const SELECTORS = { - button: '[data-test-download-button]', - icon: '[data-test-icon="download"]', -}; module('Integration | Component | download button', function (hooks) { setupRenderingTest(hooks); @@ -28,15 +25,15 @@ module('Integration | Component | download button', function (hooks) { test('it renders', async function (assert) { await render(hbs` `); - assert.dom(SELECTORS.icon).exists('renders download icon'); - assert.dom(SELECTORS.button).hasText('Download', 'renders default text'); + assert.dom(GENERAL.icon('download')).exists('renders download icon'); + assert.dom(GENERAL.button('Download')).hasText('Download', 'renders default text'); }); test('it renders passed args', async function (assert) { await render(hbs` `); - assert.dom(SELECTORS.icon).doesNotExist('hides icon'); - assert.dom(SELECTORS.button).hasText('I do something', 'renders passed text'); + assert.dom(GENERAL.icon('download')).doesNotExist('hides icon'); + assert.dom(GENERAL.button('Download')).hasText('I do something', 'renders passed text'); }); test('it downloads with defaults when only passed @data arg', async function (assert) { @@ -45,7 +42,7 @@ module('Integration | Component | download button', function (hooks) { await render(hbs` `); - await click(SELECTORS.button); + await click(GENERAL.button('Download')); const [filename, content, extension] = this.downloadSpy.getCall(0).args; assert.ok(filename.includes('Z'), 'filename defaults to ISO string'); assert.strictEqual(content, this.data, 'called with correct data'); @@ -63,7 +60,7 @@ module('Integration | Component | download button', function (hooks) { @extension={{this.extension}} /> `); - await click(SELECTORS.button); + await click(GENERAL.button('Download')); const [filename, content, extension] = this.downloadSpy.getCall(0).args; assert.ok(filename.includes(`${this.filename}-`), 'filename added to ISO string'); assert.strictEqual(content, this.data, 'called with correct data'); @@ -77,7 +74,7 @@ module('Integration | Component | download button', function (hooks) { `); - await click(SELECTORS.button); + await click(GENERAL.button('Download')); const [filename, content, extension] = this.downloadSpy.getCall(0).args; assert.ok(filename.includes('Z'), 'filename defaults to ISO string'); assert.strictEqual(content, this.fetchData(), 'called with fetched data'); diff --git a/ui/tests/integration/components/edit-form-test.js b/ui/tests/integration/components/edit-form-test.js index 4b06fbb39c..851240d036 100644 --- a/ui/tests/integration/components/edit-form-test.js +++ b/ui/tests/integration/components/edit-form-test.js @@ -42,7 +42,7 @@ module('Integration | Component | edit form', function (hooks) { const flash = this.owner.lookup('service:flash-messages'); this.flashSuccessSpy = sinon.spy(flash, 'success'); await this.renderComponent(); - await click('[data-test-edit-form-submit]'); + await click(GENERAL.submitButton); const { saveType, model } = this.onSave.lastCall.args[0]; const [flashMessage] = this.flashSuccessSpy.lastCall.args; assert.strictEqual(flashMessage, 'Saved!'); diff --git a/ui/tests/integration/components/enable-replication-form-test.js b/ui/tests/integration/components/enable-replication-form-test.js index c8ca2575c5..2a4d3173c4 100644 --- a/ui/tests/integration/components/enable-replication-form-test.js +++ b/ui/tests/integration/components/enable-replication-form-test.js @@ -11,6 +11,7 @@ import { render, fillIn, click, settled } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { setupMirage } from 'ember-cli-mirage/test-support'; import { overrideResponse } from 'vault/tests/helpers/stubs'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const ENABLE_FORM = { clusterMode: '[data-test-replication-cluster-mode-select]', @@ -19,7 +20,6 @@ const ENABLE_FORM = { primaryAddr: '[data-test-input="primary_api_addr"]', caFile: '[data-test-input="ca_file"]', caPath: '[data-test-input="ca_path"]', - submitButton: '[data-test-replication-enable]', notAllowed: '[data-test-not-allowed]', inlineMessage: '[data-test-inline-error-message]', cannotEnable: '[data-test-disable-to-continue]', @@ -55,17 +55,17 @@ module('Integration | Component | enable-replication-form', function (hooks) { ['clusterAddr'].forEach((field) => { assert.dom(ENABLE_FORM[field]).hasNoValue(); }); - assert.dom(ENABLE_FORM.submitButton).isNotDisabled(); + assert.dom(GENERAL.submitButton).isNotDisabled(); await fillIn(ENABLE_FORM.clusterMode, 'secondary'); assert.dom(ENABLE_FORM.inlineMessage).hasText('This will immediately clear all data in this cluster!'); ['secondaryToken', 'primaryAddr', 'caFile', 'caPath'].forEach((field) => { assert.dom(ENABLE_FORM[field]).hasNoValue(); }); - assert.dom(ENABLE_FORM.submitButton).isDisabled(); + assert.dom(GENERAL.submitButton).isDisabled(); await fillIn(ENABLE_FORM.secondaryToken, 'some-token'); await fillIn(ENABLE_FORM.primaryAddr, 'some-addr'); - assert.dom(ENABLE_FORM.submitButton).isNotDisabled(); + assert.dom(GENERAL.submitButton).isNotDisabled(); }); test(`it shows warning when capabilities restricted for ${replicationMode} replication mode`, async function (assert) { assert.expect(10); @@ -84,17 +84,25 @@ module('Integration | Component | enable-replication-form', function (hooks) { assert .dom(ENABLE_FORM.notAllowed) .hasText('The token you are using is not authorized to enable primary replication.'); - ['clusterAddr', 'submitButton'].forEach((field) => { - assert.dom(ENABLE_FORM[field]).doesNotExist(); + ['clusterAddr'].forEach((field) => { + assert + .dom(ENABLE_FORM[field]) + .doesNotExist(`${field}: field does not exist on primary form when not allowed`); }); + assert + .dom(GENERAL.submitButton) + .doesNotExist('on a primary the submit button does not exist when not allowed'); await fillIn(ENABLE_FORM.clusterMode, 'secondary'); assert .dom(ENABLE_FORM.notAllowed) .hasText('The token you are using is not authorized to enable secondary replication.'); - ['secondaryToken', 'primaryAddr', 'caFile', 'caPath', 'submitButton'].forEach((field) => { + ['secondaryToken', 'primaryAddr', 'caFile', 'caPath'].forEach((field) => { assert.dom(ENABLE_FORM[field]).doesNotExist(); }); + assert + .dom(GENERAL.submitButton) + .doesNotExist('on a secondary the submit button does not exist when not allowed'); }); }); @@ -115,7 +123,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { ['clusterAddr'].forEach((field) => { assert.dom(ENABLE_FORM[field]).hasNoValue(); }); - assert.dom(ENABLE_FORM.submitButton).isNotDisabled(); + assert.dom(GENERAL.submitButton).isNotDisabled(); await fillIn(ENABLE_FORM.clusterMode, 'secondary'); assert @@ -127,7 +135,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { .hasText( "When running as a DR Secondary Vault is read only. For this reason, we don't allow other Replication modes to operate at the same time. This cluster is also currently operating as a Performance Primary." ); - assert.dom(ENABLE_FORM.submitButton).isDisabled(); + assert.dom(GENERAL.submitButton).isDisabled(); this.set('performanceMode', 'secondary'); await settled(); @@ -152,7 +160,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { />`, this.context ); - assert.dom(ENABLE_FORM.submitButton).isDisabled(); + assert.dom(GENERAL.submitButton).isDisabled(); }); }); @@ -187,7 +195,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { this.context ); await fillIn(ENABLE_FORM.clusterAddr, 'some-addr'); - await click(ENABLE_FORM.submitButton); + await click(GENERAL.submitButton); // after success assert.dom(ENABLE_FORM.clusterAddr).hasNoValue(); assert.true(this.successSpy.calledOnce, 'called once'); @@ -231,7 +239,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { // Fill in then clear ca path await fillIn(ENABLE_FORM.caPath, 'some-path'); await fillIn(ENABLE_FORM.caPath, ''); - await click(ENABLE_FORM.submitButton); + await click(GENERAL.submitButton); // after success assert.dom(ENABLE_FORM.secondaryToken).hasValue(''); assert.dom(ENABLE_FORM.primaryAddr).hasNoValue(); @@ -266,7 +274,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { this.context ); await fillIn(ENABLE_FORM.clusterAddr, 'some-addr'); - await click(ENABLE_FORM.submitButton); + await click(GENERAL.submitButton); assert.dom(ENABLE_FORM.error).hasText('permission denied', 'shows error returned from API'); assert.dom(ENABLE_FORM.clusterAddr).hasValue('some-addr', 'does not clear form'); assert.false(this.successSpy.calledOnce, 'success spy not called'); @@ -287,7 +295,7 @@ module('Integration | Component | enable-replication-form', function (hooks) { await fillIn(ENABLE_FORM.clusterMode, 'secondary'); await fillIn(ENABLE_FORM.secondaryToken, 'some-token-value'); await fillIn(ENABLE_FORM.primaryAddr, 'http://127.0.0.1:8200'); - await click(ENABLE_FORM.submitButton); + await click(GENERAL.submitButton); // after error assert.dom(ENABLE_FORM.error).hasText('permission denied', 'shows error returned from API'); assert.dom(ENABLE_FORM.secondaryToken).hasValue('some-token-value', 'does not clear form'); diff --git a/ui/tests/integration/components/keymgmt/provider-edit-test.js b/ui/tests/integration/components/keymgmt/provider-edit-test.js index f6188b63ac..9aa3fef963 100644 --- a/ui/tests/integration/components/keymgmt/provider-edit-test.js +++ b/ui/tests/integration/components/keymgmt/provider-edit-test.js @@ -110,7 +110,7 @@ module('Integration | Component | keymgmt/provider-edit', function (hooks) { 'This provider cannot be deleted until all 2 key(s) distributed to it are revoked. This can be done from the Keys tab.', 'Renders disabled message' ); - await click('[data-test-confirm-cancel-button]'); + await click(GENERAL.cancelButton); }); test('it should delete a provider', async function (assert) { @@ -155,7 +155,7 @@ module('Integration | Component | keymgmt/provider-edit', function (hooks) { .hasText('None', 'None is displayed when no keys exist for provider'); await click(`[${ts}-delete]`); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); }); test('it should render create view', async function (assert) { diff --git a/ui/tests/integration/components/kubernetes/page/role/details-test.js b/ui/tests/integration/components/kubernetes/page/role/details-test.js index c9db002ced..64047b1149 100644 --- a/ui/tests/integration/components/kubernetes/page/role/details-test.js +++ b/ui/tests/integration/components/kubernetes/page/role/details-test.js @@ -11,6 +11,7 @@ import { render, click } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import sinon from 'sinon'; import { duration } from 'core/helpers/format-duration'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const allFields = [ { label: 'Role name', key: 'name' }, @@ -111,7 +112,7 @@ module('Integration | Component | kubernetes | Page::Role::Details', function (h assert.dom('[data-test-edit]').hasText('Edit role', 'Edit action renders'); await click('[data-test-delete]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.ok( transitionStub.calledWith('vault.cluster.secrets.backend.kubernetes.roles'), 'Transitions to roles route on delete success' diff --git a/ui/tests/integration/components/kubernetes/page/roles-test.js b/ui/tests/integration/components/kubernetes/page/roles-test.js index 66211b884f..f7ad30a575 100644 --- a/ui/tests/integration/components/kubernetes/page/roles-test.js +++ b/ui/tests/integration/components/kubernetes/page/roles-test.js @@ -94,7 +94,7 @@ module('Integration | Component | kubernetes | Page::Roles', function (hooks) { await this.renderComponent(); assert.dom('[data-test-list-item-content] svg').hasClass('hds-icon-user', 'List item icon renders'); assert.dom('[data-test-list-item-content]').hasText(this.roles[0].name, 'List item name renders'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert.dom('[data-test-details]').hasText('Details', 'Details link renders in menu'); assert.dom('[data-test-edit]').hasText('Edit', 'Edit link renders in menu'); assert.dom('[data-test-delete]').hasText('Delete', 'Details link renders in menu'); diff --git a/ui/tests/integration/components/kv/page/kv-page-list-test.js b/ui/tests/integration/components/kv/page/kv-page-list-test.js index 0eddc52e35..64081ee776 100644 --- a/ui/tests/integration/components/kv/page/kv-page-list-test.js +++ b/ui/tests/integration/components/kv/page/kv-page-list-test.js @@ -13,6 +13,7 @@ import { kvMetadataPath } from 'vault/utils/kv-path'; import { allowAllCapabilitiesStub } from 'vault/tests/helpers/stubs'; import { PAGE } from 'vault/tests/helpers/kv/kv-selectors'; import { setRunOptions } from 'ember-a11y-testing/test-support'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const CREATE_RECORDS = (number, store, server) => { const mirageList = server.createList('kv-metadatum', number, 'withCustomPath'); @@ -92,7 +93,7 @@ module('Integration | Component | kv | Page::List', function (hooks) { const popupSelector = `${PAGE.list.item('my-secret-0')} ${PAGE.popup}`; await click(popupSelector); await click('[data-test-popup-metadata-delete]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.dom(PAGE.list.item('my-secret-0')).doesNotExist('deleted the first record from the list'); }); }); diff --git a/ui/tests/integration/components/kv/page/kv-page-secret-details-test.js b/ui/tests/integration/components/kv/page/kv-page-secret-details-test.js index 05c5c2d509..5ccebf4018 100644 --- a/ui/tests/integration/components/kv/page/kv-page-secret-details-test.js +++ b/ui/tests/integration/components/kv/page/kv-page-secret-details-test.js @@ -124,7 +124,7 @@ module('Integration | Component | kv-v2 | Page::Secret::Details', function (hook assert.dom(PAGE.title).includesText(this.model.path, 'renders secret path as page title'); assert.dom(PAGE.infoRowValue('foo')).exists('renders row for secret data'); assert.dom(PAGE.infoRowValue('foo')).hasText('***********'); - await click(FORM.toggleMasked); + await click(GENERAL.button('toggle-masked')); assert.dom(PAGE.infoRowValue('foo')).hasText('bar', 'renders secret value'); await click(FORM.toggleJson); assert.dom(GENERAL.codeBlock('secret-data')).hasText( diff --git a/ui/tests/integration/components/ldap/page/configuration-test.js b/ui/tests/integration/components/ldap/page/configuration-test.js index 56ec934024..b78a74a198 100644 --- a/ui/tests/integration/components/ldap/page/configuration-test.js +++ b/ui/tests/integration/components/ldap/page/configuration-test.js @@ -16,7 +16,6 @@ import { GENERAL } from 'vault/tests/helpers/general-selectors'; const selectors = { rotateAction: '[data-test-toolbar-rotate-action]', - confirmRotate: '[data-test-confirm-button]', configAction: '[data-test-toolbar-config-action]', configCta: '[data-test-config-cta]', mountConfig: '[data-test-mount-config]', @@ -84,7 +83,7 @@ module('Integration | Component | ldap | Page::Configuration', function (hooks) await this.renderComponent(); - assert.dom(selectors.pageError).exists('Config fetch error is rendered'); + assert.dom(GENERAL.pageError.error).exists('Config fetch error is rendered'); }); test('it should render display fields', async function (assert) { @@ -116,6 +115,6 @@ module('Integration | Component | ldap | Page::Configuration', function (hooks) await this.renderComponent(); await click(selectors.rotateAction); - await click(selectors.confirmRotate); + await click(GENERAL.confirmButton); }); }); diff --git a/ui/tests/integration/components/ldap/page/library/check-out-test.js b/ui/tests/integration/components/ldap/page/library/check-out-test.js index 8116adc258..81593f14b3 100644 --- a/ui/tests/integration/components/ldap/page/library/check-out-test.js +++ b/ui/tests/integration/components/ldap/page/library/check-out-test.js @@ -70,7 +70,7 @@ module('Integration | Component | ldap | Page::Library::CheckOut', function (hoo 'Warning alert renders' ); assert.dom('[data-test-row-value="Account name"]').hasText('foo.bar', 'Account name renders'); - await click('[data-test-button="toggle-masked"]'); + await click(GENERAL.button('toggle-masked')); assert.dom(`${GENERAL.infoRowValue('Password')} .masked-value`).hasText('password', 'Password renders'); assert .dom('[data-test-row-value="Lease ID"]') diff --git a/ui/tests/integration/components/ldap/page/library/details-test.js b/ui/tests/integration/components/ldap/page/library/details-test.js index c7ef6515b6..8e99e01cb0 100644 --- a/ui/tests/integration/components/ldap/page/library/details-test.js +++ b/ui/tests/integration/components/ldap/page/library/details-test.js @@ -10,6 +10,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; import { render, click } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import sinon from 'sinon'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | ldap | Page::Library::Details', function (hooks) { setupRenderingTest(hooks); @@ -70,7 +71,7 @@ module('Integration | Component | ldap | Page::Library::Details', function (hook const transitionStub = sinon.stub(this.owner.lookup('service:router'), 'transitionTo'); await click('[data-test-delete]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.ok( transitionStub.calledWith('vault.cluster.secrets.backend.ldap.libraries'), 'Transitions to libraries route on delete success' diff --git a/ui/tests/integration/components/ldap/page/role/details-test.js b/ui/tests/integration/components/ldap/page/role/details-test.js index d6bcd95223..08e4e16a6f 100644 --- a/ui/tests/integration/components/ldap/page/role/details-test.js +++ b/ui/tests/integration/components/ldap/page/role/details-test.js @@ -84,7 +84,7 @@ module('Integration | Component | ldap | Page::Role::Details', function (hooks) .doesNotExist('Rotate credentials action is hidden for dynamic role'); await click('[data-test-delete]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.ok( transitionStub.calledWith('vault.cluster.secrets.backend.ldap.roles'), 'Transitions to roles route on delete success' diff --git a/ui/tests/integration/components/ldap/page/roles-test.js b/ui/tests/integration/components/ldap/page/roles-test.js index c6c4c37a01..afbf22b711 100644 --- a/ui/tests/integration/components/ldap/page/roles-test.js +++ b/ui/tests/integration/components/ldap/page/roles-test.js @@ -13,6 +13,7 @@ import { allowAllCapabilitiesStub } from 'vault/tests/helpers/stubs'; import { createSecretsEngine, generateBreadcrumbs } from 'vault/tests/helpers/ldap/ldap-helpers'; import sinon from 'sinon'; import { LDAP_SELECTORS } from 'vault/tests/helpers/ldap/ldap-selectors'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | ldap | Page::Roles', function (hooks) { setupRenderingTest(hooks); @@ -103,7 +104,7 @@ module('Integration | Component | ldap | Page::Roles', function (hooks) { .dom('[data-test-role-type-badge="static-test"]') .hasText(this.roles[0].type, 'List item type badge renders'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert.dom('[data-test-edit]').hasText('Edit', 'Edit link renders in menu'); assert.dom('[data-test-get-creds]').hasText('Get credentials', 'Get credentials link renders in menu'); assert diff --git a/ui/tests/integration/components/masked-input-test.js b/ui/tests/integration/components/masked-input-test.js index c419eac083..a0c8842647 100644 --- a/ui/tests/integration/components/masked-input-test.js +++ b/ui/tests/integration/components/masked-input-test.js @@ -11,9 +11,6 @@ import hbs from 'htmlbars-inline-precompile'; import sinon from 'sinon'; const SELECTORS = { - downloadBtn: '[data-test-download-button]', - toggle: '[data-test-button="toggle-masked"]', - downloadIcon: '[data-test-download-icon]', stringify: '[data-test-stringify-toggle]', }; module('Integration | Component | masked input', function (hooks) { @@ -32,11 +29,11 @@ module('Integration | Component | masked input', function (hooks) { assert.dom('textarea').exists(); assert.dom('textarea').hasClass('masked-font', 'it renders an input with obscure font'); assert.dom(GENERAL.copyButton).doesNotExist('does not render copy button by default'); - assert.dom('[data-test-download-button]').doesNotExist('does not render download button by default'); + assert.dom(GENERAL.button('Download')).doesNotExist('does not render download button by default'); - await click(SELECTORS.toggle); + await click(GENERAL.button('toggle-masked')); assert.dom('.masked-value').doesNotHaveClass('masked-font', 'it unmasks when show button is clicked'); - await click(SELECTORS.toggle); + await click(GENERAL.button('toggle-masked')); assert.dom('.masked-value').hasClass('masked-font', 'it remasks text when button is clicked'); }); @@ -56,10 +53,10 @@ module('Integration | Component | masked input', function (hooks) { test('it renders a download button when allowDownload is true', async function (assert) { await render(hbs` `); - assert.dom(SELECTORS.downloadIcon).exists(); + assert.dom(GENERAL.button('Download secret value')).exists(); - await click(SELECTORS.downloadIcon); - assert.dom(SELECTORS.downloadBtn).exists('clicking download icon opens modal with download button'); + await click(GENERAL.button('Download secret value')); + assert.dom(GENERAL.button('Download')).exists('clicking download icon opens modal with download button'); }); test('it shortens all outputs when displayOnly and masked', async function (assert) { @@ -68,7 +65,7 @@ module('Integration | Component | masked input', function (hooks) { const maskedValue = document.querySelector('.masked-value').innerText; assert.strictEqual(maskedValue.length, 11); - await click(SELECTORS.toggle); + await click(GENERAL.button('toggle-masked')); const unMaskedValue = document.querySelector('.masked-value').innerText; assert.strictEqual(unMaskedValue.length, this.value.length); }); @@ -106,7 +103,7 @@ module('Integration | Component | masked input', function (hooks) { this.set('value', 'hello'); await render(hbs``); await triggerKeyEvent('textarea', 'keydown', 9); - await click(SELECTORS.toggle); + await click(GENERAL.button('toggle-masked')); const unMaskedValue = document.querySelector('.masked-value').value; assert.strictEqual(unMaskedValue, this.value); }); @@ -123,10 +120,10 @@ module('Integration | Component | masked input', function (hooks) { `); assert.dom('[data-test-masked-input]').exists('shows masked input'); assert.dom(GENERAL.copyButton).exists(); - assert.dom(SELECTORS.downloadIcon).exists(); - assert.dom(SELECTORS.toggle).exists('shows toggle mask button'); + assert.dom(GENERAL.button('Download secret value')).exists(); + assert.dom(GENERAL.button('toggle-masked')).exists('shows toggle mask button'); - await click(SELECTORS.toggle); + await click(GENERAL.button('toggle-masked')); assert.dom('.masked-value').doesNotHaveClass('masked-font', 'it unmasks when show button is clicked'); assert .dom('[data-test-icon="minus"]') @@ -157,12 +154,12 @@ module('Integration | Component | masked input', function (hooks) { /> `); - await click(SELECTORS.downloadIcon); + await click(GENERAL.button('Download secret value')); assert.dom(SELECTORS.stringify).isNotChecked('Stringify toggle off as default'); - await click(SELECTORS.downloadBtn); + await click(GENERAL.button('Download')); - await click(SELECTORS.downloadIcon); + await click(GENERAL.button('Download secret value')); await click(SELECTORS.stringify); - await click(SELECTORS.downloadBtn); + await click(GENERAL.button('Download')); }); }); diff --git a/ui/tests/integration/components/oidc-consent-block-test.js b/ui/tests/integration/components/oidc-consent-block-test.js index 8439841451..3ccd8c598c 100644 --- a/ui/tests/integration/components/oidc-consent-block-test.js +++ b/ui/tests/integration/components/oidc-consent-block-test.js @@ -28,7 +28,7 @@ module('Integration | Component | oidc-consent-block', function (hooks) { 'In order to complete the login process, you must consent to Vault sharing your profile, email, address, and phone with the client.', 'shows the correct copy for consent form' ); - assert.dom('[data-test-edit-form-submit]').hasText('Yes', 'form button has correct submit text'); + assert.dom(GENERAL.submitButton).hasText('Yes', 'form button has correct submit text'); assert.dom(GENERAL.cancelButton).hasText('No', 'form button has correct cancel text'); }); @@ -49,7 +49,7 @@ module('Integration | Component | oidc-consent-block', function (hooks) { 'In order to complete the login process, you must consent to Vault sharing your profile, email, address, and phone with the client.', 'shows the correct copy for consent form' ); - await click('[data-test-edit-form-submit]'); + await click(GENERAL.submitButton); assert.ok(spy.calledWith(`${redirectBase}/?code=1234`), 'Redirects to correct route'); }); @@ -101,7 +101,7 @@ module('Integration | Component | oidc-consent-block', function (hooks) { 'In order to complete the login process, you must consent to Vault sharing your profile, email, address, and phone with the client.', 'shows the correct copy for consent form' ); - await click('[data-test-edit-form-submit]'); + await click(GENERAL.submitButton); assert.ok( spy.calledWith(`${redirectBase}/?code=unescaped%3Cstring&state=foo`), 'Redirects to correct route, with escaped values and without superflous params' diff --git a/ui/tests/integration/components/oidc/client-list-test.js b/ui/tests/integration/components/oidc/client-list-test.js index 94c77d720c..f08068dcfd 100644 --- a/ui/tests/integration/components/oidc/client-list-test.js +++ b/ui/tests/integration/components/oidc/client-list-test.js @@ -9,6 +9,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { allowAllCapabilitiesStub, capabilitiesStub } from 'vault/tests/helpers/stubs'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | oidc/client-list', function (hooks) { setupRenderingTest(hooks); @@ -46,7 +47,7 @@ module('Integration | Component | oidc/client-list', function (hooks) { await render(hbs``); assert.dom('[data-test-popup-menu-trigger]').exists({ count: 1 }, 'Only one popup menu is rendered'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert.dom('[data-test-oidc-client-menu-link="details"]').exists('Details link is rendered'); assert.dom('[data-test-oidc-client-menu-link="edit"]').doesNotExist('Edit link is not rendered'); }); diff --git a/ui/tests/integration/components/oidc/provider-list-test.js b/ui/tests/integration/components/oidc/provider-list-test.js index 4771cfcd12..8935697995 100644 --- a/ui/tests/integration/components/oidc/provider-list-test.js +++ b/ui/tests/integration/components/oidc/provider-list-test.js @@ -9,6 +9,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { allowAllCapabilitiesStub, capabilitiesStub } from 'vault/tests/helpers/stubs'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | oidc/provider-list', function (hooks) { setupRenderingTest(hooks); @@ -47,7 +48,7 @@ module('Integration | Component | oidc/provider-list', function (hooks) { }); await render(hbs``); assert.dom('[data-test-popup-menu-trigger]').exists({ count: 1 }, 'Only one popup menu is rendered'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert.dom('[data-test-oidc-provider-menu-link="details"]').exists('Details link is rendered'); assert.dom('[data-test-oidc-provider-menu-link="edit"]').doesNotExist('Edit link is not rendered'); }); diff --git a/ui/tests/integration/components/page/mode-index-test.js b/ui/tests/integration/components/page/mode-index-test.js index 9af014881e..c01356d51f 100644 --- a/ui/tests/integration/components/page/mode-index-test.js +++ b/ui/tests/integration/components/page/mode-index-test.js @@ -8,12 +8,12 @@ import { setupRenderingTest } from 'vault/tests/helpers'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { setupEngine } from 'ember-engines/test-support'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const S = { title: 'h1', subtitle: 'h2', enableForm: '[data-test-replication-enable-form]', - enableBtn: '[data-test-replication-enable]', summary: '[data-test-replication-summary]', notAllowed: '[data-test-not-allowed]', }; @@ -46,7 +46,7 @@ module('Integration | Component | replication page/mode-index', function (hooks) assert.dom(S.title).hasText('Enable Disaster Recovery Replication'); assert.dom(S.enableForm).exists(); assert.dom(S.notAllowed).doesNotExist(); - assert.dom(S.enableBtn).exists('Enable button shows by default if no permissions available'); + assert.dom(GENERAL.submitButton).exists('Enable button shows by default if no permissions available'); }); test('it renders correctly when replication enabled', async function (assert) { this.replicationDisabled = false; @@ -62,7 +62,7 @@ module('Integration | Component | replication page/mode-index', function (hooks) assert.dom(S.enableForm).exists(); assert.dom(S.notAllowed).exists(); - assert.dom(S.enableBtn).doesNotExist(); + assert.dom(GENERAL.submitButton).doesNotExist(); }); test('it shows enable button if has permissions', async function (assert) { @@ -71,7 +71,7 @@ module('Integration | Component | replication page/mode-index', function (hooks) assert.dom(S.enableForm).exists(); assert.dom(S.notAllowed).doesNotExist(); - assert.dom(S.enableBtn).exists(); + assert.dom(GENERAL.submitButton).exists(); }); }); @@ -85,7 +85,7 @@ module('Integration | Component | replication page/mode-index', function (hooks) assert.dom(S.title).hasText('Enable Performance Replication'); assert.dom(S.enableForm).exists(); assert.dom(S.notAllowed).doesNotExist(); - assert.dom(S.enableBtn).exists('Enable button shows by default if no permissions available'); + assert.dom(GENERAL.submitButton).exists('Enable button shows by default if no permissions available'); }); test('it renders correctly when replication enabled', async function (assert) { this.replicationDisabled = false; @@ -101,7 +101,7 @@ module('Integration | Component | replication page/mode-index', function (hooks) assert.dom(S.enableForm).exists(); assert.dom(S.notAllowed).exists(); - assert.dom(S.enableBtn).doesNotExist(); + assert.dom(GENERAL.submitButton).doesNotExist(); }); test('it shows enable button if has permissions', async function (assert) { @@ -110,7 +110,7 @@ module('Integration | Component | replication page/mode-index', function (hooks) assert.dom(S.enableForm).exists(); assert.dom(S.notAllowed).doesNotExist(); - assert.dom(S.enableBtn).exists(); + assert.dom(GENERAL.submitButton).exists(); }); }); }); diff --git a/ui/tests/integration/components/pki/page/pki-certificate-details-test.js b/ui/tests/integration/components/pki/page/pki-certificate-details-test.js index ff46f9c41d..48635dbbf4 100644 --- a/ui/tests/integration/components/pki/page/pki-certificate-details-test.js +++ b/ui/tests/integration/components/pki/page/pki-certificate-details-test.js @@ -103,8 +103,8 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function ( 'Download pem method called with correct args' ); - await click('[data-test-confirm-action-trigger]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.dom(GENERAL.infoRowValue('Revocation time')).exists('Revocation time is displayed'); }); @@ -153,8 +153,8 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function ( 'Download pem method called with correct args' ); - await click('[data-test-confirm-action-trigger]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); assert.dom(GENERAL.infoRowValue('Revocation time')).exists('Revocation time is displayed'); }); @@ -185,7 +185,7 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function ( await render(hbs``, { owner: this.engine, }); - await click('[data-test-confirm-action-trigger]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmTrigger); + await click(GENERAL.confirmButton); }); }); diff --git a/ui/tests/integration/components/raft-storage-restore-test.js b/ui/tests/integration/components/raft-storage-restore-test.js index d9ce0577f9..fe93e95748 100644 --- a/ui/tests/integration/components/raft-storage-restore-test.js +++ b/ui/tests/integration/components/raft-storage-restore-test.js @@ -8,6 +8,7 @@ import { setupRenderingTest } from 'ember-qunit'; import { setupMirage } from 'ember-cli-mirage/test-support'; import { render, triggerEvent, click, waitFor } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | raft-storage-restore', function (hooks) { setupRenderingTest(hooks); @@ -29,9 +30,9 @@ module('Integration | Component | raft-storage-restore', function (hooks) { await triggerEvent('[data-test-file-input]', 'change', { files: [new Blob(['Raft Snapshot'])], }); - await click('[data-test-edit-form-submit]'); + await click(GENERAL.submitButton); await waitFor('#force-restore'); await click('#force-restore'); - await click('[data-test-edit-form-submit]'); + await click(GENERAL.submitButton); }); }); diff --git a/ui/tests/integration/components/replication-action-generate-token-test.js b/ui/tests/integration/components/replication-action-generate-token-test.js index cc2d6b5d56..28bf46fb55 100644 --- a/ui/tests/integration/components/replication-action-generate-token-test.js +++ b/ui/tests/integration/components/replication-action-generate-token-test.js @@ -8,6 +8,7 @@ import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import { setupMirage } from 'ember-cli-mirage/test-support'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | replication-action-generate-token', function (hooks) { setupRenderingTest(hooks); @@ -22,6 +23,6 @@ module('Integration | Component | replication-action-generate-token', function ( {{replication-action-generate-token}} `); assert.dom('h4.title').hasText('Generate operation token', 'renders default title'); - assert.dom('[data-test-replication-action-trigger]').hasText('Generate token', 'renders default CTA'); + assert.dom(GENERAL.button('Generate token')).exists('renders default CTA'); }); }); diff --git a/ui/tests/integration/components/replication-actions-test.js b/ui/tests/integration/components/replication-actions-test.js index 27f39d2700..27481ee9be 100644 --- a/ui/tests/integration/components/replication-actions-test.js +++ b/ui/tests/integration/components/replication-actions-test.js @@ -9,6 +9,7 @@ import Service from '@ember/service'; import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { click, fillIn, render } from '@ember/test-helpers'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; import hbs from 'htmlbars-inline-precompile'; import sinon from 'sinon'; @@ -128,9 +129,9 @@ module('Integration | Component | replication actions', function (hooks) { ]; for (const [replicationMode, clusterMode, action, headerText, fillInFn, expectedOnSubmit] of testCases) { - test(`replication mode ${replicationMode}, cluster mode: ${clusterMode}, action: ${action}`, async function (assert) { + const testCaseKey = `${replicationMode}-${clusterMode}-${action}`; + test(`replication and cluster mode action behavior: testCaseKey = ${testCaseKey}`, async function (assert) { assert.expect(1); - const testKey = `${replicationMode}-${clusterMode}-${action}`; this.set('model', { replicationAttrs: { modeForUrl: clusterMode, @@ -151,7 +152,7 @@ module('Integration | Component | replication actions', function (hooks) { assert.deepEqual( JSON.stringify(actual), JSON.stringify(expectedOnSubmit), - `${testKey}: submitted values match expected` + `Submitted values match what is expected for the testCaseKey: ${testCaseKey}` ); return resolve(); }); @@ -168,13 +169,12 @@ module('Integration | Component | replication actions', function (hooks) { ); assert .dom(`[data-test-${action}-replication] h3`) - .hasText(headerText, `${testKey}: renders the ${action} component header`); - - await click(`[data-test-replication-action-trigger="${action}"]`); + .hasText(headerText, `Renders the component header for: ${testCaseKey}`); + await click(GENERAL.button(action)); if (typeof fillInFn === 'function') { await fillInFn.call(this); } - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); }); } }); diff --git a/ui/tests/integration/components/seal-action-test.js b/ui/tests/integration/components/seal-action-test.js index 65ca87e873..dd7e5dd946 100644 --- a/ui/tests/integration/components/seal-action-test.js +++ b/ui/tests/integration/components/seal-action-test.js @@ -8,6 +8,7 @@ import { setupRenderingTest } from 'vault/tests/helpers'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import sinon from 'sinon'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; const SEAL_WHEN_STANDBY_MSG = 'vault cannot seal when in standby mode; please restart instead'; @@ -25,7 +26,7 @@ module('Integration | Component | seal-action', function (hooks) { // attempt seal await click('[data-test-seal]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.ok(this.sealSuccess.calledOnce, 'called onSeal action'); assert.dom('[data-test-seal-error]').doesNotExist('Does not show error when successful'); @@ -37,7 +38,7 @@ module('Integration | Component | seal-action', function (hooks) { // attempt seal await click('[data-test-seal]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.ok(this.sealError.calledOnce, 'called onSeal action'); assert.dom('[data-test-seal-error]').includesText(SEAL_WHEN_STANDBY_MSG, 'Shows error returned from API'); diff --git a/ui/tests/integration/components/secret-engine/configure-wif-test.js b/ui/tests/integration/components/secret-engine/configure-wif-test.js index f6029c5436..9581fc90cb 100644 --- a/ui/tests/integration/components/secret-engine/configure-wif-test.js +++ b/ui/tests/integration/components/secret-engine/configure-wif-test.js @@ -789,7 +789,7 @@ module('Integration | Component | SecretEngine::ConfigureWif', function (hooks) }); await click(GENERAL.enableField('clientSecret')); - await click('[data-test-button="toggle-masked"]'); + await click(GENERAL.button('toggle-masked')); await fillIn(GENERAL.inputByAttr('clientSecret'), 'new-secret'); await click(GENERAL.submitButton); }); @@ -858,7 +858,7 @@ module('Integration | Component | SecretEngine::ConfigureWif', function (hooks) }); await click(GENERAL.enableField('secretKey')); - await click('[data-test-button="toggle-masked"]'); + await click(GENERAL.button('toggle-masked')); await fillIn(GENERAL.inputByAttr('secretKey'), 'new-secret'); await click(GENERAL.submitButton); }); diff --git a/ui/tests/integration/components/sidebar/user-menu-test.js b/ui/tests/integration/components/sidebar/user-menu-test.js index 0541777052..cb6d8c928a 100644 --- a/ui/tests/integration/components/sidebar/user-menu-test.js +++ b/ui/tests/integration/components/sidebar/user-menu-test.js @@ -66,7 +66,7 @@ module('Integration | Component | sidebar-user-menu', function (hooks) { assert.dom('[data-test-user-menu-item="mfa"]').hasText('Multi-factor authentication', 'MFA link renders'); await click('[data-test-user-menu-item="revoke token"]'); - await click('[data-test-confirm-button]'); + await click(GENERAL.confirmButton); assert.true(revokeStub.calledOnce, 'Auth revoke token method called on revoke confirm'); assert.true( transitionStub.calledWith('vault.cluster.logout'), diff --git a/ui/tests/integration/components/transform-list-item-test.js b/ui/tests/integration/components/transform-list-item-test.js index 27e6c8ece3..79fbe2897d 100644 --- a/ui/tests/integration/components/transform-list-item-test.js +++ b/ui/tests/integration/components/transform-list-item-test.js @@ -8,6 +8,7 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render, click } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; module('Integration | Component | transform-list-item', function (hooks) { setupRenderingTest(hooks); @@ -53,7 +54,7 @@ module('Integration | Component | transform-list-item', function (hooks) { />`); assert.dom('[data-test-secret-link="template/foo"]').exists('shows clickable list item'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert.dom('.hds-dropdown li').exists({ count: 1 }, 'has one option'); }); @@ -76,7 +77,7 @@ module('Integration | Component | transform-list-item', function (hooks) { />`); assert.dom('[data-test-secret-link="alphabet/foo"]').exists('shows clickable list item'); - await click('[data-test-popup-menu-trigger]'); + await click(GENERAL.menuTrigger); assert.dom('.hds-dropdown li').exists({ count: 2 }, 'has both options'); }); diff --git a/ui/tests/pages/access/identity/index.js b/ui/tests/pages/access/identity/index.js index a034edb777..c0fed22906 100644 --- a/ui/tests/pages/access/identity/index.js +++ b/ui/tests/pages/access/identity/index.js @@ -14,8 +14,7 @@ export default create({ name: text('[data-test-identity-link]'), }), - delete: clickable('[data-test-popup-menu="delete"]', { + delete: clickable('[data-test-button="popup-delete"]', { testContainer: '#ember-testing', }), - confirmDelete: clickable('[data-test-confirm-button]'), }); diff --git a/ui/tests/pages/components/edit-form.js b/ui/tests/pages/components/edit-form.js index c84f79f117..0e0c760342 100644 --- a/ui/tests/pages/components/edit-form.js +++ b/ui/tests/pages/components/edit-form.js @@ -3,13 +3,10 @@ * SPDX-License-Identifier: BUSL-1.1 */ -import { clickable, isPresent, text } from 'ember-cli-page-object'; +import { isPresent, text } from 'ember-cli-page-object'; import fields from './form-field'; export default { ...fields, - submit: clickable('[data-test-edit-form-submit]'), - deleteButton: clickable('[data-test-confirm-action-trigger]'), - deleteConfirm: clickable('[data-test-confirm-button]'), deleteText: text('[data-test-edit-delete-text]'), showsDelete: isPresent('[data-test-edit-delete-text]'), errorText: text('[data-test-edit-form-error]'), diff --git a/ui/tests/pages/components/list-view.js b/ui/tests/pages/components/list-view.js index 5be88752a8..f257016283 100644 --- a/ui/tests/pages/components/list-view.js +++ b/ui/tests/pages/components/list-view.js @@ -19,10 +19,4 @@ export default { menuItems: collection('.ember-basic-dropdown-content li', { testContainer: '#ember-testing', }), - delete: clickable('[data-test-confirm-action-trigger]', { - testContainer: '#ember-testing', - }), - confirmDelete: clickable('[data-test-confirm-button]', { - testContainer: '#ember-testing', - }), }; diff --git a/ui/tests/pages/init.js b/ui/tests/pages/init.js index c1cdd40fc5..ee22b7c8b1 100644 --- a/ui/tests/pages/init.js +++ b/ui/tests/pages/init.js @@ -3,17 +3,15 @@ * SPDX-License-Identifier: BUSL-1.1 */ -import { text, create, collection, visitable, fillable, clickable } from 'ember-cli-page-object'; +import { create, collection, visitable, fillable } from 'ember-cli-page-object'; export default create({ visit: visitable('/vault/init'), - submit: clickable('[data-test-init-submit]'), shares: fillable('[data-test-key-shares]'), threshold: fillable('[data-test-key-threshold]'), keys: collection('[data-test-key-box]'), - buttonText: text('[data-test-advance-button]'), init: async function (shares, threshold) { await this.visit(); - return this.shares(shares).threshold(threshold).submit(); + return this.shares(shares).threshold(threshold); }, }); diff --git a/ui/tests/pages/policy/edit.js b/ui/tests/pages/policy/edit.js index 5cc814b7ab..304125b7b5 100644 --- a/ui/tests/pages/policy/edit.js +++ b/ui/tests/pages/policy/edit.js @@ -3,9 +3,8 @@ * SPDX-License-Identifier: BUSL-1.1 */ -import { clickable, create, isPresent, visitable } from 'ember-cli-page-object'; +import { clickable, create, visitable } from 'ember-cli-page-object'; export default create({ visit: visitable('/vault/policy/:type/:name/edit'), - deleteIsPresent: isPresent('[data-test-confirm-action-trigger]'), toggleEdit: clickable('[data-test-policy-edit-toggle]'), }); diff --git a/ui/tests/pages/secrets/backend/kmip/credentials.js b/ui/tests/pages/secrets/backend/kmip/credentials.js index 439bed7c86..ffc1219311 100644 --- a/ui/tests/pages/secrets/backend/kmip/credentials.js +++ b/ui/tests/pages/secrets/backend/kmip/credentials.js @@ -13,5 +13,4 @@ export default create({ create: clickable('[data-test-role-create]'), generateCredentialsLink: clickable('[data-test-kmip-link-generate-credentials]'), backToRoleLink: clickable('[data-test-kmip-link-back-to-role]'), - submit: clickable('[data-test-edit-form-submit]'), }); diff --git a/ui/tests/pages/secrets/backend/kmip/roles.js b/ui/tests/pages/secrets/backend/kmip/roles.js index bc06acb4a5..daa075d4ba 100644 --- a/ui/tests/pages/secrets/backend/kmip/roles.js +++ b/ui/tests/pages/secrets/backend/kmip/roles.js @@ -12,7 +12,6 @@ export default create({ visitDetail: visitable('/vault/secrets/:backend/kmip/scopes/:scope/roles/:role'), create: clickable('[data-test-role-create]'), roleName: fillable('[data-test-input="role"]'), - submit: clickable('[data-test-edit-form-submit]'), detailEditLink: clickable('[data-test-kmip-link-edit-role]'), cancelLink: clickable('[data-test-edit-form-cancel]'), }); diff --git a/ui/tests/pages/secrets/backend/kmip/scopes.js b/ui/tests/pages/secrets/backend/kmip/scopes.js index b72ab3e992..948ccb4ed4 100644 --- a/ui/tests/pages/secrets/backend/kmip/scopes.js +++ b/ui/tests/pages/secrets/backend/kmip/scopes.js @@ -12,7 +12,6 @@ export default create({ visitCreate: visitable('/vault/secrets/:backend/kmip/scopes/create'), createLink: clickable('[data-test-scope-create]'), scopeName: fillable('[data-test-input="name"]'), - submit: clickable('[data-test-edit-form-submit]'), configurationLink: clickable('[data-test-kmip-link-config]'), configureLink: clickable('[data-test-kmip-link-configure]'), scopesLink: clickable('[data-test-kmip-link-scopes]'), diff --git a/ui/tests/pages/secrets/backend/kv/show.js b/ui/tests/pages/secrets/backend/kv/show.js index fd689d015e..ba38b4a589 100644 --- a/ui/tests/pages/secrets/backend/kv/show.js +++ b/ui/tests/pages/secrets/backend/kv/show.js @@ -9,12 +9,7 @@ import { create, clickable, collection, isPresent } from 'ember-cli-page-object' export default create({ ...Base, deleteBtnV1: clickable('[data-test-secret-v1-delete]'), - confirmBtn: clickable('[data-test-confirm-button]'), rows: collection('data-test-row-label'), edit: clickable('[data-test-secret-edit]'), editIsPresent: isPresent('[data-test-secret-edit]'), - - deleteSecretV1() { - return this.deleteBtnV1().confirmBtn(); - }, }); diff --git a/ui/tests/pages/secrets/backend/list.js b/ui/tests/pages/secrets/backend/list.js index bef08d31db..62ac3fdef8 100644 --- a/ui/tests/pages/secrets/backend/list.js +++ b/ui/tests/pages/secrets/backend/list.js @@ -31,8 +31,6 @@ export default create({ menuItems: collection('.ember-basic-dropdown-content li', { testContainer: '#ember-testing', }), - delete: clickable('[data-test-confirm-action-trigger]'), - confirmDelete: clickable('[data-test-confirm-button]'), backendIsEmpty: getter(function () { return this.secrets.length === 0; }), diff --git a/ui/tests/pages/secrets/backend/ssh/edit-role.js b/ui/tests/pages/secrets/backend/ssh/edit-role.js deleted file mode 100644 index a5a58f205b..0000000000 --- a/ui/tests/pages/secrets/backend/ssh/edit-role.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import { Base } from '../create'; -import { clickable, visitable, create, fillable } from 'ember-cli-page-object'; - -export default create({ - ...Base, - visitEdit: visitable('/vault/secrets/:backend/edit/:id'), - visitEditRoot: visitable('/vault/secrets/:backend/edit'), - name: fillable('[data-test-input="name"]'), - save: clickable('[data-test-role-ssh-create]'), -}); diff --git a/ui/tests/pages/secrets/backend/ssh/show.js b/ui/tests/pages/secrets/backend/ssh/show.js index e4e23839fe..6677ed069b 100644 --- a/ui/tests/pages/secrets/backend/ssh/show.js +++ b/ui/tests/pages/secrets/backend/ssh/show.js @@ -13,9 +13,4 @@ export default create({ editIsPresent: isPresent('[data-test-edit-link]'), generate: clickable('[data-test-backend-credentials]'), generateIsPresent: isPresent('[data-test-backend-credentials]'), - deleteBtn: clickable('[data-test-confirm-action-trigger]'), - confirmBtn: clickable('[data-test-confirm-button]'), - deleteRole() { - return this.deleteBtn().confirmBtn(); - }, }); diff --git a/ui/tests/pages/secrets/backends.js b/ui/tests/pages/secrets/backends.js index 3c68a70d20..9b688b7e3c 100644 --- a/ui/tests/pages/secrets/backends.js +++ b/ui/tests/pages/secrets/backends.js @@ -13,7 +13,5 @@ export default create({ path: text('[data-test-secret-path]'), menu: clickable('[data-test-popup-menu-trigger]'), }), - disableButton: clickable('[data-test-confirm-action-trigger]'), - confirmDisable: clickable('[data-test-confirm-button]'), console: uiPanel, });