refactor: 💡 adjust css selector for specific asserts (#1468)

* refactor: 💡 adjust css selector for specific asserts

✅ Closes: ICU-6889

* refactor: 💡 small update

* refactor: 💡 selectors for .doesNotExist()

* Update addons/core/tests/integration/helpers/relative-datetime-live-test.js

Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
This commit is contained in:
lisbet-alvarezandCameron Perera authored and GitHub committed 2022-11-28 14:44:34 -08:00
1 parent ff7a1fedea
commit e8a3650fbe
12 files changed
+26 -36

No files matched your search

@@ -90,7 +90,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
'create'
)
);
assert.dom(`[href="${urls.credentials}"]`).doesNotExist();
assert.dom('.rose-nav-tabs a:nth-child(2)').doesNotExist();
});
test('User can navigate to index with only create action', async function (assert) {
@@ -93,7 +93,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read'
);
await visit(urls.credentials);
assert.dom(`[href="${urls.usernamePasswordCredential}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
});
test('cannot navigate to a username & key pair credential form without proper authorization', async function (assert) {
@@ -103,7 +103,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read'
);
await visit(urls.credentials);
assert.dom(`[href="${urls.usernameKeyPairCredential}"]`).doesNotExist();
assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
});
test('visiting an unknown credential displays 404 message', async function (assert) {
@@ -93,7 +93,7 @@ module('Acceptance | credential-stores | read', function (hooks) {
await click(`[href="${urls.credentialStores}"]`);
assert.dom(`[href="${urls.staticCredentialStore}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert.dom(`[href="${urls.vaultCredentialStore}"]`).exists();
});
@@ -107,14 +107,12 @@ module('Acceptance | credential-stores | read', function (hooks) {
await click(`[href="${urls.credentialStores}"]`);
assert.dom(`[href="${urls.vaultCredentialStore}"]`).doesNotExist();
assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
assert.dom(`[href="${urls.staticCredentialStore}"]`).exists();
});
test('visiting an unknown credential store displays 404 message', async function (assert) {
assert.expect(2);
await visit(urls.credentialStores);
assert.dom(`[href="${urls.unknownCredentialStore}"]`).doesNotExist();
assert.expect(1);
await visit(urls.unknownCredentialStore);
await a11yAudit();
@@ -86,13 +86,11 @@ module('Acceptance | host-catalogs | host sets | read', function (hooks) {
await click(`[href="${urls.hostSets}"]`);
assert.dom(`[href="${urls.hostSet}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
});
test('visiting an unknown host set displays 404 message', async function (assert) {
assert.expect(2);
await visit(urls.hostSets);
assert.dom(`[href="${urls.unknownHostSet}"]`).doesNotExist();
assert.expect(1);
await visit(urls.unknownHostSet);
await a11yAudit();
@@ -86,13 +86,11 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
await click(`[href="${urls.hosts}"]`);
assert.dom(`[href="${urls.host}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
});
test('visiting an unknown host displays 404 message', async function (assert) {
assert.expect(2);
await visit(urls.hosts);
assert.dom(`[href="${urls.unknownHost}"]`).doesNotExist();
assert.expect(1);
await visit(urls.unknownHost);
await a11yAudit();
@@ -90,8 +90,8 @@ module('Acceptance | host-catalogs | list', function (hooks) {
].includes('create')
);
assert
.dom(`nav:nth-child(2) a[href="${urls.hostCatalogs}"]`)
.doesNotExist();
.dom('[title="Resources"] a:nth-of-type(3)')
.doesNotIncludeText('Host Catalogs');
});
test('user can navigate to index with only create action', async function (assert) {
@@ -118,7 +118,7 @@ module('Acceptance | host-catalogs | list', function (hooks) {
await click(`[href="${urls.hostCatalogs}"]`);
assert.dom(`nav:nth-child(2) a[href="${urls.hostCatalog}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
});
test('user can navigate to index with only list action', async function (assert) {
@@ -78,13 +78,11 @@ module('Acceptance | host-catalogs | read', function (hooks) {
await click(`[href="${urls.hostCatalogs}"]`);
assert.dom(`[href="${urls.hostCatalog}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
});
test('visiting an unknown host catalog displays 404 message', async function (assert) {
assert.expect(2);
await visit(urls.hostCatalogs);
assert.dom(`[href="${urls.unknownHostCatalog}"]`).doesNotExist();
assert.expect(1);
await visit(urls.unknownHostCatalog);
await a11yAudit();
@@ -79,9 +79,7 @@ module('Acceptance | host-catalogs | update', function (hooks) {
await click(`[href="${urls.hostCatalog}"]`);
assert
.dom('.rose-layout-page-actions .rose-button-secondary')
.doesNotExist();
assert.dom('form [type="button"]').doesNotExist();
});
test('clicking cancel in edit mode does not save changes', async function (assert) {
+4 -1
View File
@@ -94,7 +94,10 @@ module('Acceptance | sessions', function (hooks) {
'list'
)
);
assert.dom(`[href="${urls.sessions}"]`).doesNotExist();
assert
.dom('[title="Resources"] a:first-of-type')
.doesNotIncludeText('Sessions');
});
test('users can navigate to sessions with proper authorization', async function (assert) {
@@ -236,7 +236,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
(item) => item !== 'add-credential-sources'
);
await visit(urls.brokeredCredentialSources);
assert.dom(`[href="${urls.addBrokeredCredentialSources}"]`).doesNotExist();
assert.dom('.rose-dropdown-content a:nth-child(2)').doesNotExist();
});
test('can select and cancel credential sources to add', async function (assert) {
@@ -264,9 +264,8 @@ module(
(item) => item !== 'add-credential-sources'
);
await visit(urls.injectedApplicationCredentialSources);
assert
.dom(`[href="${urls.addInjectedApplicationCredentialSources}"]`)
.doesNotExist();
assert.dom('.rose-dropdown-content a:nth-child(2)').doesNotExist();
});
test('can select and cancel credential sources to add', async function (assert) {
@@ -94,7 +94,7 @@ module('Acceptance | targets | read', function (hooks) {
await click(`[href="${urls.targets}"]`);
assert.dom(`[href="${urls.sshTarget}"]`).doesNotExist();
assert.dom('.rose-table-body tr:first-child a').doesNotExist();
assert.dom(`[href="${urls.tcpTarget}"]`).exists();
});
@@ -106,14 +106,12 @@ module('Acceptance | targets | read', function (hooks) {
await click(`[href="${urls.targets}"]`);
assert.dom(`[href="${urls.tcpTarget}"]`).doesNotExist();
assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
assert.dom(`[href="${urls.sshTarget}"]`).exists();
});
test('visiting an unknown target displays 404 message', async function (assert) {
assert.expect(2);
await visit(urls.targets);
assert.dom(`[href="${urls.unknownTarget}"]`).doesNotExist();
assert.expect(1);
await visit(urls.unknownTarget);
await a11yAudit();