Continued work on standardizing button selectors (#30972)

* download-button

* remaining data-test-button-

* manual cherry pick

* more

* fix test
This commit is contained in:
Angel Garbarino 2025-06-13 18:47:58 -06:00 committed by GitHub
parent e64ce286e2
commit d3a604b3bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
88 changed files with 300 additions and 340 deletions

View File

@ -73,7 +73,7 @@
</div>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<Hds::Button @text="Decrypt" type="submit" id="decrypt" data-test-button-decrypt />
<Hds::Button @text="Decrypt" type="submit" id="decrypt" data-test-submit />
</div>
</div>
</form>

View File

@ -94,7 +94,7 @@
</div>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<Hds::Button @text="Encrypt" type="submit" data-test-button-encrypt />
<Hds::Button @text="Encrypt" type="submit" data-test-submit />
</div>
</div>
</form>

View File

@ -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}}
<Hds::Button
@ -95,7 +95,7 @@
@model={{this.model.name}}
@icon={{if this.model.sealed "loading"}}
disabled={{this.model.sealed}}
data-test-advance-button
data-test-button="Continue to Authenticate"
/>
{{/if}}
<DownloadButton
@ -205,7 +205,7 @@
<Hds::Button
@text="Initialize"
@icon={{if this.loading "loading"}}
data-test-init-submit
data-test-submit
type="submit"
disabled={{this.loading}}
/>

View File

@ -25,7 +25,7 @@
{{@disabledMessage}}
</M.Body>
<M.Footer as |F|>
<Hds::Button data-test-confirm-cancel-button @text="Close" {{on "click" F.close}} />
<Hds::Button data-test-cancel @text="Close" {{on "click" F.close}} />
</M.Footer>
{{else}}
<M.Header data-test-confirm-action-title @icon="alert-circle">
@ -44,7 +44,7 @@
@text="Confirm"
{{on "click" @onConfirm}}
/>
<Hds::Button data-test-confirm-cancel-button @color="secondary" @text="Cancel" {{on "click" F.close}} />
<Hds::Button data-test-cancel @color="secondary" @text="Cancel" {{on "click" F.close}} />
</Hds::ButtonSet>
</M.Footer>
{{/if}}

View File

@ -4,7 +4,7 @@
}}
<Hds::Button
data-test-download-button
data-test-button="Download"
@icon={{if @hideIcon "" "download"}}
@text={{or @text "Download"}}
@color={{@color}}

View File

@ -9,7 +9,7 @@
@text={{or @saveButtonText "Save"}}
@icon={{if @isSaving "loading"}}
type="submit"
data-test-edit-form-submit
data-test-submit
disabled={{@isSaving}}
/>
{{#if this.cancelLink}}

View File

@ -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}}

View File

@ -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"
/>
</div>
</div>

View File

@ -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"
/>
</div>
</div>

View File

@ -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"
/>
</div>
</div>

View File

@ -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"
/>
</div>
</div>

View File

@ -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"
/>
</div>
</div>

View File

@ -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"
/>
</div>
</div>

View File

@ -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"
/>
</div>
</div>

View File

@ -172,7 +172,7 @@
(or (and (eq this.data.mode "primary") @canEnablePrimary) (and (eq this.data.mode "secondary") @canEnableSecondary))
}}
<div class="field is-grouped box is-fullwidth is-bottomless">
<Hds::Button @text="Enable Replication" type="submit" disabled={{this.disallowEnable}} data-test-replication-enable />
<Hds::Button @text="Enable Replication" type="submit" disabled={{this.disallowEnable}} data-test-submit />
</div>
{{/if}}
</form>

View File

@ -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);
});
});

View File

@ -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);

View File

@ -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]')),

View File

@ -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');
});

View File

@ -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();

View File

@ -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}`,

View File

@ -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');
});
});

View File

@ -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',

View File

@ -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');

View File

@ -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');

View File

@ -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(),

View File

@ -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(

View File

@ -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();

View File

@ -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(

View File

@ -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(),

View File

@ -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');
});
});

View File

@ -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');
});
});

View File

@ -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');

View File

@ -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

View File

@ -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

View File

@ -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');

View File

@ -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',

View File

@ -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(

View File

@ -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(

View File

@ -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`);

View File

@ -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();

View File

@ -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 ────── */

View File

@ -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}"]`,

View File

@ -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]',
};

View File

@ -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) {

View File

@ -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]',

View File

@ -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 <li>');
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 <li>');
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');
});
});

View File

@ -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`<ConfirmModal @onConfirm={{this.onConfirm}} @onClose={{this.onClose}} />`);
await click('[data-test-confirm-button]');
await click(GENERAL.confirmButton);
assert.true(this.onConfirm.called);
});
});

View File

@ -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');
});
});

View File

@ -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`
<DownloadButton /> `);
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`
<DownloadButton @text="I do something" @hideIcon={{true}} /> `);
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`
<DownloadButton @data={{this.data}} />
`);
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) {
<DownloadButton @fetchData={{this.fetchData}} />
`);
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');

View File

@ -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!');

View File

@ -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');

View File

@ -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) {

View File

@ -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'

View File

@ -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');

View File

@ -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');
});
});

View File

@ -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(

View File

@ -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);
});
});

View File

@ -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"]')

View File

@ -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'

View File

@ -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'

View File

@ -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

View File

@ -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`<MaskedInput @allowDownload={{true}} /> `);
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`<MaskedInput @value={{this.value}} />`);
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'));
});
});

View File

@ -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'

View File

@ -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`<Oidc::ClientList @model={{this.model}} />`);
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');
});

View File

@ -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`<Oidc::ProviderList @model={{this.model}} />`);
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');
});

View File

@ -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();
});
});
});

View File

@ -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`<Page::PkiCertificateDetails @model={{this.model}} @onRevoke={{this.revoked}} />`, {
owner: this.engine,
});
await click('[data-test-confirm-action-trigger]');
await click('[data-test-confirm-button]');
await click(GENERAL.confirmTrigger);
await click(GENERAL.confirmButton);
});
});

View File

@ -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);
});
});

View File

@ -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');
});
});

View File

@ -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);
});
}
});

View File

@ -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');

View File

@ -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);
});

View File

@ -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'),

View File

@ -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');
});

View File

@ -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]'),
});

View File

@ -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]'),

View File

@ -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',
}),
};

View File

@ -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);
},
});

View File

@ -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]'),
});

View File

@ -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]'),
});

View File

@ -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]'),
});

View File

@ -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]'),

View File

@ -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();
},
});

View File

@ -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;
}),

View File

@ -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]'),
});

View File

@ -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();
},
});

View File

@ -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,
});