diff --git a/ui/app/components/dashboard/quick-actions-card.hbs b/ui/app/components/dashboard/quick-actions-card.hbs
index 5b33cb3b08..4c06e0316f 100644
--- a/ui/app/components/dashboard/quick-actions-card.hbs
+++ b/ui/app/components/dashboard/quick-actions-card.hbs
@@ -11,7 +11,7 @@
Supported engines include databases, KV
version 2, and PKI.
-
+
-
+
{{#if @model.path}}
-
+
-
+
View configuration
{{#if (not-eq backend.type "cubbyhole")}}
diff --git a/ui/lib/core/addon/components/info-table-row.hbs b/ui/lib/core/addon/components/info-table-row.hbs
index 738cc95732..b64fa63881 100644
--- a/ui/lib/core/addon/components/info-table-row.hbs
+++ b/ui/lib/core/addon/components/info-table-row.hbs
@@ -5,9 +5,9 @@
{{#if (or (has-block) this.isVisible)}}
+ {{! label section of the row }}
{{#if @label}}
@@ -34,7 +34,8 @@
{{/if}}
-
+ {{! value section of the row }}
+
{{#if @addCopyButton}}
{
assert
- .dom(`${PKI_ISSUER_DETAILS.defaultGroup} ${PKI_ISSUER_DETAILS.valueByName(label)}`)
- .exists({ count: 1 }, `${label} value rendered`);
+ .dom(`${PKI_ISSUER_DETAILS.defaultGroup} ${GENERAL.infoRowValue(label)}`)
+ .exists(`${label} value rendered`);
}
);
assert
@@ -448,7 +449,7 @@ module('Acceptance | pki workflow', function (hooks) {
await click(GENERAL.menuTrigger);
await click(PKI_ISSUER_LIST.issuerPopupDetails);
- const issuerId = find(PKI_ISSUER_DETAILS.valueByName('Issuer ID')).innerText;
+ const issuerId = find(GENERAL.infoRowValue('Issuer ID')).innerText;
assert.strictEqual(
currentURL(),
`/vault/secrets/${this.mountPath}/pki/issuers/${issuerId}/details`,
@@ -542,7 +543,7 @@ module('Acceptance | pki workflow', function (hooks) {
await click(PKI_CONFIG_EDIT.saveButton);
assert.strictEqual(currentURL(), `/vault/secrets/${this.mountPath}/pki/configuration`);
assert
- .dom('[data-test-value-div="CRL building"]')
+ .dom(GENERAL.infoRowValue('CRL building'))
.hasText('Disabled', 'Successfully saves config with partial permission');
});
});
diff --git a/ui/tests/acceptance/replication-nav-test.js b/ui/tests/acceptance/replication-nav-test.js
index 5bc3834edc..90494418ad 100644
--- a/ui/tests/acceptance/replication-nav-test.js
+++ b/ui/tests/acceptance/replication-nav-test.js
@@ -9,14 +9,15 @@ import { setupMirage } from 'ember-cli-mirage/test-support';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import replicationHandlers from 'vault/mirage/handlers/replication';
import { click } from '@ember/test-helpers';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const SELECTORS = {
navReplication: '[data-test-sidebar-nav-link="Replication"]',
navPerformance: '[data-test-sidebar-nav-link="Performance"]',
navDR: '[data-test-sidebar-nav-link="Disaster Recovery"]',
title: '[data-test-replication-title]',
- primaryCluster: '[data-test-value-div="primary_cluster_addr"]',
- replicationSet: '[data-test-row-value="Replication set"]',
+ primaryCluster: `${GENERAL.infoRowValue('primary_cluster_addr')}`,
+ replicationSet: `${GENERAL.infoRowValue('Replication set')}`,
knownSecondariesTitle: '.known-secondaries-card h3',
};
module('Acceptance | Enterprise | replication navigation', function (hooks) {
diff --git a/ui/tests/acceptance/secrets/backend/database/secret-test.js b/ui/tests/acceptance/secrets/backend/database/secret-test.js
index 7dacf97142..99560faa6e 100644
--- a/ui/tests/acceptance/secrets/backend/database/secret-test.js
+++ b/ui/tests/acceptance/secrets/backend/database/secret-test.js
@@ -34,7 +34,7 @@ const newConnection = async (
await connectionPage.name(name);
await connectionPage.connectionUrl(connectionUrl);
await connectionPage.toggleVerify();
- await connectionPage.save();
+ await click(GENERAL.saveButton);
await connectionPage.enable();
return name;
};
@@ -42,8 +42,8 @@ const newConnection = async (
const navToConnection = async (backend, connection) => {
await visit('/vault/secrets');
await click(SES.secretsBackendLink(backend));
- await click('[data-test-secret-list-tab="Connections"]');
- await click(`[data-test-secret-link="${connection}"]`);
+ await click(GENERAL.secretTab('Connections'));
+ await click(SES.secretLink(connection));
return;
};
@@ -56,14 +56,14 @@ const connectionTests = [
url: 'http://127.0.0.1:9200',
assertCount: 9,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
- assert.dom('[data-test-input="ca_cert"]').exists(`CA certificate field exists for ${name}`);
- assert.dom('[data-test-input="ca_path"]').exists(`CA path field exists for ${name}`);
- assert.dom('[data-test-input="client_cert"]').exists(`Client certificate field exists for ${name}`);
- assert.dom('[data-test-input="client_key"]').exists(`Client key field exists for ${name}`);
- assert.dom('[data-test-input="tls_server_name"]').exists(`TLS server name field exists for ${name}`);
- assert.dom('[data-test-input="insecure"]').exists(`Insecure checkbox exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('ca_cert')).exists(`CA certificate field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('ca_path')).exists(`CA path field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('client_cert')).exists(`Client certificate field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('client_key')).exists(`Client key field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('tls_server_name')).exists(`TLS server name field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('insecure')).exists(`Insecure checkbox exists for ${name}`);
assert
.dom('[data-test-toggle-input="show-username_template"]')
.exists(`Username template toggle exists for ${name}`);
@@ -75,12 +75,12 @@ const connectionTests = [
url: `mongodb://127.0.0.1:4321/test`,
assertCount: 5,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
- assert.dom('[data-test-input="write_concern"]').exists(`Write concern field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('write_concern')).exists(`Write concern field exists for ${name}`);
assert.dom('[data-test-toggle-group="TLS options"]').exists('TLS options toggle exists');
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
},
},
@@ -90,19 +90,19 @@ const connectionTests = [
url: `mssql://127.0.0.1:4321/test`,
assertCount: 6,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
},
},
@@ -112,20 +112,20 @@ const connectionTests = [
url: `{{username}}:{{password}}@tcp(127.0.0.1:3306)/test`,
assertCount: 7,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert.dom('[data-test-toggle-group="TLS options"]').exists('TLS options toggle exists');
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
},
},
@@ -135,20 +135,20 @@ const connectionTests = [
url: `{{username}}:{{password}}@tcp(127.0.0.1:3306)/test`,
assertCount: 7,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert.dom('[data-test-toggle-group="TLS options"]').exists('TLS options toggle exists');
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
},
},
@@ -158,20 +158,20 @@ const connectionTests = [
url: `{{username}}:{{password}}@tcp(127.0.0.1:3306)/test`,
assertCount: 7,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert.dom('[data-test-toggle-group="TLS options"]').exists('TLS options toggle exists');
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
},
},
@@ -181,20 +181,20 @@ const connectionTests = [
url: `{{username}}:{{password}}@tcp(127.0.0.1:3306)/test`,
assertCount: 7,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert.dom('[data-test-toggle-group="TLS options"]').exists('TLS options toggle exists');
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
},
},
@@ -206,19 +206,19 @@ const connectionTests = [
password: 'password',
assertCount: 7,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
assert
.dom('[data-test-toggle-input="show-username_template"]')
@@ -289,14 +289,13 @@ module('Acceptance | secrets/database/*', function (hooks) {
await connectionPage.password(testCase.password);
}
testCase.requiredFields(assert, testCase.plugin);
- assert.dom('[data-test-input="verify_connection"]').isChecked('verify is checked');
+ assert.dom(GENERAL.inputByAttr('verify_connection')).isChecked('verify is checked');
await connectionPage.toggleVerify();
- assert.dom('[data-test-input="verify_connection"]').isNotChecked('verify is unchecked');
+ assert.dom(GENERAL.inputByAttr('verify_connection')).isNotChecked('verify is unchecked');
assert
.dom('[data-test-database-oracle-alert]')
.doesNotExist('does not show oracle alert for non-oracle plugins');
- await connectionPage.save();
- await settled();
+ await click(GENERAL.saveButton);
assert
.dom('[data-test-db-connection-modal-title]')
.hasText('Rotate your root credentials?', 'Modal appears asking to rotate root credentials');
@@ -317,11 +316,11 @@ module('Acceptance | secrets/database/*', function (hooks) {
);
assert.dom(`[data-test-input="name"]`).hasAttribute('readonly');
assert.dom(`[data-test-input="plugin_name"]`).hasAttribute('readonly');
- assert.dom('[data-test-input="password"]').doesNotExist('Password is not displayed on edit form');
+ assert.dom(GENERAL.inputByAttr('password')).doesNotExist('Password is not displayed on edit form');
assert.dom('[data-test-toggle-input="show-password"]').exists('Update password toggle exists');
- assert.dom('[data-test-input="verify_connection"]').isNotChecked('verify is still unchecked');
- await connectionPage.save();
+ assert.dom(GENERAL.inputByAttr('verify_connection')).isNotChecked('verify is still unchecked');
+ await click(GENERAL.saveButton);
assert.strictEqual(currentURL(), `/vault/secrets/${backend}/show/${testCase.name}`);
// click "Add Role"
await connectionPage.addRole();
@@ -351,19 +350,19 @@ module('Acceptance | secrets/database/*', function (hooks) {
plugin: 'vault-plugin-database-oracle',
url: `{{username}}/{{password}}@localhost:1521/OraDoc.localhost`,
requiredFields: async (assert, name) => {
- assert.dom('[data-test-input="username"]').exists(`Username field exists for ${name}`);
- assert.dom('[data-test-input="password"]').exists(`Password field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('username')).exists(`Username field exists for ${name}`);
+ assert.dom(GENERAL.inputByAttr('password')).exists(`Password field exists for ${name}`);
assert
- .dom('[data-test-input="max_open_connections"]')
+ .dom(GENERAL.inputByAttr('max_open_connections'))
.exists(`Max open connections exists for ${name}`);
assert
- .dom('[data-test-input="max_idle_connections"]')
+ .dom(GENERAL.inputByAttr('max_idle_connections'))
.exists(`Max idle connections exists for ${name}`);
assert
- .dom('[data-test-input="max_connection_lifetime"]')
+ .dom(GENERAL.inputByAttr('max_connection_lifetime'))
.exists(`Max connection lifetime exists for ${name}`);
assert
- .dom('[data-test-input="root_rotation_statements"]')
+ .dom(GENERAL.inputByAttr('root_rotation_statements'))
.exists(`Root rotation statements exists for ${name}`);
assert
.dom('[data-test-database-oracle-alert]')
@@ -430,7 +429,7 @@ module('Acceptance | secrets/database/*', function (hooks) {
await connectionPage.edit();
assert
- .dom('[data-test-input="connection_url"]')
+ .dom(GENERAL.inputByAttr('connection_url'))
.hasValue(decoded, 'connection_url is decoded when editing');
});
@@ -465,8 +464,7 @@ module('Acceptance | secrets/database/*', function (hooks) {
});
// uncheck verify for the save step to work
await connectionPage.toggleVerify();
- await connectionPage.save();
- await settled();
+ await click(GENERAL.saveButton);
assert
.dom('[data-test-db-connection-modal-title]')
.hasText('Rotate your root credentials?', 'Modal appears asking to ');
@@ -584,7 +582,7 @@ module('Acceptance | secrets/database/*', function (hooks) {
.exists({ count: 2 }, 'Two empty states exist after a database is selected');
await rolePage.roleType('static');
assert.dom('[data-test-component="empty-state"]').doesNotExist('Empty states go away');
- assert.dom('[data-test-input="username"]').exists('Username field appears for static role');
+ assert.dom(GENERAL.inputByAttr('username')).exists('Username field appears for static role');
assert
.dom('[data-test-toggle-input="Rotation period"]')
.exists('Rotation period field appears for static role');
diff --git a/ui/tests/acceptance/secrets/backend/database/workflow-test.js b/ui/tests/acceptance/secrets/backend/database/workflow-test.js
index bd11bbbfca..2e3a5ad482 100644
--- a/ui/tests/acceptance/secrets/backend/database/workflow-test.js
+++ b/ui/tests/acceptance/secrets/backend/database/workflow-test.js
@@ -15,6 +15,7 @@ import { setupApplicationTest } from 'vault/tests/helpers';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import flashMessage from 'vault/tests/pages/components/flash-message';
import { deleteEngineCmd, mountEngineCmd, runCmd } from 'vault/tests/helpers/commands';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
import { SECRET_ENGINE_SELECTORS as SES } from 'vault/tests/helpers/secret-engine/secret-engine-selectors';
const flash = create(flashMessage);
@@ -23,9 +24,6 @@ const PAGE = {
// GENERIC
emptyStateTitle: '[data-test-empty-state-title]',
infoRow: '[data-test-component="info-table-row"]',
- infoRowLabel: (label) => `[data-test-row-label="${label}"]`,
- infoRowValue: (label) => `[data-test-row-value="${label}"]`,
- infoRowValueDiv: (label) => `[data-test-value-div="${label}"]`,
// CONNECTIONS
rotateModal: '[data-test-db-connection-modal-title]',
confirmRotate: '[data-test-enable-rotate-connection]',
@@ -39,18 +37,16 @@ const PAGE = {
};
const FORM = {
- inputByAttr: (attr) => `[data-test-input="${attr}"]`,
creationStatement: (idx = 0) =>
`[data-test-input="creation_statements"] [data-test-string-list-input="${idx}"]`,
- saveBtn: '[data-test-secret-save]',
};
async function fillOutConnection(name) {
- await fillIn(FORM.inputByAttr('name'), name);
- await fillIn(FORM.inputByAttr('plugin_name'), 'mysql-database-plugin');
- await fillIn(FORM.inputByAttr('connection_url'), '{{username}}:{{password}}@tcp(127.0.0.1:33060)/');
- await fillIn(FORM.inputByAttr('username'), 'admin');
- await fillIn(FORM.inputByAttr('password'), 'very-secure');
+ await fillIn(GENERAL.inputByAttr('name'), name);
+ await fillIn(GENERAL.inputByAttr('plugin_name'), 'mysql-database-plugin');
+ await fillIn(GENERAL.inputByAttr('connection_url'), '{{username}}:{{password}}@tcp(127.0.0.1:33060)/');
+ await fillIn(GENERAL.inputByAttr('username'), 'admin');
+ await fillIn(GENERAL.inputByAttr('password'), 'very-secure');
}
/**
@@ -108,7 +104,7 @@ module('Acceptance | database workflow', function (hooks) {
// fill in connection details
await fillOutConnection(`connect-${this.backend}`);
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
assert.dom(PAGE.rotateModal).hasText('Rotate your root credentials?', 'rotate modal is shown');
await click(PAGE.confirmRotate);
@@ -120,12 +116,8 @@ module('Acceptance | database workflow', function (hooks) {
);
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
- const valueSelector =
- label === 'Rotate static roles immediately'
- ? PAGE.infoRowValueDiv(label)
- : PAGE.infoRowValue(label);
- assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
+ assert.dom(GENERAL.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
+ assert.dom(GENERAL.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
});
});
test('create without rotate', async function (assert) {
@@ -145,7 +137,7 @@ module('Acceptance | database workflow', function (hooks) {
// fill in connection details
await fillOutConnection(`connect-${this.backend}`);
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
assert.dom(PAGE.rotateModal).hasText('Rotate your root credentials?', 'rotate modal is shown');
await click(PAGE.skipRotate);
@@ -157,12 +149,8 @@ module('Acceptance | database workflow', function (hooks) {
);
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
- const valueSelector =
- label === 'Rotate static roles immediately'
- ? PAGE.infoRowValueDiv(label)
- : PAGE.infoRowValue(label);
- assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
+ assert.dom(GENERAL.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
+ assert.dom(GENERAL.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
});
});
test('create failure', async function (assert) {
@@ -183,14 +171,14 @@ module('Acceptance | database workflow', function (hooks) {
// fill in connection details
await fillOutConnection(`bad-connection`);
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
assert.strictEqual(
flash.latestMessage,
`error creating database object: error verifying - ping: Error 1045 (28000): Access denied for user 'admin'@'192.168.65.1' (using password: YES)`,
'shows the error message from API'
);
- await fillIn(FORM.inputByAttr('name'), `connect-${this.backend}`);
- await click(FORM.saveBtn);
+ await fillIn(GENERAL.inputByAttr('name'), `connect-${this.backend}`);
+ await click(GENERAL.saveButton);
assert.dom(PAGE.rotateModal).hasText('Rotate your root credentials?', 'rotate modal is shown');
await click(PAGE.confirmRotate);
@@ -201,12 +189,8 @@ module('Acceptance | database workflow', function (hooks) {
);
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
- const valueSelector =
- label === 'Rotate static roles immediately'
- ? PAGE.infoRowValueDiv(label)
- : PAGE.infoRowValue(label);
- assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
+ assert.dom(GENERAL.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
+ assert.dom(GENERAL.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
});
});
@@ -222,7 +206,7 @@ module('Acceptance | database workflow', function (hooks) {
// fill in connection details
await fillOutConnection(`fail-rotate`);
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
assert.dom(PAGE.rotateModal).hasText('Rotate your root credentials?', 'rotate modal is shown');
await click(PAGE.confirmRotate);
@@ -243,7 +227,7 @@ module('Acceptance | database workflow', function (hooks) {
this.connection = `connect-${this.backend}`;
await visit(`/vault/secrets/${this.backend}/create`);
await fillOutConnection(this.connection);
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
await visit(`/vault/secrets/${this.backend}/show/${this.connection}`);
});
@@ -263,10 +247,10 @@ module('Acceptance | database workflow', function (hooks) {
.dom(`${PAGE.statementsSection} ${PAGE.emptyStateTitle}`)
.hasText('No role type selected', 'statements section shows empty state before selecting role type');
- await fillIn(FORM.inputByAttr('name'), roleName);
+ await fillIn(GENERAL.inputByAttr('name'), roleName);
assert.dom('[data-test-selected-option]').hasText(this.connection, 'Connection is selected by default');
- await fillIn(FORM.inputByAttr('type'), 'dynamic');
+ await fillIn(GENERAL.inputByAttr('type'), 'dynamic');
assert
.dom(`${PAGE.roleSettingsSection} ${PAGE.emptyStateTitle}`)
.doesNotExist('roles section no longer has empty state');
@@ -278,7 +262,7 @@ module('Acceptance | database workflow', function (hooks) {
await fillIn(FORM.creationStatement(), `GRANT SELECT ON *.* TO '{{name}}'@'%'`);
await click(`[data-test-string-list-row="0"] [data-test-string-list-button="add"]`);
await fillIn(FORM.creationStatement(1), `GRANT CREATE ON *.* TO '{{name}}'@'%'`);
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
// DETAILS
assert.strictEqual(
currentURL(),
@@ -298,10 +282,8 @@ module('Acceptance | database workflow', function (hooks) {
},
{ label: 'Revocation statements', value: 'Default' },
].forEach(({ label, value }) => {
- const valueSelector =
- label === 'Creation statements' ? PAGE.infoRowValueDiv(label) : PAGE.infoRowValue(label);
- assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
+ assert.dom(GENERAL.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
+ assert.dom(GENERAL.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
});
// EDIT
await click(PAGE.editRole);
@@ -311,18 +293,18 @@ module('Acceptance | database workflow', function (hooks) {
'Takes you to edit page for role'
);
// TODO: these should be readonly not disabled
- assert.dom(FORM.inputByAttr('name')).isDisabled('Name is read-only');
- assert.dom(FORM.inputByAttr('database')).isDisabled('Database is read-only');
- assert.dom(FORM.inputByAttr('type')).isDisabled('Type is read-only');
+ assert.dom(GENERAL.inputByAttr('name')).isDisabled('Name is read-only');
+ assert.dom(GENERAL.inputByAttr('database')).isDisabled('Database is read-only');
+ assert.dom(GENERAL.inputByAttr('type')).isDisabled('Type is read-only');
await fillIn('[data-test-ttl-value="Generated credentials’s Time-to-Live (TTL)"]', '2');
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
assert.strictEqual(
currentURL(),
`/vault/secrets/${this.backend}/show/role/${roleName}`,
'Takes you to details page for role after save'
);
assert
- .dom(PAGE.infoRowValue('Generated credentials’s Time-to-Live (TTL)'))
+ .dom(GENERAL.infoRowValue('Generated credentials’s Time-to-Live (TTL)'))
.hasText('2 hours', 'Shows updated TTL');
// CREDENTIALS
@@ -336,23 +318,27 @@ module('Acceptance | database workflow', function (hooks) {
.dom('[data-test-credentials-warning]')
.exists('shows warning about credentials only being available once');
assert
- .dom(`[data-test-value-div="Username"] [data-test-masked-input]`)
+ .dom(`${GENERAL.infoRowValue('Username')} [data-test-masked-input]`)
.hasText('***********', 'Username is masked');
- await click(`[data-test-value-div="Username"] [data-test-button="toggle-masked"]`);
+
+ await click(`${GENERAL.infoRowValue('Username')} ${GENERAL.testButton('toggle-masked')}`);
assert
- .dom(`[data-test-value-div="Username"] [data-test-masked-input]`)
+ .dom(`${GENERAL.infoRowValue('Username')} [data-test-masked-input]`)
.hasText('generated-username', 'Username is generated');
assert
- .dom(`[data-test-value-div="Password"] [data-test-masked-input]`)
+ .dom(`${GENERAL.infoRowValue('Password')} [data-test-masked-input]`)
.hasText('***********', 'Password is masked');
- await click(`[data-test-value-div="Password"] [data-test-button="toggle-masked"]`);
+
+ await click(`${GENERAL.infoRowValue('Password')} ${GENERAL.testButton('toggle-masked')}`);
assert
- .dom(`[data-test-value-div="Password"] [data-test-masked-input]`)
+ .dom(`${GENERAL.infoRowValue('Password')} [data-test-masked-input]`)
.hasText('generated-password', 'Password is generated');
- assert.dom(PAGE.infoRowValue('Lease Duration')).hasText('3600', 'shows lease duration from response');
assert
- .dom(PAGE.infoRowValue('Lease ID'))
+ .dom(GENERAL.infoRowValue('Lease Duration'))
+ .hasText('3600', 'shows lease duration from response');
+ assert
+ .dom(GENERAL.infoRowValue('Lease ID'))
.hasText(`database/creds/${roleName}/abcd`, 'shows lease ID from response');
});
});
@@ -366,7 +352,7 @@ module('Acceptance | database workflow', function (hooks) {
if (toggleRotateOff) {
await click('[data-test-toggle-input="toggle-skip_static_role_rotation_import"]');
}
- await click(FORM.saveBtn);
+ await click(GENERAL.saveButton);
await visit(`/vault/secrets/${this.backend}/show/${this.connection}`);
};
});
@@ -382,9 +368,9 @@ module('Acceptance | database workflow', function (hooks) {
'Takes you to create role page'
);
- await fillIn(FORM.inputByAttr('name'), roleName);
+ await fillIn(GENERAL.inputByAttr('name'), roleName);
- await fillIn(FORM.inputByAttr('type'), 'static');
+ await fillIn(GENERAL.inputByAttr('type'), 'static');
assert
.dom('[data-test-toggle-subtext]')
@@ -402,9 +388,9 @@ module('Acceptance | database workflow', function (hooks) {
'Takes you to create role page'
);
- await fillIn(FORM.inputByAttr('name'), roleName);
+ await fillIn(GENERAL.inputByAttr('name'), roleName);
- await fillIn(FORM.inputByAttr('type'), 'static');
+ await fillIn(GENERAL.inputByAttr('type'), 'static');
assert
.dom('[data-test-toggle-subtext]')
diff --git a/ui/tests/acceptance/secrets/backend/engines-test.js b/ui/tests/acceptance/secrets/backend/engines-test.js
index 892bcb654b..f3e151438a 100644
--- a/ui/tests/acceptance/secrets/backend/engines-test.js
+++ b/ui/tests/acceptance/secrets/backend/engines-test.js
@@ -21,11 +21,11 @@ module('Acceptance | secret-engine list view', function (hooks) {
const createSecret = async (path, key, value, enginePath) => {
await click(SES.createSecretLink);
- await fillIn('[data-test-secret-path]', path);
+ await fillIn(SES.secretPath('create'), path);
- await fillIn('[data-test-secret-key]', key);
+ await fillIn(SES.secretKey('create'), key);
await fillIn(GENERAL.inputByAttr(key), value);
- await click('[data-test-secret-save]');
+ await click(GENERAL.saveButton);
await click(SES.crumb(enginePath));
};
@@ -52,6 +52,8 @@ module('Acceptance | secret-engine list view', function (hooks) {
'redirects to the backends list page'
);
assert.dom(SES.secretsBackendLink(enginePath)).doesNotExist('does not show the disabled engine');
+ // remove the filter as it may cause issues in the next tests
+ await click(GENERAL.searchSelect.removeSelected);
});
test('it adds disabled css styling to unsupported secret engines', async function (assert) {
diff --git a/ui/tests/acceptance/secrets/backend/kv/secret-test.js b/ui/tests/acceptance/secrets/backend/kv/secret-test.js
index 1ae56d390d..dc2193984d 100644
--- a/ui/tests/acceptance/secrets/backend/kv/secret-test.js
+++ b/ui/tests/acceptance/secrets/backend/kv/secret-test.js
@@ -8,7 +8,6 @@ import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { v4 as uuidv4 } from 'uuid';
-import editPage from 'vault/tests/pages/secrets/backend/kv/edit-secret';
import showPage from 'vault/tests/pages/secrets/backend/kv/show';
import listPage from 'vault/tests/pages/secrets/backend/list';
@@ -341,7 +340,7 @@ module('Acceptance | secrets/secret/create, read, delete', function (hooks) {
await fillIn(SS.secretPath('create'), secretPath);
await click(GENERAL.toggleInput('json'));
codemirror().setValue(content);
- await editPage.save();
+ await click(GENERAL.saveButton);
assert.strictEqual(
currentRouteName(),
diff --git a/ui/tests/acceptance/secrets/backend/ssh/roles-test.js b/ui/tests/acceptance/secrets/backend/ssh/roles-test.js
index e698240dd5..4aa271e3e8 100644
--- a/ui/tests/acceptance/secrets/backend/ssh/roles-test.js
+++ b/ui/tests/acceptance/secrets/backend/ssh/roles-test.js
@@ -72,12 +72,10 @@ module('Acceptance | ssh | roles', function (hooks) {
`/vault/secrets/${sshPath}/sign/${this.name}`,
'ca sign url is correct'
);
- assert.dom('[data-test-row-label="Signed key"]').exists({ count: 1 }, 'renders the signed key');
- assert
- .dom('[data-test-row-value="Signed key"]')
- .exists({ count: 1 }, "renders the signed key's value");
- assert.dom('[data-test-row-label="Serial number"]').exists({ count: 1 }, 'renders the serial');
- assert.dom('[data-test-row-value="Serial number"]').exists({ count: 1 }, 'renders the serial value');
+ assert.dom(GENERAL.infoRowLabel('Signed key')).exists({ count: 1 }, 'renders the signed key');
+ assert.dom(GENERAL.infoRowValue('Signed key')).exists("renders the signed key's value");
+ assert.dom(GENERAL.infoRowLabel('Serial number')).exists({ count: 1 }, 'renders the serial');
+ assert.dom(GENERAL.infoRowValue('Serial number')).exists('renders the serial value');
},
},
{
@@ -102,7 +100,7 @@ module('Acceptance | ssh | roles', function (hooks) {
assert.dom(GENERAL.infoRowLabel('Key')).exists({ count: 1 }, 'renders the key');
assert.dom('[data-test-masked-input]').exists({ count: 1 }, 'renders mask for key value');
assert.dom(GENERAL.infoRowLabel('Port')).exists({ count: 1 }, 'renders the port');
- assert.dom('[data-test-row-value="Port"]').exists({ count: 1 }, "renders the port's value");
+ assert.dom(GENERAL.infoRowValue('Port')).exists("renders the port's value");
},
},
];
diff --git a/ui/tests/acceptance/settings-test.js b/ui/tests/acceptance/settings-test.js
index d305c1d119..7197096805 100644
--- a/ui/tests/acceptance/settings-test.js
+++ b/ui/tests/acceptance/settings-test.js
@@ -4,19 +4,17 @@
*/
import { currentURL, visit, click, fillIn } from '@ember/test-helpers';
+import { selectChoose } from 'ember-power-select/test-support';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { v4 as uuidv4 } from 'uuid';
-import backendListPage from 'vault/tests/pages/secrets/backends';
import mountSecrets from 'vault/tests/pages/settings/mount-secret-backend';
import { login } from 'vault/tests/helpers/auth/auth-helpers';
import { deleteEngineCmd, mountEngineCmd, runCmd } from 'vault/tests/helpers/commands';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
import { MOUNT_BACKEND_FORM } from 'vault/tests/helpers/components/mount-backend-form-selectors';
-const { searchSelect } = GENERAL;
-
module('Acceptance | secret engine mount settings', function (hooks) {
setupApplicationTest(hooks);
@@ -62,10 +60,9 @@ module('Acceptance | secret engine mount settings', function (hooks) {
await visit('/vault/settings/mount-secret-backend');
await runCmd(mountEngineCmd(type, path), false);
await visit('/vault/secrets');
- await click(searchSelect.trigger('filter-by-engine-name'));
- await click(searchSelect.option(searchSelect.optionIndex(path)));
+ await selectChoose(GENERAL.searchSelect.trigger('filter-by-engine-name'), path);
await click(GENERAL.menuTrigger);
- await backendListPage.configLink();
+ await click(GENERAL.menuItem('view-configuration'));
assert.strictEqual(
currentURL(),
`/vault/secrets/${path}/${type}/configuration`,
@@ -82,10 +79,9 @@ module('Acceptance | secret engine mount settings', function (hooks) {
await visit('/vault/settings/mount-secret-backend');
await runCmd(mountEngineCmd(type, path), false);
await visit('/vault/secrets');
- await click(searchSelect.trigger('filter-by-engine-name'));
- await click(searchSelect.option(searchSelect.optionIndex(path)));
+ await selectChoose(GENERAL.searchSelect.trigger('filter-by-engine-name'), path);
await click(GENERAL.menuTrigger);
- await backendListPage.configLink();
+ await click(GENERAL.menuItem('view-configuration'));
assert.strictEqual(
currentURL(),
`/vault/secrets/${path}/configuration`,
diff --git a/ui/tests/acceptance/transit-test.js b/ui/tests/acceptance/transit-test.js
index dba4229517..1d31cd41cc 100644
--- a/ui/tests/acceptance/transit-test.js
+++ b/ui/tests/acceptance/transit-test.js
@@ -21,7 +21,6 @@ const SELECTORS = {
versionsTab: '[data-test-transit-link="versions"]',
actionsTab: '[data-test-transit-key-actions-link]',
card: (action) => `[data-test-transit-card="${action}"]`,
- infoRow: (label) => `[data-test-value-div="${label}"]`,
form: (item) => `[data-test-transit-key="${item}"]`,
versionRow: (version) => `[data-test-transit-version="${version}"]`,
rotate: {
@@ -245,10 +244,10 @@ module('Acceptance | transit', function (hooks) {
`/vault/secrets/${this.path}/show/${name}?tab=details`,
'it navigates to show page'
);
- assert.dom(SELECTORS.infoRow('Auto-rotation period')).hasText('30 days');
- assert.dom(SELECTORS.infoRow('Deletion allowed')).hasText('false');
- assert.dom(SELECTORS.infoRow('Derived')).hasText('Yes');
- assert.dom(SELECTORS.infoRow('Convergent encryption')).hasText('Yes');
+ assert.dom(GENERAL.infoRowValue('Auto-rotation period')).hasText('30 days');
+ assert.dom(GENERAL.infoRowValue('Deletion allowed')).hasText('false');
+ assert.dom(GENERAL.infoRowValue('Derived')).hasText('Yes');
+ assert.dom(GENERAL.infoRowValue('Convergent encryption')).hasText('Yes');
await click(GENERAL.breadcrumbLink(this.path));
await click(SELECTORS.popupMenu);
const actions = findAll('.hds-dropdown__list li');
@@ -346,7 +345,7 @@ module('Acceptance | transit', function (hooks) {
const name = await this.generateTransitKey(keyData);
await visit(`vault/secrets/${this.path}/show/${name}`);
assert
- .dom(SELECTORS.infoRow('Auto-rotation period'))
+ .dom(GENERAL.infoRowValue('Auto-rotation period'))
.hasText('30 days', 'Has expected auto rotate value');
await click(SELECTORS.versionsTab);
diff --git a/ui/tests/helpers/general-selectors.ts b/ui/tests/helpers/general-selectors.ts
index edb4d94201..90fa999c9c 100644
--- a/ui/tests/helpers/general-selectors.ts
+++ b/ui/tests/helpers/general-selectors.ts
@@ -40,8 +40,6 @@ export const GENERAL = {
checkboxByAttr: (attr: string) => `[data-test-checkbox="${attr}"]`,
enableField: (attr: string) => `[data-test-enable-field="${attr}"] button`,
fieldByAttr: (attr: string) => `[data-test-field="${attr}"]`,
- infoRowLabel: (label: string) => `[data-test-row-label="${label}"]`,
- infoRowValue: (label: string) => `[data-test-value-div="${label}"]`,
inputByAttr: (attr: string) => `[data-test-input="${attr}"]`,
selectByAttr: (attr: string) => `[data-test-select="${attr}"]`,
textToggle: '[data-test-text-toggle]',
@@ -52,7 +50,10 @@ export const GENERAL = {
toggle: (attr: string) => `[data-test-toggle-label="${attr}"]`,
input: (attr: string) => `[data-test-ttl-value="${attr}"]`,
},
-
+ // Info Table Row
+ infoRowLabel: (label: string) => `[data-test-row-label="${label}"]`,
+ infoRowValue: (label: string) => `[data-test-row-value="${label}"]`,
+ // Validation
validation: (attr: string) => `[data-test-field-validation=${attr}]`,
validationWarning: (attr: string) => `[data-test-validation-warning=${attr}]`,
messageError: '[data-test-message-error]',
@@ -95,11 +96,14 @@ export const GENERAL = {
input: '[data-test-kv-suggestion-input]',
select: '[data-test-kv-suggestion-select]',
},
+ // Links and buttons
navLink: (label: string) => `[data-test-sidebar-nav-link="${label}"]`,
+ backButton: '[data-test-back-button]',
cancelButton: '[data-test-cancel]',
saveButton: '[data-test-save]',
- backButton: '[data-test-back-button]',
+ testButton: (label: string) => `[data-test-button="${label}"]`,
codeBlock: (label: string) => `[data-test-code-block="${label}"]`,
+ // TODO replace data-test-component="value" as a higher level selector
codemirror: `[data-test-component="code-mirror-modifier"]`,
codemirrorTextarea: `[data-test-component="code-mirror-modifier"] textarea`,
};
diff --git a/ui/tests/helpers/kv/kv-selectors.js b/ui/tests/helpers/kv/kv-selectors.js
index b03f64e739..5ce9bc6360 100644
--- a/ui/tests/helpers/kv/kv-selectors.js
+++ b/ui/tests/helpers/kv/kv-selectors.js
@@ -12,8 +12,8 @@ export const PAGE = {
breadcrumbCurrentAtIdx: (idx) =>
`[data-test-breadcrumbs] li:nth-child(${idx + 1}) .hds-breadcrumb__current`,
infoRow: '[data-test-component="info-table-row"]',
- infoRowValue: (label) => `[data-test-value-div="${label}"]`,
- infoRowToggleMasked: (label) => `[data-test-value-div="${label}"] [data-test-button="toggle-masked"]`,
+ infoRowValue: (label) => `[data-test-row-value="${label}"]`, // TODO replace with GENERAL.infoRowValue
+ infoRowToggleMasked: (label) => `[data-test-row-value="${label}"] [data-test-button="toggle-masked"]`,
secretTab: (tab) => (tab ? `[data-test-secrets-tab="${tab}"]` : '[data-test-secrets-tab]'),
emptyStateTitle: '[data-test-empty-state-title]',
emptyStateMessage: '[data-test-empty-state-message]',
diff --git a/ui/tests/helpers/pki/pki-selectors.ts b/ui/tests/helpers/pki/pki-selectors.ts
index 4b9839d21f..b66a3fa403 100644
--- a/ui/tests/helpers/pki/pki-selectors.ts
+++ b/ui/tests/helpers/pki/pki-selectors.ts
@@ -3,6 +3,8 @@
* SPDX-License-Identifier: BUSL-1.1
*/
+import { GENERAL } from '../general-selectors';
+
export const PKI_OVERVIEW = {
issueCertificateInput: '[data-test-issue-certificate-input]',
issueCertificatePowerSearch: '[data-test-issue-certificate-input] span',
@@ -56,14 +58,14 @@ export const PKI_GENERATE_ROOT = {
urlField: '[data-test-urls-section] [data-test-input]',
// Shown values after save
saved: {
- certificate: '[data-test-value-div="Certificate"] [data-test-certificate-card]',
- commonName: '[data-test-row-value="Common name"]',
- issuerName: '[data-test-row-value="Issuer name"]',
- issuerLink: '[data-test-value-div="Issuer ID"] a',
- keyName: '[data-test-row-value="Key name"]',
- keyLink: '[data-test-value-div="Key ID"] a',
- privateKey: '[data-test-value-div="Private key"] [data-test-certificate-card]',
- serialNumber: '[data-test-row-value="Serial number"]',
+ certificate: `${GENERAL.infoRowValue('Certificate')} [data-test-certificate-card]`,
+ commonName: GENERAL.infoRowValue('Common name'),
+ issuerName: GENERAL.infoRowValue('Issuer name'),
+ issuerLink: `${GENERAL.infoRowValue('Issuer ID')} a`,
+ keyName: GENERAL.infoRowValue('Key name'),
+ keyLink: `${GENERAL.infoRowValue('Key ID')} a`,
+ privateKey: `${GENERAL.infoRowValue('Private key')} [data-test-certificate-card]`,
+ serialNumber: GENERAL.infoRowValue('Serial number'),
},
};
@@ -73,13 +75,13 @@ export const PKI_CROSS_SIGN = {
statusCount: '[data-test-cross-sign-status-count]',
signedIssuerRow: (row = 0) => `[data-test-info-table-row="${row}"]`,
signedIssuerCol: (attr: string) => `[data-test-info-table-column="${attr}"]`,
- rowValue: (attr: string) => `[data-test-row-value="${attr}"]`,
- copyButton: (attr: string) => `[data-test-value-div="${attr}"] [data-test-copy-button]`,
+ rowValue: (attr: string) => `[data-test-row-value="${attr}"]`, // TODO replace with the GENERAL.infoRowValue
+ copyButton: (attr: string) => `[data-test-row-value="${attr}"] [data-test-copy-button]`,
};
export const PKI_ISSUER_DETAILS = {
configure: '[data-test-pki-issuer-configure]',
- copyButtonByName: (name: string) => `[data-test-value-div="${name}"] [data-test-copy-button]`,
+ copyButtonByName: (name: string) => `[data-test-row-value="${name}"] [data-test-copy-button]`,
crossSign: '[data-test-pki-issuer-cross-sign]',
defaultGroup: '[data-test-details-group="default"]',
download: '[data-test-issuer-download]',
@@ -91,7 +93,6 @@ export const PKI_ISSUER_DETAILS = {
row: '[data-test-component="info-table-row"]',
signIntermediate: '[data-test-pki-issuer-sign-int]',
urlsGroup: '[data-test-details-group="Issuer URLs"]',
- valueByName: (name: string) => `[data-test-value-div="${name}"]`,
};
export const PKI_KEY_FORM = {
@@ -179,11 +180,11 @@ export const PKI_KEYS = {
export const PKI_ROLE_DETAILS = {
issuerLabel: '[data-test-row-label="Issuer"]',
- noStoreValue: '[data-test-value-div="Store in storage backend"]',
- noStoreMetadataValue: '[data-test-value-div="Store metadata in storage backend"]',
- keyUsageValue: '[data-test-value-div="Key usage"]',
- extKeyUsageValue: '[data-test-value-div="Ext key usage"]',
- customTtlValue: '[data-test-value-div="Issued certificates expire after"]',
+ noStoreValue: GENERAL.infoRowValue('Store in storage backend'),
+ noStoreMetadataValue: GENERAL.infoRowValue('Store metadata in storage backend'),
+ keyUsageValue: GENERAL.infoRowValue('Key usage'),
+ extKeyUsageValue: GENERAL.infoRowValue('Ext key usage'),
+ customTtlValue: GENERAL.infoRowValue('Issued certificates expire after'),
deleteRoleButton: '[data-test-pki-role-delete]',
generateCertLink: '[data-test-pki-role-generate-cert]',
signCertLink: '[data-test-pki-role-sign-cert]',
@@ -210,8 +211,8 @@ export const PKI_TIDY = {
alertUpdatedAt: '[data-test-tidy-status-alert-updated-at]',
cancelTidyAction: '[data-test-cancel-tidy-action]',
hdsAlertButtonText: '[data-test-cancel-tidy-action] .hds-button__text',
- timeStartedRow: '[data-test-value-div="Time started"]',
- timeFinishedRow: '[data-test-value-div="Time finished"]',
+ timeStartedRow: GENERAL.infoRowValue('Time started'),
+ timeFinishedRow: GENERAL.infoRowValue('Time finished'),
cancelTidyModalBackground: '#pki-cancel-tidy-modal',
tidyEmptyStateConfigure: '[data-test-tidy-empty-state-configure]',
manualTidyToolbar: '[data-test-pki-manual-tidy-config]',
diff --git a/ui/tests/helpers/secret-engine/secret-engine-helpers.js b/ui/tests/helpers/secret-engine/secret-engine-helpers.js
index 93fde91b56..33f4053e5e 100644
--- a/ui/tests/helpers/secret-engine/secret-engine-helpers.js
+++ b/ui/tests/helpers/secret-engine/secret-engine-helpers.js
@@ -15,7 +15,7 @@ export async function createSecret(path, key, value) {
await fillIn(SES.secretPath('create'), path);
await fillIn('[data-test-secret-key]', key);
await fillIn('[data-test-secret-value] textarea', value);
- await click('[data-test-secret-save]');
+ await click(GENERAL.saveButton);
return;
}
diff --git a/ui/tests/helpers/secret-engine/secret-engine-selectors.ts b/ui/tests/helpers/secret-engine/secret-engine-selectors.ts
index 00138cbf45..8b691054ef 100644
--- a/ui/tests/helpers/secret-engine/secret-engine-selectors.ts
+++ b/ui/tests/helpers/secret-engine/secret-engine-selectors.ts
@@ -19,6 +19,7 @@ export const SECRET_ENGINE_SELECTORS = {
path ? `[data-test-secrets-backend-link="${path}"]` : '[data-test-secrets-backend-link]',
createSecretLink: '[data-test-create-secret-link]',
secretPath: (name: string) => `[data-test-secret-path="${name}"]`,
+ secretKey: (name: string) => `[data-test-secret-key="${name}"]`,
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]`,
diff --git a/ui/tests/integration/components/config-ui/messages/page/details-test.js b/ui/tests/integration/components/config-ui/messages/page/details-test.js
index 91c865d73b..33ed50c645 100644
--- a/ui/tests/integration/components/config-ui/messages/page/details-test.js
+++ b/ui/tests/integration/components/config-ui/messages/page/details-test.js
@@ -10,6 +10,7 @@ import { setupEngine } from 'ember-engines/test-support';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { dateFormat } from 'core/helpers/date-format';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const allFields = [
{ label: 'Active', key: 'active' },
@@ -62,26 +63,23 @@ module('Integration | Component | messages/page/details', function (hooks) {
.exists({ count: allFields.length }, 'Correct number of filtered fields render');
allFields.forEach((field) => {
- assert
- .dom(`[data-test-row-label="${field.label}"]`)
- .hasText(field.label, `${field.label} label renders`);
+ assert.dom(GENERAL.infoRowLabel(field.label)).hasText(field.label, `${field.label} label renders`);
if (field.key === 'startTime' || field.key === 'endTime') {
const formattedDate = dateFormat([this.message[field.key], 'MMM d, yyyy hh:mm aaa'], {
withTimeZone: true,
});
assert
- .dom(`[data-test-row-value="${field.label}"]`)
+ .dom(GENERAL.infoRowValue(field.label))
.hasText(formattedDate || 'Never', `${field.label} value renders`);
} else if (field.key === 'authenticated' || field.key === 'active') {
assert
- .dom(`[data-test-value-div="${field.label}"]`)
+ .dom(GENERAL.infoRowValue(field.label))
.hasText(this.message[field.key] ? 'Yes' : 'No', `${field.label} value renders`);
} else if (field.key === 'link') {
- assert.dom('[data-test-value-div="Link"]').exists();
- assert.dom('[data-test-value-div="Link"] [data-test-link="message link"]').hasText('here');
+ assert.dom(GENERAL.infoRowValue('Link')).hasText('here');
} else {
assert
- .dom(`[data-test-row-value="${field.label}"]`)
+ .dom(GENERAL.infoRowValue(field.label))
.hasText(this.message[field.key], `${field.label} value renders`);
}
});
diff --git a/ui/tests/integration/components/dashboard/quick-actions-card-test.js b/ui/tests/integration/components/dashboard/quick-actions-card-test.js
index 1558a64777..fdebce6f42 100644
--- a/ui/tests/integration/components/dashboard/quick-actions-card-test.js
+++ b/ui/tests/integration/components/dashboard/quick-actions-card-test.js
@@ -5,7 +5,8 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'vault/tests/helpers';
-import { render, findAll, click } from '@ember/test-helpers';
+import { render, findAll } from '@ember/test-helpers';
+import { clickTrigger } from 'ember-power-select/test-support/helpers';
import { hbs } from 'ember-cli-htmlbars';
import { fillIn } from '@ember/test-helpers';
import { selectChoose } from 'ember-power-select/test-support';
@@ -134,7 +135,7 @@ module('Integration | Component | dashboard/quick-actions-card', function (hooks
});
test('it should show correct actions for kv', async function (assert) {
await this.renderComponent();
- await click('[data-test-component="search-select"]#secrets-engines-select .ember-basic-dropdown-trigger');
+ await clickTrigger('#type-to-select-a-mount');
assert.strictEqual(
findAll('li.ember-power-select-option').length,
5,
diff --git a/ui/tests/integration/components/database-role-edit-test.js b/ui/tests/integration/components/database-role-edit-test.js
index 9da4e61ca2..2a1a3eec6d 100644
--- a/ui/tests/integration/components/database-role-edit-test.js
+++ b/ui/tests/integration/components/database-role-edit-test.js
@@ -53,7 +53,7 @@ module('Integration | Component | database-role-edit', function (hooks) {
this.server.post('/sys/capabilities-self', capabilitiesStub('database/static-creds/my-role', ['create']));
await render(hbs``);
- await click('[data-test-secret-save]');
+ await click(GENERAL.saveButton);
assert.dom('[data-test-inline-error-message]').exists('Inline form errors exist');
});
@@ -75,7 +75,7 @@ module('Integration | Component | database-role-edit', function (hooks) {
await render(hbs``);
await fillIn('[data-test-ttl-value="Rotation period"]', '20');
- await click('[data-test-secret-save]');
+ await click(GENERAL.saveButton);
});
test('enterprise: it should successfully create user that does not rotate immediately', async function (assert) {
@@ -101,7 +101,7 @@ module('Integration | Component | database-role-edit', function (hooks) {
await click(GENERAL.toggleInput('toggle-skip_import_rotation'));
await fillIn(GENERAL.inputByAttr('password'), 'testPassword'); // fill in password field
- await click('[data-test-secret-save]');
+ await click(GENERAL.saveButton);
await render(hbs``);
assert.dom(GENERAL.infoRowValue('Rotate immediately')).containsText('No');
@@ -130,7 +130,7 @@ module('Integration | Component | database-role-edit', function (hooks) {
this.server.post('/sys/capabilities-self', capabilitiesStub('database/static-creds/my-role', ['create']));
await render(hbs``);
- await click('[data-test-secret-save]');
+ await click(GENERAL.saveButton);
assert.dom('[data-test-issuer-warning]').exists(); // check if warning modal shows after clicking save
await click('[data-test-issuer-save]'); // click continue button on modal
diff --git a/ui/tests/integration/components/info-table-row-test.js b/ui/tests/integration/components/info-table-row-test.js
index b299d603cd..1f7b8f5813 100644
--- a/ui/tests/integration/components/info-table-row-test.js
+++ b/ui/tests/integration/components/info-table-row-test.js
@@ -9,6 +9,7 @@ import Service from '@ember/service';
import { setupRenderingTest } from 'ember-qunit';
import { render, triggerEvent } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const VALUE = 'test value';
const LABEL = 'test label';
@@ -52,11 +53,19 @@ module('Integration | Component | InfoTableRow', function (hooks) {
/>`);
assert.dom('[data-test-component="info-table-row"]').exists();
- assert.dom('[data-test-row-value]').hasText(VALUE, 'renders value as passed through');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText(VALUE, 'renders value as passed through');
+ });
+ test('it does not render if a value is empty and alwaysRender is false (even if default exists)', async function (assert) {
this.set('value', '');
+ await render(hbs``);
+
assert
- .dom('[data-test-label-div]')
+ .dom(GENERAL.infoRowValue(this.label))
.doesNotExist('does not render if no value and alwaysRender is false (even if default exists)');
});
@@ -69,8 +78,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
@tooltipText={{this.tooltipText}}
/>`);
- await triggerEvent('[data-test-value-div="test label"] .ember-basic-dropdown-trigger', 'mouseenter');
-
+ await triggerEvent('.ember-basic-dropdown-trigger', 'mouseenter');
const tooltip = document.querySelector('div.box').textContent.trim();
assert.strictEqual(tooltip, 'Tooltip text!', 'renders tooltip text');
});
@@ -89,7 +97,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
/>
`);
- await triggerEvent('[data-test-value-div="test label"] .ember-basic-dropdown-trigger', 'mouseenter');
+ await triggerEvent('.ember-basic-dropdown-trigger', 'mouseenter');
assert.dom('[data-test-tooltip-copy]').doesNotExist('Tooltip has no copy button');
this.set('isCopyable', true);
@@ -146,7 +154,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
assert.dom('div.column.is-flex-center .hds-icon').exists('Renders a dash (-) for undefined value');
this.set('default', DEFAULT);
- assert.dom('[data-test-value-div]').hasText(DEFAULT, 'Renders default text if value is empty');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText(DEFAULT, 'Renders default text if value is empty');
this.set('value', '');
this.set('label', '');
@@ -167,7 +175,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
Block content is here
`);
- const block = document.querySelector('[data-test-value-div]').textContent.trim();
+ const block = document.querySelector(GENERAL.infoRowValue(this.label)).textContent.trim();
assert.strictEqual(block, 'Block content is here', 'renders block passed through');
});
@@ -177,8 +185,8 @@ module('Integration | Component | InfoTableRow', function (hooks) {
@alwaysRender={{false}}>
Block content
`);
- assert.dom('[data-test-value-div]').exists('renders block');
- assert.dom('[data-test-value-div]').hasText('Block content', 'renders block');
+ assert.dom(GENERAL.infoRowValue(this.label)).exists('renders block');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText('Block content', 'renders block');
});
test('Row does not render empty block content when alwaysRender = false', async function (assert) {
@@ -195,6 +203,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
assert.dom('[data-test-component="info-table-row"]').exists();
assert.dom('[data-test-icon="minus"]').exists('renders dash when no label');
});
+
test('Truncates the label if too long', async function (assert) {
this.set('label', 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz');
await render(hbs`
@@ -204,26 +213,29 @@ module('Integration | Component | InfoTableRow', function (hooks) {
/>
`);
assert.dom('[data-test-component="info-table-row"]').exists('Row renders');
- assert.dom('[data-test-label-div].label-overflow').exists('Label has class label-overflow');
await triggerEvent('[data-test-row-label]', 'mouseenter');
assert.dom('[data-test-label-tooltip]').exists('Label tooltip exists on hover');
});
+
test('Renders if block value and alwaysrender=false', async function (assert) {
await render(hbs`{{this.value}}`);
assert.dom('[data-test-component="info-table-row"]').exists();
});
+
test('Does not render if value is empty and alwaysrender=false', async function (assert) {
await render(hbs``);
assert.dom('[data-test-component="info-table-row"]').doesNotExist();
});
+
test('Renders dash for value if value empty and alwaysRender=true', async function (assert) {
await render(hbs``);
assert.dom('[data-test-component="info-table-row"]').exists();
- assert.dom('[data-test-value-div] [data-test-icon="minus"]').exists('renders dash for value');
+ assert.dom(GENERAL.infoRowValue(this.label)).exists('renders dash for value');
});
+
test('Renders block over @value or @defaultShown', async function (assert) {
await render(hbs``);
assert.dom('[data-test-component="info-table-row"]').exists();
- assert.dom('[data-test-value-div]').hasText('foo', 'renders block value');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText('foo', 'renders block value');
});
+
test('Renders icons if value is boolean', async function (assert) {
this.set('value', true);
await render(hbs``);
assert.dom('[data-test-boolean-true]').exists('check icon exists');
- assert.dom('[data-test-value-div]').hasText('Yes', 'Renders yes text');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText('Yes', 'Renders yes text');
this.set('value', false);
assert.dom('[data-test-boolean-false]').exists('x icon exists');
- assert.dom('[data-test-value-div]').hasText('No', 'renders no text');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText('No', 'renders no text');
});
test('Renders data-test attrs passed from parent', async function (assert) {
this.set('value', true);
@@ -267,7 +280,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
@formatDate={{'yyyy'}}
/>`);
- assert.dom('[data-test-value-div]').hasText('2018', 'Renders date with passed format');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText('2018', 'Renders date with passed format');
});
test('Formats the value as TTL when formatTtl present', async function (assert) {
@@ -279,7 +292,7 @@ module('Integration | Component | InfoTableRow', function (hooks) {
/>`);
assert
- .dom('[data-test-value-div]')
+ .dom(GENERAL.infoRowValue(this.label))
.hasText('1 hour 40 minutes', 'Translates number value to largest unit with carryover of minutes');
});
@@ -291,6 +304,6 @@ module('Integration | Component | InfoTableRow', function (hooks) {
@formatTtl={{true}}
/>`);
- assert.dom('[data-test-value-div]').hasText('45 minutes', 'it formats string duration');
+ assert.dom(GENERAL.infoRowValue(this.label)).hasText('45 minutes', 'it formats string duration');
});
});
diff --git a/ui/tests/integration/components/keymgmt/provider-edit-test.js b/ui/tests/integration/components/keymgmt/provider-edit-test.js
index b4615a2919..f6188b63ac 100644
--- a/ui/tests/integration/components/keymgmt/provider-edit-test.js
+++ b/ui/tests/integration/components/keymgmt/provider-edit-test.js
@@ -10,6 +10,7 @@ import { hbs } from 'ember-cli-htmlbars';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { click, settled, fillIn } from '@ember/test-helpers';
import { setRunOptions } from 'ember-a11y-testing/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const ts = 'data-test-kms-provider';
const root = {
@@ -150,7 +151,7 @@ module('Integration | Component | keymgmt/provider-edit', function (hooks) {
/>`);
assert
- .dom('[data-test-value-div="Keys"]')
+ .dom(GENERAL.infoRowValue('Keys'))
.hasText('None', 'None is displayed when no keys exist for provider');
await click(`[${ts}-delete]`);
diff --git a/ui/tests/integration/components/kubernetes/page/credentials-test.js b/ui/tests/integration/components/kubernetes/page/credentials-test.js
index beb6bf22e1..83c29f2093 100644
--- a/ui/tests/integration/components/kubernetes/page/credentials-test.js
+++ b/ui/tests/integration/components/kubernetes/page/credentials-test.js
@@ -10,6 +10,7 @@ import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { render, click, fillIn } from '@ember/test-helpers';
import { Response } from 'miragejs';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
import hbs from 'htmlbars-inline-precompile';
import timestamp from 'core/utils/timestamp';
@@ -91,7 +92,7 @@ module('Integration | Component | kubernetes | Page::Credentials', function (hoo
assert.expect(15);
this.server.post('/kubernetes-test/creds/role-0', () => {
- assert.ok('POST request made to generate credentials');
+ assert.true(true, 'POST request made to generate credentials');
return {
request_id: '58fefc6c-5195-c17a-94f2-8f889f3df57c',
lease_id: 'kubernetes/creds/default-role/aWczfcfJ7NKUdiirJrPXIs38',
@@ -120,20 +121,20 @@ module('Integration | Component | kubernetes | Page::Credentials', function (hoo
.dom('[data-test-k8-alert-message]')
.hasText("You won't be able to access these credentials later, so please copy them now.");
assert.dom('[data-test-row-label="Service account token"]').hasText('Service account token');
- await click('[data-test-value-div="Service account token"] [data-test-button]');
+ await click(`${GENERAL.infoRowValue('Service account token')} [data-test-button]`);
assert
- .dom('[data-test-value-div="Service account token"] .display-only')
+ .dom(`${GENERAL.infoRowValue('Service account token')} .display-only`)
.hasText('eyJhbGciOiJSUzI1NiIsImtpZCI6Imlr');
assert.dom('[data-test-row-label="Namespace"]').hasText('Namespace');
- assert.dom('[data-test-value-div="Namespace"]').exists();
+ assert.dom(GENERAL.infoRowValue('Namespace')).exists();
assert.dom('[data-test-row-label="Service account name"]').hasText('Service account name');
- assert.dom('[data-test-value-div="Service account name"]').exists();
+ assert.dom(GENERAL.infoRowValue('Service account name')).exists();
assert.dom('[data-test-row-label="Lease expiry"]').hasText('Lease expiry');
- assert.dom('[data-test-value-div="Lease expiry"]').hasText('April 3rd 2018, 3:15:30 PM');
+ assert.dom(GENERAL.infoRowValue('Lease expiry')).hasText('April 3rd 2018, 3:15:30 PM');
assert.dom('[data-test-row-label="lease_id"]').hasText('lease_id');
assert
- .dom('[data-test-value-div="lease_id"] [data-test-row-value="lease_id"]')
+ .dom(GENERAL.infoRowValue('lease_id'))
.hasText('kubernetes/creds/default-role/aWczfcfJ7NKUdiirJrPXIs38');
});
});
diff --git a/ui/tests/integration/components/kv/kv-paths-card-test.js b/ui/tests/integration/components/kv/kv-paths-card-test.js
index b29a0ee8bc..498a2f1208 100644
--- a/ui/tests/integration/components/kv/kv-paths-card-test.js
+++ b/ui/tests/integration/components/kv/kv-paths-card-test.js
@@ -40,8 +40,8 @@ module('Integration | Component | kv-v2 | KvPathsCard', function (hooks) {
await this.renderComponent();
assert.dom('[data-test-component="info-table-row"] .helper-text').doesNotExist('subtext does not render');
- assert.dom('[data-test-label-div]').hasClass('is-one-quarter');
- assert.dom(PAGE.infoRowValue('API path for metadata')).doesNotExist();
+
+ assert.dom('[data-test-component="info-table-row"] div').hasClass('is-one-quarter');
assert.dom(PAGE.paths.codeSnippet('cli')).doesNotExist();
assert.dom(PAGE.paths.codeSnippet('api')).doesNotExist();
@@ -59,7 +59,7 @@ module('Integration | Component | kv-v2 | KvPathsCard', function (hooks) {
await this.renderComponent();
assert.dom('[data-test-component="info-table-row"] .helper-text').exists('subtext renders');
- assert.dom('[data-test-label-div]').hasClass('is-one-third');
+ assert.dom('[data-test-component="info-table-row"] div').hasClass('is-one-third');
assert.dom(PAGE.infoRowValue('API path for metadata')).exists();
assert.dom(PAGE.paths.codeSnippet('cli')).exists();
assert.dom(PAGE.paths.codeSnippet('api')).exists();
diff --git a/ui/tests/integration/components/ldap/page/configuration-test.js b/ui/tests/integration/components/ldap/page/configuration-test.js
index 0867f7f1bf..56ec934024 100644
--- a/ui/tests/integration/components/ldap/page/configuration-test.js
+++ b/ui/tests/integration/components/ldap/page/configuration-test.js
@@ -12,6 +12,7 @@ import hbs from 'htmlbars-inline-precompile';
import { duration } from 'core/helpers/format-duration';
import { createSecretsEngine, generateBreadcrumbs } from 'vault/tests/helpers/ldap/ldap-helpers';
import { setRunOptions } from 'ember-a11y-testing/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const selectors = {
rotateAction: '[data-test-toolbar-rotate-action]',
@@ -20,7 +21,6 @@ const selectors = {
configCta: '[data-test-config-cta]',
mountConfig: '[data-test-mount-config]',
pageError: '[data-test-page-error]',
- fieldValue: (label) => `[data-test-value-div="${label}"]`,
};
module('Integration | Component | ldap | Page::Configuration', function (hooks) {
@@ -90,21 +90,21 @@ module('Integration | Component | ldap | Page::Configuration', function (hooks)
test('it should render display fields', async function (assert) {
await this.renderComponent();
- assert.dom(selectors.fieldValue('Administrator Distinguished Name')).hasText(this.config.binddn);
- assert.dom(selectors.fieldValue('URL')).hasText(this.config.url);
- assert.dom(selectors.fieldValue('Schema')).hasText(this.config.schema);
- assert.dom(selectors.fieldValue('Password Policy')).hasText(this.config.password_policy);
- assert.dom(selectors.fieldValue('Userdn')).hasText(this.config.userdn);
- assert.dom(selectors.fieldValue('Userattr')).hasText(this.config.userattr);
+ assert.dom(GENERAL.infoRowValue('Administrator Distinguished Name')).hasText(this.config.binddn);
+ assert.dom(GENERAL.infoRowValue('URL')).hasText(this.config.url);
+ assert.dom(GENERAL.infoRowValue('Schema')).hasText(this.config.schema);
+ assert.dom(GENERAL.infoRowValue('Password Policy')).hasText(this.config.password_policy);
+ assert.dom(GENERAL.infoRowValue('Userdn')).hasText(this.config.userdn);
+ assert.dom(GENERAL.infoRowValue('Userattr')).hasText(this.config.userattr);
assert
- .dom(selectors.fieldValue('Connection Timeout'))
+ .dom(GENERAL.infoRowValue('Connection Timeout'))
.hasText(duration([this.config.connection_timeout]));
- assert.dom(selectors.fieldValue('Request Timeout')).hasText(duration([this.config.request_timeout]));
- assert.dom(selectors.fieldValue('CA Certificate')).hasText(this.config.certificate);
- assert.dom(selectors.fieldValue('Start TLS')).includesText('No');
- assert.dom(selectors.fieldValue('Insecure TLS')).includesText('No');
- assert.dom(selectors.fieldValue('Client TLS Certificate')).hasText(this.config.client_tls_cert);
- assert.dom(selectors.fieldValue('Client TLS Key')).hasText(this.config.client_tls_key);
+ assert.dom(GENERAL.infoRowValue('Request Timeout')).hasText(duration([this.config.request_timeout]));
+ assert.dom(GENERAL.infoRowValue('CA Certificate')).hasText(this.config.certificate);
+ assert.dom(GENERAL.infoRowValue('Start TLS')).includesText('No');
+ assert.dom(GENERAL.infoRowValue('Insecure TLS')).includesText('No');
+ assert.dom(GENERAL.infoRowValue('Client TLS Certificate')).hasText(this.config.client_tls_cert);
+ assert.dom(GENERAL.infoRowValue('Client TLS Key')).hasText(this.config.client_tls_key);
});
test('it should rotate root password', async function (assert) {
diff --git a/ui/tests/integration/components/ldap/page/library/check-out-test.js b/ui/tests/integration/components/ldap/page/library/check-out-test.js
index ea33162fc1..8116adc258 100644
--- a/ui/tests/integration/components/ldap/page/library/check-out-test.js
+++ b/ui/tests/integration/components/ldap/page/library/check-out-test.js
@@ -8,6 +8,7 @@ import { setupRenderingTest } from 'ember-qunit';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { render, click } from '@ember/test-helpers';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
@@ -70,27 +71,27 @@ module('Integration | Component | ldap | Page::Library::CheckOut', function (hoo
);
assert.dom('[data-test-row-value="Account name"]').hasText('foo.bar', 'Account name renders');
await click('[data-test-button="toggle-masked"]');
- assert.dom('[data-test-value-div="Password"] .masked-value').hasText('password', 'Password renders');
+ assert.dom(`${GENERAL.infoRowValue('Password')} .masked-value`).hasText('password', 'Password renders');
assert
.dom('[data-test-row-value="Lease ID"]')
.hasText('ldap/library/test/check-out/123', 'Lease ID renders');
assert
- .dom('[data-test-value-div="Lease renewable"] svg')
+ .dom(`${GENERAL.infoRowValue('Lease renewable')} svg`)
.hasClass('hds-icon-check-circle', 'Lease renewable true icon renders');
assert
- .dom('[data-test-value-div="Lease renewable"] svg')
+ .dom(`${GENERAL.infoRowValue('Lease renewable')} svg`)
.hasClass('has-text-success', 'Lease renewable true icon color renders');
- assert.dom('[data-test-value-div="Lease renewable"] span').hasText('True', 'Lease renewable renders');
+ assert.dom(`${GENERAL.infoRowValue('Lease renewable')} span`).hasText('True', 'Lease renewable renders');
this.creds.renewable = false;
await this.renderComponent();
assert
- .dom('[data-test-value-div="Lease renewable"] svg')
+ .dom(`${GENERAL.infoRowValue('Lease renewable')} svg`)
.hasClass('hds-icon-x-circle', 'Lease renewable false icon renders');
assert
- .dom('[data-test-value-div="Lease renewable"] svg')
+ .dom(`${GENERAL.infoRowValue('Lease renewable')} svg`)
.hasClass('has-text-danger', 'Lease renewable false icon color renders');
- assert.dom('[data-test-value-div="Lease renewable"] span').hasText('False', 'Lease renewable renders');
+ assert.dom(`${GENERAL.infoRowValue('Lease renewable')} span`).hasText('False', 'Lease renewable renders');
await click('[data-test-done]');
const didTransition = transitionStub.calledWith(
diff --git a/ui/tests/integration/components/ldap/page/library/details/configuration-test.js b/ui/tests/integration/components/ldap/page/library/details/configuration-test.js
index 728f1dde16..0d85bcb048 100644
--- a/ui/tests/integration/components/ldap/page/library/details/configuration-test.js
+++ b/ui/tests/integration/components/ldap/page/library/details/configuration-test.js
@@ -10,6 +10,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { duration } from 'core/helpers/format-duration';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
module('Integration | Component | ldap | Page::Library::Details::Configuration', function (hooks) {
setupRenderingTest(hooks);
@@ -46,8 +47,8 @@ module('Integration | Component | ldap | Page::Library::Details::Configuration',
const value = label.includes('TTL') ? duration([this.model[key]]) : this.model[key];
const method = key === 'disable_check_in_enforcement' ? 'includesText' : 'hasText';
- assert.dom(`[data-test-row-label="${label}"]`).hasText(label, `${label} info row label renders`);
- assert.dom(`[data-test-value-div="${label}"]`)[method](value, `${label} info row label renders`);
+ assert.dom(GENERAL.infoRowLabel(label)).hasText(label, `${label} info row label renders`);
+ assert.dom(GENERAL.infoRowValue(label))[method](value, `${label} info row value renders`);
});
assert
diff --git a/ui/tests/integration/components/ldap/page/role/credentials-test.js b/ui/tests/integration/components/ldap/page/role/credentials-test.js
index 15e29109ef..91d8cedb90 100644
--- a/ui/tests/integration/components/ldap/page/role/credentials-test.js
+++ b/ui/tests/integration/components/ldap/page/role/credentials-test.js
@@ -12,6 +12,7 @@ import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
import { duration } from 'core/helpers/format-duration';
import { dateFormat } from 'core/helpers/date-format';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
module('Integration | Component | ldap | Page::Role::Credentials', function (hooks) {
setupRenderingTest(hooks);
@@ -77,16 +78,14 @@ module('Integration | Component | ldap | Page::Role::Credentials', function (hoo
);
for (const field of fields) {
- assert
- .dom(`[data-test-row-label="${field.label}"]`)
- .hasText(field.label, `${field.label} label renders`);
+ assert.dom(GENERAL.infoRowLabel(field.label)).hasText(field.label, `${field.label} label renders`);
if (field.isMasked) {
- await click(`[data-test-value-div="${field.label}"] [data-test-button="toggle-masked"]`);
+ await click(`${GENERAL.infoRowValue(field.label)} ${GENERAL.testButton('toggle-masked')}`);
}
const value = field.value ? field.value() : this.creds[field.key];
- assert.dom(`[data-test-value-div="${field.label}"]`).hasText(value, `${field.label} value renders`);
+ assert.dom(GENERAL.infoRowValue(field.label)).hasText(value, `${field.label} value renders`);
}
await click('[data-test-done]');
@@ -120,16 +119,14 @@ module('Integration | Component | ldap | Page::Role::Credentials', function (hoo
);
for (const field of fields) {
- assert
- .dom(`[data-test-row-label="${field.label}"]`)
- .hasText(field.label, `${field.label} label renders`);
+ assert.dom(GENERAL.infoRowLabel(field.label)).hasText(field.label, `${field.label} label renders`);
if (field.isMasked) {
- await click(`[data-test-value-div="${field.label}"] [data-test-button="toggle-masked"]`);
+ await click(`${GENERAL.infoRowValue(field.label)} ${GENERAL.testButton('toggle-masked')}`);
}
const value = field.value ? field.value() : this.creds[field.key];
- assert.dom(`[data-test-value-div="${field.label}"]`).hasText(value, `${field.label} value renders`);
+ assert.dom(GENERAL.infoRowValue(field.label)).hasText(value, `${field.label} value renders`);
}
await click('[data-test-done]');
diff --git a/ui/tests/integration/components/mfa-login-enforcement-form-test.js b/ui/tests/integration/components/mfa-login-enforcement-form-test.js
index 3498035a42..d459cce79e 100644
--- a/ui/tests/integration/components/mfa-login-enforcement-form-test.js
+++ b/ui/tests/integration/components/mfa-login-enforcement-form-test.js
@@ -9,6 +9,7 @@ import { render, click, fillIn } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { setRunOptions } from 'ember-a11y-testing/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
module('Integration | Component | mfa-login-enforcement-form', function (hooks) {
setupRenderingTest(hooks);
@@ -170,10 +171,10 @@ module('Integration | Component | mfa-login-enforcement-form', function (hooks)
.dom('.search-select-list-item small')
.hasText('123456', 'MFA method id renders in selected option');
assert
- .dom('[data-test-row-label="Authentication mount"]')
+ .dom(GENERAL.infoRowLabel('Authentication mount'))
.hasText('Authentication mount', 'Selected target type renders');
assert
- .dom('[data-test-value-div="Authentication mount"]')
+ .dom(GENERAL.infoRowValue('Authentication mount'))
.hasText('auth_userpass_1234', 'Selected target value renders');
await click('[data-test-mlef-remove-target]');
@@ -237,10 +238,10 @@ module('Integration | Component | mfa-login-enforcement-form', function (hooks)
for (const [index, target] of targets.entries()) {
// target populated from model
assert
- .dom(`[data-test-row-label="${target.label}"]`)
+ .dom(GENERAL.infoRowLabel(target.label))
.hasText(target.label, `${target.label} target populated with correct type label`);
assert
- .dom(`[data-test-value-div="${target.label}"]`)
+ .dom(GENERAL.infoRowValue(target.label))
.hasText(target.value, `${target.label} target populated with correct value`);
// remove target
await click(`[data-test-mlef-remove-target="${target.label}"]`);
diff --git a/ui/tests/integration/components/pki/page/pki-certificate-details-test.js b/ui/tests/integration/components/pki/page/pki-certificate-details-test.js
index ffa5957227..ff46f9c41d 100644
--- a/ui/tests/integration/components/pki/page/pki-certificate-details-test.js
+++ b/ui/tests/integration/components/pki/page/pki-certificate-details-test.js
@@ -9,6 +9,7 @@ import { click, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
import sinon from 'sinon';
module('Integration | Component | pki | Page::PkiCertificateDetails', function (hooks) {
@@ -91,9 +92,9 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function (
.dom('[data-test-component="info-table-row"]')
.exists({ count: 5 }, 'Correct number of fields render when certificate has not been revoked');
assert
- .dom('[data-test-value-div="Certificate"] [data-test-certificate-card]')
+ .dom(`${GENERAL.infoRowValue('Certificate')} [data-test-certificate-card]`)
.exists('Certificate card renders for certificate');
- assert.dom('[data-test-value-div="Serial number"] code').exists('Serial number renders as monospace');
+ assert.dom(`${GENERAL.infoRowValue('Serial number')} code`).exists('Serial number renders as monospace');
await click('[data-test-pki-cert-download-button]');
const { serialNumber, certificate } = this.model;
@@ -105,7 +106,7 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function (
await click('[data-test-confirm-action-trigger]');
await click('[data-test-confirm-button]');
- assert.dom('[data-test-value-div="Revocation time"]').exists('Revocation time is displayed');
+ assert.dom(GENERAL.infoRowValue('Revocation time')).exists('Revocation time is displayed');
});
test('it should render actions and fields for generated cert', async function (assert) {
@@ -132,17 +133,17 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function (
.dom('[data-test-component="info-table-row"]')
.exists({ count: 9 }, 'Correct number of fields render when certificate has not been revoked');
assert
- .dom('[data-test-value-div="Certificate"] [data-test-certificate-card]')
+ .dom(`${GENERAL.infoRowValue('Certificate')} [data-test-certificate-card]`)
.exists('Certificate card renders for certificate');
- assert.dom('[data-test-value-div="Serial number"] code').exists('Serial number renders as monospace');
+ assert.dom(`${GENERAL.infoRowValue('Serial number')} code`).exists('Serial number renders as monospace');
assert
- .dom('[data-test-value-div="CA Chain"] [data-test-certificate-card]')
+ .dom(`${GENERAL.infoRowValue('CA Chain')} [data-test-certificate-card]`)
.exists('Certificate card renders for CA Chain');
assert
- .dom('[data-test-value-div="Issuing CA"] [data-test-certificate-card]')
+ .dom(`${GENERAL.infoRowValue('Issuing CA')} [data-test-certificate-card]`)
.exists('Certificate card renders for Issuing CA');
assert
- .dom('[data-test-value-div="Private key"] [data-test-certificate-card]')
+ .dom(`${GENERAL.infoRowValue('Private key')} [data-test-certificate-card]`)
.exists('Certificate card renders for private key');
await click('[data-test-pki-cert-download-button]');
@@ -155,7 +156,7 @@ module('Integration | Component | pki | Page::PkiCertificateDetails', function (
await click('[data-test-confirm-action-trigger]');
await click('[data-test-confirm-button]');
- assert.dom('[data-test-value-div="Revocation time"]').exists('Revocation time is displayed');
+ assert.dom(GENERAL.infoRowValue('Revocation time')).exists('Revocation time is displayed');
});
test('it should render back button', async function (assert) {
diff --git a/ui/tests/integration/components/pki/page/pki-configuration-details-test.js b/ui/tests/integration/components/pki/page/pki-configuration-details-test.js
index e6be8a26f7..2b29e32545 100644
--- a/ui/tests/integration/components/pki/page/pki-configuration-details-test.js
+++ b/ui/tests/integration/components/pki/page/pki-configuration-details-test.js
@@ -9,11 +9,10 @@ import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupEngine } from 'ember-engines/test-support';
import { setRunOptions } from 'ember-a11y-testing/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const SELECTORS = {
- rowLabel: (attr) => `[data-test-row-label="${attr}"]`,
- rowValue: (attr) => `[data-test-value-div="${attr}"]`,
- rowIcon: (attr, icon) => `[data-test-row-value="${attr}"] [data-test-icon="${icon}"]`,
+ rowIcon: (attr, icon) => `${GENERAL.infoRowValue(attr)} ${GENERAL.icon(icon)}`,
};
module('Integration | Component | Page::PkiConfigurationDetails', function (hooks) {
@@ -60,9 +59,9 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
owner: this.engine,
});
assert
- .dom(SELECTORS.rowValue("Mount's API path"))
+ .dom(GENERAL.infoRowValue("Mount's API path"))
.hasText('https://pr-a.vault.example.com/v1/ns1/pki-root', 'mount API path row renders');
- assert.dom(SELECTORS.rowValue('AIA path')).hasText('None', "renders 'None' when no data");
+ assert.dom(GENERAL.infoRowValue('AIA path')).hasText('None', "renders 'None' when no data");
});
test('shows the correct information on global urls section', async function (assert) {
@@ -72,10 +71,10 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
);
assert
- .dom(SELECTORS.rowLabel('Issuing certificates'))
+ .dom(GENERAL.infoRowLabel('Issuing certificates'))
.hasText('Issuing certificates', 'issuing certificate row label renders');
assert
- .dom(SELECTORS.rowValue('Issuing certificates'))
+ .dom(GENERAL.infoRowValue('Issuing certificates'))
.hasText('example.com', 'issuing certificate value renders');
this.urls.issuingCertificates = null;
await render(
@@ -83,13 +82,13 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
{ owner: this.engine }
);
assert
- .dom(SELECTORS.rowValue('Issuing certificates'))
+ .dom(GENERAL.infoRowValue('Issuing certificates'))
.hasText('None', 'issuing certificate value renders None if none is configured');
assert
- .dom(SELECTORS.rowLabel('CRL distribution points'))
+ .dom(GENERAL.infoRowLabel('CRL distribution points'))
.hasText('CRL distribution points', 'crl distribution points row label renders');
assert
- .dom(SELECTORS.rowValue('CRL distribution points'))
+ .dom(GENERAL.infoRowValue('CRL distribution points'))
.hasText('None', 'crl distribution points value renders None if none is configured');
});
@@ -99,24 +98,24 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
{ owner: this.engine }
);
- assert.dom(SELECTORS.rowLabel('CRL building')).hasText('CRL building', 'crl expiry row label renders');
- assert.dom(SELECTORS.rowValue('CRL building')).hasText('Enabled', 'enabled renders');
- assert.dom(SELECTORS.rowValue('Expiry')).hasText('20h', 'expiry value renders');
- assert.dom(SELECTORS.rowLabel('Auto-rebuild')).hasText('Auto-rebuild', 'auto rebuild label renders');
- assert.dom(SELECTORS.rowValue('Auto-rebuild')).hasText('On', 'it renders truthy auto build');
+ assert.dom(GENERAL.infoRowLabel('CRL building')).hasText('CRL building', 'crl expiry row label renders');
+ assert.dom(GENERAL.infoRowValue('CRL building')).hasText('Enabled', 'enabled renders');
+ assert.dom(GENERAL.infoRowValue('Expiry')).hasText('20h', 'expiry value renders');
+ assert.dom(GENERAL.infoRowLabel('Auto-rebuild')).hasText('Auto-rebuild', 'auto rebuild label renders');
+ assert.dom(GENERAL.infoRowValue('Auto-rebuild')).hasText('On', 'it renders truthy auto build');
assert.dom(SELECTORS.rowIcon('Auto-rebuild', 'check-circle'));
assert
- .dom(SELECTORS.rowValue('Auto-rebuild grace period'))
+ .dom(GENERAL.infoRowValue('Auto-rebuild grace period'))
.hasText('13h', 'it renders auto build grace period');
- assert.dom(SELECTORS.rowValue('Delta CRL building')).hasText('On', 'it renders truthy delta crl build');
+ assert.dom(GENERAL.infoRowValue('Delta CRL building')).hasText('On', 'it renders truthy delta crl build');
assert.dom(SELECTORS.rowIcon('Delta CRL building', 'check-circle'));
assert
- .dom(SELECTORS.rowValue('Delta rebuild interval'))
+ .dom(GENERAL.infoRowValue('Delta rebuild interval'))
.hasText('15m', 'it renders delta build duration');
assert
- .dom(SELECTORS.rowValue('Responder APIs'))
+ .dom(GENERAL.infoRowValue('Responder APIs'))
.hasText('Enabled', 'responder apis value renders Enabled if ocsp_disable=false');
- assert.dom(SELECTORS.rowValue('Interval')).hasText('77h', 'interval value renders');
+ assert.dom(GENERAL.infoRowValue('Interval')).hasText('77h', 'interval value renders');
// check falsy aut_rebuild and _enable_delta hides duration values
this.crl.autoRebuild = false;
this.crl.enableDelta = false;
@@ -124,15 +123,15 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
hbs`,`,
{ owner: this.engine }
);
- assert.dom(SELECTORS.rowValue('Auto-rebuild')).hasText('Off', 'it renders falsy auto build');
+ assert.dom(GENERAL.infoRowValue('Auto-rebuild')).hasText('Off', 'it renders falsy auto build');
assert.dom(SELECTORS.rowIcon('Auto-rebuild', 'x-square'));
assert
- .dom(SELECTORS.rowValue('Auto-rebuild grace period'))
+ .dom(GENERAL.infoRowValue('Auto-rebuild grace period'))
.doesNotExist('does not render auto-rebuild grace period');
- assert.dom(SELECTORS.rowValue('Delta CRL building')).hasText('Off', 'it renders falsy delta cr build');
+ assert.dom(GENERAL.infoRowValue('Delta CRL building')).hasText('Off', 'it renders falsy delta cr build');
assert.dom(SELECTORS.rowIcon('Delta CRL building', 'x-square'));
assert
- .dom(SELECTORS.rowValue('Delta rebuild interval'))
+ .dom(GENERAL.infoRowValue('Delta rebuild interval'))
.doesNotExist('does not render delta rebuild duration');
// check falsy disable and ocsp_disable hides duration values and other params
@@ -144,16 +143,16 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
hbs`,`,
{ owner: this.engine }
);
- assert.dom(SELECTORS.rowValue('CRL building')).hasText('Disabled', 'disabled renders');
- assert.dom(SELECTORS.rowValue('Expiry')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('CRL building')).hasText('Disabled', 'disabled renders');
+ assert.dom(GENERAL.infoRowValue('Expiry')).doesNotExist();
assert
- .dom(SELECTORS.rowValue('Responder APIs'))
+ .dom(GENERAL.infoRowValue('Responder APIs'))
.hasText('Disabled', 'responder apis value renders Disabled');
- assert.dom(SELECTORS.rowValue('Interval')).doesNotExist();
- assert.dom(SELECTORS.rowValue('Auto-rebuild')).doesNotExist();
- assert.dom(SELECTORS.rowValue('Auto-rebuild grace period')).doesNotExist();
- assert.dom(SELECTORS.rowValue('Delta CRL building')).doesNotExist();
- assert.dom(SELECTORS.rowValue('Delta rebuild interval')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Interval')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Auto-rebuild')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Auto-rebuild grace period')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Delta CRL building')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Delta rebuild interval')).doesNotExist();
});
test('it renders enterprise params in crl section', async function (assert) {
@@ -163,11 +162,11 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
hbs`,`,
{ owner: this.engine }
);
- assert.dom(SELECTORS.rowValue('Cross-cluster revocation')).hasText('Yes');
+ assert.dom(GENERAL.infoRowValue('Cross-cluster revocation')).hasText('Yes');
assert.dom(SELECTORS.rowIcon('Cross-cluster revocation', 'check-circle'));
- assert.dom(SELECTORS.rowValue('Unified CRL')).hasText('Yes');
+ assert.dom(GENERAL.infoRowValue('Unified CRL')).hasText('Yes');
assert.dom(SELECTORS.rowIcon('Unified CRL', 'check-circle'));
- assert.dom(SELECTORS.rowValue('Unified CRL on existing paths')).hasText('Yes');
+ assert.dom(GENERAL.infoRowValue('Unified CRL on existing paths')).hasText('Yes');
assert.dom(SELECTORS.rowIcon('Unified CRL on existing paths', 'check-circle'));
});
@@ -178,8 +177,8 @@ module('Integration | Component | Page::PkiConfigurationDetails', function (hook
hbs`,`,
{ owner: this.engine }
);
- assert.dom(SELECTORS.rowValue('Cross-cluster revocation')).doesNotExist();
- assert.dom(SELECTORS.rowValue('Unified CRL')).doesNotExist();
- assert.dom(SELECTORS.rowValue('Unified CRL on existing paths')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Cross-cluster revocation')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Unified CRL')).doesNotExist();
+ assert.dom(GENERAL.infoRowValue('Unified CRL on existing paths')).doesNotExist();
});
});
diff --git a/ui/tests/integration/components/pki/page/pki-issuer-edit-test.js b/ui/tests/integration/components/pki/page/pki-issuer-edit-test.js
index cf7ef00dcc..1f13c3a028 100644
--- a/ui/tests/integration/components/pki/page/pki-issuer-edit-test.js
+++ b/ui/tests/integration/components/pki/page/pki-issuer-edit-test.js
@@ -10,6 +10,7 @@ import { hbs } from 'ember-cli-htmlbars';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { Response } from 'miragejs';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
import sinon from 'sinon';
const selectors = {
@@ -27,7 +28,6 @@ const selectors = {
certUrlRemove: '[data-test-string-list-button="delete"]',
crlDist: '[data-test-input="crlDistributionPoints"] [data-test-string-list-input="0"]',
ocspServers: '[data-test-input="ocspServers"] [data-test-string-list-input="0"]',
- save: '[data-test-save]',
cancel: '[data-test-cancel]',
error: '[data-test-message-error]',
alert: '[data-test-inline-error-message]',
@@ -132,7 +132,7 @@ module('Integration | Component | pki | Page::PkiIssuerEditPage::PkiIssuerEdit',
await render(hbs``, { owner: this.engine });
await this.update();
- await click(selectors.save);
+ await click(GENERAL.saveButton);
assert.ok(this.transitionCalled(), 'Transitions to details route on save success');
});
@@ -140,7 +140,7 @@ module('Integration | Component | pki | Page::PkiIssuerEditPage::PkiIssuerEdit',
this.server.post('/pki/issuer/test', () => new Response(404, {}, { errors: ['Some error occurred'] }));
await render(hbs``, { owner: this.engine });
- await click(selectors.save);
+ await click(GENERAL.saveButton);
assert
.dom(selectors.alert)
diff --git a/ui/tests/integration/components/pki/page/pki-tidy-auto-settings-test.js b/ui/tests/integration/components/pki/page/pki-tidy-auto-settings-test.js
index 9c44f479ce..162e34c42d 100644
--- a/ui/tests/integration/components/pki/page/pki-tidy-auto-settings-test.js
+++ b/ui/tests/integration/components/pki/page/pki-tidy-auto-settings-test.js
@@ -8,6 +8,7 @@ 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';
module('Integration | Component | page/pki-tidy-auto-settings', function (hooks) {
setupRenderingTest(hooks);
@@ -50,26 +51,26 @@ module('Integration | Component | page/pki-tidy-auto-settings', function (hooks)
.dom('[data-test-pki-edit-tidy-auto-link]')
.hasText('Edit auto-tidy', 'toolbar edit link has correct text');
- assert.dom('[data-test-row="enabled"] [data-test-label-div]').hasText('Automatic tidy enabled');
- assert.dom('[data-test-value-div="Automatic tidy enabled"]').hasText('No');
- assert.dom('[data-test-value-div="Interval duration"]').hasText('2 days');
+ assert.dom('[data-test-row="enabled"] [data-test-row-label]').hasText('Automatic tidy enabled');
+ assert.dom(GENERAL.infoRowValue('Automatic tidy enabled')).hasText('No');
+ assert.dom(GENERAL.infoRowValue('Interval duration')).hasText('2 days');
// Universal operations
assert.dom('[data-test-group-title="Universal operations"]').hasText('Universal operations');
assert
- .dom('[data-test-value-div="Tidy the certificate store"]')
+ .dom(GENERAL.infoRowValue('Tidy the certificate store'))
.exists('Renders universal field when value exists');
- assert.dom('[data-test-value-div="Tidy the certificate store"]').hasText('No');
+ assert.dom(GENERAL.infoRowValue('Tidy the certificate store')).hasText('No');
assert
- .dom('[data-test-value-div="Tidy revoked certificates"]')
+ .dom(GENERAL.infoRowValue('Tidy revoked certificates'))
.doesNotExist('Does not render universal field when value null');
// Issuer operations
assert.dom('[data-test-group-title="Issuer operations"]').hasText('Issuer operations');
assert
- .dom('[data-test-value-div="Tidy expired issuers"]')
+ .dom(GENERAL.infoRowValue('Tidy expired issuers'))
.exists('Renders issuer op field when value exists');
- assert.dom('[data-test-value-div="Tidy expired issuers"]').hasText('Yes');
+ assert.dom(GENERAL.infoRowValue('Tidy expired issuers')).hasText('Yes');
assert
- .dom('[data-test-value-div="Tidy legacy CA bundle"]')
+ .dom(GENERAL.infoRowValue('Tidy legacy CA bundle'))
.doesNotExist('Does not render issuer op field when value null');
});
});
diff --git a/ui/tests/integration/components/pki/parsed-certificate-info-rows-test.js b/ui/tests/integration/components/pki/parsed-certificate-info-rows-test.js
index aa318e31c7..6288d258da 100644
--- a/ui/tests/integration/components/pki/parsed-certificate-info-rows-test.js
+++ b/ui/tests/integration/components/pki/parsed-certificate-info-rows-test.js
@@ -8,6 +8,7 @@ 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';
module('Integration | Component | parsed-certificate-info-rows', function (hooks) {
setupRenderingTest(hooks);
@@ -37,10 +38,10 @@ module('Integration | Component | parsed-certificate-info-rows', function (hooks
});
assert.dom('[data-test-component="info-table-row"]').exists({ count: 2 }, 'renders 2 rows');
- assert.dom('[data-test-value-div="Common name"]').doesNotExist('common name is never rendered');
+ assert.dom(GENERAL.infoRowValue('Common name')).doesNotExist('common name is never rendered');
assert.dom('[data-test-row-value="Subject Alternative Names (SANs)"]').hasText('something,here');
- assert.dom('[data-test-value-div="Use PSS"]').hasText('No', 'Booleans are rendered');
- assert.dom('[data-test-value-div="ttl"]').doesNotExist('ttl is not rendered because value undefined');
+ assert.dom(GENERAL.infoRowValue('Use PSS')).hasText('No', 'Booleans are rendered');
+ assert.dom(GENERAL.infoRowValue('ttl')).doesNotExist('ttl is not rendered because value undefined');
assert
.dom('[data-test-parsing-error-alert-banner]')
.doesNotExist('does not render parsing error info banner');
diff --git a/ui/tests/integration/components/pki/pki-generate-csr-test.js b/ui/tests/integration/components/pki/pki-generate-csr-test.js
index 7f4d6aa3f2..292cc38ab9 100644
--- a/ui/tests/integration/components/pki/pki-generate-csr-test.js
+++ b/ui/tests/integration/components/pki/pki-generate-csr-test.js
@@ -10,6 +10,7 @@ import { hbs } from 'ember-cli-htmlbars';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { setRunOptions } from 'ember-a11y-testing/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
module('Integration | Component | pki-generate-csr', function (hooks) {
setupRenderingTest(hooks);
@@ -121,16 +122,16 @@ module('Integration | Component | pki-generate-csr', function (hooks) {
);
assert
- .dom('[data-test-value-div="CSR"] [data-test-certificate-card] button')
+ .dom(`${GENERAL.infoRowValue('CSR')} [data-test-certificate-card] button`)
.hasAttribute('data-test-copy-button', this.model.csr, 'it renders copyable csr');
assert
- .dom('[data-test-value-div="Key ID"] button')
+ .dom(`${GENERAL.infoRowValue('Key ID')} button`)
.hasAttribute('data-test-copy-button', this.model.keyId, 'it renders copyable key_id');
assert
- .dom('[data-test-value-div="Private key"] [data-test-certificate-card] button')
+ .dom(`${GENERAL.infoRowValue('Private key')} [data-test-certificate-card] button`)
.hasAttribute('data-test-copy-button', this.model.privateKey, 'it renders copyable private_key');
assert
- .dom('[data-test-value-div="Private key type"]')
+ .dom(GENERAL.infoRowValue('Private key type'))
.hasText(this.model.privateKeyType, 'renders private_key_type');
await click('[data-test-done]');
});
@@ -152,14 +153,14 @@ module('Integration | Component | pki-generate-csr', function (hooks) {
'renders Next steps alert banner'
);
assert
- .dom('[data-test-value-div="CSR"] [data-test-certificate-card] button')
+ .dom(`${GENERAL.infoRowValue('CSR')} [data-test-certificate-card] button`)
.hasAttribute('data-test-copy-button', this.model.csr, 'it renders copyable csr');
assert
- .dom('[data-test-value-div="Key ID"] button')
+ .dom(`${GENERAL.infoRowValue('Key ID')} button`)
.hasAttribute('data-test-copy-button', this.model.keyId, 'it renders copyable key_id');
- assert.dom('[data-test-value-div="Private key"]').hasText('internal', 'does not render private key');
+ assert.dom(GENERAL.infoRowValue('Private key')).hasText('internal', 'does not render private key');
assert
- .dom('[data-test-value-div="Private key type"]')
+ .dom(GENERAL.infoRowValue('Private key type'))
.hasText('internal', 'does not render private key type');
});
});
diff --git a/ui/tests/integration/components/pki/pki-issuer-details-test.js b/ui/tests/integration/components/pki/pki-issuer-details-test.js
index 7fa9ed5258..1bae513861 100644
--- a/ui/tests/integration/components/pki/pki-issuer-details-test.js
+++ b/ui/tests/integration/components/pki/pki-issuer-details-test.js
@@ -9,6 +9,7 @@ import { render, settled } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupEngine } from 'ember-engines/test-support';
import { PKI_ISSUER_DETAILS } from 'vault/tests/helpers/pki/pki-selectors';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
module('Integration | Component | page/pki-issuer-details', function (hooks) {
setupRenderingTest(hooks);
@@ -89,25 +90,23 @@ module('Integration | Component | page/pki-issuer-details', function (hooks) {
// Default group details:
assert.dom(PKI_ISSUER_DETAILS.defaultGroup).exists('Default group of details exists');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('Certificate')).exists('Certificate detail exists');
+ assert.dom(GENERAL.infoRowValue('Certificate')).exists('Certificate detail exists');
assert.dom(PKI_ISSUER_DETAILS.copyButtonByName('Certificate')).exists('Certificate is copyable');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('CA Chain')).exists('CA Chain detail exists');
+ assert.dom(GENERAL.infoRowValue('CA Chain')).exists('CA Chain detail exists');
assert.dom(PKI_ISSUER_DETAILS.copyButtonByName('CA Chain')).exists('CA Chain is copyable');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('Common name')).exists('Common name detail exists');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('Issuer name')).exists('Issuer name detail exists');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('Issuer ID')).exists('Issuer ID detail exists');
+ assert.dom(GENERAL.infoRowValue('Common name')).exists('Common name detail exists');
+ assert.dom(GENERAL.infoRowValue('Issuer name')).exists('Issuer name detail exists');
+ assert.dom(GENERAL.infoRowValue('Issuer ID')).exists('Issuer ID detail exists');
assert.dom(PKI_ISSUER_DETAILS.copyButtonByName('Issuer ID')).exists('Issuer ID is copyable');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('Default key ID')).exists('Default key ID detail exists');
+ assert.dom(GENERAL.infoRowValue('Default key ID')).exists('Default key ID detail exists');
// Issuer URLs group details:
assert.dom(PKI_ISSUER_DETAILS.urlsGroup).exists('Issuer URLs group of details exists');
+ assert.dom(GENERAL.infoRowValue('Issuing certificates')).exists('Issuing certificates detail exists');
assert
- .dom(PKI_ISSUER_DETAILS.valueByName('Issuing certificates'))
- .exists('Issuing certificates detail exists');
- assert
- .dom(PKI_ISSUER_DETAILS.valueByName('CRL distribution points'))
+ .dom(GENERAL.infoRowValue('CRL distribution points'))
.exists('CRL distribution points detail exists');
- assert.dom(PKI_ISSUER_DETAILS.valueByName('OCSP servers')).exists('OCSP servers detail exists');
+ assert.dom(GENERAL.infoRowValue('OCSP servers')).exists('OCSP servers detail exists');
});
test('it renders parsing error banner if issuer certificate contains unsupported OIDs', async function (assert) {
diff --git a/ui/tests/integration/components/pki/pki-sign-intermediate-form-test.js b/ui/tests/integration/components/pki/pki-sign-intermediate-form-test.js
index 3dca52d491..bfd57a071d 100644
--- a/ui/tests/integration/components/pki/pki-sign-intermediate-form-test.js
+++ b/ui/tests/integration/components/pki/pki-sign-intermediate-form-test.js
@@ -10,6 +10,7 @@ import { hbs } from 'ember-cli-htmlbars';
import Sinon from 'sinon';
import { setupEngine } from 'ember-engines/test-support';
import { setupMirage } from 'ember-cli-mirage/test-support';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
const selectors = {
form: '[data-test-sign-intermediate-form]',
@@ -21,8 +22,6 @@ const selectors = {
fieldError: '[data-test-inline-alert]',
formError: '[data-test-form-error]',
resultsContainer: '[data-test-sign-intermediate-result]',
- rowByName: (name) => `[data-test-row-label="${name}"]`,
- valueByName: (name) => `[data-test-value-div="${name}"]`,
};
module('Integration | Component | pki-sign-intermediate-form', function (hooks) {
setupRenderingTest(hooks);
@@ -93,12 +92,12 @@ module('Integration | Component | pki-sign-intermediate-form', function (hooks)
{ label: 'Certificate', isCertificate: true },
{ label: 'Issuing CA', isCertificate: true },
].forEach(({ label, isCertificate }) => {
- assert.dom(selectors.rowByName(label)).exists();
+ assert.dom(GENERAL.infoRowLabel(label)).exists();
if (isCertificate) {
- assert.dom(selectors.valueByName(label)).includesText('PEM Format', `${label} is isCertificate`);
+ assert.dom(GENERAL.infoRowValue(label)).includesText('PEM Format', `${label} is isCertificate`);
} else {
- assert.dom(selectors.valueByName(label)).hasText('31:52:b9:09:40', `Renders ${label}`);
- assert.dom(`${selectors.valueByName(label)} a`).exists(`${label} is a link`);
+ assert.dom(GENERAL.infoRowValue(label)).hasText('31:52:b9:09:40', `Renders ${label}`);
+ assert.dom(`${GENERAL.infoRowValue(label)} a`).exists(`${label} is a link`);
}
});
});
diff --git a/ui/tests/integration/components/secret-edit-test.js b/ui/tests/integration/components/secret-edit-test.js
index 17ceef4879..dda29b2f96 100644
--- a/ui/tests/integration/components/secret-edit-test.js
+++ b/ui/tests/integration/components/secret-edit-test.js
@@ -11,6 +11,7 @@ import { run } from '@ember/runloop';
import Service from '@ember/service';
import hbs from 'htmlbars-inline-precompile';
import codemirror from 'vault/tests/helpers/codemirror';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
let capabilities;
const storeService = Service.extend({
@@ -86,7 +87,7 @@ module('Integration | Component | secret edit', function (hooks) {
},
});
await render(hbs``);
- assert.dom('[data-test-secret-save]').isNotDisabled();
+ assert.dom(GENERAL.saveButton).isNotDisabled();
});
test('it shows an error when editing and the data is not an object', async function (assert) {
diff --git a/ui/tests/integration/components/secrets-engine-mount-config-test.js b/ui/tests/integration/components/secrets-engine-mount-config-test.js
index c176b19c1b..80755e9980 100644
--- a/ui/tests/integration/components/secrets-engine-mount-config-test.js
+++ b/ui/tests/integration/components/secrets-engine-mount-config-test.js
@@ -7,11 +7,11 @@ 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';
const selectors = {
toggle: '[data-test-mount-config-toggle]',
field: '[data-test-mount-config-field]',
- rowValue: (label) => `[data-test-value-div="${label}"]`,
};
module('Integration | Component | secrets-engine-mount-config', function (hooks) {
@@ -56,15 +56,15 @@ module('Integration | Component | secrets-engine-mount-config', function (hooks)
await click(selectors.toggle);
assert
- .dom(selectors.rowValue('Secret Engine Type'))
+ .dom(GENERAL.infoRowValue('Secret Engine Type'))
.hasText(this.model.engineType, 'Secret engine type renders');
- assert.dom(selectors.rowValue('Path')).hasText(this.model.path, 'Path renders');
- assert.dom(selectors.rowValue('Accessor')).hasText(this.model.accessor, 'Accessor renders');
- assert.dom(selectors.rowValue('Local')).includesText('No', 'Local renders');
- assert.dom(selectors.rowValue('Seal Wrap')).includesText('Yes', 'Seal wrap renders');
- assert.dom(selectors.rowValue('Default Lease TTL')).includesText('0', 'Default Lease TTL renders');
+ assert.dom(GENERAL.infoRowValue('Path')).hasText(this.model.path, 'Path renders');
+ assert.dom(GENERAL.infoRowValue('Accessor')).hasText(this.model.accessor, 'Accessor renders');
+ assert.dom(GENERAL.infoRowValue('Local')).includesText('No', 'Local renders');
+ assert.dom(GENERAL.infoRowValue('Seal Wrap')).includesText('Yes', 'Seal wrap renders');
+ assert.dom(GENERAL.infoRowValue('Default Lease TTL')).includesText('0', 'Default Lease TTL renders');
assert
- .dom(selectors.rowValue('Max Lease TTL'))
+ .dom(GENERAL.infoRowValue('Max Lease TTL'))
.includesText('2 hours 46 minutes 40 seconds', 'Max Lease TTL renders');
});
diff --git a/ui/tests/pages/secrets/backend/configuration.js b/ui/tests/pages/secrets/backend/configuration.js
index fc02b0e824..f06a1f9b51 100644
--- a/ui/tests/pages/secrets/backend/configuration.js
+++ b/ui/tests/pages/secrets/backend/configuration.js
@@ -4,9 +4,10 @@
*/
import { create, visitable, text } from 'ember-cli-page-object';
+import { GENERAL } from 'vault/tests/helpers/general-selectors';
export default create({
visit: visitable('/vault/secrets/:backend/configuration'),
- defaultTTL: text('[data-test-value-div="Default Lease TTL"]'),
- maxTTL: text('[data-test-value-div="Max Lease TTL"]'),
+ defaultTTL: text(GENERAL.infoRowValue('Default Lease TTL')),
+ maxTTL: text(GENERAL.infoRowValue('Max Lease TTL')),
});
diff --git a/ui/tests/pages/secrets/backend/database/connection.js b/ui/tests/pages/secrets/backend/database/connection.js
index d3e16a7c70..acd3af642a 100644
--- a/ui/tests/pages/secrets/backend/database/connection.js
+++ b/ui/tests/pages/secrets/backend/database/connection.js
@@ -18,7 +18,6 @@ export default create({
url: fillable('[data-test-input="url"]'),
username: fillable('[data-test-input="username"]'),
password: fillable('[data-test-input="password"]'),
- save: clickable('[data-test-secret-save]'),
addRole: clickable('[data-test-add-role]'), // only from connection show
enable: clickable('[data-test-enable-connection]'),
edit: clickable('[data-test-edit-link]'),
diff --git a/ui/tests/pages/secrets/backend/database/role.js b/ui/tests/pages/secrets/backend/database/role.js
index 2c12d8c510..5f76f29a5d 100644
--- a/ui/tests/pages/secrets/backend/database/role.js
+++ b/ui/tests/pages/secrets/backend/database/role.js
@@ -14,6 +14,5 @@ export default create({
createLink: clickable('[data-test-secret-create]'),
name: fillable('[data-test-input="name"]'),
roleType: selectable('[data-test-input="type"'),
- save: clickable('[data-test-secret-save]'),
edit: clickable('[data-test-edit-link]'),
});
diff --git a/ui/tests/pages/secrets/backend/kv/edit-secret.js b/ui/tests/pages/secrets/backend/kv/edit-secret.js
index fbe0b3befc..a9cf032045 100644
--- a/ui/tests/pages/secrets/backend/kv/edit-secret.js
+++ b/ui/tests/pages/secrets/backend/kv/edit-secret.js
@@ -11,6 +11,5 @@ export default create({
path: fillable('[data-test-secret-path="true"]'),
secretKey: fillable('[data-test-secret-key]'),
secretValue: fillable('[data-test-secret-value] textarea'),
- save: clickable('[data-test-secret-save]'),
toggleJSON: clickable('[data-test-toggle-input="json"]'),
});
diff --git a/ui/tests/pages/secrets/backends.js b/ui/tests/pages/secrets/backends.js
index 1c10e85c8d..3c68a70d20 100644
--- a/ui/tests/pages/secrets/backends.js
+++ b/ui/tests/pages/secrets/backends.js
@@ -13,9 +13,6 @@ export default create({
path: text('[data-test-secret-path]'),
menu: clickable('[data-test-popup-menu-trigger]'),
}),
- configLink: clickable('[data-test-engine-config]', {
- testContainer: '#ember-testing',
- }),
disableButton: clickable('[data-test-confirm-action-trigger]'),
confirmDisable: clickable('[data-test-confirm-button]'),
console: uiPanel,