{{t 'resources.target.workers.edit-ingress-worker-filter.title'}}
-
+
{{t
'resources.target.workers.edit-ingress-worker-filter.description'
@@ -26,7 +26,7 @@
-
-
-
- {{t 'resources.target.host-source.messages.welcome.description'}}
-
-
-
- {{t 'resources.target.actions.add-host-sources'}}
-
-
+
+
+
+
+
+
+
{{/if}}
diff --git a/ui/admin/app/templates/scopes/scope/targets/target/injected-application-credential-sources.hbs b/ui/admin/app/templates/scopes/scope/targets/target/injected-application-credential-sources.hbs
index 0a4e31f41b..04fd1cf4f6 100644
--- a/ui/admin/app/templates/scopes/scope/targets/target/injected-application-credential-sources.hbs
+++ b/ui/admin/app/templates/scopes/scope/targets/target/injected-application-credential-sources.hbs
@@ -110,26 +110,27 @@
{{else}}
-
-
- {{t
- 'resources.target.injected-application-credential-source.messages.welcome.description'
+
+
-
-
- {{t
- 'resources.target.actions.add-injected-application-credential-sources'
+ />
+
-
+ />
+
+
+
+
{{/if}}
diff --git a/ui/admin/app/templates/scopes/scope/targets/target/workers.hbs b/ui/admin/app/templates/scopes/scope/targets/target/workers.hbs
index eb51a2ee32..8c41131002 100644
--- a/ui/admin/app/templates/scopes/scope/targets/target/workers.hbs
+++ b/ui/admin/app/templates/scopes/scope/targets/target/workers.hbs
@@ -3,9 +3,9 @@
SPDX-License-Identifier: BUSL-1.1
}}
-{{page-title (t 'resources.target.workers.title')}}
+{{page-title (t 'titles.workers')}}
@@ -51,9 +51,13 @@
'resources.target.workers.accordion-label.ingress-workers'
}}
@@ -62,23 +66,20 @@
<:content>
{{#if @model.ingress_worker_filter}}
- {{t
- 'resources.target.workers.worker-filter.title'
- }}
+ {{t 'form.worker_filter.label'}}
{{t
'resources.target.workers.worker-filter.description'
}}
{{else}}
-
+
@@ -110,23 +117,20 @@
<:content>
{{#if @model.egress_worker_filter}}
- {{t
- 'resources.target.workers.worker-filter.title'
- }}
+ {{t 'form.worker_filter.label'}}
{{t
'resources.target.workers.worker-filter.description'
}}
{{else}}
-
+
-
+
{{#if (can 'create model' this.scope collection='users')}}
-
-
- {{t 'resources.user.messages.accounts.description'}}
-
-
-
- {{t 'resources.user.actions.add-accounts'}}
-
-
+
+
+
+
+
+
+
{{/if}}
diff --git a/ui/admin/app/templates/scopes/scope/users/user/add-accounts.hbs b/ui/admin/app/templates/scopes/scope/users/user/add-accounts.hbs
index 0b6ae827dc..ed0f2deddf 100644
--- a/ui/admin/app/templates/scopes/scope/users/user/add-accounts.hbs
+++ b/ui/admin/app/templates/scopes/scope/users/user/add-accounts.hbs
@@ -21,32 +21,13 @@
- {{#if @model.accounts}}
-
- {{/if}}
-
- {{#unless @model.accounts}}
-
-
-
- {{t 'resources.user.messages.no-accounts.description'}}
-
-
-
- {{t 'actions.back'}}
-
-
-
- {{/unless}}
+
\ No newline at end of file
diff --git a/ui/admin/app/templates/scopes/scope/workers.hbs b/ui/admin/app/templates/scopes/scope/workers.hbs
index 57d97163fd..5f7cc1edb2 100644
--- a/ui/admin/app/templates/scopes/scope/workers.hbs
+++ b/ui/admin/app/templates/scopes/scope/workers.hbs
@@ -3,10 +3,7 @@
SPDX-License-Identifier: BUSL-1.1
}}
-{{page-title (t 'resources.worker.title_plural')}}
-
+{{page-title (t 'titles.workers')}}
+
{{outlet}}
\ No newline at end of file
diff --git a/ui/admin/app/templates/scopes/scope/workers/index.hbs b/ui/admin/app/templates/scopes/scope/workers/index.hbs
index bf0879ce9b..6d1b24bd23 100644
--- a/ui/admin/app/templates/scopes/scope/workers/index.hbs
+++ b/ui/admin/app/templates/scopes/scope/workers/index.hbs
@@ -11,7 +11,7 @@
- {{t 'resources.worker.title_plural'}}
+ {{t 'titles.workers'}}
@@ -200,39 +200,21 @@
{{/if}}
{{else}}
-
-
- {{#if (can 'list worker' this.scope collection='workers')}}
- {{! can list (at least): show default welcome message}}
- {{t 'resources.worker.description'}}
- {{else if
- (can 'create worker led worker' this.scope collection='workers')
- }}
- {{! can create (only): show create-but-not-list welcome message}}
- {{t
- 'descriptions.create-but-not-list'
- resource=(t 'resources.worker.title_plural')
- }}
- {{else}}
- {{! can neither list nor create }}
- {{t
- 'descriptions.neither-list-nor-create'
- resource=(t 'resources.worker.title_plural')
- }}
- {{/if}}
-
+
+
+
{{#if
(can 'create worker led worker' this.scope collection='workers')
}}
-
-
- {{t 'titles.new'}}
-
+
+
+
{{/if}}
-
+
{{/if}}
diff --git a/ui/admin/config/environment.js b/ui/admin/config/environment.js
index 5d7e0b26ad..694597b6ba 100644
--- a/ui/admin/config/environment.js
+++ b/ui/admin/config/environment.js
@@ -101,8 +101,8 @@ module.exports = function (environment) {
'target.add-host-sources': '/docs/concepts/domain-model/host-sets',
'target.enable-session-recording':
'/docs/configuration/session-recording/enable-session-recording',
- 'target.worker-filters':
- '/docs/concepts/filtering/worker-tags#worker-filtering',
+ 'worker-filters-format':
+ '/docs/concepts/filtering/worker-tags#filter-examples',
user: '/docs/concepts/domain-model/users',
downloads: '/install',
'getting-started.desktop':
@@ -131,6 +131,7 @@ module.exports = function (environment) {
'storage-policy.update':
'/docs/configuration/session-recording/update-storage-policy',
alias: '/docs/concepts/aliases',
+ 'support-page': 'https://support.hashicorp.com/hc/en-us',
},
},
diff --git a/ui/admin/config/features.js b/ui/admin/config/features.js
index 5c0908787e..37e3a6483f 100644
--- a/ui/admin/config/features.js
+++ b/ui/admin/config/features.js
@@ -28,7 +28,7 @@ const baseEdition = {
'target-network-address': false,
'vault-worker-filter': false,
'ldap-auth-methods': false,
- 'dynamic-credentials-worker-filter': false,
+ 'host-catalog-worker-filter': false,
};
// Editions maps edition keys to their associated featuresets.
const featureEditions = {};
@@ -44,7 +44,7 @@ featureEditions.enterprise = {
...featureEditions.oss,
'target-worker-filters-v2-ingress': true,
'vault-worker-filter': true,
- 'dynamic-credentials-worker-filter': true,
+ 'host-catalog-worker-filter': true,
};
featureEditions.hcp = {
...featureEditions.enterprise,
diff --git a/ui/admin/package.json b/ui/admin/package.json
index adafd5834b..4e3943b7b5 100644
--- a/ui/admin/package.json
+++ b/ui/admin/package.json
@@ -10,7 +10,7 @@
"test": "tests"
},
"scripts": {
- "doc:toc": "doctoc README.md tests/e2e/README.md",
+ "doc:toc": "doctoc README.md",
"build:development": "ember build",
"build": "ember build --environment=production",
"build:oss": "EDITION=oss ember build --environment=production",
@@ -37,7 +37,8 @@
},
"dependencies": {
"ember-named-blocks-polyfill": "^0.2.5",
- "lodash": "^4.17.21"
+ "lodash": "^4.17.21",
+ "uuid": "^11.0.3"
},
"devDependencies": {
"@babel/core": "^7.25.2",
@@ -52,7 +53,6 @@
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"@hashicorp/ember-asciinema-player": "https://github.com/hashicorp/ember-asciinema-player.git#e047a096039cff70234c232efe75dcad74c6358a",
- "@playwright/test": "^1.43.0",
"babel-loader": "^9.2.1",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^9.1.0",
@@ -61,7 +61,6 @@
"ember-a11y-testing": "^7.0.0",
"ember-auto-import": "^2.8.1",
"ember-cli": "^5.12.0",
- "ember-cli-app-version": "^6.0.0",
"ember-cli-babel": "^8.2.0",
"ember-cli-code-coverage": "^1.0.3",
"ember-cli-content-security-policy": "^2.0.3",
@@ -94,7 +93,7 @@
"qunit": "^2.22.0",
"qunit-dom": "^3.2.1",
"rose": "*",
- "sinon": "^18.0.0",
+ "sinon": "^19.0.2",
"stylelint": "^15.10.1",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard-scss": "^11.0.0",
diff --git a/ui/admin/tests/acceptance/accounts/change-password-test.js b/ui/admin/tests/acceptance/accounts/change-password-test.js
index 034636019e..4787620175 100644
--- a/ui/admin/tests/acceptance/accounts/change-password-test.js
+++ b/ui/admin/tests/acceptance/accounts/change-password-test.js
@@ -5,15 +5,13 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
import {
authenticateSession,
- // These are left here intentionally for future reference.
- // currentSession,
invalidateSession,
} from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
@@ -36,7 +34,7 @@ module('Acceptance | accounts | change password', function (hooks) {
changePassword: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -48,7 +46,7 @@ module('Acceptance | accounts | change password', function (hooks) {
instances.account = this.server.create('account', {
scope: instances.scopes.org,
});
- authenticateSession({
+ await authenticateSession({
account_id: instances.account.id,
username: 'admin',
});
@@ -163,7 +161,7 @@ module('Acceptance | accounts | change password', function (hooks) {
});
test('cannot change password when not authenticated', async function (assert) {
- invalidateSession();
+ await invalidateSession();
await visit(urls.changePassword);
diff --git a/ui/admin/tests/acceptance/accounts/create-test.js b/ui/admin/tests/acceptance/accounts/create-test.js
index b1d7481857..0ce845a6fa 100644
--- a/ui/admin/tests/acceptance/accounts/create-test.js
+++ b/ui/admin/tests/acceptance/accounts/create-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -40,8 +35,8 @@ module('Acceptance | accounts | create', function (hooks) {
account: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/accounts/delete-test.js b/ui/admin/tests/acceptance/accounts/delete-test.js
index 68fa74aafe..c0cc9e9506 100644
--- a/ui/admin/tests/acceptance/accounts/delete-test.js
+++ b/ui/admin/tests/acceptance/accounts/delete-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, click, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -38,8 +33,8 @@ module('Acceptance | accounts | delete', function (hooks) {
account: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/accounts/list-test.js b/ui/admin/tests/acceptance/accounts/list-test.js
index f5ba216fb5..57396a8c36 100644
--- a/ui/admin/tests/acceptance/accounts/list-test.js
+++ b/ui/admin/tests/acceptance/accounts/list-test.js
@@ -5,14 +5,9 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -36,8 +31,8 @@ module('Acceptance | accounts | list', function (hooks) {
account: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/accounts/read-test.js b/ui/admin/tests/acceptance/accounts/read-test.js
index b702647b92..e640f312fd 100644
--- a/ui/admin/tests/acceptance/accounts/read-test.js
+++ b/ui/admin/tests/acceptance/accounts/read-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | accounts | read', function (hooks) {
@@ -35,8 +30,8 @@ module('Acceptance | accounts | read', function (hooks) {
account: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -58,7 +53,7 @@ module('Acceptance | accounts | read', function (hooks) {
test('can navigate to an account form', async function (assert) {
await visit(urls.accounts);
- await click(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK);
+ await click(commonSelectors.TABLE_RESOURCE_LINK(urls.account));
await a11yAudit();
assert.strictEqual(currentURL(), urls.account);
@@ -69,10 +64,12 @@ module('Acceptance | accounts | read', function (hooks) {
instances.account.authorized_actions.filter((item) => item !== 'read');
await visit(urls.accounts);
- assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.account))
+ .doesNotExist();
});
- test('user can navigate to account and incorrect url autocorrects', async function (assert) {
+ test('user can navigate to account and incorrect url auto-corrects', async function (assert) {
const authMethod = this.server.create('auth-method', {
scope: instances.scopes.org,
});
diff --git a/ui/admin/tests/acceptance/accounts/set-password-test.js b/ui/admin/tests/acceptance/accounts/set-password-test.js
index 86d4932e49..7e6d6c40cf 100644
--- a/ui/admin/tests/acceptance/accounts/set-password-test.js
+++ b/ui/admin/tests/acceptance/accounts/set-password-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -37,8 +32,8 @@ module('Acceptance | accounts | set password', function (hooks) {
setPassword: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/accounts/update-test.js b/ui/admin/tests/acceptance/accounts/update-test.js
index 360ddd1d26..af3195f338 100644
--- a/ui/admin/tests/acceptance/accounts/update-test.js
+++ b/ui/admin/tests/acceptance/accounts/update-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | accounts | update', function (hooks) {
@@ -36,8 +31,8 @@ module('Acceptance | accounts | update', function (hooks) {
account: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/aliases/create-test.js b/ui/admin/tests/acceptance/aliases/create-test.js
index 16c28b432d..f571bd9e5a 100644
--- a/ui/admin/tests/acceptance/aliases/create-test.js
+++ b/ui/admin/tests/acceptance/aliases/create-test.js
@@ -43,7 +43,7 @@ module('Acceptance | aliases | create', function (hooks) {
newAlias: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
urls.globalScope = `/scopes/global`;
urls.aliases = `${urls.globalScope}/aliases`;
@@ -51,7 +51,7 @@ module('Acceptance | aliases | create', function (hooks) {
getAliasCount = () => this.server.schema.aliases.all().models.length;
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('users can create a new alias with host and target info', async function (assert) {
diff --git a/ui/admin/tests/acceptance/aliases/delete-test.js b/ui/admin/tests/acceptance/aliases/delete-test.js
index 81885c1bbd..3c30d0296b 100644
--- a/ui/admin/tests/acceptance/aliases/delete-test.js
+++ b/ui/admin/tests/acceptance/aliases/delete-test.js
@@ -38,8 +38,8 @@ module('Acceptance | aliases | delete', function (hooks) {
target: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/aliases/list-test.js b/ui/admin/tests/acceptance/aliases/list-test.js
index 222d14cc60..39701da444 100644
--- a/ui/admin/tests/acceptance/aliases/list-test.js
+++ b/ui/admin/tests/acceptance/aliases/list-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click, currentURL, waitFor, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -44,7 +44,7 @@ module('Acceptance | aliases | list', function (hooks) {
aliasWithTarget: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -71,7 +71,7 @@ module('Acceptance | aliases | list', function (hooks) {
urls.aliasWithTarget = `${urls.aliases}/${instances.aliasWithTarget.id}`;
intl = this.owner.lookup('service:intl');
- authenticateSession({});
+ await authenticateSession({});
});
test('users can navigate to aliases with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/aliases/read-test.js b/ui/admin/tests/acceptance/aliases/read-test.js
index f40e955fa3..13817733f0 100644
--- a/ui/admin/tests/acceptance/aliases/read-test.js
+++ b/ui/admin/tests/acceptance/aliases/read-test.js
@@ -10,13 +10,13 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | aliases | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
- const MESSAGE_SELECTOR = '.rose-message-subtitle';
const TABLE_LINK_SELECTOR = '.hds-table__tbody tr:first-child a';
const instances = {
@@ -34,7 +34,7 @@ module('Acceptance | aliases | read', function (hooks) {
unknownAlias: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -48,7 +48,7 @@ module('Acceptance | aliases | read', function (hooks) {
urls.alias = `${urls.aliases}/${instances.alias.id}`;
urls.unknownAlias = `${urls.aliases}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting a alias', async function (assert) {
@@ -77,6 +77,8 @@ module('Acceptance | aliases | read', function (hooks) {
await visit(urls.unknownAlias);
await a11yAudit();
- assert.dom(MESSAGE_SELECTOR).hasText('Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
});
diff --git a/ui/admin/tests/acceptance/aliases/update-test.js b/ui/admin/tests/acceptance/aliases/update-test.js
index 37e49392de..2820e0c52f 100644
--- a/ui/admin/tests/acceptance/aliases/update-test.js
+++ b/ui/admin/tests/acceptance/aliases/update-test.js
@@ -48,7 +48,7 @@ module('Acceptance | aliases | update', function (hooks) {
target: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -66,7 +66,7 @@ module('Acceptance | aliases | update', function (hooks) {
urls.alias = `${urls.aliases}/${instances.alias.id}`;
aliasCount = () => this.server.schema.aliases.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('users can update an exisiting alias', async function (assert) {
diff --git a/ui/admin/tests/acceptance/auth-methods/create-test.js b/ui/admin/tests/acceptance/auth-methods/create-test.js
index cf7ca645d1..fe8c037823 100644
--- a/ui/admin/tests/acceptance/auth-methods/create-test.js
+++ b/ui/admin/tests/acceptance/auth-methods/create-test.js
@@ -5,54 +5,19 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, select } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // // These are left here intentionally for future reference.
- // //currentSession,
- // //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
+import * as selectors from './selectors';
module('Acceptance | auth-methods | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
- const DROPDOWN_SELECTOR_ICON =
- 'tbody .hds-table__tr:nth-child(1) .hds-table__td:last-child .hds-dropdown-toggle-icon';
- const DROPDOWN_SELECTOR_OPTION =
- '.hds-dropdown__content .hds-dropdown-list-item [type=button]';
- const NEW_DROPDOWN_SELECTOR =
- '[data-test-new-dropdown] .hds-dropdown-toggle-button';
- const SAVE_BTN_SELECTOR = '.rose-form-actions [type="submit"]';
- const CANCEL_BTN_SELECTOR = '.rose-form-actions [type="button"]';
- const NAME_INPUT_SELECTOR = '[name="name"]';
- const URLS_INPUT_SELECTOR = '[name="urls"]';
- const DESC_INPUT_SELECTOR = '[name="description"]';
- const ERROR_MSG_SELECTOR =
- '[data-test-toast-notification] .hds-alert__description';
- const FIELD_ERROR_TEXT_SELECTOR = '.hds-form-error__message';
-
- const CERTIFICATES_BTN_SELECTOR = '[name="certificates"] button';
- const CERTIFICATES_INPUT_SELECTOR = '[name="certificates"] textarea';
- const IDP_CERTS_INPUT_SELECTOR = '[name="idp_ca_certs"] textarea';
- const IDP_CERTS_BTN_SELECTOR = '[name="idp_ca_certs"] button';
-
- const ALLOWED_AUDIENCES_BTN_SELECTOR = '[name="allowed_audiences"] button';
- const ALLOWED_AUDIENCES_INPUT_SELECTOR = '[name="allowed_audiences"] input';
-
- const CLAIMS_SCOPES_BTN_SELECTOR = '[name="claims_scopes"] button';
- const CLAIMS_SCOPES_INPUT_SELECTOR = '[name="claims_scopes"] input';
- const TOGGLE_SELECTOR = '[name="prompts"]';
-
- const MANAGE_DROPDOWN_SELECTOR =
- '[data-test-manage-auth-method] button:first-child';
- const MAKE_PRIMARY_SELECTOR =
- '[data-test-manage-auth-method] ul li:first-child button';
-
let getAuthMethodsCount;
let featuresService;
@@ -74,8 +39,8 @@ module('Acceptance | auth-methods | create', function (hooks) {
authMethod: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.orgScope = this.server.create(
'scope',
{
@@ -110,9 +75,12 @@ module('Acceptance | auth-methods | create', function (hooks) {
const count = getAuthMethodsCount();
await visit(urls.newAuthMethod);
- await fillIn(NAME_INPUT_SELECTOR, 'AuthMethod name');
- await fillIn(DESC_INPUT_SELECTOR, 'description');
- await click(SAVE_BTN_SELECTOR);
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ await click(commonSelectors.SAVE_BTN);
assert.strictEqual(getAuthMethodsCount(), count + 1);
});
@@ -120,123 +88,223 @@ module('Acceptance | auth-methods | create', function (hooks) {
const count = getAuthMethodsCount();
await visit(`${urls.authMethods}/new?type=oidc`);
- const name = 'oidc name';
- await fillIn(NAME_INPUT_SELECTOR, name);
- await fillIn(DESC_INPUT_SELECTOR, 'description');
- await fillIn('[name="issuer"]', 'issuer');
- await fillIn('[name="client_id"]', 'client_id');
- await fillIn('[name="client_secret"]', 'client_secret');
- await select('form fieldset:nth-of-type(1) select', 'RS384');
- await click('[data-test-add-option-button]');
- await fillIn(ALLOWED_AUDIENCES_INPUT_SELECTOR, 'allowed_audiences');
- await click(ALLOWED_AUDIENCES_BTN_SELECTOR, 'allowed_audiences');
- await fillIn(CLAIMS_SCOPES_INPUT_SELECTOR, 'claims_scopes');
- await click(CLAIMS_SCOPES_BTN_SELECTOR, 'claims_scopes');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ await fillIn(selectors.FIELD_ISSUER, selectors.FIELD_ISSUER_VALUE);
+ await fillIn(selectors.FIELD_CLIENT_ID, selectors.FIELD_CLIENT_ID_VALUE);
+ await fillIn(
+ selectors.FIELD_CLIENT_SECRET,
+ selectors.FIELD_CLIENT_SECRET_VALUE,
+ );
+ await select(
+ selectors.FIELD_SIGNING_ALGORITHMS,
+ selectors.FIELD_SIGNING_ALGORITHMS_VALUE,
+ );
+ await click(selectors.FIELD_SIGNING_ALGORITHMS_ADD_BTN);
+ await fillIn(
+ selectors.FIELD_ALLOWED_AUDIENCES,
+ selectors.FIELD_ALLOWED_AUDIENCES_VALUE,
+ );
+ await click(selectors.FIELD_ALLOWED_AUDIENCES_ADD_BTN);
+ await fillIn(
+ selectors.FIELD_CLAIMS_SCOPES,
+ selectors.FIELD_CLAIMS_SCOPES_VALUE,
+ );
+ await click(selectors.FIELD_CLAIMS_SCOPES_ADD_BTN);
await fillIn(
- '[name="account_claim_maps"] tbody td:nth-of-type(1) input',
- 'from_claim',
+ selectors.FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM,
+ selectors.FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM_VALUE,
);
await select(
- '[name="account_claim_maps"] tbody td:nth-of-type(2) select',
- 'email',
+ selectors.FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM,
+ selectors.FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM_VALUE,
);
+ await click(selectors.FIELD_ACCOUNT_CLAIM_MAPS_ADD_BTN);
- await click('[name="account_claim_maps"] button');
+ await fillIn(selectors.FIELD_IDP_CERTS, selectors.FIELD_IDP_CERTS_VALUE);
+ await click(selectors.FIELD_IDP_CERTS_ADD_BTN);
+ await fillIn(selectors.FIELD_MAX_AGE, selectors.FIELD_MAX_AGE_VALUE);
- await fillIn(IDP_CERTS_INPUT_SELECTOR, 'certificates');
- await click(IDP_CERTS_BTN_SELECTOR);
- await fillIn('[name="max_age"]', '5');
- await fillIn('[name="api_url_prefix"]', 'api_url_prefix');
- await click('[id="consent"]', 'consent');
+ await fillIn(
+ selectors.FIELD_API_URL_PREFIX,
+ selectors.FIELD_API_URL_PREFIX_VALUE,
+ );
+ await click(selectors.FIELD_PROMPTS_CONSENT);
//If skip prompts toggle is clicked, then we hide the rest of the prompt options
- await click(TOGGLE_SELECTOR);
- assert.dom('[id="select_account"]').isNotVisible();
- await click(SAVE_BTN_SELECTOR);
+ await click(selectors.FIELD_PROMPTS);
+ assert.dom(selectors.FIELD_PROMPTS_SELECT_ACCOUNT).isNotVisible();
+ await click(commonSelectors.SAVE_BTN);
assert.strictEqual(getAuthMethodsCount(), count + 1);
- const authMethod = this.server.schema.authMethods.findBy({ name });
- assert.strictEqual(authMethod.name, name);
- assert.strictEqual(authMethod.description, 'description');
- assert.strictEqual(authMethod.attributes.issuer, 'issuer');
- assert.strictEqual(authMethod.attributes.client_id, 'client_id');
- assert.deepEqual(authMethod.attributes.signing_algorithms, ['RS384']);
+ const authMethod = this.server.schema.authMethods.findBy({
+ name: commonSelectors.FIELD_NAME_VALUE,
+ });
+ assert.strictEqual(authMethod.name, commonSelectors.FIELD_NAME_VALUE);
+ assert.strictEqual(
+ authMethod.description,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ assert.strictEqual(
+ authMethod.attributes.issuer,
+ selectors.FIELD_ISSUER_VALUE,
+ );
+ assert.strictEqual(
+ authMethod.attributes.client_id,
+ selectors.FIELD_CLIENT_ID_VALUE,
+ );
+ assert.deepEqual(authMethod.attributes.signing_algorithms, [
+ selectors.FIELD_SIGNING_ALGORITHMS_VALUE,
+ ]);
assert.deepEqual(authMethod.attributes.allowed_audiences, [
- 'allowed_audiences',
+ selectors.FIELD_ALLOWED_AUDIENCES_VALUE,
+ ]);
+ assert.deepEqual(authMethod.attributes.claims_scopes, [
+ selectors.FIELD_CLAIMS_SCOPES_VALUE,
]);
- assert.deepEqual(authMethod.attributes.claims_scopes, ['claims_scopes']);
assert.deepEqual(authMethod.attributes.account_claim_maps, [
- 'from_claim=email',
+ `${selectors.FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM_VALUE}=${selectors.FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM_VALUE}`,
]);
- assert.deepEqual(authMethod.attributes.idp_ca_certs, ['certificates']);
- assert.strictEqual(authMethod.attributes.max_age, 5);
- assert.strictEqual(authMethod.attributes.api_url_prefix, 'api_url_prefix');
+ assert.deepEqual(authMethod.attributes.idp_ca_certs, [
+ selectors.FIELD_IDP_CERTS_VALUE,
+ ]);
+ assert.strictEqual(
+ authMethod.attributes.max_age,
+ parseInt(selectors.FIELD_MAX_AGE_VALUE),
+ );
+ assert.strictEqual(
+ authMethod.attributes.api_url_prefix,
+ selectors.FIELD_API_URL_PREFIX_VALUE,
+ );
assert.deepEqual(authMethod.attributes.prompts, ['none']);
});
test('Users can create a new ldap auth method', async function (assert) {
featuresService.enable('ldap-auth-methods');
const authMethodsCount = getAuthMethodsCount();
- const name = 'ldap auth method';
await visit(urls.authMethods);
- await click(NEW_DROPDOWN_SELECTOR);
- await click(`[href="${urls.newLdapAuthMethod}"]`);
- await fillIn(NAME_INPUT_SELECTOR, name);
- await fillIn(DESC_INPUT_SELECTOR, 'description');
- await fillIn('[name="urls"]', 'url1,url2');
- await fillIn(CERTIFICATES_INPUT_SELECTOR, 'certificate');
- await click(CERTIFICATES_BTN_SELECTOR);
- await fillIn('[name="client_certificate"]', 'client cert');
- await fillIn('[name="client_certificate_key"]', 'client cert key');
- await click('[name="start_tls"]');
- await click('[name="insecure_tls"]');
- await fillIn('[name="bind_dn"]', 'bind dn');
- await fillIn('[name="bind_password"]', 'password');
- await fillIn('[name="upn_domain"]', 'upn domain');
- await click('[name="discover_dn"]');
- await click('[name="anon_group_search"]');
- await fillIn('[name="user_dn"]', 'user dn');
- await fillIn('[name="user_attr"]', 'user attr');
- await fillIn('[name="user_filter"]', 'user filter');
- await fillIn('[name="account_attribute_maps"] input', 'attribute');
- await select('[name="account_attribute_maps"] select', 'email');
- await click('[name="account_attribute_maps"] button');
- await fillIn('[name="group_dn"]', 'group dn');
- await fillIn('[name="group_attr"]', 'group attr');
- await fillIn('[name="group_filter"]', 'group filter');
- await click('[name="enable_groups"]');
- await click('[name="use_token_groups"]');
- await click(SAVE_BTN_SELECTOR);
+ await click(selectors.NEW_DROPDOWN);
+ await click(commonSelectors.HREF(urls.newLdapAuthMethod));
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ await fillIn(selectors.FIELD_URLS, selectors.FIELD_URLS_VALUE);
+ await fillIn(
+ selectors.FIELD_CERTIFICATES,
+ selectors.FIELD_CERTIFICATES_VALUE,
+ );
+ await click(selectors.FIELD_CERTIFICATES_ADD_BTN);
+ await fillIn(
+ selectors.FIELD_CLIENT_CERTIFICATE,
+ selectors.FIELD_CLIENT_CERTIFICATE_VALUE,
+ );
+ await fillIn(
+ selectors.FIELD_CLIENT_CERTIFICATE_KEY,
+ selectors.FIELD_CLIENT_CERTIFICATE_KEY_VALUE,
+ );
+ await click(selectors.FIELD_START_TLS);
+ await click(selectors.FIELD_INSECURE_TLS);
+ await fillIn(selectors.FIELD_BIND_DN, selectors.FIELD_BIND_DN_VALUE);
+ await fillIn(
+ selectors.FIELD_BIND_PASSWORD,
+ selectors.FIELD_BIND_PASSWORD_VALUE,
+ );
+ await fillIn(selectors.FIELD_UPN_DOMAIN, selectors.FIELD_UPN_DOMAIN_VALUE);
+ await click(selectors.FIELD_DISCOVER_DN);
+ await click(selectors.FIELD_ANON_GROUP_SEARCH);
+ await fillIn(selectors.FIELD_USER_DN, selectors.FIELD_USER_DN_VALUE);
+ await fillIn(selectors.FIELD_USER_ATTR, selectors.FIELD_USER_ATTR_VALUE);
+ await fillIn(
+ selectors.FIELD_USER_FILTER,
+ selectors.FIELD_USER_FILTER_VALUE,
+ );
+ await fillIn(
+ selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_FROM,
+ selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_FROM_VALUE,
+ );
+ await select(
+ selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO,
+ selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO_VALUE,
+ );
+ await click(selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_ADD_BTN);
+ await fillIn(selectors.FIELD_GROUP_DN, selectors.FIELD_GROUP_DN_VALUE);
+ await fillIn(selectors.FIELD_GROUP_ATTR, selectors.FIELD_GROUP_ATTR_VALUE);
+ await fillIn(
+ selectors.FIELD_GROUP_FILTER,
+ selectors.FIELD_GROUP_FILTER_VALUE,
+ );
+ await click(selectors.FIELD_ENABLE_GROUPS);
+ await click(selectors.FIELD_USE_TOKEN_GROUPS);
+ await click(commonSelectors.SAVE_BTN);
assert.strictEqual(getAuthMethodsCount(), authMethodsCount + 1);
- const ldapAuthMethod = this.server.schema.authMethods.findBy({ name });
- assert.strictEqual(ldapAuthMethod.name, name);
- assert.strictEqual(ldapAuthMethod.description, 'description');
- assert.deepEqual(ldapAuthMethod.attributes.urls, ['url1', 'url2']);
- assert.deepEqual(ldapAuthMethod.attributes.certificates, ['certificate']);
+ const ldapAuthMethod = this.server.schema.authMethods.findBy({
+ name: commonSelectors.FIELD_NAME_VALUE,
+ });
+ assert.strictEqual(ldapAuthMethod.name, commonSelectors.FIELD_NAME_VALUE);
+ assert.strictEqual(
+ ldapAuthMethod.description,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ assert.deepEqual(
+ ldapAuthMethod.attributes.urls,
+ selectors.FIELD_URLS_VALUE.split(','),
+ );
+ assert.deepEqual(ldapAuthMethod.attributes.certificates, [
+ selectors.FIELD_CERTIFICATES_VALUE,
+ ]);
assert.strictEqual(
ldapAuthMethod.attributes.client_certificate,
- 'client cert',
+ selectors.FIELD_CLIENT_CERTIFICATE_VALUE,
);
assert.notOk(ldapAuthMethod.attributes.client_certificate_key);
assert.true(ldapAuthMethod.attributes.start_tls);
assert.true(ldapAuthMethod.attributes.insecure_tls);
- assert.strictEqual(ldapAuthMethod.attributes.bind_dn, 'bind dn');
+ assert.strictEqual(
+ ldapAuthMethod.attributes.bind_dn,
+ selectors.FIELD_BIND_DN_VALUE,
+ );
assert.notOk(ldapAuthMethod.attributes.bind_password);
- assert.strictEqual(ldapAuthMethod.attributes.upn_domain, 'upn domain');
+ assert.strictEqual(
+ ldapAuthMethod.attributes.upn_domain,
+ selectors.FIELD_UPN_DOMAIN_VALUE,
+ );
assert.true(ldapAuthMethod.attributes.discover_dn);
assert.true(ldapAuthMethod.attributes.anon_group_search);
- assert.strictEqual(ldapAuthMethod.attributes.user_dn, 'user dn');
- assert.strictEqual(ldapAuthMethod.attributes.user_attr, 'user attr');
- assert.strictEqual(ldapAuthMethod.attributes.user_filter, 'user filter');
+ assert.strictEqual(
+ ldapAuthMethod.attributes.user_dn,
+ selectors.FIELD_USER_DN_VALUE,
+ );
+ assert.strictEqual(
+ ldapAuthMethod.attributes.user_attr,
+ selectors.FIELD_USER_ATTR_VALUE,
+ );
+ assert.strictEqual(
+ ldapAuthMethod.attributes.user_filter,
+ selectors.FIELD_USER_FILTER_VALUE,
+ );
assert.deepEqual(ldapAuthMethod.attributes.account_attribute_maps, [
- 'attribute=email',
+ `${selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_FROM_VALUE}=${selectors.FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO_VALUE}`,
]);
- assert.strictEqual(ldapAuthMethod.attributes.group_dn, 'group dn');
- assert.strictEqual(ldapAuthMethod.attributes.group_attr, 'group attr');
- assert.strictEqual(ldapAuthMethod.attributes.group_filter, 'group filter');
+ assert.strictEqual(
+ ldapAuthMethod.attributes.group_dn,
+ selectors.FIELD_GROUP_DN_VALUE,
+ );
+ assert.strictEqual(
+ ldapAuthMethod.attributes.group_attr,
+ selectors.FIELD_GROUP_ATTR_VALUE,
+ );
+ assert.strictEqual(
+ ldapAuthMethod.attributes.group_filter,
+ selectors.FIELD_GROUP_FILTER_VALUE,
+ );
assert.true(ldapAuthMethod.attributes.enable_groups);
assert.true(ldapAuthMethod.attributes.use_token_groups);
});
@@ -248,7 +316,7 @@ module('Acceptance | auth-methods | create', function (hooks) {
];
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
assert.true(
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
@@ -256,23 +324,22 @@ module('Acceptance | auth-methods | create', function (hooks) {
),
);
- await click(NEW_DROPDOWN_SELECTOR);
-
- assert.dom(`[href="${urls.newAuthMethod}"]`).exists();
+ await click(selectors.NEW_DROPDOWN);
+ assert.dom(commonSelectors.HREF(urls.newAuthMethod)).isVisible();
});
test('Users cannot navigate to new auth-methods route without proper authorization', async function (assert) {
instances.orgScope.authorized_collection_actions['auth-methods'] = ['list'];
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
assert.false(
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
'create',
),
);
- assert.dom(NEW_DROPDOWN_SELECTOR).doesNotExist();
+ assert.dom(selectors.NEW_DROPDOWN).doesNotExist();
});
test('Users can navigate to new ldap auth-method route with proper authorization and feature flag enabled', async function (assert) {
@@ -283,7 +350,7 @@ module('Acceptance | auth-methods | create', function (hooks) {
featuresService.enable('ldap-auth-methods');
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
assert.true(
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
@@ -291,9 +358,8 @@ module('Acceptance | auth-methods | create', function (hooks) {
),
);
- await click(NEW_DROPDOWN_SELECTOR);
-
- assert.dom(`[href="${urls.newLdapAuthMethod}"]`).exists();
+ await click(selectors.NEW_DROPDOWN);
+ assert.dom(commonSelectors.HREF(urls.newLdapAuthMethod)).isVisible();
});
test('Users cannot navigate to new ldap auth-method route when feature flag disabled', async function (assert) {
@@ -303,7 +369,7 @@ module('Acceptance | auth-methods | create', function (hooks) {
];
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
assert.true(
instances.orgScope.authorized_collection_actions['auth-methods'].includes(
@@ -311,20 +377,22 @@ module('Acceptance | auth-methods | create', function (hooks) {
),
);
- await click(NEW_DROPDOWN_SELECTOR);
-
- assert.dom(`[href="${urls.newLdapAuthMethod}"]`).doesNotExist();
+ await click(selectors.NEW_DROPDOWN);
+ assert.dom(commonSelectors.HREF(urls.newLdapAuthMethod)).doesNotExist();
});
test('can cancel new auth method creation', async function (assert) {
const count = getAuthMethodsCount();
await visit(urls.authMethods);
- await click(NEW_DROPDOWN_SELECTOR);
- await click(`[href="${urls.newAuthMethod}"]`);
- await fillIn(NAME_INPUT_SELECTOR, 'AuthMethod name');
- await fillIn(DESC_INPUT_SELECTOR, 'description');
- await click(CANCEL_BTN_SELECTOR);
+ await click(selectors.NEW_DROPDOWN);
+ await click(commonSelectors.HREF(urls.newAuthMethod));
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ await click(commonSelectors.CANCEL_BTN);
assert.strictEqual(getAuthMethodsCount(), count);
assert.strictEqual(currentURL(), urls.authMethods);
@@ -337,9 +405,9 @@ module('Acceptance | auth-methods | create', function (hooks) {
);
await visit(urls.authMethods);
- await click(`[href="${urls.authMethod}"]`);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(MAKE_PRIMARY_SELECTOR);
+ await click(commonSelectors.HREF(urls.authMethod));
+ await click(selectors.MANAGE_DROPDOWN);
+ await click(selectors.MANAGE_DROPDOWN_MAKE_PRIMARY);
const scope = this.server.schema.scopes.find(instances.orgScope.id);
assert.strictEqual(
@@ -365,10 +433,12 @@ module('Acceptance | auth-methods | create', function (hooks) {
instances.orgScope.primaryAuthMethodId,
'Primary auth method is not yet set.',
);
+
await visit(urls.authMethod);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(MAKE_PRIMARY_SELECTOR);
- assert.dom(ERROR_MSG_SELECTOR).exists();
+ await click(selectors.MANAGE_DROPDOWN);
+ await click(selectors.MANAGE_DROPDOWN_MAKE_PRIMARY);
+
+ assert.dom(commonSelectors.ALERT_TOAST).isVisible();
});
test('user can remove as primary an auth method', async function (assert) {
@@ -381,9 +451,9 @@ module('Acceptance | auth-methods | create', function (hooks) {
);
await visit(urls.authMethods);
- await click(`[href="${urls.authMethod}"]`);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(MAKE_PRIMARY_SELECTOR);
+ await click(commonSelectors.HREF(urls.authMethod));
+ await click(selectors.MANAGE_DROPDOWN);
+ await click(selectors.MANAGE_DROPDOWN_MAKE_PRIMARY);
const scope = this.server.schema.scopes.find(instances.orgScope.id);
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
});
@@ -410,11 +480,11 @@ module('Acceptance | auth-methods | create', function (hooks) {
);
await visit(urls.authMethods);
- await click(`[href="${urls.authMethod}"]`);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(MAKE_PRIMARY_SELECTOR);
+ await click(commonSelectors.HREF(urls.authMethod));
+ await click(selectors.MANAGE_DROPDOWN);
+ await click(selectors.MANAGE_DROPDOWN_MAKE_PRIMARY);
- assert.dom(ERROR_MSG_SELECTOR).hasText('Sorry!');
+ assert.dom(commonSelectors.ALERT_TOAST_BODY).hasText('Sorry!');
});
test('user can make and remove primary auth methods from index', async function (assert) {
@@ -424,9 +494,9 @@ module('Acceptance | auth-methods | create', function (hooks) {
);
await visit(urls.authMethods);
- await click(DROPDOWN_SELECTOR_ICON);
- assert.dom(DROPDOWN_SELECTOR_OPTION).exists();
- await click(DROPDOWN_SELECTOR_OPTION);
+ await click(selectors.TABLE_FIRST_ROW_ACTION_DROPDOWN);
+ assert.dom(selectors.TABLE_FIRST_ROW_ACTION_FIRST_ITEM).isVisible();
+ await click(selectors.TABLE_FIRST_ROW_ACTION_FIRST_ITEM);
let scope = this.server.schema.scopes.find(instances.orgScope.id);
@@ -435,9 +505,9 @@ module('Acceptance | auth-methods | create', function (hooks) {
instances.authMethod.id,
'Primary auth method is set.',
);
- await click(DROPDOWN_SELECTOR_ICON);
- await click(DROPDOWN_SELECTOR_OPTION);
+ await click(selectors.TABLE_FIRST_ROW_ACTION_DROPDOWN);
+ await click(selectors.TABLE_FIRST_ROW_ACTION_FIRST_ITEM);
scope = this.server.schema.scopes.find(instances.orgScope.id);
assert.notOk(scope.primaryAuthMethodId, 'Primary auth method is unset.');
@@ -466,15 +536,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
await visit(urls.authMethods);
- await click(NEW_DROPDOWN_SELECTOR);
- await click(`[href="${urls.newLdapAuthMethod}"]`);
- await fillIn(URLS_INPUT_SELECTOR, '');
- await click(SAVE_BTN_SELECTOR);
+ await click(selectors.NEW_DROPDOWN);
+ await click(commonSelectors.HREF(urls.newLdapAuthMethod));
+ await fillIn(selectors.FIELD_URLS, '');
+ await click(commonSelectors.SAVE_BTN);
- assert.dom(ERROR_MSG_SELECTOR).hasText('The request was invalid.');
assert
- .dom(FIELD_ERROR_TEXT_SELECTOR)
- .hasText('At least one URL is required.');
+ .dom(commonSelectors.ALERT_TOAST_BODY)
+ .hasText('The request was invalid.');
+ assert.dom(selectors.FIELD_ERROR).hasText('At least one URL is required.');
});
test('users cannot directly navigate to new auth method route without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/auth-methods/delete-test.js b/ui/admin/tests/acceptance/auth-methods/delete-test.js
index b15b4f9afc..b4b92b6789 100644
--- a/ui/admin/tests/acceptance/auth-methods/delete-test.js
+++ b/ui/admin/tests/acceptance/auth-methods/delete-test.js
@@ -5,18 +5,14 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // // These are left here intentionally for future reference.
- // //currentSession,
- // //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_LDAP } from 'api/models/auth-method';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | auth-methods | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -26,8 +22,6 @@ module('Acceptance | auth-methods | delete', function (hooks) {
let featuresService;
let getAuthMethodCount;
- const DIALOG_DELETE_BTN_SELECTOR = '.rose-dialog .rose-button-primary';
- const DIALOG_CANCEL_BTN_SELECTOR = '.rose-dialog .rose-button-secondary';
const ERROR_MSG_SELECTOR =
'[data-test-toast-notification] .hds-alert__description';
@@ -51,9 +45,9 @@ module('Acceptance | auth-methods | delete', function (hooks) {
ldapAuthMethod: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Setup Mirage mock resources for this test
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -181,7 +175,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.authMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click(DIALOG_DELETE_BTN_SELECTOR);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.authMethods);
assert.strictEqual(getAuthMethodCount(), authMethodCount - 1);
@@ -197,7 +191,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.ldapAuthMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click(DIALOG_DELETE_BTN_SELECTOR);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.authMethods);
assert.strictEqual(getAuthMethodCount(), authMethodCount - 1);
@@ -212,7 +206,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.authMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click(DIALOG_CANCEL_BTN_SELECTOR);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.authMethod);
assert.strictEqual(getAuthMethodCount(), authMethodCount);
@@ -228,7 +222,7 @@ module('Acceptance | auth-methods | delete', function (hooks) {
await click(`[href="${urls.ldapAuthMethod}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click(DIALOG_CANCEL_BTN_SELECTOR);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.ldapAuthMethod);
assert.strictEqual(getAuthMethodCount(), authMethodCount);
diff --git a/ui/admin/tests/acceptance/auth-methods/list-test.js b/ui/admin/tests/acceptance/auth-methods/list-test.js
index 9984296e61..6ddc05a5e9 100644
--- a/ui/admin/tests/acceptance/auth-methods/list-test.js
+++ b/ui/admin/tests/acceptance/auth-methods/list-test.js
@@ -5,35 +5,22 @@
import { module, test } from 'qunit';
import { visit, click, waitFor, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import {
TYPE_AUTH_METHOD_PASSWORD,
TYPE_AUTH_METHOD_OIDC,
} from 'api/models/auth-method';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
+import * as selectors from './selectors';
module('Acceptance | auth-methods | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupIndexedDb(hooks);
- const SEARCH_INPUT_SELECTOR = '.search-filtering [type="search"]';
- const NO_RESULTS_MSG_SELECTOR = '[data-test-no-auth-method-results]';
- const FILTER_DROPDOWN_SELECTOR = (name) =>
- `.search-filtering [name="${name}"] button`;
- const FILTER_APPLY_BUTTON_SELECTOR =
- '.search-filtering [data-test-dropdown-apply-button]';
- const AUTH_ACTIONS_SELECTOR = (id) =>
- `tbody [data-test-auth-methods-table-row="${id}"] .hds-table__td:last-child .hds-dropdown button`;
- const MAKE_PRIMARY_ACTION_SELECTOR = '[data-test-make-primary-action]';
-
const instances = {
scopes: {
global: null,
@@ -51,7 +38,7 @@ module('Acceptance | auth-methods | list', function (hooks) {
oidcAuthMethod: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create(
'scope',
@@ -75,34 +62,34 @@ module('Acceptance | auth-methods | list', function (hooks) {
urls.passwordAuthMethod = `${urls.authMethods}/${instances.passwordAuthMethod.id}`;
urls.oidcAuthMethod = `${urls.authMethods}/${instances.oidcAuthMethod.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('users can navigate to auth methods with proper authorization', async function (assert) {
await visit(urls.globalScope);
- await click(`[href="${urls.orgScope}"]`);
+ await click(commonSelectors.HREF(urls.orgScope));
assert.true(
instances.scopes.org.authorized_collection_actions[
'auth-methods'
].includes('list'),
);
- assert.dom(`[href="${urls.authMethods}"]`).exists();
+ assert.dom(commonSelectors.HREF(urls.authMethods)).isVisible();
});
test('users cannot navigate to index without either list or create actions', async function (assert) {
instances.scopes.org.authorized_collection_actions['auth-methods'] = [];
await visit(urls.globalScope);
- await click(`[href="${urls.orgScope}"]`);
+ await click(commonSelectors.HREF(urls.orgScope));
assert.false(
instances.scopes.org.authorized_collection_actions[
'auth-methods'
].includes('list'),
);
- assert.dom(`[href="${urls.authMethods}"]`).doesNotExist();
+ assert.dom(commonSelectors.HREF(urls.authMethods)).isNotVisible();
});
test('users can navigate to index with only create action', async function (assert) {
@@ -111,73 +98,79 @@ module('Acceptance | auth-methods | list', function (hooks) {
];
await visit(urls.globalScope);
- await click(`[href="${urls.orgScope}"]`);
-
- assert.dom(`[href="${urls.authMethods}"]`).exists();
+ await click(commonSelectors.HREF(urls.orgScope));
+ assert.dom(commonSelectors.HREF(urls.authMethods)).isVisible();
});
test('user can search for a specifc auth-method by id', async function (assert) {
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isVisible();
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).exists();
+ await fillIn(selectors.SEARCH_BAR_INPUT, instances.passwordAuthMethod.id);
+ await waitFor(commonSelectors.HREF(urls.oidcAuthMethod), { count: 0 });
- await fillIn(SEARCH_INPUT_SELECTOR, instances.passwordAuthMethod.id);
- await waitFor(`[href="${urls.oidcAuthMethod}"]`, { count: 0 });
-
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).doesNotExist();
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isNotVisible();
});
test('user can search for auth-methods and get no results', async function (assert) {
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
-
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).exists();
+ await click(commonSelectors.HREF(urls.authMethods));
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isVisible();
- await fillIn(SEARCH_INPUT_SELECTOR, 'fake target that does not exist');
- await waitFor(NO_RESULTS_MSG_SELECTOR, { count: 1 });
+ await fillIn(selectors.SEARCH_BAR_INPUT, 'fake target that does not exist');
+ await waitFor(commonSelectors.PAGE_MESSAGE_HEADER, { count: 1 });
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).doesNotExist();
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).doesNotExist();
- assert.dom(NO_RESULTS_MSG_SELECTOR).includesText('No results found');
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isNotVisible();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isNotVisible();
+ assert
+ .dom(commonSelectors.PAGE_MESSAGE_HEADER)
+ .includesText('No results found');
});
test('user can filter for auth-methods by type', async function (assert) {
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isVisible();
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).exists();
-
- await click(FILTER_DROPDOWN_SELECTOR('type'));
- await click(`input[value="${TYPE_AUTH_METHOD_PASSWORD}"]`);
- await click(FILTER_APPLY_BUTTON_SELECTOR);
+ await click(commonSelectors.FILTER_DROPDOWN('type'));
+ await click(
+ commonSelectors.FILTER_DROPDOWN_ITEM(TYPE_AUTH_METHOD_PASSWORD),
+ );
+ await click(commonSelectors.FILTER_DROPDOWN_ITEM_APPLY_BTN('type'));
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).doesNotExist();
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isNotVisible();
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
});
test('user can filter for auth-methods by primary', async function (assert) {
await visit(urls.orgScope);
- await click(`[href="${urls.authMethods}"]`);
+ await click(commonSelectors.HREF(urls.authMethods));
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isVisible();
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).exists();
+ await click(
+ selectors.TABLE_ACTION_DROPDOWN(instances.passwordAuthMethod.id),
+ );
+ await click(
+ selectors.TABLE_ACTION_DROPDOWN_MAKE_PRIMARY(
+ instances.passwordAuthMethod.id,
+ ),
+ );
- await click(AUTH_ACTIONS_SELECTOR(instances.passwordAuthMethod.id));
- await click(MAKE_PRIMARY_ACTION_SELECTOR);
- await click(FILTER_DROPDOWN_SELECTOR('primary'));
- await click(`input[value="true"]`);
- await click(FILTER_APPLY_BUTTON_SELECTOR);
+ await click(commonSelectors.FILTER_DROPDOWN('primary'));
+ await click(commonSelectors.FILTER_DROPDOWN_ITEM('true'));
+ await click(commonSelectors.FILTER_DROPDOWN_ITEM_APPLY_BTN('primary'));
- assert.dom(`[href="${urls.oidcAuthMethod}"]`).doesNotExist();
- assert.dom(`[href="${urls.passwordAuthMethod}"]`).exists();
+ assert.dom(commonSelectors.HREF(urls.oidcAuthMethod)).isNotVisible();
+ assert.dom(commonSelectors.HREF(urls.passwordAuthMethod)).isVisible();
});
});
diff --git a/ui/admin/tests/acceptance/auth-methods/oidc-test.js b/ui/admin/tests/acceptance/auth-methods/oidc-test.js
index 48792c0a76..43bf98e1dd 100644
--- a/ui/admin/tests/acceptance/auth-methods/oidc-test.js
+++ b/ui/admin/tests/acceptance/auth-methods/oidc-test.js
@@ -4,24 +4,12 @@
*/
import { module, test } from 'qunit';
-import {
- visit,
- currentURL,
- click,
- // fillIn,
- find,
- // findAll,
-} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, currentURL, click, find } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
//import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
@@ -47,8 +35,8 @@ module('Acceptance | auth-methods | oidc', function (hooks) {
authMethod: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/auth-methods/read-test.js b/ui/admin/tests/acceptance/auth-methods/read-test.js
index 338d9cd61c..0b3fd07388 100644
--- a/ui/admin/tests/acceptance/auth-methods/read-test.js
+++ b/ui/admin/tests/acceptance/auth-methods/read-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
@@ -47,9 +47,9 @@ module('Acceptance | auth-methods | read', function (hooks) {
oidcAuthMethodGlobal: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Setup Mirage mock resources for this test
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/auth-methods/selectors.js b/ui/admin/tests/acceptance/auth-methods/selectors.js
new file mode 100644
index 0000000000..2c4be3fd22
--- /dev/null
+++ b/ui/admin/tests/acceptance/auth-methods/selectors.js
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+export const FIELD_ISSUER = '[name=issuer]';
+export const FIELD_ISSUER_VALUE = 'Issuer fake value';
+export const FIELD_CLIENT_ID = '[name=client_id]';
+export const FIELD_CLIENT_ID_VALUE = 'Client id value';
+export const FIELD_CLIENT_SECRET = '[name=client_secret]';
+export const FIELD_CLIENT_SECRET_VALUE = 'Client secret value';
+export const FIELD_SIGNING_ALGORITHMS = '[name=signing_algorithms] select';
+export const FIELD_SIGNING_ALGORITHMS_VALUE = 'RS384';
+export const FIELD_SIGNING_ALGORITHMS_ADD_BTN = '[data-test-add-option-button]';
+export const FIELD_ALLOWED_AUDIENCES = '[name=allowed_audiences] input';
+export const FIELD_ALLOWED_AUDIENCES_VALUE = 'Allowed audiences';
+export const FIELD_ALLOWED_AUDIENCES_ADD_BTN =
+ '[name=allowed_audiences] button';
+export const FIELD_CLAIMS_SCOPES = '[name=claims_scopes] input';
+export const FIELD_CLAIMS_SCOPES_VALUE = 'Claim scopes';
+export const FIELD_CLAIMS_SCOPES_ADD_BTN = '[name=claims_scopes] button';
+export const FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM =
+ '[name=account_claim_maps] tbody td:nth-of-type(1) input';
+export const FIELD_ACCOUNT_CLAIM_MAPS_FROM_CLAIM_VALUE = 'from_claim';
+export const FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM =
+ '[name=account_claim_maps] tbody td:nth-of-type(2) select';
+export const FIELD_ACCOUNT_CLAIM_MAPS_TO_CLAIM_VALUE = 'email';
+export const FIELD_ACCOUNT_CLAIM_MAPS_ADD_BTN =
+ '[name=account_claim_maps] button';
+export const FIELD_IDP_CERTS = '[name=idp_ca_certs] textarea';
+export const FIELD_IDP_CERTS_VALUE = 'IDP certificates';
+export const FIELD_IDP_CERTS_ADD_BTN = '[name=idp_ca_certs] button';
+export const FIELD_MAX_AGE = '[name=max_age]';
+export const FIELD_MAX_AGE_VALUE = '5';
+export const FIELD_API_URL_PREFIX = '[name=api_url_prefix]';
+export const FIELD_API_URL_PREFIX_VALUE = 'Api url prefix';
+export const FIELD_PROMPTS = '[name=prompts]';
+export const FIELD_PROMPTS_CONSENT = '[id=consent]';
+export const FIELD_PROMPTS_SELECT_ACCOUNT = '[id=select_account]';
+export const NEW_DROPDOWN = '[data-test-new-dropdown] button';
+export const FIELD_URLS = '[name=urls]';
+export const FIELD_URLS_VALUE = 'url1,url2';
+export const FIELD_CERTIFICATES = '[name=certificates] textarea';
+export const FIELD_CERTIFICATES_VALUE = 'certificate';
+export const FIELD_CERTIFICATES_ADD_BTN = '[name=certificates] button';
+export const FIELD_CLIENT_CERTIFICATE = '[name=client_certificate]';
+export const FIELD_CLIENT_CERTIFICATE_VALUE = 'Client certificate value';
+export const FIELD_CLIENT_CERTIFICATE_KEY = '[name=client_certificate_key]';
+export const FIELD_CLIENT_CERTIFICATE_KEY_VALUE =
+ 'Client certificate key value';
+export const FIELD_START_TLS = '[name=start_tls]';
+export const FIELD_INSECURE_TLS = '[name=insecure_tls]';
+export const FIELD_BIND_DN = '[name=bind_dn]';
+export const FIELD_BIND_DN_VALUE = 'Bind dn';
+export const FIELD_BIND_PASSWORD = '[name=bind_password]';
+export const FIELD_BIND_PASSWORD_VALUE = 'Bind password value';
+export const FIELD_UPN_DOMAIN = '[name=upn_domain]';
+export const FIELD_UPN_DOMAIN_VALUE = 'Upn domain value';
+export const FIELD_DISCOVER_DN = '[name=discover_dn]';
+export const FIELD_ANON_GROUP_SEARCH = '[name=anon_group_search]';
+export const FIELD_USER_DN = '[name=user_dn]';
+export const FIELD_USER_DN_VALUE = 'User dn value';
+export const FIELD_USER_ATTR = '[name=user_attr]';
+export const FIELD_USER_ATTR_VALUE = 'User attribute value';
+export const FIELD_USER_FILTER = '[name=user_filter]';
+export const FIELD_USER_FILTER_VALUE = 'User filter value';
+export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_FROM =
+ '[name=account_attribute_maps] input';
+export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_FROM_VALUE = 'attribute';
+export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO =
+ '[name=account_attribute_maps] select';
+export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_TO_VALUE = 'email';
+export const FIELD_ACCOUNT_ATTRIBUTE_MAPS_ADD_BTN =
+ '[name=account_attribute_maps] button';
+export const FIELD_GROUP_DN = '[name=group_dn]';
+export const FIELD_GROUP_DN_VALUE = 'Group dn value';
+export const FIELD_GROUP_ATTR = '[name=group_attr]';
+export const FIELD_GROUP_ATTR_VALUE = 'Group attribute value';
+export const FIELD_GROUP_FILTER = '[name=group_filter]';
+export const FIELD_GROUP_FILTER_VALUE = 'Group filter value';
+export const FIELD_ENABLE_GROUPS = '[name=enable_groups]';
+export const FIELD_USE_TOKEN_GROUPS = '[name=use_token_groups]';
+export const FIELD_ERROR = '.hds-form-error__message'; // Selects any error message on the DOM.
+
+export const MANAGE_DROPDOWN = '[data-test-manage-auth-method] button';
+export const MANAGE_DROPDOWN_MAKE_PRIMARY =
+ '[data-test-manage-auth-method] ul li:first-child button';
+
+export const TABLE_FIRST_ROW_ACTION_DROPDOWN =
+ 'tbody tr:first-child td:last-child button';
+export const TABLE_FIRST_ROW_ACTION_FIRST_ITEM =
+ 'tbody tr:first-child td:last-child ul li:first-child button';
+
+export const SEARCH_BAR_INPUT = '[type=search]';
+
+export const TABLE_ACTION_DROPDOWN = (authMethodId) =>
+ `tbody [data-test-auth-methods-table-row="${authMethodId}"] .hds-table__td:last-child .hds-dropdown button`;
+export const TABLE_ACTION_DROPDOWN_MAKE_PRIMARY = (authMethodId) =>
+ `tbody tr[data-test-auth-methods-table-row="${authMethodId}"] td:last-child ul li:first-child button`;
diff --git a/ui/admin/tests/acceptance/auth-methods/update-test.js b/ui/admin/tests/acceptance/auth-methods/update-test.js
index d8acd06703..6458bb141b 100644
--- a/ui/admin/tests/acceptance/auth-methods/update-test.js
+++ b/ui/admin/tests/acceptance/auth-methods/update-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, select, findAll } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // // These are left here intentionally for future reference.
- // //currentSession,
- // //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import {
TYPE_AUTH_METHOD_OIDC,
TYPE_AUTH_METHOD_LDAP,
@@ -78,9 +73,9 @@ module('Acceptance | auth-methods | update', function (hooks) {
ldapAuthMethod: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Setup Mirage mock resources for this test
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/authentication-test.js b/ui/admin/tests/acceptance/authentication-test.js
index d32d1abee3..949f9e4158 100644
--- a/ui/admin/tests/acceptance/authentication-test.js
+++ b/ui/admin/tests/acceptance/authentication-test.js
@@ -12,7 +12,7 @@ import {
findAll,
getRootElement,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
@@ -66,8 +66,8 @@ module('Acceptance | authentication', function (hooks) {
let sessionsURL;
let targetsURL;
- hooks.beforeEach(function () {
- invalidateSession();
+ hooks.beforeEach(async function () {
+ await invalidateSession();
indexURL = '/';
globalScope = this.server.create('scope', { id: 'global' });
orgScope1 = this.server.create(
@@ -235,7 +235,7 @@ module('Acceptance | authentication', function (hooks) {
});
test('visiting any authentication parent route while already authenticated with an org redirects to projects', async function (assert) {
- authenticateSession({ scope });
+ await authenticateSession({ scope });
await visit(indexURL);
assert.strictEqual(currentURL(), projectsURL);
await visit(scopesURL);
@@ -250,7 +250,7 @@ module('Acceptance | authentication', function (hooks) {
});
test('visiting index or scopes routes while already authenticated with global redirects to orgs', async function (assert) {
- authenticateSession({
+ await authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
});
await visit(indexURL);
@@ -316,7 +316,7 @@ module('Acceptance | authentication', function (hooks) {
});
test('401 responses result in deauthentication', async function (assert) {
- authenticateSession({
+ await authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
});
await visit(orgsURL);
@@ -333,26 +333,36 @@ module('Acceptance | authentication', function (hooks) {
});
test('color theme is applied from session data', async function (assert) {
- authenticateSession({
+ await authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
});
- // system default
await visit(orgsURL);
- assert.notOk(currentSession().get('data.theme'));
- assert.notOk(getRootElement().classList.contains('rose-theme-light'));
- assert.notOk(getRootElement().classList.contains('rose-theme-dark'));
- // toggle light mode
- await click('[name="theme"][value="light"]');
+
+ // light mode
assert.strictEqual(currentSession().get('data.theme'), 'light');
assert.ok(getRootElement().classList.contains('rose-theme-light'));
assert.notOk(getRootElement().classList.contains('rose-theme-dark'));
+
+ // toggle system default
+ await click('[name="theme"][value="system-default-theme"]');
+
+ assert.strictEqual(
+ currentSession().get('data.theme'),
+ 'system-default-theme',
+ );
+ assert.notOk(getRootElement().classList.contains('rose-theme-light'));
+ assert.notOk(getRootElement().classList.contains('rose-theme-dark'));
+
// toggle dark mode
await click('[name="theme"][value="dark"]');
+
assert.strictEqual(currentSession().get('data.theme'), 'dark');
assert.notOk(getRootElement().classList.contains('rose-theme-light'));
assert.ok(getRootElement().classList.contains('rose-theme-dark'));
+
// toggle system default
await click('[name="theme"][value="system-default-theme"]');
+
assert.strictEqual(
currentSession().get('data.theme'),
'system-default-theme',
diff --git a/ui/admin/tests/acceptance/credential-library/create-test.js b/ui/admin/tests/acceptance/credential-library/create-test.js
index bea22e8958..3604fb4f7f 100644
--- a/ui/admin/tests/acceptance/credential-library/create-test.js
+++ b/ui/admin/tests/acceptance/credential-library/create-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, currentURL, select } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -40,7 +40,7 @@ module('Acceptance | credential-libraries | create', function (hooks) {
newCredentialLibrary: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -71,7 +71,7 @@ module('Acceptance | credential-libraries | create', function (hooks) {
// Generate resource counter
getCredentialLibraryCount = () =>
this.server.schema.credentialLibraries.all().models.length;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -247,8 +247,8 @@ module('Acceptance | credential-libraries | create', function (hooks) {
details: {
request_fields: [
{
- name: 'name',
- description: 'Name is required.',
+ name: 'path',
+ description: 'Vault path is required',
},
],
},
@@ -262,7 +262,9 @@ module('Acceptance | credential-libraries | create', function (hooks) {
assert
.dom(commonSelectors.ALERT_TOAST_BODY)
.hasText('The request was invalid');
- assert.dom(commonSelectors.FIELD_NAME_ERROR).hasText('Name is required.');
+ assert
+ .dom(selectors.FIELD_VAULT_PATH_ERROR)
+ .hasText('Vault path is required');
});
test('cannot select vault ssh cert when feature is disabled', async function (assert) {
diff --git a/ui/admin/tests/acceptance/credential-library/delete-test.js b/ui/admin/tests/acceptance/credential-library/delete-test.js
index 8312e562ad..03a352c53e 100644
--- a/ui/admin/tests/acceptance/credential-library/delete-test.js
+++ b/ui/admin/tests/acceptance/credential-library/delete-test.js
@@ -4,23 +4,21 @@
*/
import { module, test } from 'qunit';
-import { visit, click, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, click } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-libraries | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let getCredentialLibraryCount;
- const MANAGE_DROPDOWN_SELECTOR =
- '[data-test-manage-credential-library-dropdown] button:first-child';
- const DELETE_ACTION_SELECTOR =
- '[data-test-manage-credential-library-dropdown] ul li button';
const instances = {
scopes: {
@@ -31,9 +29,6 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
};
const urls = {
- globalScope: null,
- orgScope: null,
- projectScope: null,
credentialStores: null,
credentialStore: null,
credentialLibrary: null,
@@ -42,7 +37,7 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
unknownCredentialLibrary: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -61,10 +56,7 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
credentialStore: instances.credentialStore,
});
// Generate route URLs for resources
- urls.globalScope = `/scopes/global/scopes`;
- urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
- urls.projectScope = `/scopes/${instances.scopes.project.id}`;
- urls.credentialStores = `${urls.projectScope}/credential-stores`;
+ urls.credentialStores = `/scopes/${instances.scopes.project.id}/credential-stores`;
urls.credentialStore = `${urls.credentialStores}/${instances.credentialStore.id}`;
urls.credentialLibraries = `${urls.credentialStore}/credential-libraries`;
urls.credentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
@@ -73,14 +65,16 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
// Generate resource counter
getCredentialLibraryCount = () =>
this.server.schema.credentialLibraries.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete resource', async function (assert) {
const count = getCredentialLibraryCount();
await visit(urls.credentialLibrary);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
+
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB);
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB_DELETE);
+
assert.strictEqual(getCredentialLibraryCount(), count - 1);
});
@@ -89,10 +83,10 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
instances.credentialLibrary.authorized_actions.filter(
(item) => item !== 'delete',
);
+
await visit(urls.credentialLibrary);
- assert.notOk(
- find('.rose-layout-page-actions .rose-dropdown-button-danger'),
- );
+
+ assert.dom(selectors.MANAGE_DROPDOWN_CRED_LIB).doesNotExist();
});
test('can accept delete credential library via dialog', async function (assert) {
@@ -101,8 +95,10 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
confirmService.confirm = sinon.fake.returns(resolve());
const count = getCredentialLibraryCount();
await visit(urls.credentialLibrary);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
+
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB);
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB_DELETE);
+
assert.strictEqual(getCredentialLibraryCount(), count - 1);
assert.ok(confirmService.confirm.calledOnce);
});
@@ -113,8 +109,10 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
confirmService.confirm = sinon.fake.returns(reject());
const count = getCredentialLibraryCount();
await visit(urls.credentialLibrary);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
+
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB);
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB_DELETE);
+
assert.strictEqual(getCredentialLibraryCount(), count);
assert.ok(confirmService.confirm.calledOnce);
});
@@ -132,10 +130,10 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
);
});
await visit(urls.credentialLibrary);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
- assert
- .dom('[data-test-toast-notification] .hds-alert__description')
- .hasText('Oops.');
+
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB);
+ await click(selectors.MANAGE_DROPDOWN_CRED_LIB_DELETE);
+
+ assert.dom(commonSelectors.ALERT_TOAST_BODY).hasText('Oops.');
});
});
diff --git a/ui/admin/tests/acceptance/credential-library/list-test.js b/ui/admin/tests/acceptance/credential-library/list-test.js
index c4bb65b211..c805d00658 100644
--- a/ui/admin/tests/acceptance/credential-library/list-test.js
+++ b/ui/admin/tests/acceptance/credential-library/list-test.js
@@ -4,15 +4,11 @@
*/
import { module, test } from 'qunit';
-import { visit, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-libraries | list', function (hooks) {
setupApplicationTest(hooks);
@@ -27,16 +23,13 @@ module('Acceptance | credential-libraries | list', function (hooks) {
};
const urls = {
- globalScope: null,
- orgScope: null,
- projectScope: null,
credentialStores: null,
credentialStore: null,
credentialLibrary: null,
credentialLibraries: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -54,44 +47,45 @@ module('Acceptance | credential-libraries | list', function (hooks) {
credentialStore: instances.credentialStore,
});
// Generate route URLs for resources
- urls.globalScope = `/scopes/global/scopes`;
- urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
- urls.projectScope = `/scopes/${instances.scopes.project.id}`;
- urls.credentialStores = `${urls.projectScope}/credential-stores`;
+ urls.credentialStores = `/scopes/${instances.scopes.project.id}/credential-stores`;
urls.credentialStore = `${urls.credentialStores}/${instances.credentialStore.id}`;
urls.credentialLibraries = `${urls.credentialStore}/credential-libraries`;
- urls.credentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('Users can navigate to credential libraries with proper authorization', async function (assert) {
await visit(urls.credentialStore);
+
assert.ok(
instances.credentialStore.authorized_collection_actions[
'credential-libraries'
].includes('list'),
);
- assert.ok(find(`[href="${urls.credentialLibraries}"]`));
+ assert.dom(commonSelectors.HREF(urls.credentialLibraries)).isVisible();
});
test('Users cannot navigate to index without either list or create actions', async function (assert) {
instances.credentialStore.authorized_collection_actions[
'credential-libraries'
] = [];
+
await visit(urls.credentialStore);
+
assert.notOk(
instances.credentialStore.authorized_collection_actions[
'credential-libraries'
].includes('list'),
);
- assert.notOk(find(`[href="${urls.credentialLibraries}"]`));
+ assert.dom(commonSelectors.HREF(urls.credentialLibraries)).doesNotExist();
});
test('Users can navigate to index with only create action', async function (assert) {
instances.credentialStore.authorized_collection_actions[
'credential-libraries'
] = ['create'];
+
await visit(urls.credentialStore);
- assert.ok(find(`[href="${urls.credentialLibraries}"]`));
+
+ assert.dom(commonSelectors.HREF(urls.credentialLibraries)).isVisible();
});
});
diff --git a/ui/admin/tests/acceptance/credential-library/read-test.js b/ui/admin/tests/acceptance/credential-library/read-test.js
index 4bf3cacdb9..87fd411901 100644
--- a/ui/admin/tests/acceptance/credential-library/read-test.js
+++ b/ui/admin/tests/acceptance/credential-library/read-test.js
@@ -4,12 +4,13 @@
*/
import { module, test } from 'qunit';
-import { visit, click, currentURL, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, click, currentURL } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE } from 'api/models/credential-library';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-libraries | read', function (hooks) {
setupApplicationTest(hooks);
@@ -33,9 +34,10 @@ module('Acceptance | credential-libraries | read', function (hooks) {
credentialLibraries: null,
newCredentialLibrary: null,
unknownCredentialLibrary: null,
+ vaultSshCredentialLibrary: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -63,13 +65,15 @@ module('Acceptance | credential-libraries | read', function (hooks) {
urls.credentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
urls.newCredentialLibrary = `${urls.credentialLibraries}/new`;
urls.unknownCredentialLibrary = `${urls.credentialLibraries}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('can navigate to resource', async function (assert) {
await visit(urls.credentialLibraries);
- await click('.hds-table .hds-table__tbody .hds-table__tr a');
+
+ await click(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary));
await a11yAudit();
+
assert.strictEqual(currentURL(), urls.credentialLibrary);
});
@@ -79,7 +83,10 @@ module('Acceptance | credential-libraries | read', function (hooks) {
(item) => item !== 'read',
);
await visit(urls.credentialLibraries);
- assert.notOk(find('main tbody .rose-table-header-cell a'));
+
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary))
+ .doesNotExist();
});
test('cannot navigate to vault ssh cert form when feature is not enabled', async function (assert) {
@@ -88,22 +95,28 @@ module('Acceptance | credential-libraries | read', function (hooks) {
credentialStore: instances.credentialStore,
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
});
- await visit(
- `${urls.credentialLibraries}/${instances.credentialLibrary.id}`,
- );
+ urls.vaultSshCredentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
await visit(urls.credentialLibraries);
const featuresService = this.owner.lookup('service:features');
+
assert.false(featuresService.isEnabled('ssh-target'));
- assert.dom('.rose-table-body tr:nth-of-type(2) a').doesNotExist();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultSshCredentialLibrary))
+ .doesNotExist();
});
test('visiting an unknown credential library displays 404 message', async function (assert) {
await visit(urls.unknownCredentialLibrary);
await a11yAudit();
- assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
- test('users can navigate to credential library and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to credential library and incorrect url auto-corrects', async function (assert) {
const credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
diff --git a/ui/admin/tests/acceptance/credential-library/selectors.js b/ui/admin/tests/acceptance/credential-library/selectors.js
index 1fe15f723d..1cc6a76371 100644
--- a/ui/admin/tests/acceptance/credential-library/selectors.js
+++ b/ui/admin/tests/acceptance/credential-library/selectors.js
@@ -8,6 +8,7 @@ export const FIELD_CRED_TYPE_VALUE = 'ssh_private_key';
export const FIELD_VAULT_PATH = '[name=vault_path]';
export const FIELD_VAULT_PATH_VALUE = 'path';
+export const FIELD_VAULT_PATH_ERROR = '[data-test-error-message-vault-path]';
export const FIELD_USERNAME = '[name=username]';
export const FIELD_USERNAME_VALUE = 'username';
@@ -45,3 +46,8 @@ export const FIELD_EXT_KEY =
export const FIELD_EXT_VALUE =
'[name="extensions"] tbody td:nth-of-type(2) input';
export const FIELD_EXT_BTN = '[name="extensions"] button';
+
+export const MANAGE_DROPDOWN_CRED_LIB =
+ '[data-test-manage-credential-library-dropdown] button:first-child';
+export const MANAGE_DROPDOWN_CRED_LIB_DELETE =
+ '[data-test-manage-credential-library-dropdown] ul li button';
diff --git a/ui/admin/tests/acceptance/credential-library/update-test.js b/ui/admin/tests/acceptance/credential-library/update-test.js
index 29d8111875..6aa318daeb 100644
--- a/ui/admin/tests/acceptance/credential-library/update-test.js
+++ b/ui/admin/tests/acceptance/credential-library/update-test.js
@@ -4,35 +4,19 @@
*/
import { module, test } from 'qunit';
-import {
- visit,
- click,
- fillIn,
- currentURL,
- find,
- select,
-} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, click, fillIn, currentURL, select } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import { TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE } from 'api/models/credential-library';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-libraries | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
- const BUTTON_SELECTOR = '.rose-form-actions [type="button"]';
- const SAVE_BTN_SELECTOR = '.rose-form-actions [type="submit"]';
- const NAME_INPUT_SELECTOR = '[name="name"]';
- const FIELD_ERROR_TEXT_SELECTOR = '.hds-form-error__message';
- const DESC_INPUT_SELECTOR = '[name="description"]';
- const VAULT_PATH_SELECTOR = '[name="vault_path"]';
- const CRED_TYPE_SELECTOR = '[name="credential_type"]';
- const CRED_MAPPING_OVERRIDES_SELECT =
- '[name="credential_mapping_overrides"] tbody td:nth-of-type(1) select';
- const CRED_MAPPING_OVERRIDES_INPUT =
- '[name="credential_mapping_overrides"] tbody td:nth-of-type(2) input';
const instances = {
scopes: {
global: null,
@@ -53,7 +37,7 @@ module('Acceptance | credential-libraries | update', function (hooks) {
unknownCredentialLibrary: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -81,7 +65,7 @@ module('Acceptance | credential-libraries | update', function (hooks) {
urls.credentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
urls.newCredentialLibrary = `${urls.credentialLibraries}/new`;
urls.unknownCredentialLibrary = `${urls.credentialLibraries}/foo`;
- authenticateSession({});
+ await authenticateSession({});
});
test('cannot update resource without proper authorization', async function (assert) {
@@ -89,48 +73,60 @@ module('Acceptance | credential-libraries | update', function (hooks) {
instances.credentialLibrary.authorized_actions.filter(
(item) => item !== 'update',
);
+
await visit(urls.credentialLibrary);
- assert.notOk(find(BUTTON_SELECTOR));
+
+ assert.dom(commonSelectors.EDIT_BTN).doesNotExist();
});
test('can update a credential library and cancel changes', async function (assert) {
await visit(urls.credentialLibrary);
- await click(BUTTON_SELECTOR, 'Activate edit mode');
- await fillIn(NAME_INPUT_SELECTOR, 'random string');
- await click(BUTTON_SELECTOR);
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await click(commonSelectors.CANCEL_BTN);
+
assert.notEqual(
this.server.schema.credentialLibraries.all().models[0].name,
- 'random string',
- );
- assert.strictEqual(
- find(NAME_INPUT_SELECTOR).value,
- instances.credentialLibrary.name,
+ commonSelectors.FIELD_NAME_VALUE,
);
+ assert
+ .dom(commonSelectors.FIELD_NAME)
+ .hasValue(instances.credentialLibrary.name);
});
test('can update a vault generic credential library and save changes', async function (assert) {
- await visit(
- `${urls.credentialLibraries}/${instances.credentialLibrary.id}`,
- );
-
- await click(BUTTON_SELECTOR);
-
- await fillIn(NAME_INPUT_SELECTOR, 'random string');
- await fillIn(DESC_INPUT_SELECTOR, 'description');
- await fillIn(VAULT_PATH_SELECTOR, 'path');
-
- await select(CRED_MAPPING_OVERRIDES_SELECT, 'private_key_attribute');
- await fillIn(CRED_MAPPING_OVERRIDES_INPUT, 'key');
+ await visit(urls.credentialLibrary);
- await click('[name="credential_mapping_overrides"] button');
+ await click(commonSelectors.EDIT_BTN);
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ await fillIn(selectors.FIELD_VAULT_PATH, selectors.FIELD_VAULT_PATH_VALUE);
+ await select(
+ selectors.FIELD_CRED_MAP_OVERRIDES_SELECT,
+ selectors.FIELD_CRED_MAP_OVERRIDES_SELECT_VALUE,
+ );
+ await fillIn(selectors.FIELD_CRED_MAP_OVERRIDES_INPUT, 'key');
+ await click(selectors.FIELD_CRED_MAP_OVERRIDES_BTN);
+ await click(commonSelectors.SAVE_BTN);
- await click(SAVE_BTN_SELECTOR);
const credentialLibrary = this.server.schema.credentialLibraries.findBy({
- name: 'random string',
+ name: commonSelectors.FIELD_NAME_VALUE,
});
- assert.strictEqual(credentialLibrary.name, 'random string');
- assert.strictEqual(credentialLibrary.description, 'description');
- assert.strictEqual(credentialLibrary.attributes.path, 'path');
+ assert.strictEqual(
+ credentialLibrary.name,
+ commonSelectors.FIELD_NAME_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.description,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.path,
+ selectors.FIELD_VAULT_PATH_VALUE,
+ );
assert.deepEqual(credentialLibrary.credentialMappingOverrides, {
private_key_attribute: 'key',
});
@@ -148,8 +144,8 @@ module('Acceptance | credential-libraries | update', function (hooks) {
details: {
request_fields: [
{
- name: 'name',
- description: 'Name is required',
+ name: 'path',
+ description: 'Vault path is required',
},
],
},
@@ -157,38 +153,45 @@ module('Acceptance | credential-libraries | update', function (hooks) {
);
});
await visit(urls.credentialLibrary);
- await click(BUTTON_SELECTOR, 'Activate edit mode');
- await fillIn(NAME_INPUT_SELECTOR, 'random string');
- await click(SAVE_BTN_SELECTOR);
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await click(commonSelectors.SAVE_BTN);
+
assert
- .dom('[data-test-toast-notification] .hds-alert__description')
+ .dom(commonSelectors.ALERT_TOAST_BODY)
.hasText('The request was invalid.');
- assert.ok(
- find(FIELD_ERROR_TEXT_SELECTOR).textContent.trim(),
- 'Name is required.',
- );
+ assert
+ .dom(selectors.FIELD_VAULT_PATH_ERROR)
+ .hasText('Vault path is required');
});
test('can discard unsaved credential library changes via dialog', async function (assert) {
assert.expect(5);
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
- assert.notEqual(instances.credentialLibrary.name, 'random string');
+
+ assert.notEqual(
+ instances.credentialLibrary.name,
+ commonSelectors.FIELD_NAME_VALUE,
+ );
await visit(urls.credentialLibrary);
- await click(BUTTON_SELECTOR, 'Activate edit mode');
- await fillIn(NAME_INPUT_SELECTOR, 'random string');
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+
assert.strictEqual(currentURL(), urls.credentialLibrary);
try {
await visit(urls.credentialLibraries);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:first-child', 'Click Discard');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
+
assert.strictEqual(currentURL(), urls.credentialLibraries);
assert.notEqual(
this.server.schema.credentialLibraries.all().models[0].name,
- 'random string',
+ commonSelectors.FIELD_NAME_VALUE,
);
}
});
@@ -197,29 +200,38 @@ module('Acceptance | credential-libraries | update', function (hooks) {
assert.expect(5);
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
- assert.notEqual(instances.credentialLibrary.name, 'random string');
+
+ assert.notEqual(
+ instances.credentialLibrary.name,
+ commonSelectors.FIELD_NAME_VALUE,
+ );
+
await visit(urls.credentialLibrary);
- await click(BUTTON_SELECTOR, 'Activate edit mode');
- await fillIn(NAME_INPUT_SELECTOR, 'random string');
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+
assert.strictEqual(currentURL(), urls.credentialLibrary);
try {
await visit(urls.credentialLibraries);
- } catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:last-child');
+ } catch {
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
+
assert.strictEqual(currentURL(), urls.credentialLibrary);
assert.notEqual(
this.server.schema.credentialLibraries.all().models[0].name,
- 'random string',
+ commonSelectors.FIELD_NAME_VALUE,
);
}
});
test('cannot update credential type in a vault generic credential library', async function (assert) {
await visit(urls.credentialLibrary);
- await click(BUTTON_SELECTOR, 'Activate edit mode');
- assert.dom(CRED_TYPE_SELECTOR).isDisabled();
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+
+ assert.dom(selectors.FIELD_CRED_TYPE).isDisabled();
});
test('can update a vault ssh cert credential library and save changes', async function (assert) {
@@ -231,47 +243,61 @@ module('Acceptance | credential-libraries | update', function (hooks) {
await visit(
`${urls.credentialLibraries}/${instances.credentialLibrary.id}`,
);
- await click(BUTTON_SELECTOR, 'Activate edit mode');
- await fillIn(NAME_INPUT_SELECTOR, 'name');
- await fillIn(DESC_INPUT_SELECTOR, 'description');
- await fillIn(VAULT_PATH_SELECTOR, 'path');
- await fillIn('[name="username"]', 'username');
- await select('[name="key_type"]', 'rsa');
- await fillIn('[name="key_bits"]', 100);
- await fillIn('[name="ttl"]', 'ttl');
- await fillIn('[name="key_id"]', 'key_id');
- await fillIn(
- '[name="critical_options"] tbody td:nth-of-type(1) input',
- 'co_key',
- );
- await fillIn(
- '[name="critical_options"] tbody td:nth-of-type(2) input',
- 'co_value',
- );
- await click('[name="critical_options"] button');
- await fillIn(
- '[name="extensions"] tbody td:nth-of-type(1) input',
- 'ext_key',
- );
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
await fillIn(
- '[name="extensions"] tbody td:nth-of-type(2) input',
- 'ext_value',
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
);
+ await fillIn(selectors.FIELD_VAULT_PATH, selectors.FIELD_VAULT_PATH_VALUE);
+ await fillIn(selectors.FIELD_USERNAME, selectors.FIELD_USERNAME_VALUE);
+ await fillIn(selectors.FIELD_KEY_TYPE, selectors.FIELD_KEY_TYPE_VALUE);
+ await fillIn(selectors.FIELD_KEY_BITS, selectors.FIELD_KEY_BITS_VALUE);
+ await fillIn(selectors.FIELD_TTL, selectors.FIELD_TTL_VALUE);
+ await fillIn(selectors.FIELD_KEY_ID, selectors.FIELD_KEY_ID_VALUE);
+ await fillIn(selectors.FIELD_CRIT_OPTS_KEY, 'co_key');
+ await fillIn(selectors.FIELD_CRIT_OPTS_VALUE, 'co_value');
+ await click(selectors.FIELD_CRIT_OPTS_BTN);
+ await fillIn(selectors.FIELD_EXT_KEY, 'ext_key');
+ await fillIn(selectors.FIELD_EXT_VALUE, 'ext_value');
+ await click(selectors.FIELD_EXT_BTN);
+ await click(commonSelectors.SAVE_BTN);
- await click('[name="extensions"] button');
-
- await click(SAVE_BTN_SELECTOR);
const credentialLibrary = this.server.schema.credentialLibraries.findBy({
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
});
- assert.strictEqual(credentialLibrary.name, 'name');
- assert.strictEqual(credentialLibrary.description, 'description');
- assert.strictEqual(credentialLibrary.attributes.path, 'path');
- assert.strictEqual(credentialLibrary.attributes.username, 'username');
- assert.strictEqual(credentialLibrary.attributes.key_type, 'rsa');
- assert.strictEqual(credentialLibrary.attributes.key_bits, 100);
- assert.strictEqual(credentialLibrary.attributes.ttl, 'ttl');
- assert.strictEqual(credentialLibrary.attributes.key_id, 'key_id');
+ assert.strictEqual(
+ credentialLibrary.name,
+ commonSelectors.FIELD_NAME_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.description,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.path,
+ selectors.FIELD_VAULT_PATH_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.username,
+ selectors.FIELD_USERNAME_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.key_type,
+ selectors.FIELD_KEY_TYPE_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.key_bits,
+ selectors.FIELD_KEY_BITS_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.ttl,
+ selectors.FIELD_TTL_VALUE,
+ );
+ assert.strictEqual(
+ credentialLibrary.attributes.key_id,
+ selectors.FIELD_KEY_ID_VALUE,
+ );
assert.deepEqual(credentialLibrary.attributes.critical_options, {
co_key: 'co_value',
});
diff --git a/ui/admin/tests/acceptance/credential-store/create-test.js b/ui/admin/tests/acceptance/credential-store/create-test.js
index 5c0d447a20..24f09d4a47 100644
--- a/ui/admin/tests/acceptance/credential-store/create-test.js
+++ b/ui/admin/tests/acceptance/credential-store/create-test.js
@@ -4,12 +4,14 @@
*/
import { module, test } from 'qunit';
-import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-stores | create', function (hooks) {
setupApplicationTest(hooks);
@@ -30,13 +32,11 @@ module('Acceptance | credential-stores | create', function (hooks) {
};
const urls = {
- globalScope: null,
- projectScope: null,
credentialStores: null,
newCredentialStore: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -48,9 +48,7 @@ module('Acceptance | credential-stores | create', function (hooks) {
scope: { id: instances.scopes.org.id, type: 'org' },
});
// Generate route URLs for resources
- urls.globalScope = `/scopes/global/scopes`;
- urls.projectScope = `/scopes/${instances.scopes.project.id}`;
- urls.credentialStores = `${urls.projectScope}/credential-stores`;
+ urls.credentialStores = `/scopes/${instances.scopes.project.id}/credential-stores`;
urls.newCredentialStore = `${urls.credentialStores}/new`;
// Generate resource counter
getCredentialStoresCount = () => {
@@ -64,7 +62,7 @@ module('Acceptance | credential-stores | create', function (hooks) {
return this.server.schema.credentialStores.where({ type: 'vault' }).models
.length;
};
- authenticateSession({});
+ await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -72,8 +70,10 @@ module('Acceptance | credential-stores | create', function (hooks) {
featuresService.enable('static-credentials');
const count = getStaticCredentialStoresCount();
await visit(urls.newCredentialStore);
- await fillIn('[name="name"]', 'random string');
- await click('[type="submit"]');
+
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await click(commonSelectors.SAVE_BTN);
+
assert.strictEqual(getStaticCredentialStoresCount(), count + 1);
});
@@ -81,17 +81,21 @@ module('Acceptance | credential-stores | create', function (hooks) {
featuresService.enable('static-credentials');
const count = getVaultCredentialStoresCount();
await visit(urls.newCredentialStore);
- await fillIn('[name="name"]', 'random string');
- await click('[value="vault"]');
- await click('[type="submit"]');
+
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await click(selectors.TYPE_VAULT);
+ await click(commonSelectors.SAVE_BTN);
+
assert.strictEqual(getVaultCredentialStoresCount(), count + 1);
});
test('Users can cancel create new credential stores', async function (assert) {
const count = getCredentialStoresCount();
await visit(urls.newCredentialStore);
- await fillIn('[name="name"]', 'random string');
- await click('.rose-form-actions [type="button"]');
+
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await click(commonSelectors.CANCEL_BTN);
+
assert.strictEqual(currentURL(), urls.credentialStores);
assert.strictEqual(getCredentialStoresCount(), count);
});
@@ -101,15 +105,18 @@ module('Acceptance | credential-stores | create', function (hooks) {
'credential-stores'
] = [];
await visit(urls.credentialStores);
+
assert.notOk(
instances.scopes.project.authorized_collection_actions[
'credential-stores'
].includes('create'),
);
- assert.notOk(find(`[href="${urls.newCredentialStore}"]`));
+ assert.dom(commonSelectors.HREF(urls.newCredentialStore)).doesNotExist();
});
- test('saving a new credential store with invalid fields displays error messages', async function (assert) {
+ test('saving a new static credential store with invalid fields displays error messages', async function (assert) {
+ const errorMsg =
+ 'Invalid request. Request attempted to make second resource with the same field value that must be unique.';
this.server.post('/credential-stores', () => {
return new Response(
400,
@@ -117,7 +124,7 @@ module('Acceptance | credential-stores | create', function (hooks) {
{
status: 400,
code: 'invalid_argument',
- message: 'The request was invalid.',
+ message: errorMsg,
details: {
request_fields: [
{
@@ -130,23 +137,55 @@ module('Acceptance | credential-stores | create', function (hooks) {
);
});
await visit(urls.newCredentialStore);
- await click('[type="submit"]');
+
+ await click(commonSelectors.SAVE_BTN);
+
+ assert.dom(commonSelectors.ALERT_TOAST_BODY).hasText(errorMsg);
+ });
+
+ test('saving a new vault credential store with invalid fields displays error messages', async function (assert) {
+ this.server.post('/credential-stores', () => {
+ return new Response(
+ 400,
+ {},
+ {
+ status: 400,
+ code: 'invalid_argument',
+ message: 'The request was invalid.',
+ details: {
+ request_fields: [
+ {
+ name: 'attributes.address',
+ description:
+ 'Field required for creating a vault credential store.',
+ },
+ ],
+ },
+ },
+ );
+ });
+ await visit(urls.newCredentialStore);
+
+ await click(commonSelectors.SAVE_BTN);
+
assert
- .dom('[data-test-toast-notification] .hds-alert__description')
+ .dom(commonSelectors.ALERT_TOAST_BODY)
.hasText('The request was invalid.');
- assert.ok(
- find('[data-test-error-message-name]').textContent.trim(),
- 'Name is required.',
- );
+ assert
+ .dom(selectors.FIELD_VAULT_ADDRESS_ERROR)
+ .hasText('Field required for creating a vault credential store.');
});
test('Users can link to docs page for new credential store', async function (assert) {
await visit(urls.newCredentialStore);
- assert.ok(
- find(
- `[href="https://developer.hashicorp.com/boundary/docs/concepts/domain-model/credential-stores"]`,
- ),
- );
+
+ assert
+ .dom(
+ commonSelectors.HREF(
+ 'https://developer.hashicorp.com/boundary/docs/concepts/domain-model/credential-stores',
+ ),
+ )
+ .isVisible();
});
test('users cannot directly navigate to new credential store route without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/credential-store/credentials/create-test.js b/ui/admin/tests/acceptance/credential-store/credentials/create-test.js
index a9955f5eaa..2dbfa320fe 100644
--- a/ui/admin/tests/acceptance/credential-store/credentials/create-test.js
+++ b/ui/admin/tests/acceptance/credential-store/credentials/create-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -40,7 +40,7 @@ module(
newCredential: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
featuresService = this.owner.lookup('service:features');
instances.scopes.org = this.server.create('scope', {
@@ -77,7 +77,7 @@ module(
getJsonCredentialCount = () => {
return this.server.schema.credentials.where({ type: 'json' }).length;
};
- authenticateSession({});
+ await authenticateSession({});
});
test('users can create a new username & password credential', async function (assert) {
diff --git a/ui/admin/tests/acceptance/credential-store/credentials/delete-test.js b/ui/admin/tests/acceptance/credential-store/credentials/delete-test.js
index 3fc5683f9d..9ebb266ec1 100644
--- a/ui/admin/tests/acceptance/credential-store/credentials/delete-test.js
+++ b/ui/admin/tests/acceptance/credential-store/credentials/delete-test.js
@@ -4,11 +4,12 @@
*/
import { module, test } from 'qunit';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { click, currentURL, visit } from '@ember/test-helpers';
import { Response } from 'miragejs';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module(
'Acceptance | credential-stores | credentials | delete',
@@ -42,7 +43,7 @@ module(
jsonCredential: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -92,7 +93,7 @@ module(
getJSONCredentialCount = () => {
return this.server.schema.credentials.where({ type: 'json' }).length;
};
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete username & password credential', async function (assert) {
@@ -182,7 +183,7 @@ module(
await visit(urls.usernamePasswordCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog footer .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.credentials);
assert.strictEqual(
getUsernamePasswordCredentialCount(),
@@ -198,7 +199,7 @@ module(
await visit(urls.usernameKeyPairCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog footer .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.credentials);
assert.strictEqual(
getUsernameKeyPairCredentialCount(),
@@ -213,7 +214,7 @@ module(
await visit(urls.jsonCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog footer .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.credentials);
assert.strictEqual(getJSONCredentialCount(), jsonCredentialCount - 1);
});
@@ -226,7 +227,7 @@ module(
await visit(urls.usernamePasswordCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog footer .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.usernamePasswordCredential);
assert.strictEqual(
getUsernamePasswordCredentialCount(),
@@ -242,7 +243,7 @@ module(
await visit(urls.usernameKeyPairCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog footer .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.usernameKeyPairCredential);
assert.strictEqual(
getUsernameKeyPairCredentialCount(),
@@ -257,7 +258,7 @@ module(
await visit(urls.jsonCredential);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog footer .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.jsonCredential);
assert.strictEqual(getJSONCredentialCount(), jsonCredentialCount);
});
diff --git a/ui/admin/tests/acceptance/credential-store/credentials/list-test.js b/ui/admin/tests/acceptance/credential-store/credentials/list-test.js
index 072b24d9fe..7154d4eb14 100644
--- a/ui/admin/tests/acceptance/credential-store/credentials/list-test.js
+++ b/ui/admin/tests/acceptance/credential-store/credentials/list-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -38,7 +38,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
newCredential: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -73,7 +73,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
urls.staticCredentialStore = `${urls.credentialStores}/${instances.staticCredentialStore.id}`;
urls.credentials = `${urls.staticCredentialStore}/credentials`;
urls.newCredential = `${urls.staticCredentialStore}/credentials/new`;
- authenticateSession({});
+ await authenticateSession({});
});
test('Users can navigate to credentials with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/credential-store/credentials/read-test.js b/ui/admin/tests/acceptance/credential-store/credentials/read-test.js
index 6c1e538b33..4af24cd7df 100644
--- a/ui/admin/tests/acceptance/credential-store/credentials/read-test.js
+++ b/ui/admin/tests/acceptance/credential-store/credentials/read-test.js
@@ -5,10 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, find, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-stores | credentials | read', function (hooks) {
setupApplicationTest(hooks);
@@ -38,7 +39,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
unknownCredential: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -76,7 +77,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
urls.usernameKeyPairCredential = `${urls.credentials}/${instances.usernameKeyPairCredential.id}`;
urls.jsonCredential = `${urls.credentials}/${instances.jsonCredential.id}`;
urls.unknownCredential = `${urls.credentials}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -117,7 +118,13 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read',
);
await visit(urls.credentials);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
+
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernameKeyPairCredential))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
+ .doesNotExist();
});
test('cannot navigate to a username & key pair credential form without proper authorization', async function (assert) {
@@ -126,7 +133,13 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read',
);
await visit(urls.credentials);
- assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
+
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernameKeyPairCredential))
+ .doesNotExist();
});
test('cannot navigate to a JSON credential form without proper authorization', async function (assert) {
@@ -135,19 +148,33 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
(item) => item != 'read',
);
await visit(urls.credentials);
- assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist();
+
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.jsonCredential))
+ .doesNotExist();
});
test('cannot navigate to a JSON credential form when feature not enabled', async function (assert) {
await visit(urls.credentials);
+
assert.false(featuresService.isEnabled('json-credentials'));
- assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.jsonCredential))
+ .doesNotExist();
});
test('visiting an unknown credential displays 404 message', async function (assert) {
await visit(urls.unknownCredential);
await a11yAudit();
- assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
test('Users can link to docs page for credential', async function (assert) {
@@ -159,7 +186,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
);
});
- test('users can navigate to credential and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to credential and incorrect url auto-corrects', async function (assert) {
const credentialStore = this.server.create('credential-store', {
scope: instances.scopes.project,
});
diff --git a/ui/admin/tests/acceptance/credential-store/credentials/update-test.js b/ui/admin/tests/acceptance/credential-store/credentials/update-test.js
index d0d0e38150..e918e71374 100644
--- a/ui/admin/tests/acceptance/credential-store/credentials/update-test.js
+++ b/ui/admin/tests/acceptance/credential-store/credentials/update-test.js
@@ -12,10 +12,11 @@ import {
fillIn,
waitUntil,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module(
'Acceptance | credential-stores | credentials | update',
@@ -47,7 +48,7 @@ module(
jsonCredential: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -87,7 +88,7 @@ module(
urls.jsonCredential = `${urls.credentials}/${instances.jsonCredential.id}`;
featuresService = this.owner.lookup('service:features');
- authenticateSession({});
+ await authenticateSession({});
});
test('can save changes to existing username & password credential', async function (assert) {
@@ -322,11 +323,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
- assert.dom('.rose-dialog').isVisible();
- await click(
- '.rose-dialog-footer button:first-of-type',
- 'Click Discard',
- );
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentials);
assert.notEqual(
this.server.schema.credentials.where({ type: 'username_password' })
@@ -349,11 +347,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
- assert.dom('.rose-dialog').isVisible();
- await click(
- '.rose-dialog-footer button:first-of-type',
- 'Click Discard',
- );
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentials);
assert.notEqual(
this.server.schema.credentials.where({ type: 'ssh_private_key' })
@@ -376,11 +371,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
- assert.dom('.rose-dialog').isVisible();
- await click(
- '.rose-dialog-footer button:first-of-type',
- 'Click Discard',
- );
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentials);
assert.notEqual(
this.server.schema.credentials.where({ type: 'json' }).models[0].name,
@@ -403,8 +395,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
- assert.dom('.rose-dialog').isVisible();
- await click('.rose-dialog-footer button:last-child', 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.usernamePasswordCredential);
assert.strictEqual(find('[name="name"]').value, mockInput);
assert.strictEqual(
@@ -429,8 +421,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
- assert.dom('.rose-dialog').isVisible();
- await click('.rose-dialog-footer button:last-child', 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.usernameKeyPairCredential);
assert.strictEqual(find('[name="name"]').value, mockInput);
assert.strictEqual(
@@ -455,8 +447,8 @@ module(
try {
await visit(urls.credentials);
} catch (e) {
- assert.dom('.rose-dialog').isVisible();
- await click('.rose-dialog-footer button:last-child', 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.jsonCredential);
assert.strictEqual(find('[name="name"]').value, mockInput);
assert.strictEqual(
diff --git a/ui/admin/tests/acceptance/credential-store/delete-test.js b/ui/admin/tests/acceptance/credential-store/delete-test.js
index 28cf87763a..a4d234d840 100644
--- a/ui/admin/tests/acceptance/credential-store/delete-test.js
+++ b/ui/admin/tests/acceptance/credential-store/delete-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -42,7 +42,7 @@ module('Acceptance | credential-stores | delete', function (hooks) {
vaultCredentialStore: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -77,7 +77,7 @@ module('Acceptance | credential-stores | delete', function (hooks) {
return this.server.schema.credentialStores.where({ type: 'vault' }).models
.length;
};
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete credential store of type vault', async function (assert) {
diff --git a/ui/admin/tests/acceptance/credential-store/list-test.js b/ui/admin/tests/acceptance/credential-store/list-test.js
index e0ada11214..521c36d1b3 100644
--- a/ui/admin/tests/acceptance/credential-store/list-test.js
+++ b/ui/admin/tests/acceptance/credential-store/list-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, waitFor } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import {
TYPE_CREDENTIAL_STORE_STATIC,
TYPE_CREDENTIAL_STORE_VAULT,
@@ -49,7 +44,7 @@ module('Acceptance | credential-stores | list', function (hooks) {
vaultCredentialStore: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -75,7 +70,7 @@ module('Acceptance | credential-stores | list', function (hooks) {
const featuresService = this.owner.lookup('service:features');
featuresService.enable('static-credentials');
- authenticateSession({});
+ await authenticateSession({});
});
test('users can navigate to credential-stores with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/credential-store/read-test.js b/ui/admin/tests/acceptance/credential-store/read-test.js
index 296b334df3..19e2d41982 100644
--- a/ui/admin/tests/acceptance/credential-store/read-test.js
+++ b/ui/admin/tests/acceptance/credential-store/read-test.js
@@ -5,11 +5,12 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-stores | read', function (hooks) {
setupApplicationTest(hooks);
@@ -38,7 +39,7 @@ module('Acceptance | credential-stores | read', function (hooks) {
unknownCredentialStore: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -66,7 +67,7 @@ module('Acceptance | credential-stores | read', function (hooks) {
urls.vaultCredentialStore = `${urls.credentialStores}/${instances.vaultCredentialStore.id}`;
urls.unknownCredentialStore = `${urls.credentialStores}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -101,8 +102,12 @@ module('Acceptance | credential-stores | read', function (hooks) {
await click(`[href="${urls.credentialStores}"]`);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
- assert.dom(`[href="${urls.vaultCredentialStore}"]`).exists();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultCredentialStore))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticCredentialStore))
+ .doesNotExist();
});
test('cannot navigate to a vault credential store form without proper authorization', async function (assert) {
@@ -115,15 +120,21 @@ module('Acceptance | credential-stores | read', function (hooks) {
await click(`[href="${urls.credentialStores}"]`);
- assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
- assert.dom(`[href="${urls.staticCredentialStore}"]`).exists();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticCredentialStore))
+ .isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultCredentialStore))
+ .doesNotExist();
});
test('visiting an unknown credential store displays 404 message', async function (assert) {
await visit(urls.unknownCredentialStore);
await a11yAudit();
- assert.dom('.rose-message-subtitle').hasText('Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
test('users can link to docs page for credential store', async function (assert) {
@@ -138,7 +149,7 @@ module('Acceptance | credential-stores | read', function (hooks) {
.exists();
});
- test('users can navigate to credential store and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to credential store and incorrect url auto-corrects', async function (assert) {
const projectScope = this.server.create('scope', {
type: 'project',
scope: { id: instances.scopes.org.id, type: 'org' },
diff --git a/ui/admin/tests/acceptance/credential-store/selectors.js b/ui/admin/tests/acceptance/credential-store/selectors.js
new file mode 100644
index 0000000000..681714bf75
--- /dev/null
+++ b/ui/admin/tests/acceptance/credential-store/selectors.js
@@ -0,0 +1,18 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+// Manage actions dropdown selectors
+export const MANAGE_DROPDOWN =
+ '[data-test-manage-credential-stores-dropdown] button:first-child';
+export const EDIT_ACTION =
+ '[data-test-manage-credential-stores-dropdown] ul li:nth-child(2) a';
+
+export const CODE_EDITOR_BODY = '[data-test-code-editor-field-editor] textarea';
+export const CODE_BLOCK_BODY = '.hds-code-block__code';
+
+export const TYPE_VAULT = '[value="vault"]';
+
+export const FIELD_VAULT_ADDRESS_ERROR =
+ '[data-test-error-message-vault-address]';
diff --git a/ui/admin/tests/acceptance/credential-store/update-test.js b/ui/admin/tests/acceptance/credential-store/update-test.js
index 4652bd23f7..08587005b5 100644
--- a/ui/admin/tests/acceptance/credential-store/update-test.js
+++ b/ui/admin/tests/acceptance/credential-store/update-test.js
@@ -5,11 +5,13 @@
import { module, test } from 'qunit';
import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | credential-stores | update', function (hooks) {
setupApplicationTest(hooks);
@@ -33,7 +35,7 @@ module('Acceptance | credential-stores | update', function (hooks) {
vaultCredentialStore: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -59,7 +61,13 @@ module('Acceptance | credential-stores | update', function (hooks) {
urls.credentialStores = `${urls.projectScope}/credential-stores`;
urls.vaultCredentialStore = `${urls.credentialStores}/${instances.vaultCredentialStore.id}`;
urls.staticCredentialStore = `${urls.credentialStores}/${instances.staticCredentialStore.id}`;
- authenticateSession({});
+ urls.workerFilter = `${urls.credentialStores}/${instances.vaultCredentialStore.id}/worker-filter`;
+ urls.editWorkerFilter = `${urls.credentialStores}/${instances.vaultCredentialStore.id}/edit-worker-filter`;
+ await authenticateSession({});
+
+ // Enable feature flag
+ const featuresService = this.owner.lookup('service:features');
+ featuresService.enable('vault-worker-filter');
});
test('can save changes to existing static credential store', async function (assert) {
@@ -212,8 +220,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:first-child', 'Click Discard');
+ assert.ok(find(commonSelectors.MODAL_WARNING));
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentialStores);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'static' }).models[0]
@@ -237,8 +245,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:first-child', 'Click Discard');
+ assert.ok(find(commonSelectors.MODAL_WARNING));
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.credentialStores);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'vault' }).models[0]
@@ -261,8 +269,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:last-child');
+ assert.ok(find(commonSelectors.MODAL_WARNING));
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.staticCredentialStore);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'static' }).models[0]
@@ -285,8 +293,8 @@ module('Acceptance | credential-stores | update', function (hooks) {
try {
await visit(urls.credentialStores);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:last-child');
+ assert.ok(find(commonSelectors.MODAL_WARNING));
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.vaultCredentialStore);
assert.notEqual(
this.server.schema.credentialStores.where({ type: 'vault' }).models[0]
@@ -295,4 +303,63 @@ module('Acceptance | credential-stores | update', function (hooks) {
);
}
});
+
+ test('visiting static credential store does not show worker filter tab', async function (assert) {
+ await visit(urls.staticCredentialStore);
+
+ assert.dom(commonSelectors.HREF(urls.workerFilter)).doesNotExist();
+ });
+
+ test('user can click vault credential store worker filter tab and be rerouted to correct url', async function (assert) {
+ await visit(urls.vaultCredentialStore);
+
+ assert.dom(commonSelectors.HREF(urls.workerFilter)).exists();
+
+ await click(commonSelectors.HREF(urls.workerFilter));
+
+ assert.strictEqual(currentURL(), urls.workerFilter);
+ });
+
+ test('manage actions dropdown displays edit option and routes to correct url', async function (assert) {
+ await visit(urls.vaultCredentialStore);
+
+ await click(commonSelectors.HREF(urls.workerFilter));
+ await click(selectors.MANAGE_DROPDOWN);
+ await click(selectors.EDIT_ACTION);
+
+ assert.strictEqual(currentURL(), urls.editWorkerFilter);
+ });
+
+ test('when work filters code editor is empty, save btn reroutes to empty state template', async function (assert) {
+ instances.vaultCredentialStore.update({
+ attributes: { worker_filter: null },
+ });
+ await visit(urls.vaultCredentialStore);
+
+ await click(commonSelectors.HREF(urls.workerFilter));
+
+ assert.dom('.hds-application-state').exists();
+ assert
+ .dom('.hds-application-state')
+ .hasText(
+ `No worker filter added You haven't added a worker filter yet. Add Worker Filter`,
+ );
+ });
+
+ test('when worker filter exists, readonly code block displays the filter text', async function (assert) {
+ instances.vaultCredentialStore.update({
+ attributes: { worker_filter: null },
+ });
+
+ await visit(urls.vaultCredentialStore);
+
+ await click(commonSelectors.HREF(urls.workerFilter));
+ await click(selectors.MANAGE_DROPDOWN);
+ await click(selectors.EDIT_ACTION);
+ await fillIn(selectors.CODE_EDITOR_BODY, '"bar" in "/tags/foo"');
+ await click(commonSelectors.SAVE_BTN);
+
+ assert.dom(selectors.CODE_BLOCK_BODY).exists();
+ assert.dom(selectors.CODE_BLOCK_BODY).includesText('"bar" in "/tags/foo"');
+ });
});
diff --git a/ui/admin/tests/acceptance/groups/create-test.js b/ui/admin/tests/acceptance/groups/create-test.js
index a68bd68fd8..6d226d7b87 100644
--- a/ui/admin/tests/acceptance/groups/create-test.js
+++ b/ui/admin/tests/acceptance/groups/create-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
@@ -31,8 +31,8 @@ module('Acceptance | groups | create', function (hooks) {
newGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.org = this.server.create(
'scope',
{
diff --git a/ui/admin/tests/acceptance/groups/delete-test.js b/ui/admin/tests/acceptance/groups/delete-test.js
index 05a2591cb9..ef28b75bd4 100644
--- a/ui/admin/tests/acceptance/groups/delete-test.js
+++ b/ui/admin/tests/acceptance/groups/delete-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, click, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | groups | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -38,8 +33,8 @@ module('Acceptance | groups | delete', function (hooks) {
newGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/groups/list-test.js b/ui/admin/tests/acceptance/groups/list-test.js
index 29d9131ebd..07e49d60d5 100644
--- a/ui/admin/tests/acceptance/groups/list-test.js
+++ b/ui/admin/tests/acceptance/groups/list-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, waitUntil, findAll } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | groups | list', function (hooks) {
@@ -40,7 +35,7 @@ module('Acceptance | groups | list', function (hooks) {
group2: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create(
'scope',
@@ -61,7 +56,7 @@ module('Acceptance | groups | list', function (hooks) {
urls.groups = `/scopes/${instances.scopes.org.id}/groups`;
urls.group1 = `${urls.groups}/${instances.group1.id}`;
urls.group2 = `${urls.groups}/${instances.group2.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('can navigate to groups with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/groups/members-test.js b/ui/admin/tests/acceptance/groups/members-test.js
index 6fde451023..8feda962e0 100644
--- a/ui/admin/tests/acceptance/groups/members-test.js
+++ b/ui/admin/tests/acceptance/groups/members-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find, findAll } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | groups | members', function (hooks) {
setupApplicationTest(hooks);
@@ -42,8 +37,8 @@ module('Acceptance | groups | members', function (hooks) {
const ADD_MEMBERS_ACTION_SELECTOR =
'[data-test-manage-group-dropdown] ul li a';
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/groups/read-test.js b/ui/admin/tests/acceptance/groups/read-test.js
index f40302d16a..e74ee74680 100644
--- a/ui/admin/tests/acceptance/groups/read-test.js
+++ b/ui/admin/tests/acceptance/groups/read-test.js
@@ -5,20 +5,17 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
+import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | groups | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ setupIndexedDb(hooks);
const instances = {
scopes: {
@@ -34,8 +31,8 @@ module('Acceptance | groups | read', function (hooks) {
newGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -59,12 +56,12 @@ module('Acceptance | groups | read', function (hooks) {
test('cannot navigate to a group form without proper authorization', async function (assert) {
instances.group.authorized_actions =
instances.group.authorized_actions.filter((item) => item !== 'read');
- await visit(urls.group);
+ await visit(urls.groups);
- assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
+ assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.group)).doesNotExist();
});
- test('users can navigate to group and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to group and incorrect url auto-corrects', async function (assert) {
const orgScope = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
diff --git a/ui/admin/tests/acceptance/groups/update-test.js b/ui/admin/tests/acceptance/groups/update-test.js
index f19cb73a33..3fb55c9702 100644
--- a/ui/admin/tests/acceptance/groups/update-test.js
+++ b/ui/admin/tests/acceptance/groups/update-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | groups | update', function (hooks) {
setupApplicationTest(hooks);
@@ -33,8 +28,8 @@ module('Acceptance | groups | update', function (hooks) {
newGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/host-catalogs/create-test.js b/ui/admin/tests/acceptance/host-catalogs/create-test.js
index 723ef8cfb3..75a93c8c55 100644
--- a/ui/admin/tests/acceptance/host-catalogs/create-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/create-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
module('Acceptance | host-catalogs | create', function (hooks) {
@@ -26,11 +21,12 @@ module('Acceptance | host-catalogs | create', function (hooks) {
const NAME_INPUT_SELECTOR = '[name="name"]';
const DESCRIPTION_INPUT_SELECTOR = '[name="description"]';
- const TYPE_INPUT_SELECTOR = '[name="type"]';
+ const TYPE_INPUT_SELECTOR = '[name="Type"]';
const SAVE_BUTTON_SELECTOR = '[type="submit"]';
const CANCEL_BUTTON_SELECTOR = '.rose-form-actions [type="button"]';
const ALERT_TEXT_SELECTOR =
'[data-test-toast-notification] .hds-alert__description';
+ const WORKER_FILTER_INPUT_SELECTOR = '[name=worker_filter]';
const instances = {
scopes: {
@@ -50,9 +46,10 @@ module('Acceptance | host-catalogs | create', function (hooks) {
newStaticHostCatalog: null,
newAWSDynamicHostCatalog: null,
newAzureDynamicHostCatalog: null,
+ newGCPDynamicHostCatalog: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.orgScope = this.server.create(
@@ -86,13 +83,14 @@ module('Acceptance | host-catalogs | create', function (hooks) {
urls.newStaticHostCatalog = `${urls.newHostCatalog}?type=static`;
urls.newAWSDynamicHostCatalog = `${urls.newHostCatalog}?type=aws`;
urls.newAzureDynamicHostCatalog = `${urls.newHostCatalog}?type=azure`;
+ urls.newGCPDynamicHostCatalog = `${urls.newHostCatalog}?type=gcp`;
featuresService = this.owner.lookup('service:features');
// Generate resource counter
getHostCatalogCount = () =>
this.server.schema.hostCatalogs.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('Users can create new static host catalogs', async function (assert) {
@@ -115,7 +113,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.strictEqual(getHostCatalogCount(), count + 1);
});
- test('Users can create new dynamic aws host catalogs with azure provider', async function (assert) {
+ test('Users can create new dynamic azure host catalogs with azure provider', async function (assert) {
const count = getHostCatalogCount();
await visit(urls.newAzureDynamicHostCatalog);
await fillIn(NAME_INPUT_SELECTOR, 'random string');
@@ -125,6 +123,18 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.strictEqual(getHostCatalogCount(), count + 1);
});
+ test('Users can create new dynamic host catalogs with GCP provider ', async function (assert) {
+ const count = getHostCatalogCount();
+ await visit(urls.newGCPDynamicHostCatalog);
+ await fillIn(NAME_INPUT_SELECTOR, 'random string');
+ await fillIn(DESCRIPTION_INPUT_SELECTOR, 'random string');
+ await fillIn('[name="zone"]', 'random string');
+ await fillIn('[name="project_id"]', 'random string');
+ await fillIn('[name="client_email"]', 'random string');
+ await click(SAVE_BUTTON_SELECTOR);
+ assert.strictEqual(getHostCatalogCount(), count + 1);
+ });
+
test('Users can cancel creation of new static host catalogs', async function (assert) {
const count = getHostCatalogCount();
await visit(urls.newStaticHostCatalog);
@@ -143,6 +153,15 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.strictEqual(getHostCatalogCount(), count);
});
+ test('Users can cancel creation of new dynamic host catalogs with GCP provider', async function (assert) {
+ const count = getHostCatalogCount();
+ await visit(urls.newGCPDynamicHostCatalog);
+ await fillIn(NAME_INPUT_SELECTOR, 'random string');
+ await click(CANCEL_BUTTON_SELECTOR);
+ assert.strictEqual(currentURL(), urls.hostCatalogs);
+ assert.strictEqual(getHostCatalogCount(), count);
+ });
+
test('Users can cancel creation of new dynamic host catalogs with Azure provider', async function (assert) {
const count = getHostCatalogCount();
await visit(urls.newAzureDynamicHostCatalog);
@@ -159,7 +178,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
'host-catalogs'
].includes('create'),
);
- assert.dom(`[href="${urls.newHostCatalog}"]`).exists();
+ assert.dom(`[href="${urls.newHostCatalog}"]`).isVisible();
});
test('Users cannot navigate to new static host catalogs route without proper authorization', async function (assert) {
@@ -171,7 +190,7 @@ module('Acceptance | host-catalogs | create', function (hooks) {
'host-catalogs'
].includes('create'),
);
- assert.dom(`[href="${urls.newStaticHostCatalog}"]`).doesNotExist();
+ assert.dom(`[href="${urls.newStaticHostCatalog}"]`).isNotVisible();
});
test('saving a new static host catalog with invalid fields displays error messages', async function (assert) {
@@ -200,15 +219,26 @@ module('Acceptance | host-catalogs | create', function (hooks) {
assert.dom('[data-test-error-message-name]').hasText('Name is required.');
});
- test('users should not see worker filter field in community edition', async function (assert) {
+ test('users should not see worker filter field in community edition when AWS host catalog is selected', async function (assert) {
+ await visit(urls.newAWSDynamicHostCatalog);
+ assert.dom(WORKER_FILTER_INPUT_SELECTOR).isNotVisible();
+ });
+
+ test('users should not see worker filter field in community edition when GCP host catalog is selected', async function (assert) {
+ await visit(urls.newGCPDynamicHostCatalog);
+ assert.dom(WORKER_FILTER_INPUT_SELECTOR).isNotVisible();
+ });
+
+ test('users should see worker filter field in enterprise edition when AWS host catalog is selected', async function (assert) {
+ featuresService.enable('host-catalog-worker-filter');
await visit(urls.newAWSDynamicHostCatalog);
- assert.dom('[data-test-dynamic-credential-worker-filter]').doesNotExist();
+ assert.dom(WORKER_FILTER_INPUT_SELECTOR).isVisible();
});
- test('users should see worker filter field in enterprise edition', async function (assert) {
- featuresService.enable('dynamic-credentials-worker-filter');
+ test('users should see worker filter field in enterprise edition when GCP host catalog is selected', async function (assert) {
+ featuresService.enable('host-catalog-worker-filter');
await visit(urls.newAWSDynamicHostCatalog);
- assert.dom('[data-test-dynamic-credential-worker-filter]').exists();
+ assert.dom(WORKER_FILTER_INPUT_SELECTOR).isVisible();
});
test('users cannot directly navigate to new host catalog route without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/delete-test.js b/ui/admin/tests/acceptance/host-catalogs/delete-test.js
index b043430460..2bab43b5cf 100644
--- a/ui/admin/tests/acceptance/host-catalogs/delete-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/delete-test.js
@@ -5,16 +5,16 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
+import {
+ TYPE_HOST_CATALOG_DYNAMIC,
+ TYPE_HOST_CATALOG_PLUGIN_GCP,
+} from 'api/models/host-catalog';
module('Acceptance | host-catalogs | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -34,6 +34,7 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
project: null,
},
hostCatalog: null,
+ gcpDynamicHostCatalog: null,
};
const urls = {
globalScope: null,
@@ -41,9 +42,10 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
projectScope: null,
hostCatalogs: null,
hostCatalog: null,
+ gcpDynamicHostCatalog: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -57,16 +59,24 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
instances.hostCatalog = this.server.create('host-catalog', {
scope: instances.scopes.project,
});
+
+ instances.gcpDynamicHostCatalog = this.server.create('host-catalog', {
+ scope: instances.scopes.project,
+ type: TYPE_HOST_CATALOG_DYNAMIC,
+ plugin: { name: TYPE_HOST_CATALOG_PLUGIN_GCP },
+ });
+
// Generate route URLs for resources
urls.globalScope = `/scopes/global/scopes`;
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
+ urls.gcpDynamicHostCatalog = `${urls.hostCatalogs}/${instances.gcpDynamicHostCatalog.id}`;
// Generate resource counter
getHostCatalogCount = () =>
this.server.schema.hostCatalogs.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete host catalog', async function (assert) {
@@ -80,6 +90,18 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
assert.strictEqual(getHostCatalogCount(), hostCatalogCount - 1);
});
+ test('can delete GCP host catalog', async function (assert) {
+ const hostCatalogCount = getHostCatalogCount();
+
+ await visit(urls.hostCatalogs);
+ await click(`[href="${urls.gcpDynamicHostCatalog}"]`);
+
+ await click(MANAGE_DROPDOWN_SELECTOR);
+ await click(DELETE_ACTION_SELECTOR);
+
+ assert.strictEqual(getHostCatalogCount(), hostCatalogCount - 1);
+ });
+
test('cannot delete host catalog without proper authorization', async function (assert) {
await visit(urls.hostCatalogs);
instances.hostCatalog.authorized_actions =
@@ -102,7 +124,7 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
await click(`[href="${urls.hostCatalog}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert
.dom('[data-test-toast-notification] .hds-alert__description')
@@ -120,7 +142,7 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
await click(`[href="${urls.hostCatalog}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(getHostCatalogCount(), hostCatalogCount);
assert.strictEqual(currentURL(), urls.hostCatalog);
diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/create-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/create-test.js
index 83e7db51b7..1d3b9553a3 100644
--- a/ui/admin/tests/acceptance/host-catalogs/host-sets/create-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/create-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | host-catalogs | host sets | create', function (hooks) {
setupApplicationTest(hooks);
@@ -54,7 +49,7 @@ module('Acceptance | host-catalogs | host sets | create', function (hooks) {
newHostSet: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -84,7 +79,7 @@ module('Acceptance | host-catalogs | host sets | create', function (hooks) {
urls.newHostSet = `${urls.hostSets}/new`;
// Generate resource couner
getHostSetCount = () => this.server.schema.hostSets.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can create new host sets', async function (assert) {
@@ -155,6 +150,37 @@ module('Acceptance | host-catalogs | host sets | create', function (hooks) {
assert.deepEqual(hostSet.syncIntervalSeconds, 10);
});
+ test('can create new gcp host set', async function (assert) {
+ instances.hostCatalog = this.server.create('host-catalog', {
+ scope: instances.scopes.project,
+ type: 'plugin',
+ plugin: {
+ id: `plugin-id-1`,
+ name: 'gcp',
+ },
+ });
+
+ const count = getHostSetCount();
+ await visit(
+ `${urls.hostCatalogs}/${instances.hostCatalog.id}/host-sets/new`,
+ );
+ const name = 'gcp host set';
+ await fillIn(NAME_SELECTOR, name);
+ await fillIn(PREFERRED_ENDPOINT_TEXT_INPUT_SELECTOR, 'endpoint');
+ await click(PREFERRED_ENDPOINT_BUTTON_SELECTOR);
+ await fillIn(FILTER_TEXT_INPUT_SELECTOR, 'filter_test');
+ await click(FILTER_BUTTON_SELECTOR);
+
+ await fillIn(SYNC_INTERVAL_SELECTOR, 10);
+ await click(SUBMIT_BTN_SELECTOR);
+
+ assert.strictEqual(getHostSetCount(), count + 1);
+ const hostSet = this.server.schema.hostSets.findBy({ name });
+ assert.deepEqual(hostSet.preferredEndpoints, ['endpoint']);
+ assert.deepEqual(hostSet.attributes.filters, ['filter_test']);
+ assert.deepEqual(hostSet.syncIntervalSeconds, 10);
+ });
+
test('Users cannot create a new host set without proper authorization', async function (assert) {
instances.hostCatalog.authorized_collection_actions['host-sets'] = [];
await visit(urls.hostCatalog);
diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/delete-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/delete-test.js
index fa17fc1ce5..82529926b8 100644
--- a/ui/admin/tests/acceptance/host-catalogs/host-sets/delete-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/delete-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, find, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | host-catalogs | host sets | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -48,7 +43,7 @@ module('Acceptance | host-catalogs | host sets | delete', function (hooks) {
newHostSet: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -78,7 +73,7 @@ module('Acceptance | host-catalogs | host sets | delete', function (hooks) {
urls.newHostSet = `${urls.hostSets}/new`;
// Generate resource couner
getHostSetCount = () => this.server.schema.hostSets.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete host', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/hosts-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/hosts-test.js
index d33f750985..19fbd677d0 100644
--- a/ui/admin/tests/acceptance/host-catalogs/host-sets/hosts-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/hosts-test.js
@@ -12,16 +12,11 @@ import {
findAll,
fillIn,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) {
setupApplicationTest(hooks);
@@ -57,7 +52,7 @@ module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) {
newHost: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -90,7 +85,7 @@ module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) {
// Generate resource counter
getHostSetHostCount = () =>
this.server.schema.hostSets.all().models[0].hosts.length;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting host set hosts', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js
index 24a5f2d87c..54eda5971c 100644
--- a/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js
@@ -5,14 +5,9 @@
import { module, test } from 'qunit';
import { visit, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | host-catalogs | host sets | list', function (hooks) {
setupApplicationTest(hooks);
@@ -41,7 +36,7 @@ module('Acceptance | host-catalogs | host sets | list', function (hooks) {
newHostSet: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -68,7 +63,7 @@ module('Acceptance | host-catalogs | host sets | list', function (hooks) {
urls.hostSets = `${urls.hostCatalog}/host-sets`;
urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`;
urls.newHostSet = `${urls.hostSets}/new`;
- authenticateSession({});
+ await authenticateSession({});
});
test('Users can navigate to host-sets with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js
index 6b464d8511..7778639695 100644
--- a/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js
@@ -5,15 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
setupApplicationTest(hooks);
@@ -40,7 +36,7 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
unknownHostSet: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -68,7 +64,7 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`;
urls.unknownHostSet = `${urls.hostSets}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting host sets', async function (assert) {
@@ -89,14 +85,18 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
await click(`[href="${urls.hostSets}"]`);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.hostSet))
+ .doesNotExist();
});
test('visiting an unknown host set displays 404 message', async function (assert) {
await visit(urls.unknownHostSet);
await a11yAudit();
- assert.dom('.rose-message-subtitle').hasText('Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
test('users can link to docs page for host sets', async function (assert) {
@@ -111,7 +111,7 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
.exists();
});
- test('users can navigate to host set and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to host set and incorrect url auto-corrects', async function (assert) {
const hostCatalog = this.server.create('host-catalog', {
scope: instances.scopes.project,
type: 'static',
diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/update-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/update-test.js
index 10da34f497..4ea2960823 100644
--- a/ui/admin/tests/acceptance/host-catalogs/host-sets/update-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/update-test.js
@@ -12,15 +12,11 @@ import {
click,
fillIn,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | host sets | update', function (hooks) {
setupApplicationTest(hooks);
@@ -67,7 +63,7 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
azureHostSet: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -124,7 +120,7 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
urls.awshostSet = `${urls.hostCatalogs}/${instances.awsHostCatalog.id}/host-sets/${instances.awsHostSet.id}`;
urls.azureHostSet = `${urls.hostCatalogs}/${instances.azureHostCatalog.id}/host-sets/${instances.azureHostSet.id}`;
// Generate resource couner
- authenticateSession({});
+ await authenticateSession({});
});
test('saving a new host set with invalid fields displays error messages', async function (assert) {
@@ -251,6 +247,52 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
assert.deepEqual(hostSet.syncIntervalSeconds, 10);
});
+ test('can save changes to an existing gcp host-set', async function (assert) {
+ await visit(urls.awshostSet);
+
+ await click(EDIT_BUTTON_SELECTOR, 'Activate edit mode');
+
+ const name = 'gcp host set';
+ await fillIn('[name="name"]', name);
+
+ const endpointList = findAll(PREFERRED_ENDPOINT_REMOVE_BUTTON_SELECTOR);
+
+ for (const element of endpointList) {
+ await click(element);
+ }
+
+ assert.strictEqual(
+ findAll(PREFERRED_ENDPOINT_REMOVE_BUTTON_SELECTOR).length,
+ 0,
+ );
+
+ await fillIn(PREFERRED_ENDPOINT_TEXT_INPUT_SELECTOR, 'sample endpoint');
+ await click(PREFERRED_ENDPOINT_BUTTON_SELECTOR);
+
+ // Remove all the filters
+ const filterList = await Promise.all(
+ findAll(FILTER_REMOVE_BUTTON_SELECTOR),
+ );
+ for (const element of filterList) {
+ await click(element);
+ }
+
+ assert.strictEqual(findAll(FILTER_REMOVE_BUTTON_SELECTOR).length, 0);
+ await fillIn(FILTER_TEXT_INPUT_SELECTOR, 'sample filters');
+ await click(FILTER_BUTTON_SELECTOR);
+
+ await fillIn(SYNC_INTERVAL_SELECTOR, 10);
+
+ await click(SUBMIT_BTN_SELECTOR);
+
+ assert.strictEqual(currentURL(), urls.awshostSet);
+ const hostSet = this.server.schema.hostSets.findBy({ name });
+ assert.strictEqual(hostSet.name, name);
+ assert.deepEqual(hostSet.preferredEndpoints, ['sample endpoint']);
+ assert.deepEqual(hostSet.attributes.filters, ['sample filters']);
+ assert.deepEqual(hostSet.syncIntervalSeconds, 10);
+ });
+
test('cannot make changes to an existing host without proper authorization', async function (assert) {
instances.hostSet.authorized_actions =
instances.hostSet.authorized_actions.filter((item) => item !== 'update');
@@ -312,8 +354,8 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
try {
await visit(urls.hostSets);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:first-child');
+ assert.ok(find(commonSelectors.MODAL_WARNING));
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.hostSets);
assert.notEqual(
this.server.schema.hostSets.first().name,
diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js
index e6c872f965..d5158b74ff 100644
--- a/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -39,7 +39,7 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
newHost: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -70,7 +70,7 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
urls.newHost = `${urls.hosts}/new`;
// Generate resource couner
getHostCount = () => this.server.schema.hosts.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can create new host', async function (assert) {
@@ -98,14 +98,22 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
assert.dom(commonSelectors.HREF(urls.newHost)).doesNotExist();
});
+
test('Users can navigate to new host route with proper authorization', async function (assert) {
await visit(urls.hosts);
+
assert.ok(
instances.hostCatalog.authorized_collection_actions.hosts.includes(
'create',
),
);
- assert.dom(selectors.MANAGE_DROPDOWN).exists();
+ assert.dom(selectors.MANAGE_DROPDOWN_HOST_CATALOG).exists();
+ await click(selectors.MANAGE_DROPDOWN_HOST_CATALOG);
+ assert
+ .dom(selectors.MANAGE_DROPDOWN_HOST_CATALOG_NEW_HOST)
+ .hasAttribute('href', urls.newHost);
+ await click(selectors.MANAGE_DROPDOWN_HOST_CATALOG_NEW_HOST);
+ assert.strictEqual(currentURL(), urls.newHost);
});
test('Users cannot navigate to new host route without proper authorization', async function (assert) {
@@ -141,8 +149,8 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
details: {
request_fields: [
{
- name: 'name',
- description: 'Name is required.',
+ name: 'address',
+ description: 'Address is required.',
},
],
},
@@ -156,7 +164,7 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
.dom(commonSelectors.ALERT_TOAST_BODY)
.hasText('The request was invalid.');
- assert.dom(commonSelectors.FIELD_NAME_ERROR).hasText('Name is required.');
+ assert.dom(selectors.FIELD_ADDRESS_ERROR).hasText('Address is required.');
});
test('users cannot directly navigate to new host route without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/delete-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/delete-test.js
index 47db37aab2..670a3fcba0 100644
--- a/ui/admin/tests/acceptance/host-catalogs/hosts/delete-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/hosts/delete-test.js
@@ -4,28 +4,21 @@
*/
import { module, test } from 'qunit';
-import { visit, find, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, click } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let getHostCount;
- const MANAGE_DROPDOWN_SELECTOR =
- '[data-test-manage-hosts-dropdown] button:first-child';
- const DELETE_ACTION_SELECTOR =
- '[data-test-manage-hosts-dropdown] ul li button';
const instances = {
scopes: {
@@ -48,7 +41,7 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
newHost: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -78,14 +71,15 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
urls.newHost = `${urls.hosts}/new`;
// Generate resource couner
getHostCount = () => this.server.schema.hosts.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete host', async function (assert) {
const count = getHostCount();
await visit(urls.host);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
+
+ await click(selectors.MANAGE_DROPDOWN_HOST);
+ await click(selectors.MANAGE_DROPDOWN_HOST_DELETE);
assert.strictEqual(getHostCount(), count - 1);
});
@@ -93,9 +87,8 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
instances.host.authorized_actions =
instances.host.authorized_actions.filter((item) => item !== 'delete');
await visit(urls.host);
- assert.notOk(
- find('.rose-layout-page-actions .rose-dropdown-button-danger'),
- );
+
+ assert.dom(selectors.MANAGE_DROPDOWN_HOST).doesNotExist();
});
test('can accept delete host via dialog', async function (assert) {
@@ -104,8 +97,10 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
confirmService.confirm = sinon.fake.returns(resolve());
const count = getHostCount();
await visit(urls.host);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
+
+ await click(selectors.MANAGE_DROPDOWN_HOST);
+ await click(selectors.MANAGE_DROPDOWN_HOST_DELETE);
+
assert.strictEqual(getHostCount(), count - 1);
assert.ok(confirmService.confirm.calledOnce);
});
@@ -116,8 +111,10 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
confirmService.confirm = sinon.fake.returns(reject());
const count = getHostCount();
await visit(urls.host);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
+
+ await click(selectors.MANAGE_DROPDOWN_HOST);
+ await click(selectors.MANAGE_DROPDOWN_HOST_DELETE);
+
assert.strictEqual(getHostCount(), count);
assert.ok(confirmService.confirm.calledOnce);
});
@@ -135,10 +132,10 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
);
});
await visit(urls.host);
- await click(MANAGE_DROPDOWN_SELECTOR);
- await click(DELETE_ACTION_SELECTOR);
- assert
- .dom('[data-test-toast-notification] .hds-alert__description')
- .hasText('Oops.');
+
+ await click(selectors.MANAGE_DROPDOWN_HOST);
+ await click(selectors.MANAGE_DROPDOWN_HOST_DELETE);
+
+ assert.dom(commonSelectors.ALERT_TOAST_BODY).hasText('Oops.');
});
});
diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js
index ae7a135fd3..e56c4e09b9 100644
--- a/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js
@@ -4,25 +4,17 @@
*/
import { module, test } from 'qunit';
-import { visit, find, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, click, currentURL } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | hosts | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
- const MANAGE_DROPDOWN_SELECTOR =
- '[data-test-manage-host-catalogs-dropdown] button:first-child';
- const NEW_HOST_SELECTOR =
- '[data-test-manage-host-catalogs-dropdown] div ul li a';
-
const instances = {
scopes: {
global: null,
@@ -44,7 +36,7 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) {
newHost: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -72,35 +64,41 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) {
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
urls.newHost = `${urls.hosts}/new`;
- authenticateSession({});
+ await authenticateSession({});
});
+
test('Users can navigate to hosts with proper authorization', async function (assert) {
await visit(urls.hostCatalog);
+
assert.ok(
instances.hostCatalog.authorized_collection_actions.hosts.includes(
'list',
),
);
- assert.dom(MANAGE_DROPDOWN_SELECTOR);
- assert.ok(find(`[href="${urls.hosts}"]`));
+
+ assert.dom(selectors.MANAGE_DROPDOWN_HOST_CATALOG).isVisible();
+ assert.dom(commonSelectors.HREF(urls.hosts)).isVisible();
});
test('User cannot navigate to index without either list or create actions', async function (assert) {
instances.hostCatalog.authorized_collection_actions.hosts = [];
await visit(urls.hostCatalog);
+
assert.notOk(
instances.hostCatalog.authorized_collection_actions.hosts.includes(
'list',
),
);
- assert.notOk(find(`[href="${urls.hosts}"]`));
+ assert.dom(commonSelectors.HREF(urls.hosts)).doesNotExist();
});
test('User can navigate to index with only create action', async function (assert) {
instances.hostCatalog.authorized_collection_actions.hosts = ['create'];
await visit(urls.hostCatalog);
- assert.ok(find(`[href="${urls.hosts}"]`));
- await click(MANAGE_DROPDOWN_SELECTOR);
- assert.dom(NEW_HOST_SELECTOR).hasAttribute('href', urls.newHost);
+
+ assert.dom(commonSelectors.HREF(urls.hosts)).isVisible();
+ await click(selectors.MANAGE_DROPDOWN_HOST_CATALOG);
+ await click(selectors.MANAGE_DROPDOWN_HOST_CATALOG_NEW_HOST);
+ assert.strictEqual(currentURL(), urls.newHost);
});
});
diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js
index e9ef8de8e7..9351fcb8ed 100644
--- a/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -36,7 +36,7 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
unknownHost: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -64,7 +64,7 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting hosts', async function (assert) {
@@ -85,7 +85,7 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
await click(commonSelectors.HREF(urls.hosts));
- assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
+ assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.host)).doesNotExist();
});
test('visiting an unknown host displays 404 message', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/selectors.js b/ui/admin/tests/acceptance/host-catalogs/hosts/selectors.js
index 1a144c948e..d27a7e0bad 100644
--- a/ui/admin/tests/acceptance/host-catalogs/hosts/selectors.js
+++ b/ui/admin/tests/acceptance/host-catalogs/hosts/selectors.js
@@ -3,8 +3,14 @@
* SPDX-License-Identifier: BUSL-1.1
*/
-export const MANAGE_DROPDOWN =
+export const MANAGE_DROPDOWN_HOST_CATALOG =
'[data-test-manage-host-catalogs-dropdown] button:first-child';
-
+export const MANAGE_DROPDOWN_HOST_CATALOG_NEW_HOST =
+ '[data-test-manage-host-catalogs-dropdown] ul li:first-child a';
+export const MANAGE_DROPDOWN_HOST =
+ '[data-test-manage-hosts-dropdown] button:first-child';
+export const MANAGE_DROPDOWN_HOST_DELETE =
+ '[data-test-manage-hosts-dropdown] ul li button';
export const FIELD_ADDRESS = '[name=address]';
export const FIELD_ADDRESS_VALUE = 'New address';
+export const FIELD_ADDRESS_ERROR = '[data-test-error-message-address]';
diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/update-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/update-test.js
index 3973c5fcdb..3965bcd30d 100644
--- a/ui/admin/tests/acceptance/host-catalogs/hosts/update-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/hosts/update-test.js
@@ -4,16 +4,13 @@
*/
import { module, test } from 'qunit';
-import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as selectors from './selectors';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | hosts | update', function (hooks) {
setupApplicationTest(hooks);
@@ -40,7 +37,7 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
newHost: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -69,36 +66,51 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
urls.unknownHost = `${urls.hosts}/foo`;
urls.newHost = `${urls.hosts}/new`;
// Generate resource couner
- authenticateSession({});
+ await authenticateSession({});
});
test('can save changes to existing host', async function (assert) {
- assert.notEqual(instances.host.name, 'random string');
+ assert.notEqual(instances.host.name, commonSelectors.FIELD_NAME_VALUE);
await visit(urls.host);
- await click('form [type="button"]', 'Activate edit mode');
- await fillIn('[name="name"]', 'random string');
- await click('.rose-form-actions [type="submit"]');
- assert.strictEqual(currentURL(), urls.host);
- assert.strictEqual(
- this.server.schema.hosts.all().models[0].name,
- 'random string',
+
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
);
+ await click(commonSelectors.SAVE_BTN);
+
+ const { name, description } = this.server.schema.hosts.all().models[0];
+ assert.strictEqual(currentURL(), urls.host);
+ assert.strictEqual(name, commonSelectors.FIELD_NAME_VALUE);
+ assert.strictEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
});
test('cannot make changes to an existing host without proper authorization', async function (assert) {
instances.host.authorized_actions =
instances.host.authorized_actions.filter((item) => item !== 'update');
await visit(urls.host);
- assert.notOk(find('.rose-layout-page-actions .rose-button-secondary'));
+
+ assert.dom(commonSelectors.EDIT_BTN).doesNotExist();
});
test('can cancel changes to existing host', async function (assert) {
+ const { name, description } = instances.host;
await visit(urls.host);
- await click('form [type="button"]', 'Activate edit mode');
- await fillIn('[name="name"]', 'random string');
- await click('.rose-form-actions [type="button"]');
- assert.notEqual(instances.host.name, 'random string');
- assert.strictEqual(find('[name="name"]').value, instances.host.name);
+
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
+ await click(commonSelectors.CANCEL_BTN);
+
+ assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
+ assert.notEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
+ assert.dom(commonSelectors.FIELD_NAME).hasValue(name);
+ assert.dom(commonSelectors.FIELD_DESCRIPTION).hasValue(description);
});
test('saving an existing host with invalid fields displays error messages', async function (assert) {
@@ -113,8 +125,8 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
details: {
request_fields: [
{
- name: 'name',
- description: 'Name is required.',
+ name: 'address',
+ description: 'Address is required.',
},
],
},
@@ -122,59 +134,73 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
);
});
await visit(urls.host);
- await click('form [type="button"]', 'Activate edit mode');
- await fillIn('[name="name"]', 'random string');
- await click('[type="submit"]');
+
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(selectors.FIELD_ADDRESS, '');
+ await click(commonSelectors.SAVE_BTN);
+
assert
- .dom('[data-test-toast-notification] .hds-alert__description')
+ .dom(commonSelectors.ALERT_TOAST_BODY)
.hasText('The request was invalid.');
- assert.ok(
- find('[data-test-error-message-name]').textContent.trim(),
- 'Name is required.',
- );
+ assert.dom(selectors.FIELD_ADDRESS_ERROR).hasText('Address is required.');
});
test('can discard unsaved host changes via dialog', async function (assert) {
- assert.expect(5);
+ assert.expect(7);
+ const { name, description } = this.server.schema.hosts.all().models[0];
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
- assert.notEqual(instances.host.name, 'random string');
+ assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
+ assert.notEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
await visit(urls.host);
- await click('form [type="button"]', 'Activate edit mode');
- await fillIn('[name="name"]', 'random string');
+
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
assert.strictEqual(currentURL(), urls.host);
+
+ // Wrap on a try/catch because transitioning while editing returns error
try {
await visit(urls.hosts);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:first-child');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.hosts);
- assert.notEqual(
- this.server.schema.hosts.all().models[0].name,
- 'random string',
- );
+ assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
+ assert.notEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
}
});
test('can cancel discard unsaved host changes via dialog', async function (assert) {
- assert.expect(5);
+ assert.expect(7);
+ const { name, description } = this.server.schema.hosts.all().models[0];
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
- assert.notEqual(instances.host.name, 'random string');
+ assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
+ assert.notEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
await visit(urls.host);
- await click('form [type="button"]', 'Activate edit mode');
- await fillIn('[name="name"]', 'random string');
+
+ await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
+ await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
+ await fillIn(
+ commonSelectors.FIELD_DESCRIPTION,
+ commonSelectors.FIELD_DESCRIPTION_VALUE,
+ );
assert.strictEqual(currentURL(), urls.host);
+
+ // Wrap on a try/catch because transitioning while editing returns error
try {
await visit(urls.hosts);
} catch (e) {
- assert.ok(find('.rose-dialog'));
- await click('.rose-dialog-footer button:last-child');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
+
assert.strictEqual(currentURL(), urls.host);
- assert.notEqual(
- this.server.schema.hosts.all().models[0].name,
- 'random string',
- );
+ assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
+ assert.notEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
}
});
});
diff --git a/ui/admin/tests/acceptance/host-catalogs/list-test.js b/ui/admin/tests/acceptance/host-catalogs/list-test.js
index 76ba216e13..ff61bcabf9 100644
--- a/ui/admin/tests/acceptance/host-catalogs/list-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/list-test.js
@@ -5,21 +5,18 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, waitFor } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import {
TYPE_HOST_CATALOG_DYNAMIC,
TYPE_HOST_CATALOG_STATIC,
TYPE_HOST_CATALOG_PLUGIN_AWS,
TYPE_HOST_CATALOG_PLUGIN_AZURE,
+ TYPE_HOST_CATALOG_PLUGIN_GCP,
} from 'api/models/host-catalog';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | list', function (hooks) {
setupApplicationTest(hooks);
@@ -33,6 +30,7 @@ module('Acceptance | host-catalogs | list', function (hooks) {
project: null,
},
staticHostCatalog: null,
+ gcpHostCatalog: null,
};
const urls = {
@@ -40,13 +38,16 @@ module('Acceptance | host-catalogs | list', function (hooks) {
orgScope: null,
projectScope: null,
hostCatalogs: null,
+ awsHostCatalog: null,
+ azureHostCatalog: null,
staticHostCatalog: null,
+ gcpHostCatalog: null,
};
const SEARCH_INPUT_SELECTOR = '.search-filtering [type="search"]';
const NO_RESULTS_MSG_SELECTOR = '[data-test-no-host-catalog-results]';
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -70,6 +71,12 @@ module('Acceptance | host-catalogs | list', function (hooks) {
type: TYPE_HOST_CATALOG_DYNAMIC,
plugin: { name: TYPE_HOST_CATALOG_PLUGIN_AZURE },
});
+ instances.gcpHostCatalog = this.server.create('host-catalog', {
+ scope: instances.scopes.project,
+ type: TYPE_HOST_CATALOG_DYNAMIC,
+ plugin: { name: TYPE_HOST_CATALOG_PLUGIN_GCP },
+ });
+
urls.globalScope = `/scopes/global/scopes`;
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
@@ -77,8 +84,9 @@ module('Acceptance | host-catalogs | list', function (hooks) {
urls.staticHostCatalog = `${urls.hostCatalogs}/${instances.staticHostCatalog.id}`;
urls.awsHostCatalog = `${urls.hostCatalogs}/${instances.awsHostCatalog.id}`;
urls.azureHostCatalog = `${urls.hostCatalogs}/${instances.azureHostCatalog.id}`;
+ urls.gcpHostCatalog = `${urls.hostCatalogs}/${instances.gcpHostCatalog.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('user can navigate to host catalogs with proper authorization', async function (assert) {
@@ -143,7 +151,10 @@ module('Acceptance | host-catalogs | list', function (hooks) {
await click(`[href="${urls.hostCatalogs}"]`);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
+ assert.dom('.hds-application-state__body-text').isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticHostCatalog))
+ .doesNotExist();
});
test('user can navigate to index with only list action', async function (assert) {
@@ -214,6 +225,21 @@ module('Acceptance | host-catalogs | list', function (hooks) {
assert.dom(`[href="${urls.azureHostCatalog}"]`).exists();
});
+ test('user can search for gcp host catalog', async function (assert) {
+ await visit(urls.projectScope);
+
+ await click(`[href="${urls.hostCatalogs}"]`);
+ assert.dom(`[href="${urls.staticHostCatalog}"]`).isVisible();
+ assert.dom(`[href="${urls.awsHostCatalog}"]`).isVisible();
+ assert.dom(`[href="${urls.azureHostCatalog}"]`).isVisible();
+ assert.dom(`[href="${urls.gcpHostCatalog}"]`).isVisible();
+
+ await fillIn(SEARCH_INPUT_SELECTOR, TYPE_HOST_CATALOG_PLUGIN_GCP);
+ await waitFor(`[href="${urls.staticHostCatalog}"]`, { count: 0 });
+
+ assert.dom(`[href="${urls.gcpHostCatalog}"]`).isVisible();
+ });
+
test('user can search for host catalogs and get no results', async function (assert) {
await visit(urls.projectScope);
diff --git a/ui/admin/tests/acceptance/host-catalogs/read-test.js b/ui/admin/tests/acceptance/host-catalogs/read-test.js
index b90cd4e702..790575beb1 100644
--- a/ui/admin/tests/acceptance/host-catalogs/read-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/read-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | host-catalogs | read', function (hooks) {
setupApplicationTest(hooks);
@@ -38,7 +34,7 @@ module('Acceptance | host-catalogs | read', function (hooks) {
hostCatalog: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -60,7 +56,7 @@ module('Acceptance | host-catalogs | read', function (hooks) {
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
urls.unknownHostCatalog = `${urls.hostCatalogs}/foo`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting host catalogs', async function (assert) {
@@ -83,14 +79,18 @@ module('Acceptance | host-catalogs | read', function (hooks) {
await click(`[href="${urls.hostCatalogs}"]`);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.hostCatalog))
+ .doesNotExist();
});
test('visiting an unknown host catalog displays 404 message', async function (assert) {
await visit(urls.unknownHostCatalog);
await a11yAudit();
- assert.dom('.rose-message-subtitle').hasText('Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
test('users can link to docs page for host catalog', async function (assert) {
diff --git a/ui/admin/tests/acceptance/host-catalogs/update-test.js b/ui/admin/tests/acceptance/host-catalogs/update-test.js
index ab7d216363..4ad8931030 100644
--- a/ui/admin/tests/acceptance/host-catalogs/update-test.js
+++ b/ui/admin/tests/acceptance/host-catalogs/update-test.js
@@ -5,19 +5,16 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
import {
TYPE_HOST_CATALOG_DYNAMIC,
TYPE_HOST_CATALOG_PLUGIN_AWS,
+ TYPE_HOST_CATALOG_PLUGIN_GCP,
} from 'api/models/host-catalog';
module('Acceptance | host-catalogs | update', function (hooks) {
@@ -32,6 +29,7 @@ module('Acceptance | host-catalogs | update', function (hooks) {
project: null,
},
hostCatalog: null,
+ GCPHostCatalog: null,
};
const urls = {
globalScope: null,
@@ -40,19 +38,17 @@ module('Acceptance | host-catalogs | update', function (hooks) {
hostCatalogs: null,
hostCatalog: null,
AWSHostCatalogWithStaticCredential: null,
+ GCPHostCatalog: null,
};
const NAME_INPUT_SELECTOR = '[name="name"]';
- const EDIT_BUTTON_SELECTOR = 'form [type="button"]';
+ const EDIT_BUTTON_SELECTOR = '.rose-form-actions [type=button]';
const SAVE_BUTTON_SELECTOR = '.rose-form-actions [type="submit"]';
const CANCEL_BUTTON_SELECTOR = '.rose-form-actions [type="button"]';
- const MODAL_DISCARD_BUTTON_SELECTOR =
- '.rose-dialog-footer button:first-child';
- const MODAL_CANCEL_BUTTON_SELECTOR = '.rose-dialog-footer button:last-child';
const CREDENTIAL_TYPE_SELECTOR =
'.dynamic-credential-selection input:checked';
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -66,6 +62,12 @@ module('Acceptance | host-catalogs | update', function (hooks) {
instances.hostCatalog = this.server.create('host-catalog', {
scope: instances.scopes.project,
});
+ instances.GCPHostCatalog = this.server.create('host-catalog', {
+ scope: instances.scopes.project,
+ type: TYPE_HOST_CATALOG_DYNAMIC,
+ plugin: { name: TYPE_HOST_CATALOG_PLUGIN_GCP },
+ });
+
instances.AWSHostCatalogWithStaticCredential = this.server.create(
'host-catalog',
{
@@ -82,12 +84,14 @@ module('Acceptance | host-catalogs | update', function (hooks) {
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
urls.AWSHostCatalogWithStaticCredential = `${urls.hostCatalogs}/${instances.AWSHostCatalogWithStaticCredential.id}`;
- authenticateSession({});
+ urls.GCPHostCatalog = `${urls.hostCatalogs}/${instances.GCPHostCatalog.id}`;
+ await authenticateSession({});
});
test('can update static AWS credentials to Dynamic AWS credentials', async function (assert) {
await visit(urls.AWSHostCatalogWithStaticCredential);
await click(EDIT_BUTTON_SELECTOR, 'Activate edit mode');
+
assert.strictEqual(
find(CREDENTIAL_TYPE_SELECTOR).value,
'static-credential',
@@ -103,6 +107,19 @@ module('Acceptance | host-catalogs | update', function (hooks) {
);
});
+ test('can update GCP host catalog', async function (assert) {
+ await visit(urls.GCPHostCatalog);
+ await click(EDIT_BUTTON_SELECTOR, 'Activate edit mode');
+ await fillIn('[name=project_id]', 'project-id');
+ await click(SAVE_BUTTON_SELECTOR);
+
+ assert.strictEqual(
+ this.server.schema.hostCatalogs.where({ type: 'plugin' }).models[0]
+ .attributes.project_id,
+ 'project-id',
+ );
+ });
+
test('can save changes to existing host catalog', async function (assert) {
assert.notEqual(instances.hostCatalog.name, 'random string');
await visit(urls.hostCatalog);
@@ -183,8 +200,8 @@ module('Acceptance | host-catalogs | update', function (hooks) {
await fillIn(NAME_INPUT_SELECTOR, 'random string');
assert.strictEqual(currentURL(), urls.hostCatalog);
await click(`[href="${urls.hostCatalogs}"]`);
- assert.dom('.rose-dialog').exists();
- await click(MODAL_DISCARD_BUTTON_SELECTOR, 'Click Discard');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.hostCatalogs);
assert.notEqual(
@@ -203,8 +220,8 @@ module('Acceptance | host-catalogs | update', function (hooks) {
await fillIn(NAME_INPUT_SELECTOR, 'random string');
assert.strictEqual(currentURL(), urls.hostCatalog);
await click(`[href="${urls.hostCatalogs}"]`);
- assert.dom('.rose-dialog').exists();
- await click(MODAL_CANCEL_BUTTON_SELECTOR, 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.hostCatalog);
assert.notEqual(
diff --git a/ui/admin/tests/acceptance/managed-groups/create-test.js b/ui/admin/tests/acceptance/managed-groups/create-test.js
index 83f13feea3..c82c5fb374 100644
--- a/ui/admin/tests/acceptance/managed-groups/create-test.js
+++ b/ui/admin/tests/acceptance/managed-groups/create-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -53,8 +53,8 @@ module('Acceptance | managed-groups | create', function (hooks) {
newLdapManagedGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/managed-groups/delete-test.js b/ui/admin/tests/acceptance/managed-groups/delete-test.js
index 32d08b27f4..343e656bda 100644
--- a/ui/admin/tests/acceptance/managed-groups/delete-test.js
+++ b/ui/admin/tests/acceptance/managed-groups/delete-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
@@ -50,8 +50,8 @@ module('Acceptance | managed-groups | delete', function (hooks) {
ldapManagedGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/managed-groups/list-test.js b/ui/admin/tests/acceptance/managed-groups/list-test.js
index eda54202f2..f906a9af74 100644
--- a/ui/admin/tests/acceptance/managed-groups/list-test.js
+++ b/ui/admin/tests/acceptance/managed-groups/list-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -43,8 +43,8 @@ module('Acceptance | managed-groups | list', function (hooks) {
newLdapManagedGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/managed-groups/members-test.js b/ui/admin/tests/acceptance/managed-groups/members-test.js
index 959706a62b..95f1ec123e 100644
--- a/ui/admin/tests/acceptance/managed-groups/members-test.js
+++ b/ui/admin/tests/acceptance/managed-groups/members-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, currentURL, findAll } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
module('Acceptance | managed-groups | members', function (hooks) {
@@ -38,8 +33,8 @@ module('Acceptance | managed-groups | members', function (hooks) {
managedGroupMembers: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/managed-groups/read-test.js b/ui/admin/tests/acceptance/managed-groups/read-test.js
index d4dac17a26..ddeddf5311 100644
--- a/ui/admin/tests/acceptance/managed-groups/read-test.js
+++ b/ui/admin/tests/acceptance/managed-groups/read-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
@@ -39,8 +39,8 @@ module('Acceptance | managed-groups | read', function (hooks) {
ldapManagedGroup: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/onboarding/onboarding-test.js b/ui/admin/tests/acceptance/onboarding/onboarding-test.js
index 8e46b1a9e8..3d5da16362 100644
--- a/ui/admin/tests/acceptance/onboarding/onboarding-test.js
+++ b/ui/admin/tests/acceptance/onboarding/onboarding-test.js
@@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { visit, fillIn, click, currentURL } from '@ember/test-helpers';
@@ -19,8 +19,8 @@ module('Acceptance | onboarding', function (hooks) {
orgs: '/scopes/global/scopes',
};
- hooks.beforeEach(() => {
- authenticateSession({});
+ hooks.beforeEach(async () => {
+ await authenticateSession({});
});
test('show targetAddress and targetPort fields', async function (assert) {
diff --git a/ui/admin/tests/acceptance/onboarding/success-test.js b/ui/admin/tests/acceptance/onboarding/success-test.js
index 680dd6add0..2926935a1d 100644
--- a/ui/admin/tests/acceptance/onboarding/success-test.js
+++ b/ui/admin/tests/acceptance/onboarding/success-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, find, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -13,8 +13,8 @@ module('Acceptance | onboarding | success', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
});
const urls = {
diff --git a/ui/admin/tests/acceptance/policy/create-test.js b/ui/admin/tests/acceptance/policy/create-test.js
index e0658c4dca..ed7853477c 100644
--- a/ui/admin/tests/acceptance/policy/create-test.js
+++ b/ui/admin/tests/acceptance/policy/create-test.js
@@ -45,7 +45,7 @@ module('Acceptance | policies | create', function (hooks) {
newPolicy: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -57,7 +57,7 @@ module('Acceptance | policies | create', function (hooks) {
getPolicyCount = () => this.server.schema.policies.all().models.length;
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('users can create a new policy with global scope', async function (assert) {
diff --git a/ui/admin/tests/acceptance/policy/delete-test.js b/ui/admin/tests/acceptance/policy/delete-test.js
index 1c8232c3a8..4ad1162477 100644
--- a/ui/admin/tests/acceptance/policy/delete-test.js
+++ b/ui/admin/tests/acceptance/policy/delete-test.js
@@ -35,8 +35,8 @@ module('Acceptance | policies | delete', function (hooks) {
policy: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/policy/list-test.js b/ui/admin/tests/acceptance/policy/list-test.js
index 20657ba209..cb7faa2e49 100644
--- a/ui/admin/tests/acceptance/policy/list-test.js
+++ b/ui/admin/tests/acceptance/policy/list-test.js
@@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | policies | list', function (hooks) {
setupApplicationTest(hooks);
@@ -19,8 +20,6 @@ module('Acceptance | policies | list', function (hooks) {
let intl;
const STORAGE_POLICY_TITLE = 'Storage Policies';
- const MESSAGE_DESCRIPTION_SELECTOR = '.rose-message-description';
- const MESSAGE_LINK_SELECTOR = '.rose-message-body .hds-link-standalone';
const DROPDOWN_BUTTON_SELECTOR = '.hds-dropdown-toggle-icon';
const DROPDOWN_ITEM_SELECTOR = '.hds-dropdown-list-item a';
@@ -38,7 +37,7 @@ module('Acceptance | policies | list', function (hooks) {
policy: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -49,7 +48,7 @@ module('Acceptance | policies | list', function (hooks) {
intl = this.owner.lookup('service:intl');
- authenticateSession({});
+ await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -72,9 +71,9 @@ module('Acceptance | policies | list', function (hooks) {
await click(`[href="${urls.policies}"]`);
assert
- .dom(MESSAGE_DESCRIPTION_SELECTOR)
+ .dom(commonSelectors.PAGE_MESSAGE_DESCRIPTION)
.hasText(intl.t('resources.policy.messages.none.description'));
- assert.dom(MESSAGE_LINK_SELECTOR).exists();
+ assert.dom(commonSelectors.PAGE_MESSAGE_LINK).exists();
});
test('user cannot navigate to index without either list or create actions', async function (assert) {
@@ -100,12 +99,12 @@ module('Acceptance | policies | list', function (hooks) {
await visit(urls.policies);
- assert.dom(MESSAGE_DESCRIPTION_SELECTOR).hasText(
+ assert.dom(commonSelectors.PAGE_MESSAGE_DESCRIPTION).hasText(
intl.t('descriptions.neither-list-nor-create', {
resource: STORAGE_POLICY_TITLE,
}),
);
- assert.dom(MESSAGE_LINK_SELECTOR).doesNotExist();
+ assert.dom(commonSelectors.PAGE_MESSAGE_LINK).doesNotExist();
});
test('user can navigate to index with only create action', async function (assert) {
@@ -132,12 +131,12 @@ module('Acceptance | policies | list', function (hooks) {
await click(`[href="${urls.policies}"]`);
- assert.dom(MESSAGE_DESCRIPTION_SELECTOR).hasText(
+ assert.dom(commonSelectors.PAGE_MESSAGE_DESCRIPTION).hasText(
intl.t('descriptions.create-but-not-list', {
resource: STORAGE_POLICY_TITLE,
}),
);
- assert.dom(MESSAGE_LINK_SELECTOR).exists();
+ assert.dom(commonSelectors.PAGE_MESSAGE_LINK).exists();
});
test('user can navigate to index with only list action', async function (assert) {
@@ -165,9 +164,9 @@ module('Acceptance | policies | list', function (hooks) {
await click(`[href="${urls.policies}"]`);
assert
- .dom(MESSAGE_DESCRIPTION_SELECTOR)
+ .dom(commonSelectors.PAGE_MESSAGE_DESCRIPTION)
.hasText(intl.t('resources.policy.messages.none.description'));
- assert.dom(MESSAGE_LINK_SELECTOR).doesNotExist();
+ assert.dom(commonSelectors.PAGE_MESSAGE_LINK).doesNotExist();
});
test('user cannot navigate to index when feature is disabled', async function (assert) {
diff --git a/ui/admin/tests/acceptance/policy/read-test.js b/ui/admin/tests/acceptance/policy/read-test.js
index f012212c53..5982811999 100644
--- a/ui/admin/tests/acceptance/policy/read-test.js
+++ b/ui/admin/tests/acceptance/policy/read-test.js
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | policies | read', function (hooks) {
setupApplicationTest(hooks);
@@ -18,7 +19,6 @@ module('Acceptance | policies | read', function (hooks) {
let features;
- const MESSAGE_SELECTOR = '.rose-message-subtitle';
const TABLE_LINK_SELECTOR = '.hds-table__tbody tr:first-child a';
const instances = {
@@ -36,7 +36,7 @@ module('Acceptance | policies | read', function (hooks) {
unknownPolicy: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -52,7 +52,7 @@ module('Acceptance | policies | read', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting a policy', async function (assert) {
@@ -81,6 +81,8 @@ module('Acceptance | policies | read', function (hooks) {
await visit(urls.unknownPolicy);
await a11yAudit();
- assert.dom(MESSAGE_SELECTOR).hasText('Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
});
diff --git a/ui/admin/tests/acceptance/policy/update-test.js b/ui/admin/tests/acceptance/policy/update-test.js
index b5de7d8654..398fdec030 100644
--- a/ui/admin/tests/acceptance/policy/update-test.js
+++ b/ui/admin/tests/acceptance/policy/update-test.js
@@ -43,7 +43,7 @@ module('Acceptance | policies | update', function (hooks) {
policy: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.policy = this.server.create('policy', {
@@ -56,7 +56,7 @@ module('Acceptance | policies | update', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({});
+ await authenticateSession({});
});
test('users can update forever select option to a custom input', async function (assert) {
diff --git a/ui/admin/tests/acceptance/roles/create-test.js b/ui/admin/tests/acceptance/roles/create-test.js
index 59cf73da0b..39e509c964 100644
--- a/ui/admin/tests/acceptance/roles/create-test.js
+++ b/ui/admin/tests/acceptance/roles/create-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | roles | create', function (hooks) {
setupApplicationTest(hooks);
@@ -37,8 +32,8 @@ module('Acceptance | roles | create', function (hooks) {
orgScope: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.org = this.server.create(
'scope',
{
diff --git a/ui/admin/tests/acceptance/roles/delete-test.js b/ui/admin/tests/acceptance/roles/delete-test.js
index 3a13805869..c43e21c43f 100644
--- a/ui/admin/tests/acceptance/roles/delete-test.js
+++ b/ui/admin/tests/acceptance/roles/delete-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, click, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | roles | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -38,8 +33,8 @@ module('Acceptance | roles | delete', function (hooks) {
newRole: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/roles/global-scope-test.js b/ui/admin/tests/acceptance/roles/global-scope-test.js
index c9718b461c..cf83dd6c0f 100644
--- a/ui/admin/tests/acceptance/roles/global-scope-test.js
+++ b/ui/admin/tests/acceptance/roles/global-scope-test.js
@@ -12,11 +12,12 @@ import {
fillIn,
waitUntil,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
import {
GRANT_SCOPE_THIS,
GRANT_SCOPE_CHILDREN,
@@ -58,11 +59,6 @@ module('Acceptance | roles | global-scope', function (hooks) {
const BUTTON_ICON_SELECTOR =
'.hds-button__icon [data-test-icon="check-circle"]';
const PAGINATION_SELECTOR = '.hds-pagination';
- const DISCARD_CHANGES_DIALOG = '.rose-dialog';
- const DISCARD_CHANGES_DISCARD_BUTTON =
- '.rose-dialog-footer .rose-button-primary';
- const DISCARD_CHANGES_CANCEL_BUTTON =
- '.rose-dialog-footer .rose-button-secondary';
const REMOVE_ORG_MODAL = (name) =>
`[data-test-manage-scopes-remove-${name}-modal]`;
const REMOVE_ORG_PROJECTS_BUTTON = '.hds-modal .hds-button--color-primary';
@@ -86,8 +82,8 @@ module('Acceptance | roles | global-scope', function (hooks) {
manageCustomScopes: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
confirmService = this.owner.lookup('service:confirm');
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -376,9 +372,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
await click(SCOPE_TOGGLE_SELECTOR(GRANT_SCOPE_THIS));
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_DISCARD_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.roles);
});
@@ -393,9 +389,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
await click(SCOPE_TOGGLE_SELECTOR(GRANT_SCOPE_THIS));
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_CANCEL_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.manageScopes);
});
@@ -503,9 +499,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_DISCARD_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.roles);
});
@@ -520,9 +516,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_CANCEL_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.manageCustomScopes);
});
@@ -841,9 +837,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
);
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_DISCARD_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.roles);
});
@@ -862,9 +858,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
);
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_CANCEL_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(
currentURL(),
diff --git a/ui/admin/tests/acceptance/roles/grants-test.js b/ui/admin/tests/acceptance/roles/grants-test.js
index 6f733799aa..1061d271cd 100644
--- a/ui/admin/tests/acceptance/roles/grants-test.js
+++ b/ui/admin/tests/acceptance/roles/grants-test.js
@@ -12,16 +12,11 @@ import {
find,
findAll,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | roles | grants', function (hooks) {
setupApplicationTest(hooks);
@@ -44,8 +39,8 @@ module('Acceptance | roles | grants', function (hooks) {
const grantsForm = 'form:nth-child(2)';
let grantsCount;
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/roles/list-test.js b/ui/admin/tests/acceptance/roles/list-test.js
index 8f60acb05d..131463aa98 100644
--- a/ui/admin/tests/acceptance/roles/list-test.js
+++ b/ui/admin/tests/acceptance/roles/list-test.js
@@ -12,15 +12,10 @@ import {
waitUntil,
focus,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { GRANT_SCOPE_THIS } from 'api/models/role';
module('Acceptance | roles | list', function (hooks) {
@@ -54,7 +49,7 @@ module('Acceptance | roles | list', function (hooks) {
role2: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -71,7 +66,7 @@ module('Acceptance | roles | list', function (hooks) {
urls.roles = `/scopes/${instances.scopes.org.id}/roles`;
urls.role1 = `${urls.roles}/${instances.role1.id}`;
urls.role2 = `${urls.roles}/${instances.role2.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('users can navigate to roles with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/roles/org-scope-test.js b/ui/admin/tests/acceptance/roles/org-scope-test.js
index d3a278e5ab..2a6ce7c57d 100644
--- a/ui/admin/tests/acceptance/roles/org-scope-test.js
+++ b/ui/admin/tests/acceptance/roles/org-scope-test.js
@@ -12,11 +12,12 @@ import {
fillIn,
waitUntil,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
import {
GRANT_SCOPE_THIS,
GRANT_SCOPE_CHILDREN,
@@ -55,12 +56,6 @@ module('Acceptance | roles | org-scope', function (hooks) {
const BUTTON_ICON_SELECTOR =
'.hds-button__icon [data-test-icon="check-circle"]';
const PAGINATION_SELECTOR = '.hds-pagination';
- const DISCARD_CHANGES_DIALOG = '.rose-dialog';
- const DISCARD_CHANGES_DISCARD_BUTTON =
- '.rose-dialog-footer .rose-button-primary';
- const DISCARD_CHANGES_CANCEL_BUTTON =
- '.rose-dialog-footer .rose-button-secondary';
-
const instances = {
scopes: {
global: null,
@@ -79,8 +74,8 @@ module('Acceptance | roles | org-scope', function (hooks) {
manageOrgProjects: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
confirmService = this.owner.lookup('service:confirm');
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -327,9 +322,9 @@ module('Acceptance | roles | org-scope', function (hooks) {
await click(SCOPE_TOGGLE_SELECTOR(GRANT_SCOPE_THIS));
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_DISCARD_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.roles);
});
@@ -344,9 +339,9 @@ module('Acceptance | roles | org-scope', function (hooks) {
await click(SCOPE_TOGGLE_SELECTOR(GRANT_SCOPE_THIS));
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_CANCEL_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.manageScopes);
});
@@ -456,9 +451,9 @@ module('Acceptance | roles | org-scope', function (hooks) {
);
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_DISCARD_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.roles);
});
@@ -474,9 +469,9 @@ module('Acceptance | roles | org-scope', function (hooks) {
);
await click(`[href="${urls.roles}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_CANCEL_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.manageOrgProjects);
});
diff --git a/ui/admin/tests/acceptance/roles/principals-test.js b/ui/admin/tests/acceptance/roles/principals-test.js
index ab2b402c35..26b7755147 100644
--- a/ui/admin/tests/acceptance/roles/principals-test.js
+++ b/ui/admin/tests/acceptance/roles/principals-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find, findAll } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | roles | principals', function (hooks) {
setupApplicationTest(hooks);
@@ -40,8 +35,8 @@ module('Acceptance | roles | principals', function (hooks) {
};
let principalsCount;
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/roles/project-scope-test.js b/ui/admin/tests/acceptance/roles/project-scope-test.js
index 39c2cf1345..1bbb4699ea 100644
--- a/ui/admin/tests/acceptance/roles/project-scope-test.js
+++ b/ui/admin/tests/acceptance/roles/project-scope-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -40,8 +40,8 @@ module('Acceptance | roles | project-scope', function (hooks) {
roleScopes: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/roles/read-test.js b/ui/admin/tests/acceptance/roles/read-test.js
index 842b383612..085d551921 100644
--- a/ui/admin/tests/acceptance/roles/read-test.js
+++ b/ui/admin/tests/acceptance/roles/read-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | roles | read', function (hooks) {
setupApplicationTest(hooks);
@@ -36,8 +31,8 @@ module('Acceptance | roles | read', function (hooks) {
newRole: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/roles/update-test.js b/ui/admin/tests/acceptance/roles/update-test.js
index fc2489e03d..2df9a4e65f 100644
--- a/ui/admin/tests/acceptance/roles/update-test.js
+++ b/ui/admin/tests/acceptance/roles/update-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | roles | update', function (hooks) {
setupApplicationTest(hooks);
@@ -34,8 +29,8 @@ module('Acceptance | roles | update', function (hooks) {
newRole: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/scopes-test.js b/ui/admin/tests/acceptance/scopes-test.js
index 952c160505..c22d0aba87 100644
--- a/ui/admin/tests/acceptance/scopes-test.js
+++ b/ui/admin/tests/acceptance/scopes-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | scopes', function (hooks) {
setupApplicationTest(hooks);
@@ -57,7 +52,7 @@ module('Acceptance | scopes', function (hooks) {
project2ScopeEdit: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -92,7 +87,7 @@ module('Acceptance | scopes', function (hooks) {
urls.project2ScopeEdit = `${urls.project2Scope}/edit`;
// Generate resource counter
getScopeCount = (type) => this.server.schema.scopes.where({ type }).length;
- authenticateSession({ isGlobal: true, username: 'admin' });
+ await authenticateSession({ isGlobal: true, username: 'admin' });
});
test('visiting global scope', async function (assert) {
diff --git a/ui/admin/tests/acceptance/scopes/add-storage-policy-test.js b/ui/admin/tests/acceptance/scopes/add-storage-policy-test.js
index 5bd0ca9a2f..8f7d83aedf 100644
--- a/ui/admin/tests/acceptance/scopes/add-storage-policy-test.js
+++ b/ui/admin/tests/acceptance/scopes/add-storage-policy-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, find, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -50,7 +50,7 @@ module('Acceptance | scope | add storage policy', function (hooks) {
addStoragePolicy: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -74,7 +74,7 @@ module('Acceptance | scope | add storage policy', function (hooks) {
urls.policy = `${urls.policies}/${policyOne.id}`;
urls.addStoragePolicy = `${urls.orgScope}/add-storage-policy`;
urls.newPolicy = `${urls.addStoragePolicy}/create`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('cannot attach policy on a scope without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/scopes/delete-test.js b/ui/admin/tests/acceptance/scopes/delete-test.js
index 0d12dcdc45..61a0a21898 100644
--- a/ui/admin/tests/acceptance/scopes/delete-test.js
+++ b/ui/admin/tests/acceptance/scopes/delete-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | scopes | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -42,7 +38,7 @@ module('Acceptance | scopes | delete', function (hooks) {
projectScopeEdit: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -60,7 +56,7 @@ module('Acceptance | scopes | delete', function (hooks) {
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
// Generate resource counter
getScopeCount = (type) => this.server.schema.scopes.where({ type }).length;
- authenticateSession({ isGlobal: true });
+ await authenticateSession({ isGlobal: true });
});
test('can delete scope', async function (assert) {
@@ -97,7 +93,7 @@ module('Acceptance | scopes | delete', function (hooks) {
await click(`[href="${urls.orgScopeEdit}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(getScopeCount('org'), orgScopeCount - 1);
assert.strictEqual(currentURL(), urls.globalScope);
@@ -112,7 +108,7 @@ module('Acceptance | scopes | delete', function (hooks) {
await click(`[href="${urls.orgScopeEdit}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(getScopeCount('org'), orgScopeCount);
assert.strictEqual(currentURL(), urls.orgScopeEdit);
diff --git a/ui/admin/tests/acceptance/scopes/list-test.js b/ui/admin/tests/acceptance/scopes/list-test.js
index bc727a603f..7f185dd7bb 100644
--- a/ui/admin/tests/acceptance/scopes/list-test.js
+++ b/ui/admin/tests/acceptance/scopes/list-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, fillIn, waitFor } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | scopes | list', function (hooks) {
setupApplicationTest(hooks);
@@ -40,7 +35,7 @@ module('Acceptance | scopes | list', function (hooks) {
orgScope: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org1 = this.server.create('scope', {
type: 'org',
@@ -60,7 +55,7 @@ module('Acceptance | scopes | list', function (hooks) {
});
urls.globalScope = `/scopes/global/scopes`;
urls.orgScope = `/scopes/${instances.scopes.org1.id}/scopes`;
- authenticateSession({});
+ await authenticateSession({});
});
test('user can search for a specifc org scope by id', async function (assert) {
diff --git a/ui/admin/tests/acceptance/scopes/read-test.js b/ui/admin/tests/acceptance/scopes/read-test.js
index b14e06ad74..ce1a4be6ca 100644
--- a/ui/admin/tests/acceptance/scopes/read-test.js
+++ b/ui/admin/tests/acceptance/scopes/read-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | scopes | read', function (hooks) {
setupApplicationTest(hooks);
@@ -44,7 +39,7 @@ module('Acceptance | scopes | read', function (hooks) {
orgScopeEdit: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -58,7 +53,7 @@ module('Acceptance | scopes | read', function (hooks) {
urls.orgScopeEdit = `/scopes/${instances.scopes.org.id}/edit`;
features = this.owner.lookup('service:features');
featureEdition = this.owner.lookup('service:featureEdition');
- authenticateSession({ isGlobal: true, username: 'admin' });
+ await authenticateSession({ isGlobal: true, username: 'admin' });
});
test('visiting org scope edit', async function (assert) {
diff --git a/ui/admin/tests/acceptance/scopes/update-test.js b/ui/admin/tests/acceptance/scopes/update-test.js
index 00d8670bcc..36b45c4aef 100644
--- a/ui/admin/tests/acceptance/scopes/update-test.js
+++ b/ui/admin/tests/acceptance/scopes/update-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | scopes | update', function (hooks) {
setupApplicationTest(hooks);
@@ -35,7 +31,7 @@ module('Acceptance | scopes | update', function (hooks) {
projectScope: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -55,7 +51,7 @@ module('Acceptance | scopes | update', function (hooks) {
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.orgScopeEdit = `/scopes/${instances.scopes.org.id}/edit`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
- authenticateSession({ isGlobal: true });
+ await authenticateSession({ isGlobal: true });
});
test('can save changes to existing scope', async function (assert) {
@@ -144,8 +140,8 @@ module('Acceptance | scopes | update', function (hooks) {
await fillIn('[name="name"]', 'random string');
assert.strictEqual(currentURL(), urls.orgScopeEdit);
await click(`[href="${urls.globalScope}"]`);
- assert.dom('.rose-dialog').exists();
- await click('.rose-dialog-footer button:first-child', 'Click Discard');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.globalScope);
assert.notEqual(
@@ -165,8 +161,8 @@ module('Acceptance | scopes | update', function (hooks) {
await fillIn('[name="name"]', 'random string');
assert.strictEqual(currentURL(), urls.orgScopeEdit);
await click(`[href="${urls.globalScope}"]`);
- assert.dom('.rose-dialog').exists();
- await click('.rose-dialog-footer button:last-child', 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.orgScopeEdit);
assert.notEqual(
diff --git a/ui/admin/tests/acceptance/session-recordings/list-test.js b/ui/admin/tests/acceptance/session-recordings/list-test.js
index 42e077c066..8cda56987d 100644
--- a/ui/admin/tests/acceptance/session-recordings/list-test.js
+++ b/ui/admin/tests/acceptance/session-recordings/list-test.js
@@ -61,7 +61,7 @@ module('Acceptance | session recordings | list', function (hooks) {
sessionRecording2: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -122,7 +122,7 @@ module('Acceptance | session recordings | list', function (hooks) {
featuresService = this.owner.lookup('service:features');
featuresService.enable('ssh-session-recording');
- authenticateSession({});
+ await authenticateSession({});
});
test('users can navigate to session-recordings with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/session-recordings/read-test.js b/ui/admin/tests/acceptance/session-recordings/read-test.js
index 542ce77afd..1613f69a76 100644
--- a/ui/admin/tests/acceptance/session-recordings/read-test.js
+++ b/ui/admin/tests/acceptance/session-recordings/read-test.js
@@ -42,7 +42,7 @@ module('Acceptance | session-recordings | read', function (hooks) {
channelRecording: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -69,7 +69,7 @@ module('Acceptance | session-recordings | read', function (hooks) {
urls.sessionRecordings = `${urls.globalScope}/session-recordings`;
urls.sessionRecording = `${urls.sessionRecordings}/${instances.sessionRecording.id}/channels-by-connection`;
urls.channelRecording = `${urls.sessionRecording}/${instances.channelRecording.id}`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
diff --git a/ui/admin/tests/acceptance/session-recordings/session-recording/channels-by-connection/channel-test.js b/ui/admin/tests/acceptance/session-recordings/session-recording/channels-by-connection/channel-test.js
index b791ac31da..e49efd784e 100644
--- a/ui/admin/tests/acceptance/session-recordings/session-recording/channels-by-connection/channel-test.js
+++ b/ui/admin/tests/acceptance/session-recordings/session-recording/channels-by-connection/channel-test.js
@@ -47,7 +47,7 @@ module(
channelRecording: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -81,7 +81,7 @@ module(
this.server.schema.sessionRecordings.all().models.length;
featuresService = this.owner.lookup('service:features');
- authenticateSession({});
+ await authenticateSession({});
});
test('user can navigate to a channel', async function (assert) {
diff --git a/ui/admin/tests/acceptance/sessions/list-test.js b/ui/admin/tests/acceptance/sessions/list-test.js
index b70d23999b..6f753fd48c 100644
--- a/ui/admin/tests/acceptance/sessions/list-test.js
+++ b/ui/admin/tests/acceptance/sessions/list-test.js
@@ -12,17 +12,12 @@ import {
waitUntil,
findAll,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
module('Acceptance | sessions | list', function (hooks) {
@@ -56,7 +51,7 @@ module('Acceptance | sessions | list', function (hooks) {
sessions: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.admin = this.server.create('user', {
scopeId: 'global',
@@ -103,7 +98,7 @@ module('Acceptance | sessions | list', function (hooks) {
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.sessions = `${urls.projectScope}/sessions`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting sessions', async function (assert) {
diff --git a/ui/admin/tests/acceptance/storage-buckets/create-test.js b/ui/admin/tests/acceptance/storage-buckets/create-test.js
index ba1ae3c0ef..abcf6d9972 100644
--- a/ui/admin/tests/acceptance/storage-buckets/create-test.js
+++ b/ui/admin/tests/acceptance/storage-buckets/create-test.js
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, select } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
@@ -33,7 +32,7 @@ module('Acceptance | storage-buckets | create', function (hooks) {
newStorageBucket: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -47,7 +46,7 @@ module('Acceptance | storage-buckets | create', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('users can create a new storage bucket aws plugin type with global scope', async function (assert) {
@@ -58,6 +57,11 @@ module('Acceptance | storage-buckets | create', function (hooks) {
await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
await select(selectors.FIELD_SCOPE, 'global');
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
+
assert.dom(selectors.FIELD_BUCKET_NAME).isNotDisabled();
assert.dom(selectors.FIELD_BUCKET_PREFIX).isNotDisabled();
assert.dom(selectors.FIELD_BUCKET_NAME).doesNotHaveAttribute('readOnly');
@@ -70,6 +74,9 @@ module('Acceptance | storage-buckets | create', function (hooks) {
assert.strictEqual(storageBucket.name, commonSelectors.FIELD_NAME_VALUE);
assert.strictEqual(storageBucket.scopeId, 'global');
+ assert
+ .dom(selectors.READONLY_WORKER_FILTER)
+ .hasText(selectors.EDITOR_WORKER_FILTER_VALUE);
assert.strictEqual(getStorageBucketCount(), storageBucketCount + 1);
});
@@ -81,6 +88,11 @@ module('Acceptance | storage-buckets | create', function (hooks) {
await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
await select(selectors.FIELD_SCOPE, instances.scopes.org.id);
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
+
assert.dom(selectors.FIELD_BUCKET_NAME).isNotDisabled();
assert.dom(selectors.FIELD_BUCKET_PREFIX).isNotDisabled();
assert.dom(selectors.FIELD_BUCKET_NAME).doesNotHaveAttribute('readOnly');
@@ -120,6 +132,11 @@ module('Acceptance | storage-buckets | create', function (hooks) {
);
await fillIn(selectors.FIELD_ACCESS_KEY, selectors.FIELD_ACCESS_KEY_VALUE);
await fillIn(selectors.FIELD_SECRET_KEY, selectors.FIELD_SECRET_KEY_VALUE);
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
+
await click(commonSelectors.SAVE_BTN);
// Assertions
@@ -148,12 +165,14 @@ module('Acceptance | storage-buckets | create', function (hooks) {
await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
// There are 2 credential types
- assert
- .dom(`${selectors.GROUP_CREDENTIAL_TYPE} .hds-form-radio-card`)
- .exists({ count: 2 });
+ assert.dom(selectors.GROUP_CREDENTIAL_TYPE).exists({ count: 2 });
await click(selectors.FIELD_DYNAMIC_CREDENTIAL);
await fillIn(selectors.FIELD_ROLE_ARN, selectors.FIELD_ROLE_ARN_VALUE);
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
await click(commonSelectors.SAVE_BTN);
const storageBucket = this.server.schema.storageBuckets.findBy({
@@ -172,13 +191,15 @@ module('Acceptance | storage-buckets | create', function (hooks) {
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
- assert
- .dom(`${selectors.GROUP_CREDENTIAL_TYPE} .hds-form-radio-card`)
- .exists({ count: 2 });
+ assert.dom(selectors.GROUP_CREDENTIAL_TYPE).exists({ count: 2 });
await click(selectors.FIELD_STATIC_CREDENTIAL);
await fillIn(selectors.FIELD_ACCESS_KEY, selectors.FIELD_ACCESS_KEY_VALUE);
await fillIn(selectors.FIELD_SECRET_KEY, selectors.FIELD_SECRET_KEY_VALUE);
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
await click(commonSelectors.SAVE_BTN);
@@ -212,6 +233,10 @@ module('Acceptance | storage-buckets | create', function (hooks) {
);
await fillIn(selectors.FIELD_ACCESS_KEY, selectors.FIELD_ACCESS_KEY_VALUE);
await fillIn(selectors.FIELD_SECRET_KEY, selectors.FIELD_SECRET_KEY_VALUE);
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
await click(commonSelectors.SAVE_BTN);
@@ -268,8 +293,11 @@ module('Acceptance | storage-buckets | create', function (hooks) {
await visit(urls.storageBuckets);
await click(`[href="${urls.newStorageBucket}"]`);
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
await click(commonSelectors.SAVE_BTN);
- await a11yAudit();
assert
.dom(commonSelectors.ALERT_TOAST_BODY)
diff --git a/ui/admin/tests/acceptance/storage-buckets/delete-test.js b/ui/admin/tests/acceptance/storage-buckets/delete-test.js
index d52b4e51ef..6c752f75d1 100644
--- a/ui/admin/tests/acceptance/storage-buckets/delete-test.js
+++ b/ui/admin/tests/acceptance/storage-buckets/delete-test.js
@@ -4,11 +4,12 @@
*/
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | storage-buckets | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -21,10 +22,6 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
const DROPDOWN_BUTTON_SELECTOR = '.hds-dropdown-toggle-icon';
const DELETE_DROPDOWN_SELECTOR = '.hds-dropdown-list-item [type="button"]';
- const DIALOG_DELETE_BTN_SELECTOR = '.rose-dialog .rose-button-primary';
- const DIALOG_CANCEL_BTN_SELECTOR = '.rose-dialog .rose-button-secondary';
- const DIALOG_MESSAGE_SELECTOR = '.rose-dialog-body';
- const DIALOG_TITLE_SELECTOR = '.rose-dialog-header';
const NOTIFICATION_MSG_SELECTOR =
'[data-test-toast-notification] .hds-alert__description';
const NOTIFICATION_MSG_TEXT = 'Deleted successfully.';
@@ -42,7 +39,7 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
storageBuckets: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -56,7 +53,7 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
getStorageBucketCount = () =>
this.server.schema.storageBuckets.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
intl = this.owner.lookup('service:intl');
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
@@ -85,10 +82,10 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
await click(DELETE_DROPDOWN_SELECTOR);
assert
- .dom(DIALOG_DELETE_BTN_SELECTOR)
+ .dom(commonSelectors.MODAL_WARNING_CONFIRM_BTN)
.hasText(intl.t('resources.storage-bucket.actions.delete'));
- await click(DIALOG_DELETE_BTN_SELECTOR);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.dom(NOTIFICATION_MSG_SELECTOR).hasText(NOTIFICATION_MSG_TEXT);
assert.strictEqual(currentURL(), urls.storageBuckets);
@@ -106,21 +103,21 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
await click(DELETE_DROPDOWN_SELECTOR);
assert
- .dom(DIALOG_TITLE_SELECTOR)
+ .dom(commonSelectors.MODAL_WARNING_TITLE)
.hasText(
intl.t(
'resources.storage-bucket.questions.delete-storage-bucket.title',
),
);
assert
- .dom(DIALOG_MESSAGE_SELECTOR)
+ .dom(commonSelectors.MODAL_WARNING_MESSAGE)
.hasText(
intl.t(
'resources.storage-bucket.questions.delete-storage-bucket.message',
),
);
- await click(DIALOG_CANCEL_BTN_SELECTOR);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.storageBuckets);
assert.strictEqual(getStorageBucketCount(), storageBucketCount);
diff --git a/ui/admin/tests/acceptance/storage-buckets/list-test.js b/ui/admin/tests/acceptance/storage-buckets/list-test.js
index 1bb6690284..8bdad990dc 100644
--- a/ui/admin/tests/acceptance/storage-buckets/list-test.js
+++ b/ui/admin/tests/acceptance/storage-buckets/list-test.js
@@ -34,7 +34,7 @@ module('Acceptance | storage-buckets | list', function (hooks) {
storageBucket: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -45,7 +45,7 @@ module('Acceptance | storage-buckets | list', function (hooks) {
intl = this.owner.lookup('service:intl');
- authenticateSession({});
+ await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
diff --git a/ui/admin/tests/acceptance/storage-buckets/read-test.js b/ui/admin/tests/acceptance/storage-buckets/read-test.js
index 985732dc6f..1a9cfc9c45 100644
--- a/ui/admin/tests/acceptance/storage-buckets/read-test.js
+++ b/ui/admin/tests/acceptance/storage-buckets/read-test.js
@@ -34,7 +34,7 @@ module('Acceptance | storage-buckets | read', function (hooks) {
unknownStorageBucket: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -50,7 +50,7 @@ module('Acceptance | storage-buckets | read', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting a storage bucket', async function (assert) {
@@ -71,7 +71,9 @@ module('Acceptance | storage-buckets | read', function (hooks) {
await click(commonSelectors.HREF(urls.storageBuckets));
- assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.storageBucket))
+ .doesNotExist();
});
test('visiting an unknown storage bucket displays 404 message', async function (assert) {
@@ -83,7 +85,7 @@ module('Acceptance | storage-buckets | read', function (hooks) {
.hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
- test('users can navigate to storage bucket and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to storage bucket and incorrect url auto-corrects', async function (assert) {
const incorrectUrl = `/scopes/${instances.scopes.org.id}/storage-buckets/${instances.storageBucket.id}`;
await visit(incorrectUrl);
diff --git a/ui/admin/tests/acceptance/storage-buckets/selectors.js b/ui/admin/tests/acceptance/storage-buckets/selectors.js
index 08eef815a4..2448d7a45f 100644
--- a/ui/admin/tests/acceptance/storage-buckets/selectors.js
+++ b/ui/admin/tests/acceptance/storage-buckets/selectors.js
@@ -14,7 +14,7 @@ export const FIELD_BUCKET_NAME_VALUE = 'Test Bucket name';
export const FIELD_BUCKET_NAME_ERROR = '[data-test-bucket-name-error]';
export const FIELD_BUCKET_PREFIX = '[name=bucket_prefix]';
export const FIELD_REGION = '[name=region]';
-export const GROUP_CREDENTIAL_TYPE = '[name=credential_type]';
+export const GROUP_CREDENTIAL_TYPE = '[name=Type]';
export const FIELD_STATIC_CREDENTIAL = '[value=static]';
export const FIELD_DYNAMIC_CREDENTIAL = '[value=dynamic]';
export const FIELD_ROLE_ARN = '[name=role_arn]';
@@ -29,6 +29,11 @@ export const FIELD_SECRET_KEY_EDIT_BTN =
'[data-test-secret-access-key] [type=button]';
export const FIELD_WORKER_FILTER = '[name=worker_filter]';
export const FIELD_WORKER_FILTER_ERROR = '[data-test-worker-filter-error]';
+export const READONLY_WORKER_FILTER = '[data-test-worker-filter]';
+export const EDITOR_WORKER_FILTER =
+ '[data-test-code-editor-field-editor] textarea';
+export const EDITOR_WORKER_FILTER_VALUE = '"dev" in "/tags/env"';
+export const TOAST = '[role=alert] div';
export const TOAST_SUCCESSFUL_VALUE = 'Saved successfully.';
export const TABLE_FIRST_ROW_ACTION_DROPDOWN =
diff --git a/ui/admin/tests/acceptance/storage-buckets/update-test.js b/ui/admin/tests/acceptance/storage-buckets/update-test.js
index eaad42e233..89df6e3ec6 100644
--- a/ui/admin/tests/acceptance/storage-buckets/update-test.js
+++ b/ui/admin/tests/acceptance/storage-buckets/update-test.js
@@ -5,10 +5,9 @@
import { module, test } from 'qunit';
import { visit, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -23,15 +22,16 @@ module('Acceptance | storage-buckets | update', function (hooks) {
global: null,
},
storageBucket: null,
+ storageBucketMinio: null,
};
const urls = {
- globalScope: null,
storageBuckets: null,
storageBucket: null,
+ storageBucketMinio: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.storageBucket = this.server.create('storage-bucket', {
scope: instances.scopes.global,
@@ -40,20 +40,18 @@ module('Acceptance | storage-buckets | update', function (hooks) {
scope: instances.scopes.global,
plugin: { name: 'minio' },
});
- urls.globalScope = `/scopes/global`;
- urls.storageBuckets = `${urls.globalScope}/storage-buckets`;
+ urls.storageBuckets = `/scopes/global/storage-buckets`;
urls.storageBucket = `${urls.storageBuckets}/${instances.storageBucket.id}`;
urls.storageBucketMinio = `${urls.storageBuckets}/${instances.storageBucketMinio.id}`;
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({});
});
test('can save changes to an existing storage-bucket', async function (assert) {
await visit(urls.storageBuckets);
- await click(`[href="${urls.storageBucket}"]`);
+ await click(commonSelectors.HREF(urls.storageBucket));
await click(commonSelectors.EDIT_BTN, 'Click edit mode');
await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
await click(commonSelectors.SAVE_BTN, 'Click save');
@@ -72,7 +70,7 @@ module('Acceptance | storage-buckets | update', function (hooks) {
const name = instances.storageBucket.name;
await visit(urls.storageBuckets);
- await click(`[href="${urls.storageBucket}"]`);
+ await click(commonSelectors.HREF(urls.storageBucket));
await click(commonSelectors.EDIT_BTN, 'Click edit mode');
await fillIn(commonSelectors.FIELD_NAME, commonSelectors.FIELD_NAME_VALUE);
await click(commonSelectors.CANCEL_BTN, 'Click cancel');
@@ -84,7 +82,7 @@ module('Acceptance | storage-buckets | update', function (hooks) {
test('can save changes to access key fields', async function (assert) {
await visit(urls.storageBuckets);
- await click(`[href="${urls.storageBucket}"]`);
+ await click(commonSelectors.HREF(urls.storageBucket));
assert.dom(selectors.FIELD_ACCESS_KEY_EDIT_BTN).exists();
assert.dom(selectors.FIELD_SECRET_KEY_EDIT_BTN).exists();
@@ -119,7 +117,7 @@ module('Acceptance | storage-buckets | update', function (hooks) {
test('can cancel changes to access key fields', async function (assert) {
await visit(urls.storageBuckets);
- await click(`[href="${urls.storageBucket}"]`);
+ await click(commonSelectors.HREF(urls.storageBucket));
await click(commonSelectors.EDIT_BTN, 'Click edit mode');
await click(selectors.FIELD_ACCESS_KEY_EDIT_BTN);
await click(selectors.FIELD_SECRET_KEY_EDIT_BTN);
@@ -167,7 +165,10 @@ module('Acceptance | storage-buckets | update', function (hooks) {
await click(`[href="${urls.storageBucket}"]`);
await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
- await fillIn(selectors.FIELD_WORKER_FILTER, 'random string');
+ await fillIn(
+ selectors.EDITOR_WORKER_FILTER,
+ selectors.EDITOR_WORKER_FILTER_VALUE,
+ );
await click(commonSelectors.SAVE_BTN);
assert
@@ -184,7 +185,7 @@ module('Acceptance | storage-buckets | update', function (hooks) {
test('user cannot edit scope, provider, bucket name, bucket prefix and region fields in a Amazon S3 storage bucket form', async function (assert) {
await visit(urls.storageBuckets);
- await click(`[href="${urls.storageBucket}"]`);
+ await click(commonSelectors.HREF(urls.storageBucket));
assert.dom(selectors.FIELD_BUCKET_NAME).isDisabled();
assert.dom(selectors.FIELD_BUCKET_PREFIX).isDisabled();
@@ -204,7 +205,7 @@ module('Acceptance | storage-buckets | update', function (hooks) {
test('user cannot edit scope, provider, endpoint_url, bucket name or region fields in a MinIO storage bucket', async function (assert) {
await visit(urls.storageBuckets);
- await click(`[href="${urls.storageBucketMinio}"]`);
+ await click(commonSelectors.HREF(urls.storageBucketMinio));
assert.dom(selectors.FIELD_BUCKET_NAME).isDisabled();
@@ -216,4 +217,17 @@ module('Acceptance | storage-buckets | update', function (hooks) {
assert.dom(selectors.FIELD_BUCKET_NAME).hasAttribute('readOnly');
assert.dom(selectors.FIELD_REGION).hasAttribute('readOnly');
});
+
+ test('user sees an editable code editor while updating and readonly code block before/after', async function (assert) {
+ await visit(urls.storageBuckets);
+ await click(commonSelectors.HREF(urls.storageBucketMinio));
+
+ assert.dom(selectors.READONLY_WORKER_FILTER).isVisible();
+ assert.dom(selectors.EDITOR_WORKER_FILTER).doesNotExist();
+
+ await click(commonSelectors.EDIT_BTN, 'Click edit mode');
+
+ assert.dom(selectors.EDITOR_WORKER_FILTER).isVisible();
+ assert.dom(selectors.READONLY_WORKER_FILTER).doesNotExist();
+ });
});
diff --git a/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js b/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js
index a658d9341f..e154436399 100644
--- a/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js
+++ b/ui/admin/tests/acceptance/targets/brokered-credential-sources-test.js
@@ -4,8 +4,8 @@
*/
import { module, test } from 'qunit';
-import { visit, find, findAll, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, findAll, click, currentURL } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
@@ -49,7 +49,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
brokeredCredentialSources: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -117,7 +117,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
this.server.schema.credentials.all().models.length;
credentialSourceCount = getCredentialLibraryCount() + getCredentialCount();
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting target brokered credential sources', async function (assert) {
@@ -167,7 +167,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
});
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
- assert.dom('.rose-message-title').doesNotExist();
+ assert.dom('.hds-application-state__title').doesNotExist();
});
test('displays list of brokered credential sources with only credential libraries available', async function (assert) {
@@ -176,15 +176,14 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
});
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, getCredentialLibraryCount());
- assert.dom('.rose-message-title').doesNotExist();
+ assert.dom('.hds-application-state__title').doesNotExist();
});
test('displays no brokered credential sources message when none available', async function (assert) {
await visit(urls.addBrokeredCredentialSources);
- assert.strictEqual(
- find('.rose-message-title').textContent.trim(),
- 'No Brokered Credential Sources Available',
- );
+ assert
+ .dom('.hds-application-state__title')
+ .hasText('No Brokered Credential Sources Available');
});
test('when no brokered credential sources available, button routes to add brokered credential sources', async function (assert) {
@@ -193,7 +192,7 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
});
await visit(urls.brokeredCredentialSources);
// Click on the rose message link
- await click(find('.rose-message > .rose-message-body > a'));
+ await click('.hds-application-state__footer .hds-link-standalone');
assert.strictEqual(currentURL(), urls.addBrokeredCredentialSources);
});
diff --git a/ui/admin/tests/acceptance/targets/create-alias-test.js b/ui/admin/tests/acceptance/targets/create-alias-test.js
index 8ec2ce2657..7d1b3b92b3 100644
--- a/ui/admin/tests/acceptance/targets/create-alias-test.js
+++ b/ui/admin/tests/acceptance/targets/create-alias-test.js
@@ -50,7 +50,7 @@ module('Acceptance | targets | create-alias', function (hooks) {
target: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
const { owner } = getContext();
featuresService = owner.lookup('service:features');
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -78,7 +78,7 @@ module('Acceptance | targets | create-alias', function (hooks) {
getAliasCount = () => this.server.schema.aliases.all().models.length;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('users can create a new alias for a target of TCP type', async function (assert) {
diff --git a/ui/admin/tests/acceptance/targets/create-test.js b/ui/admin/tests/acceptance/targets/create-test.js
index 73d8458831..0baf0fceb2 100644
--- a/ui/admin/tests/acceptance/targets/create-test.js
+++ b/ui/admin/tests/acceptance/targets/create-test.js
@@ -12,15 +12,10 @@ import {
fillIn,
getContext,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
@@ -54,7 +49,7 @@ module('Acceptance | targets | create', function (hooks) {
newSSHTarget: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
const { owner } = getContext();
featuresService = owner.lookup('service:features');
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -84,13 +79,13 @@ module('Acceptance | targets | create', function (hooks) {
this.server.schema.targets.where({ type: TYPE_TARGET_SSH }).models.length;
getTCPTargetCount = () =>
this.server.schema.targets.where({ type: TYPE_TARGET_TCP }).models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('defaults to type `ssh` when no query param provided', async function (assert) {
featuresService.enable('ssh-target');
await visit(urls.newTarget);
- assert.strictEqual(find('[name="type"]:checked').value, TYPE_TARGET_SSH);
+ assert.strictEqual(find('[name="Type"]:checked').value, TYPE_TARGET_SSH);
});
test('can create a type `ssh` target', async function (assert) {
diff --git a/ui/admin/tests/acceptance/targets/delete-test.js b/ui/admin/tests/acceptance/targets/delete-test.js
index f7d25e21f0..f10f69eb3f 100644
--- a/ui/admin/tests/acceptance/targets/delete-test.js
+++ b/ui/admin/tests/acceptance/targets/delete-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -43,7 +39,7 @@ module('Acceptance | targets | delete', function (hooks) {
newTarget: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -65,7 +61,7 @@ module('Acceptance | targets | delete', function (hooks) {
urls.newTarget = `${urls.targets}/new`;
// Generate resource counter
getTargetCount = () => this.server.schema.targets.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete target', async function (assert) {
@@ -87,7 +83,7 @@ module('Acceptance | targets | delete', function (hooks) {
await click(`[href="${urls.target}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert
.dom('[data-test-toast-notification] .hds-alert__description')
@@ -105,7 +101,7 @@ module('Acceptance | targets | delete', function (hooks) {
await click(`[href="${urls.target}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(getTargetCount(), targetCount);
assert.strictEqual(currentURL(), urls.target);
diff --git a/ui/admin/tests/acceptance/targets/enable-session-recording-test.js b/ui/admin/tests/acceptance/targets/enable-session-recording-test.js
index 714ff9c9f8..0079fb84a8 100644
--- a/ui/admin/tests/acceptance/targets/enable-session-recording-test.js
+++ b/ui/admin/tests/acceptance/targets/enable-session-recording-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, find, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -53,7 +53,7 @@ module('Acceptance | targets | enable session recording', function (hooks) {
newStorageBucket: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -89,7 +89,7 @@ module('Acceptance | targets | enable session recording', function (hooks) {
urls.newStorageBucket = `${urls.enableSessionRecording}/create-storage-bucket`;
urls.storageBucket = `${urls.storageBuckets}/${storageBucketOne.id}`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('cannot enable session recording for a target without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/targets/enable-session-recording/create-storage-bucket-test.js b/ui/admin/tests/acceptance/targets/enable-session-recording/create-storage-bucket-test.js
index 03d9470f79..bdb9049cc8 100644
--- a/ui/admin/tests/acceptance/targets/enable-session-recording/create-storage-bucket-test.js
+++ b/ui/admin/tests/acceptance/targets/enable-session-recording/create-storage-bucket-test.js
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
-import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_TARGET_SSH } from 'api/models/target';
@@ -30,6 +29,9 @@ module(
const NAME_FIELD_TEXT = 'random string';
const BUCKET_NAME_FIELD_SELECTOR = '[name="bucket_name"]';
const BUCKET_PREFIX_FIELD_SELECTOR = '[name="bucket_prefix"]';
+ const EDITOR_WORKER_FILTER =
+ '[data-test-code-editor-field-editor] textarea';
+ const EDITOR_WORKER_FILTER_VALUE = '"dev" in "/tags/env"';
const instances = {
scopes: {
@@ -47,7 +49,7 @@ module(
newStorageBucket: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -74,7 +76,7 @@ module(
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('users can create a new storage bucket with global scope', async function (assert) {
@@ -84,6 +86,7 @@ module(
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
await click('[value="global"]');
+ await fillIn(EDITOR_WORKER_FILTER, EDITOR_WORKER_FILTER_VALUE);
assert.dom(BUCKET_NAME_FIELD_SELECTOR).isNotDisabled();
assert.dom(BUCKET_PREFIX_FIELD_SELECTOR).isNotDisabled();
@@ -107,6 +110,7 @@ module(
await click(`[href="${urls.newStorageBucket}"]`);
await fillIn(NAME_FIELD_SELECTOR, NAME_FIELD_TEXT);
await click(`[value="${instances.scopes.org.scope.id}"]`);
+ await fillIn(EDITOR_WORKER_FILTER, EDITOR_WORKER_FILTER_VALUE);
assert.dom(BUCKET_NAME_FIELD_SELECTOR).isNotDisabled();
assert.dom(BUCKET_PREFIX_FIELD_SELECTOR).isNotDisabled();
@@ -158,8 +162,8 @@ module(
await visit(urls.enableSessionRecording);
await click(`[href="${urls.newStorageBucket}"]`);
+ await fillIn(EDITOR_WORKER_FILTER, EDITOR_WORKER_FILTER_VALUE);
await click(SAVE_BTN_SELECTOR);
- await a11yAudit();
assert.dom(ALERT_TEXT_SELECTOR).hasText('The request was invalid.');
assert.dom(FIELD_ERROR_TEXT_SELECTOR).hasText('Name is required.');
diff --git a/ui/admin/tests/acceptance/targets/enable-session-recording/index-test.js b/ui/admin/tests/acceptance/targets/enable-session-recording/index-test.js
index ef2c535170..c42520dcc1 100644
--- a/ui/admin/tests/acceptance/targets/enable-session-recording/index-test.js
+++ b/ui/admin/tests/acceptance/targets/enable-session-recording/index-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, find, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -56,7 +56,7 @@ module(
newStorageBucket: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -94,7 +94,7 @@ module(
intl = this.owner.lookup('service:intl');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('cannot enable session recording for a target without proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/targets/host-sources-test.js b/ui/admin/tests/acceptance/targets/host-sources-test.js
index ada073880b..69cf5b315f 100644
--- a/ui/admin/tests/acceptance/targets/host-sources-test.js
+++ b/ui/admin/tests/acceptance/targets/host-sources-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | host-sources', function (hooks) {
setupApplicationTest(hooks);
@@ -45,7 +41,7 @@ module('Acceptance | targets | host-sources', function (hooks) {
targetAddHostSources: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -85,10 +81,11 @@ module('Acceptance | targets | host-sources', function (hooks) {
urls.targetHostSources = `${urls.target}/host-sources`;
urls.targetAddHostSources = `${urls.target}/add-host-sources`;
urls.hostSet = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostCatalog.hostSetIds[0]}`;
- // Generate resource counter
- getTargetHostSetCount = () =>
- this.server.schema.targets.first().hostSets.models.length;
- authenticateSession({ username: 'admin' });
+ urls.unknownHostSet =
+ // Generate resource counter
+ getTargetHostSetCount = () =>
+ this.server.schema.targets.first().hostSets.models.length;
+ await authenticateSession({ username: 'admin' });
});
test('visiting target host sources', async function (assert) {
@@ -119,7 +116,13 @@ module('Acceptance | targets | host-sources', function (hooks) {
await click(`[href="${urls.targetHostSources}"]`);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
+ assert
+ .dom(
+ commonSelectors.TABLE_RESOURCE_LINK(
+ instances.hostCatalogPlugin.hostSets[0],
+ ),
+ )
+ .doesNotExist();
});
test('can remove a host set', async function (assert) {
@@ -281,8 +284,8 @@ module('Acceptance | targets | host-sources', function (hooks) {
await click('tbody label');
await click('form [type="submit"]');
- assert.dom('.rose-dialog').isVisible();
- await click('.rose-dialog-footer .rose-button-primary', 'Remove resources');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(
this.server.schema.targets.find(target.id).address,
@@ -317,11 +320,8 @@ module('Acceptance | targets | host-sources', function (hooks) {
await click('tbody label');
await click('form [type="submit"]');
- assert.dom('.rose-dialog').isVisible();
- await click(
- '.rose-dialog-footer .rose-button-secondary',
- 'Remove resources',
- );
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(
this.server.schema.targets.find(target.id).address,
diff --git a/ui/admin/tests/acceptance/targets/injected-application-credential-sources-test.js b/ui/admin/tests/acceptance/targets/injected-application-credential-sources-test.js
index 219832047d..ae658c0c1e 100644
--- a/ui/admin/tests/acceptance/targets/injected-application-credential-sources-test.js
+++ b/ui/admin/tests/acceptance/targets/injected-application-credential-sources-test.js
@@ -4,8 +4,8 @@
*/
import { module, test } from 'qunit';
-import { visit, find, findAll, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { visit, findAll, click, currentURL } from '@ember/test-helpers';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
@@ -49,7 +49,7 @@ module(
injectedApplicationCredentialSources: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -116,7 +116,7 @@ module(
credentialSourceCount =
getCredentialLibraryCount() + getCredentialCount();
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting target injected application credential sources', async function (assert) {
@@ -163,7 +163,7 @@ module(
});
await visit(urls.addInjectedApplicationCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
- assert.dom('.rose-message-title').doesNotExist();
+ assert.dom('.hds-application-state__title').doesNotExist();
});
test('displays list of injected application credential sources with only credential libraries available', async function (assert) {
@@ -177,15 +177,14 @@ module(
findAll('tbody tr').length,
getCredentialLibraryCount(),
);
- assert.dom('.rose-message-title').doesNotExist();
+ assert.dom('.hds-application-state__title').doesNotExist();
});
test('displays no injected application credential sources message when none available', async function (assert) {
await visit(urls.addInjectedApplicationCredentialSources);
- assert.strictEqual(
- find('.rose-message-title').textContent.trim(),
- 'No Injected Application Credential Sources Available',
- );
+ assert
+ .dom('.hds-application-state__title')
+ .hasText('No Injected Application Credential Sources Available');
});
test('when no injected application credential sources available, button routes to add injected application credential sources', async function (assert) {
@@ -194,7 +193,7 @@ module(
});
await visit(urls.injectedApplicationCredentialSources);
// Click on the rose message link
- await click(find('.rose-message > .rose-message-body > a'));
+ await click('.hds-application-state__footer .hds-link-standalone');
assert.strictEqual(
currentURL(),
urls.addInjectedApplicationCredentialSources,
diff --git a/ui/admin/tests/acceptance/targets/list-test.js b/ui/admin/tests/acceptance/targets/list-test.js
index 20f65b740b..ee4d379f4c 100644
--- a/ui/admin/tests/acceptance/targets/list-test.js
+++ b/ui/admin/tests/acceptance/targets/list-test.js
@@ -11,15 +11,10 @@ import {
waitFor,
currentRouteName,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
import { STATUS_SESSION_ACTIVE } from 'api/models/session';
@@ -58,7 +53,7 @@ module('Acceptance | targets | list', function (hooks) {
sshTarget: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -90,7 +85,7 @@ module('Acceptance | targets | list', function (hooks) {
const featuresService = this.owner.lookup('service:features');
featuresService.enable('ssh-target');
- authenticateSession({});
+ await authenticateSession({});
});
test('can navigate to targets with proper authorization', async function (assert) {
diff --git a/ui/admin/tests/acceptance/targets/manage-alias-test.js b/ui/admin/tests/acceptance/targets/manage-alias-test.js
index 6075efcf8a..81ee1648ad 100644
--- a/ui/admin/tests/acceptance/targets/manage-alias-test.js
+++ b/ui/admin/tests/acceptance/targets/manage-alias-test.js
@@ -5,7 +5,7 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -45,7 +45,7 @@ module('Acceptance | targets | manage-alias', function (hooks) {
aliases: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -90,7 +90,7 @@ module('Acceptance | targets | manage-alias', function (hooks) {
getAliasCount = () => this.server.schema.aliases.all().models.length;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('clicking on manage should take you to manage page', async function (assert) {
diff --git a/ui/admin/tests/acceptance/targets/read-test.js b/ui/admin/tests/acceptance/targets/read-test.js
index d88def7a89..1292b29461 100644
--- a/ui/admin/tests/acceptance/targets/read-test.js
+++ b/ui/admin/tests/acceptance/targets/read-test.js
@@ -5,17 +5,13 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | read', function (hooks) {
setupApplicationTest(hooks);
@@ -51,7 +47,7 @@ module('Acceptance | targets | read', function (hooks) {
aliases: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -91,7 +87,7 @@ module('Acceptance | targets | read', function (hooks) {
urls.alias = `${urls.tcpTarget}/${aliasResource.id}`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting ssh target', async function (assert) {
@@ -125,8 +121,10 @@ module('Acceptance | targets | read', function (hooks) {
await click(`[href="${urls.targets}"]`);
- assert.dom('.rose-table-body tr:first-child a').doesNotExist();
- assert.dom(`[href="${urls.tcpTarget}"]`).exists();
+ assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget)).isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget))
+ .doesNotExist();
});
test('cannot navigate to a tcp target form without proper authorization', async function (assert) {
@@ -137,15 +135,19 @@ module('Acceptance | targets | read', function (hooks) {
await click(`[href="${urls.targets}"]`);
- assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist();
- assert.dom(`[href="${urls.sshTarget}"]`).exists();
+ assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget)).isVisible();
+ assert
+ .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget))
+ .doesNotExist();
});
test('visiting an unknown target displays 404 message', async function (assert) {
await visit(urls.unknownTarget);
await a11yAudit();
- assert.dom('.rose-message-subtitle').hasText('Error 404');
+ assert
+ .dom(commonSelectors.RESOURCE_NOT_FOUND_SUBTITLE)
+ .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE);
});
test('users can link to docs page for target', async function (assert) {
@@ -160,7 +162,7 @@ module('Acceptance | targets | read', function (hooks) {
.exists();
});
- test('users can navigate to target and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to target and incorrect url auto-corrects', async function (assert) {
const incorrectUrl = `/scopes/${instances.scopes.org.id}/targets/${instances.sshTarget.id}`;
await visit(incorrectUrl);
diff --git a/ui/admin/tests/acceptance/targets/update-test.js b/ui/admin/tests/acceptance/targets/update-test.js
index d66dc2e19e..ca029faf7d 100644
--- a/ui/admin/tests/acceptance/targets/update-test.js
+++ b/ui/admin/tests/acceptance/targets/update-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | update', function (hooks) {
setupApplicationTest(hooks);
@@ -39,7 +35,7 @@ module('Acceptance | targets | update', function (hooks) {
newTarget: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -62,7 +58,7 @@ module('Acceptance | targets | update', function (hooks) {
urls.unknownTarget = `${urls.targets}/foo`;
urls.newTarget = `${urls.targets}/new`;
- authenticateSession({});
+ await authenticateSession({});
});
test('can save changes to existing target', async function (assert) {
@@ -140,9 +136,9 @@ module('Acceptance | targets | update', function (hooks) {
await click(`[href="${urls.targets}"]`);
- assert.dom('.rose-dialog').exists();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click('.rose-dialog-footer button:first-child', 'Click Discard');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.targets);
assert.notEqual(this.server.schema.targets.first().name, 'random string');
@@ -160,8 +156,8 @@ module('Acceptance | targets | update', function (hooks) {
assert.strictEqual(currentURL(), urls.target);
await click(`[href="${urls.targets}"]`);
- assert.dom('.rose-dialog').exists();
- await click('.rose-dialog-footer button:last-child', 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.target);
assert.notEqual(this.server.schema.targets.first().name, 'random string');
@@ -213,8 +209,8 @@ module('Acceptance | targets | update', function (hooks) {
await fillIn('[name="address"]', '0.0.0.0');
await click('[type="submit"]');
- assert.dom('.rose-dialog').isVisible();
- await click('.rose-dialog-footer .rose-button-primary', 'Remove resources');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(
this.server.schema.targets.find(target.id).address,
@@ -258,8 +254,8 @@ module('Acceptance | targets | update', function (hooks) {
await fillIn('[name="address"]', '0.0.0.0');
await click('[type="submit"]');
- assert.dom('.rose-dialog').isVisible();
- await click('.rose-dialog-footer .rose-button-secondary', 'Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(
this.server.schema.targets.find(target.id).address,
diff --git a/ui/admin/tests/acceptance/targets/workers-test.js b/ui/admin/tests/acceptance/targets/workers-test.js
index 4a73e4eaf4..d7858a45f4 100644
--- a/ui/admin/tests/acceptance/targets/workers-test.js
+++ b/ui/admin/tests/acceptance/targets/workers-test.js
@@ -5,18 +5,22 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | targets | workers', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
+ let intl;
let featuresService;
let featureEdition;
+ const ACCORDION_DROPDOWN_TEXT_SELECTOR = (name) =>
+ `[data-test-target-${name}-workers-accordion-item] a`;
const ACCORDION_DROPDOWN_SELECTOR = (name) =>
`[data-test-target-${name}-workers-accordion-item] .hds-accordion-item__button`;
const CODE_BLOCK_SELECTOR = (name) =>
@@ -25,10 +29,6 @@ module('Acceptance | targets | workers', function (hooks) {
'[data-test-code-editor-field-editor] textarea';
const SAVE_BUTTON_SELECTOR = '[type="submit"]';
const CANCEL_BUTTON_SELECTOR = '.rose-form-actions [type="button"]';
- const MODAL_DISCARD_BUTTON_SELECTOR =
- '.rose-dialog-footer button:first-child';
- const MODAL_CANCEL_BUTTON_SELECTOR = '.rose-dialog-footer button:last-child';
- const CONFIRM_MODAL_SELECTOR = '.rose-dialog';
const instances = {
scopes: {
@@ -49,7 +49,8 @@ module('Acceptance | targets | workers', function (hooks) {
targetEditIngressFilter: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
+ intl = this.owner.lookup('service:intl');
featuresService = this.owner.lookup('service:features');
featureEdition = this.owner.lookup('service:featureEdition');
@@ -76,7 +77,7 @@ module('Acceptance | targets | workers', function (hooks) {
urls.targetEditEgressFilter = `${urls.target}/edit-egress-worker-filter`;
urls.targetEditIngressFilter = `${urls.target}/edit-ingress-worker-filter`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting target workers', async function (assert) {
@@ -218,7 +219,10 @@ module('Acceptance | targets | workers', function (hooks) {
await click(CANCEL_BUTTON_SELECTOR);
assert.strictEqual(currentURL(), urls.targetWorkers);
- assert.notEqual(instances.target.inress_worker_filter, ingressWorkerFilter);
+ assert.notEqual(
+ instances.target.ingress_worker_filter,
+ ingressWorkerFilter,
+ );
assert
.dom(CODE_BLOCK_SELECTOR('ingress'))
.hasText(instances.target.ingress_worker_filter);
@@ -241,6 +245,38 @@ module('Acceptance | targets | workers', function (hooks) {
assert.dom(CODE_BLOCK_SELECTOR('egress')).hasText(egressWorkerFilter);
});
+ test('user will see "Add worker filter" if no filter set', async function (assert) {
+ featuresService.enable('target-worker-filters-v2-ingress');
+ instances.target.update({
+ egress_worker_filter: '',
+ ingress_worker_filter: '',
+ });
+ await visit(urls.target);
+
+ await click(`[href="${urls.targetWorkers}"]`);
+
+ assert
+ .dom(ACCORDION_DROPDOWN_TEXT_SELECTOR('egress'))
+ .hasText(intl.t('actions.add-worker-filter'));
+ assert
+ .dom(ACCORDION_DROPDOWN_TEXT_SELECTOR('ingress'))
+ .hasText(intl.t('actions.add-worker-filter'));
+ });
+
+ test('user will see "Edit worker filter" if filter is set', async function (assert) {
+ featuresService.enable('target-worker-filters-v2-ingress');
+ await visit(urls.target);
+
+ await click(`[href="${urls.targetWorkers}"]`);
+
+ assert
+ .dom(ACCORDION_DROPDOWN_TEXT_SELECTOR('egress'))
+ .hasText(intl.t('actions.edit-worker-filter'));
+ assert
+ .dom(ACCORDION_DROPDOWN_TEXT_SELECTOR('ingress'))
+ .hasText(intl.t('actions.edit-worker-filter'));
+ });
+
test('user can cancel changes to egress worker filter in a target', async function (assert) {
const egressWorkerFilter = '"random" in "/worker/filters"';
await visit(urls.target);
@@ -273,9 +309,9 @@ module('Acceptance | targets | workers', function (hooks) {
await fillIn(CODE_EDITOR_CONTENT_SELECTOR, ingressWorkerFilter);
await click(`[href="${urls.target}"]`);
- assert.dom(CONFIRM_MODAL_SELECTOR).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(MODAL_DISCARD_BUTTON_SELECTOR, 'Click Discard');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.target);
assert.notEqual(
@@ -298,9 +334,9 @@ module('Acceptance | targets | workers', function (hooks) {
await fillIn(CODE_EDITOR_CONTENT_SELECTOR, ingressWorkerFilter);
await click(`[href="${urls.target}"]`);
- assert.dom(CONFIRM_MODAL_SELECTOR).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(MODAL_CANCEL_BUTTON_SELECTOR, 'Click Cancel');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.targetEditIngressFilter);
assert.notEqual(
@@ -322,9 +358,9 @@ module('Acceptance | targets | workers', function (hooks) {
await fillIn(CODE_EDITOR_CONTENT_SELECTOR, egressWorkerFilter);
await click(`[href="${urls.target}"]`);
- assert.dom(CONFIRM_MODAL_SELECTOR).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(MODAL_DISCARD_BUTTON_SELECTOR, 'Click Discard');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.target);
assert.notEqual(instances.target.egress_worker_filter, egressWorkerFilter);
@@ -343,9 +379,9 @@ module('Acceptance | targets | workers', function (hooks) {
await fillIn(CODE_EDITOR_CONTENT_SELECTOR, egressWorkerFilter);
await click(`[href="${urls.target}"]`);
- assert.dom(CONFIRM_MODAL_SELECTOR).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(MODAL_CANCEL_BUTTON_SELECTOR, 'Click Cancel');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.targetEditEgressFilter);
assert.notEqual(instances.target.egress_worker_filter, egressWorkerFilter);
diff --git a/ui/admin/tests/acceptance/users/accounts-test.js b/ui/admin/tests/acceptance/users/accounts-test.js
index 75e1f55966..7173ab6fdb 100644
--- a/ui/admin/tests/acceptance/users/accounts-test.js
+++ b/ui/admin/tests/acceptance/users/accounts-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_LDAP } from 'api/models/auth-method';
module('Acceptance | users | accounts', function (hooks) {
@@ -53,8 +48,8 @@ module('Acceptance | users | accounts', function (hooks) {
addAccounts: null,
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
diff --git a/ui/admin/tests/acceptance/users/create-test.js b/ui/admin/tests/acceptance/users/create-test.js
index 0d34306ec1..1d4b0a0e0f 100644
--- a/ui/admin/tests/acceptance/users/create-test.js
+++ b/ui/admin/tests/acceptance/users/create-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | users | create', function (hooks) {
setupApplicationTest(hooks);
@@ -38,7 +33,7 @@ module('Acceptance | users | create', function (hooks) {
newUser: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -54,7 +49,7 @@ module('Acceptance | users | create', function (hooks) {
getUsersCount = () => {
return this.server.schema.users.all().models.length;
};
- authenticateSession({});
+ await authenticateSession({});
});
test('can create new users', async function (assert) {
diff --git a/ui/admin/tests/acceptance/users/delete-test.js b/ui/admin/tests/acceptance/users/delete-test.js
index 24c647fb09..14d6270e18 100644
--- a/ui/admin/tests/acceptance/users/delete-test.js
+++ b/ui/admin/tests/acceptance/users/delete-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | users | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -38,7 +34,7 @@ module('Acceptance | users | delete', function (hooks) {
user: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -51,7 +47,7 @@ module('Acceptance | users | delete', function (hooks) {
urls.users = `${urls.orgScope}/users`;
urls.user = `${urls.users}/${instances.user.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete a user', async function (assert) {
@@ -86,7 +82,7 @@ module('Acceptance | users | delete', function (hooks) {
await click(`[href="${urls.user}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-primary');
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert
.dom('[data-test-toast-notification] .hds-alert__description')
@@ -104,7 +100,7 @@ module('Acceptance | users | delete', function (hooks) {
await click(`[href="${urls.user}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
- await click('.rose-dialog .rose-button-secondary');
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(this.server.db.users.length, usersCount);
assert.strictEqual(currentURL(), urls.user);
diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js
index b5f44f78f4..cc6430f1ec 100644
--- a/ui/admin/tests/acceptance/users/list-test.js
+++ b/ui/admin/tests/acceptance/users/list-test.js
@@ -5,15 +5,11 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, waitUntil, findAll } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | users | list', function (hooks) {
setupApplicationTest(hooks);
@@ -40,7 +36,7 @@ module('Acceptance | users | list', function (hooks) {
user2: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -57,7 +53,7 @@ module('Acceptance | users | list', function (hooks) {
urls.users = `${urls.orgScope}/users`;
urls.user1 = `${urls.users}/${instances.user1.id}`;
urls.user2 = `${urls.users}/${instances.user2.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('users can navigate to users with proper authorization', async function (assert) {
@@ -115,7 +111,8 @@ module('Acceptance | users | list', function (hooks) {
await click(`[href="${urls.users}"]`);
- assert.dom(`.rose-table [href="${urls.user1}"]`).doesNotExist();
+ assert.dom('.hds-application-state__body-text').isVisible();
+ assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.user1)).doesNotExist();
});
test('user can navigate to users tab with only list action', async function (assert) {
diff --git a/ui/admin/tests/acceptance/users/read-test.js b/ui/admin/tests/acceptance/users/read-test.js
index ef3ad66f91..a9dc2f009a 100644
--- a/ui/admin/tests/acceptance/users/read-test.js
+++ b/ui/admin/tests/acceptance/users/read-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | users | read', function (hooks) {
setupApplicationTest(hooks);
@@ -35,7 +31,7 @@ module('Acceptance | users | read', function (hooks) {
user: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -47,7 +43,7 @@ module('Acceptance | users | read', function (hooks) {
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
urls.users = `${urls.orgScope}/users`;
urls.user = `${urls.users}/${instances.user.id}`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting users', async function (assert) {
@@ -76,7 +72,7 @@ module('Acceptance | users | read', function (hooks) {
await click(`[href="${urls.users}"]`);
- assert.dom(`.rose-table [href="${urls.user}"]`).doesNotExist();
+ assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.user)).doesNotExist();
});
test('users can link to docs page for users', async function (assert) {
@@ -91,7 +87,7 @@ module('Acceptance | users | read', function (hooks) {
.exists();
});
- test('users can navigate to user and incorrect url autocorrects', async function (assert) {
+ test('users can navigate to user and incorrect url auto-corrects', async function (assert) {
const incorrectUrl = `/scopes/global/users/${instances.user.id}`;
await visit(incorrectUrl);
diff --git a/ui/admin/tests/acceptance/users/update-test.js b/ui/admin/tests/acceptance/users/update-test.js
index 6fea6b3e2d..3915d8984c 100644
--- a/ui/admin/tests/acceptance/users/update-test.js
+++ b/ui/admin/tests/acceptance/users/update-test.js
@@ -5,16 +5,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | users | update', function (hooks) {
setupApplicationTest(hooks);
@@ -35,7 +31,7 @@ module('Acceptance | users | update', function (hooks) {
user: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -48,7 +44,7 @@ module('Acceptance | users | update', function (hooks) {
urls.users = `${urls.orgScope}/users`;
urls.user = `${urls.users}/${instances.user.id}`;
- authenticateSession({});
+ await authenticateSession({});
});
test('can save changes to an existing user', async function (assert) {
@@ -132,8 +128,8 @@ module('Acceptance | users | update', function (hooks) {
await fillIn('[name="name"]', 'Unsaved user name');
assert.strictEqual(currentURL(), urls.user);
await click(`[href="${urls.users}"]`);
- assert.dom('.rose-dialog').exists();
- await click('.rose-dialog-footer button:first-child', 'Click Discard');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN, 'Click Discard');
assert.strictEqual(currentURL(), urls.users);
assert.notEqual(this.server.schema.users.first().name, 'Unsaved user name');
@@ -149,8 +145,8 @@ module('Acceptance | users | update', function (hooks) {
await fillIn('[name="name"]', 'Unsaved user name');
assert.strictEqual(currentURL(), urls.user);
await click(`[href="${urls.users}"]`);
- assert.dom('.rose-dialog').exists();
- await click('.rose-dialog-footer button:last-child', 'Click Cancel');
+ assert.dom(commonSelectors.MODAL_WARNING).exists();
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN, 'Click Cancel');
assert.strictEqual(currentURL(), urls.user);
assert.notEqual(this.server.schema.users.first().name, 'Unsaved user name');
diff --git a/ui/admin/tests/acceptance/workers/create-tags-test.js b/ui/admin/tests/acceptance/workers/create-tags-test.js
index 49d787f215..dcd6ec21b1 100644
--- a/ui/admin/tests/acceptance/workers/create-tags-test.js
+++ b/ui/admin/tests/acceptance/workers/create-tags-test.js
@@ -5,10 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | workers | worker | create-tags', function (hooks) {
setupApplicationTest(hooks);
@@ -23,11 +24,6 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
const KEY_INPUT_SELECTOR = '[name="api_tags"] tr td:first-child input';
const VALUE_INPUT_SELECTOR = '[name="api_tags"] tr td:nth-child(2) input';
const ADD_INPUT_SELECTOR = '[name="api_tags"] tr td:last-child button';
- const DISCARD_CHANGES_DIALOG = '.rose-dialog';
- const DISCARD_CHANGES_DISCARD_BUTTON =
- '.rose-dialog-footer .rose-button-primary';
- const DISCARD_CHANGES_CANCEL_BUTTON =
- '.rose-dialog-footer .rose-button-secondary';
const instances = {
scopes: {
@@ -43,7 +39,7 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
createTags: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
@@ -53,7 +49,7 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
urls.tags = `${urls.worker}/tags`;
urls.createTags = `${urls.worker}/create-tags`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting worker create tags', async function (assert) {
@@ -116,9 +112,9 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
await click(`[href="${urls.workers}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_DISCARD_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.workers);
});
@@ -133,9 +129,9 @@ module('Acceptance | workers | worker | create-tags', function (hooks) {
await click(`[href="${urls.workers}"]`);
- assert.dom(DISCARD_CHANGES_DIALOG).isVisible();
+ assert.dom(commonSelectors.MODAL_WARNING).isVisible();
- await click(DISCARD_CHANGES_CANCEL_BUTTON);
+ await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);
assert.strictEqual(currentURL(), urls.createTags);
});
diff --git a/ui/admin/tests/acceptance/workers/create-test.js b/ui/admin/tests/acceptance/workers/create-test.js
index 365d5f4d90..be006339d7 100644
--- a/ui/admin/tests/acceptance/workers/create-test.js
+++ b/ui/admin/tests/acceptance/workers/create-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, fillIn, click, findAll, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | workers | create', function (hooks) {
setupApplicationTest(hooks);
@@ -24,14 +19,14 @@ module('Acceptance | workers | create', function (hooks) {
let newWorkerURL;
let getWorkersCount;
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
globalScope = this.server.create('scope', { id: 'global' });
workersURL = `/scopes/global/workers`;
newWorkerURL = `${workersURL}/new`;
getWorkersCount = () => this.server.schema.workers.all().length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can create new workers', async function (assert) {
diff --git a/ui/admin/tests/acceptance/workers/delete-test.js b/ui/admin/tests/acceptance/workers/delete-test.js
index c040c0f411..73c0b94f69 100644
--- a/ui/admin/tests/acceptance/workers/delete-test.js
+++ b/ui/admin/tests/acceptance/workers/delete-test.js
@@ -5,17 +5,12 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | workers | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -39,7 +34,7 @@ module('Acceptance | workers | delete', function (hooks) {
worker: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.worker = this.server.create('worker', {
@@ -52,7 +47,7 @@ module('Acceptance | workers | delete', function (hooks) {
getWorkerCount = () => this.server.schema.workers.all().models.length;
- authenticateSession({});
+ await authenticateSession({});
});
test('can delete a worker', async function (assert) {
diff --git a/ui/admin/tests/acceptance/workers/list-test.js b/ui/admin/tests/acceptance/workers/list-test.js
index 092a0d4410..960bd3bf79 100644
--- a/ui/admin/tests/acceptance/workers/list-test.js
+++ b/ui/admin/tests/acceptance/workers/list-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, click, currentURL } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
const WORKERS_FLYOUT = '[data-test-worker-tags-flyout]';
const WORKERS_FLYOUT_DISMISS = '[data-test-worker-tags-flyout] div button';
@@ -49,7 +44,7 @@ module('Acceptance | workers | list', function (hooks) {
workerTags: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
@@ -61,7 +56,7 @@ module('Acceptance | workers | list', function (hooks) {
urls.workers = `/scopes/global/workers`;
urls.worker = `${urls.workers}/${instances.worker.id}`;
urls.workerTags = `${urls.worker}/tags`;
- authenticateSession({});
+ await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
diff --git a/ui/admin/tests/acceptance/workers/read-test.js b/ui/admin/tests/acceptance/workers/read-test.js
index a49566639c..f76dbdcb61 100644
--- a/ui/admin/tests/acceptance/workers/read-test.js
+++ b/ui/admin/tests/acceptance/workers/read-test.js
@@ -5,16 +5,11 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | workers | read', function (hooks) {
setupApplicationTest(hooks);
@@ -37,7 +32,7 @@ module('Acceptance | workers | read', function (hooks) {
worker: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
//Generate the resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
@@ -54,7 +49,7 @@ module('Acceptance | workers | read', function (hooks) {
featuresService = this.owner.lookup('service:features');
featuresService.enable('byow');
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting worker', async function (assert) {
diff --git a/ui/admin/tests/acceptance/workers/tags-test.js b/ui/admin/tests/acceptance/workers/tags-test.js
index 06b7170d08..fdd4653bb9 100644
--- a/ui/admin/tests/acceptance/workers/tags-test.js
+++ b/ui/admin/tests/acceptance/workers/tags-test.js
@@ -12,7 +12,7 @@ import {
fillIn,
find,
} from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { authenticateSession } from 'ember-simple-auth/test-support';
@@ -64,7 +64,7 @@ module('Acceptance | workers | worker | tags', function (hooks) {
createTags: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
@@ -73,7 +73,7 @@ module('Acceptance | workers | worker | tags', function (hooks) {
urls.worker = `${urls.workers}/${instances.worker.id}`;
urls.tags = `${urls.worker}/tags`;
urls.createTags = `${urls.worker}/create-tags`;
- authenticateSession({ username: 'admin' });
+ await authenticateSession({ username: 'admin' });
});
test('visiting worker tags', async function (assert) {
diff --git a/ui/admin/tests/acceptance/workers/update-test.js b/ui/admin/tests/acceptance/workers/update-test.js
index 23bbe435e0..26b40e2d13 100644
--- a/ui/admin/tests/acceptance/workers/update-test.js
+++ b/ui/admin/tests/acceptance/workers/update-test.js
@@ -5,15 +5,10 @@
import { module, test } from 'qunit';
import { visit, click, find, fillIn } from '@ember/test-helpers';
-import { setupApplicationTest } from 'ember-qunit';
+import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
-import {
- authenticateSession,
- // These are left here intentionally for future reference.
- //currentSession,
- //invalidateSession,
-} from 'ember-simple-auth/test-support';
+import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | workers | update', function (hooks) {
setupApplicationTest(hooks);
@@ -31,7 +26,7 @@ module('Acceptance | workers | update', function (hooks) {
worker: null,
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
//Generate the resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.worker = this.server.create('worker', {
@@ -41,7 +36,7 @@ module('Acceptance | workers | update', function (hooks) {
urls.globalScope = '/scopes/global';
urls.workers = `${urls.globalScope}/workers`;
(urls.worker = `${urls.workers}/${instances.worker.id}`),
- authenticateSession({});
+ await authenticateSession({});
});
test('can save changes to an existing worker', async function (assert) {
diff --git a/ui/admin/tests/helpers/index.js b/ui/admin/tests/helpers/index.js
index 371167e6c5..be3d6bd1fe 100644
--- a/ui/admin/tests/helpers/index.js
+++ b/ui/admin/tests/helpers/index.js
@@ -8,6 +8,10 @@ import {
setupRenderingTest as upstreamSetupRenderingTest,
setupTest as upstreamSetupTest,
} from 'ember-qunit';
+import {
+ currentSession,
+ authenticateSession,
+} from 'ember-simple-auth/test-support';
// This file exists to provide wrappers around ember-qunit's / ember-mocha's
// test setup functions. This way, you can easily extend the setup that is
@@ -21,9 +25,10 @@ function setupApplicationTest(hooks, options) {
// For example, if you need an authenticated session for each
// application test, you could do:
//
- // hooks.beforeEach(async function () {
- // await authenticateSession(); // ember-simple-auth
- // });
+ hooks.beforeEach(async function () {
+ await authenticateSession();
+ currentSession().set('data.theme', 'light');
+ });
//
// This is also a good place to call test setup functions coming
// from other addons:
diff --git a/ui/admin/tests/helpers/selectors.js b/ui/admin/tests/helpers/selectors.js
index 65423c6bf2..ab04484892 100644
--- a/ui/admin/tests/helpers/selectors.js
+++ b/ui/admin/tests/helpers/selectors.js
@@ -14,13 +14,16 @@ export const FIELD_NAME_ERROR = '[data-test-error-message-name]';
export const FIELD_DESCRIPTION = '[name=description]';
export const FIELD_DESCRIPTION_VALUE = 'description';
-export const TABLE_FIRST_ROW_RESOURCE_LINK = 'tbody tr:first-child a';
+export const TABLE_RESOURCE_LINK = (url) => `tbody [href="${url}"]`;
-export const RESOURCE_NOT_FOUND_SUBTITLE = '.rose-message-subtitle';
-export const RESOURCE_NOT_FOUND_VALUE = 'Error 404';
+export const RESOURCE_NOT_FOUND_SUBTITLE =
+ '[data-test-error-application-state] .hds-application-state__error-code';
+export const RESOURCE_NOT_FOUND_VALUE = 'ERROR 404';
-export const PAGE_MESSAGE_DESCRIPTION = '.rose-message-description';
-export const PAGE_MESSAGE_LINK = '.rose-message-body .hds-link-standalone';
+export const PAGE_MESSAGE_HEADER = '.hds-application-state__header';
+export const PAGE_MESSAGE_DESCRIPTION = '.hds-application-state__body-text';
+export const PAGE_MESSAGE_LINK =
+ '.hds-application-state__footer .hds-link-standalone';
export const HREF = (url) => `[href="${url}"]`;
@@ -31,3 +34,17 @@ export const ALERT_TOAST_BODY =
'[data-test-toast-notification] .hds-alert__description';
export const ALERT_TOAST_DISMISS =
'[data-test-toast-notification] .hds-dismiss-button';
+
+export const MODAL_WARNING = 'dialog';
+export const MODAL_WARNING_CONFIRM_BTN =
+ 'dialog .hds-modal__footer button:first-child';
+export const MODAL_WARNING_CANCEL_BTN =
+ 'dialog .hds-modal__footer button:last-child';
+export const MODAL_WARNING_TITLE = '.hds-modal__header';
+export const MODAL_WARNING_MESSAGE = '.hds-modal__body';
+
+export const FILTER_DROPDOWN = (filterName) =>
+ `.search-filtering [name="${filterName}"] button`;
+export const FILTER_DROPDOWN_ITEM = (itemList) => `input[value="${itemList}"]`;
+export const FILTER_DROPDOWN_ITEM_APPLY_BTN = (filterName) =>
+ `.search-filtering [name="${filterName}"] .hds-dropdown__footer button`;
diff --git a/ui/admin/tests/integration/components/form/worker/create-worker-led-test.js b/ui/admin/tests/integration/components/form/worker/create-worker-led-test.js
index 986b604a89..fdaca3b83c 100644
--- a/ui/admin/tests/integration/components/form/worker/create-worker-led-test.js
+++ b/ui/admin/tests/integration/components/form/worker/create-worker-led-test.js
@@ -7,7 +7,7 @@ import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
-import { v1 } from 'ember-uuid';
+import { v4 as uuidv4 } from 'uuid';
import { setupIntl } from 'ember-intl/test-support';
import { setupBrowserFakes } from 'ember-browser-services/test-support';
@@ -25,7 +25,7 @@ module(
test('it correctly populates the cluster id for an hcp dev cluster', async function (assert) {
const windowService = this.owner.lookup('service:browser/window');
- const guid = v1();
+ const guid = uuidv4();
this.model = {};
this.submit = () => {};
this.cancel = () => {};
@@ -41,7 +41,7 @@ module(
test('it correctly populates the cluster id for an hcp int cluster', async function (assert) {
const windowService = this.owner.lookup('service:browser/window');
- const guid = v1();
+ const guid = uuidv4();
this.model = {};
this.submit = () => {};
this.cancel = () => {};
@@ -57,7 +57,7 @@ module(
test('it correctly populates the cluster id for an hcp prod cluster', async function (assert) {
const windowService = this.owner.lookup('service:browser/window');
- const guid = v1();
+ const guid = uuidv4();
this.model = {};
this.submit = () => {};
this.cancel = () => {};
diff --git a/ui/admin/tests/integration/components/worker-filter-generator/index-test.js b/ui/admin/tests/integration/components/worker-filter-generator/index-test.js
new file mode 100644
index 0000000000..c09731ba0d
--- /dev/null
+++ b/ui/admin/tests/integration/components/worker-filter-generator/index-test.js
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+import { module, test } from 'qunit';
+import { setupRenderingTest } from 'ember-qunit';
+import { render, click, fillIn, select } from '@ember/test-helpers';
+import { hbs } from 'ember-cli-htmlbars';
+import { setupIntl } from 'ember-intl/test-support';
+
+module(
+ 'Integration | Component | worker-filter-generator/index',
+ function (hooks) {
+ setupRenderingTest(hooks);
+ setupIntl(hooks, 'en-us');
+
+ const CODE_EDITOR = '[data-test-code-editor-field-editor]';
+ const CODE_EDITOR_LINE =
+ '[data-test-code-editor-field-editor] .CodeMirror-line';
+ const FILTER_GENERATOR = '[name="filter_generator"]';
+ const SHOW_FILTER_GENERATOR = '[name="show_filter_generator"]';
+ const TAG_TYPE_OPTION = '[value="tag"]';
+ const NAME_TYPE_OPTION = '[value="name"]';
+ const TAG_KEY = '[name="tag_key"]';
+ const TAG_VALUE = '[name="tag_value"]';
+ const NAME_OPERATOR = '[name="name_operator"]';
+ const GENERATED_VALUE = '[name="generated_value"]';
+
+ test('it renders correct content when egress_worker_filter is passed in', async function (assert) {
+ this.model = { egress_worker_filter: 'egress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(CODE_EDITOR).isVisible();
+ assert.dom(CODE_EDITOR_LINE).hasText(this.model.egress_worker_filter);
+ });
+
+ test('it renders correct content when ingress_worker_filter is passed in', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(CODE_EDITOR).isVisible();
+ assert.dom(CODE_EDITOR_LINE).hasText(this.model.ingress_worker_filter);
+ });
+
+ test('toggleFilterGenerator shows filter generator when toggled on', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+
+ await click(SHOW_FILTER_GENERATOR);
+
+ assert.dom(FILTER_GENERATOR).isNotVisible();
+
+ await click(SHOW_FILTER_GENERATOR);
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+ });
+
+ test('filter generator tag type shows key and value input boxes', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+
+ await click(TAG_TYPE_OPTION);
+
+ assert.dom(TAG_KEY).isVisible();
+ assert.dom(TAG_VALUE).isVisible();
+ assert.dom(NAME_OPERATOR).isNotVisible();
+ });
+
+ test('filter generator tag type generates correctly formatted filter', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+
+ await click(TAG_TYPE_OPTION);
+ await fillIn(TAG_KEY, 'key1');
+ await fillIn(TAG_VALUE, 'val1');
+
+ assert.dom(GENERATED_VALUE).hasValue('"val1" in "/tags/key1"');
+ });
+
+ test('filter generator name type shows operator and value fields', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+
+ await click(NAME_TYPE_OPTION);
+
+ assert.dom(NAME_OPERATOR).isVisible();
+ assert.dom(TAG_VALUE).isVisible();
+ assert.dom(TAG_KEY).isNotVisible();
+ });
+
+ test('filter generator name type generates correctly formatted filter', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+
+ await click(NAME_TYPE_OPTION);
+ await fillIn(TAG_VALUE, 'val1');
+ await select(NAME_OPERATOR, '==');
+
+ assert.dom(GENERATED_VALUE).hasValue('"/name" == "val1"');
+ });
+
+ test('generated result is cleared when switching filter types', async function (assert) {
+ this.model = { ingress_worker_filter: 'ingress filter' };
+ await render(
+ hbs``,
+ );
+
+ assert.dom(FILTER_GENERATOR).isVisible();
+
+ await click(NAME_TYPE_OPTION);
+ await fillIn(TAG_VALUE, 'val1');
+ await select(NAME_OPERATOR, '==');
+
+ assert.dom(GENERATED_VALUE).hasValue('"/name" == "val1"');
+
+ await click(TAG_TYPE_OPTION);
+
+ assert.dom(GENERATED_VALUE).hasNoValue();
+ });
+ },
+);
diff --git a/ui/admin/tests/integration/components/worker-filter/index-test.js b/ui/admin/tests/integration/components/worker-filter/index-test.js
deleted file mode 100644
index be095b2135..0000000000
--- a/ui/admin/tests/integration/components/worker-filter/index-test.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright (c) HashiCorp, Inc.
- * SPDX-License-Identifier: BUSL-1.1
- */
-
-import { module, test } from 'qunit';
-import { setupRenderingTest } from 'ember-qunit';
-import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
-import { setupIntl } from 'ember-intl/test-support';
-
-module('Integration | Component | worker-filter/index', function (hooks) {
- setupRenderingTest(hooks);
- setupIntl(hooks, 'en-us');
-
- test('it renders correct content when egress_worker_filter is passed in', async function (assert) {
- this.onInput = () => {};
- this.submit = () => {};
- this.cancel = () => {};
- this.model = { egress_worker_filter: 'egress filter' };
- await render(
- hbs``,
- );
-
- assert.dom('[data-test-code-editor-field-editor]').isVisible();
- assert
- .dom('[data-test-code-editor-field-editor] .CodeMirror-line')
- .hasText(this.model.egress_worker_filter);
- });
-
- test('it renders correct content when ingress_worker_filter is passed in', async function (assert) {
- this.onInput = () => {};
- this.submit = () => {};
- this.cancel = () => {};
- this.model = { ingress_worker_filter: 'ingress filter' };
- await render(
- hbs``,
- );
-
- assert.dom('[data-test-code-editor-field-editor]').isVisible();
- assert
- .dom('[data-test-code-editor-field-editor] .CodeMirror-line')
- .hasText(this.model.ingress_worker_filter);
- });
-});
diff --git a/ui/admin/tests/unit/controllers/account/change-password-test.js b/ui/admin/tests/unit/controllers/account/change-password-test.js
index facd93f5d2..25a3ec5674 100644
--- a/ui/admin/tests/unit/controllers/account/change-password-test.js
+++ b/ui/admin/tests/unit/controllers/account/change-password-test.js
@@ -30,7 +30,7 @@ module('Unit | Controller | account/change-password', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup('controller:account/change-password');
store = this.owner.lookup('service:store');
diff --git a/ui/admin/tests/unit/controllers/application-test.js b/ui/admin/tests/unit/controllers/application-test.js
index 705d584066..5b09d92bc5 100644
--- a/ui/admin/tests/unit/controllers/application-test.js
+++ b/ui/admin/tests/unit/controllers/application-test.js
@@ -16,7 +16,7 @@ module('Unit | Controller | application', function (hooks) {
let session;
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup('controller:application');
featureEdition = this.owner.lookup('service:featureEdition');
featuresService = this.owner.lookup('service:features');
diff --git a/ui/admin/tests/unit/controllers/onboarding/index-test.js b/ui/admin/tests/unit/controllers/onboarding/index-test.js
index 39017aaed4..111ad076d4 100644
--- a/ui/admin/tests/unit/controllers/onboarding/index-test.js
+++ b/ui/admin/tests/unit/controllers/onboarding/index-test.js
@@ -36,7 +36,7 @@ module('Unit | Controller | onboarding/index', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:onboarding/index');
diff --git a/ui/admin/tests/unit/controllers/onboarding/success-test.js b/ui/admin/tests/unit/controllers/onboarding/success-test.js
index 31df549e40..b27307222b 100644
--- a/ui/admin/tests/unit/controllers/onboarding/success-test.js
+++ b/ui/admin/tests/unit/controllers/onboarding/success-test.js
@@ -33,7 +33,7 @@ module('Unit | Controller | onboarding/success', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup('controller:onboarding/success');
store = this.owner.lookup('service:store');
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/create-test.js b/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/create-test.js
index 1eea4b62dd..a141f6bd6e 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/create-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/create-test.js
@@ -31,7 +31,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/add-storage-policy/create',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/index-test.js
index 5d90f91d8e..4e47c19c0f 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/add-storage-policy/index-test.js
@@ -31,7 +31,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/add-storage-policy/index',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/aliases/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/aliases/index-test.js
index 983776c50d..2bda6b3498 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/aliases/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/aliases/index-test.js
@@ -17,6 +17,7 @@ module('Unit | Controller | scopes/scope/aliases/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getAliasCount;
@@ -33,8 +34,9 @@ module('Unit | Controller | scopes/scope/aliases/index', function (hooks) {
aliases: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/aliases/index');
@@ -103,4 +105,37 @@ module('Unit | Controller | scopes/scope/aliases/index', function (hooks) {
assert.notOk(alias.destination_id);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.aliases);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.alias.messages.none.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.aliases = ['create'];
+ await visit(urls.aliases);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.alias.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.aliases = [];
+ await visit(urls.aliases);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.alias.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js
index 158f2c6a07..1439db9dbb 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/account/set-password-test.js
@@ -33,7 +33,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/accounts/account/set-password',
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/index-test.js
index c70fbe3b83..0154577083 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/accounts/index-test.js
@@ -18,6 +18,7 @@ module(
setupMirage(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let controller;
let store;
let getAccountCount;
@@ -35,7 +36,8 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/accounts/index',
);
@@ -94,5 +96,38 @@ module(
assert.strictEqual(getAccountCount(), accountCount - 1);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.accounts);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.account.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.authMethod.authorized_collection_actions.accounts = ['create'];
+ await visit(urls.accounts);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.account.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.authMethod.authorized_collection_actions.accounts = [];
+ await visit(urls.accounts);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.account.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/managed-groups/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/managed-groups/index-test.js
index e8d3171737..aaa61b2dbd 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/managed-groups/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/auth-method/managed-groups/index-test.js
@@ -18,6 +18,7 @@ module(
setupMirage(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let controller;
let store;
let getManagedGroupCount;
@@ -35,7 +36,8 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/managed-groups/index',
);
@@ -117,5 +119,40 @@ module(
assert.true(managedGroup.hasDirtyAttributes);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.managedGroups);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.managed-group.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.authMethod.authorized_collection_actions['managed-groups'] = [
+ 'create',
+ ];
+ await visit(urls.managedGroups);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.managed-group.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.authMethod.authorized_collection_actions['managed-groups'] = [];
+ await visit(urls.managedGroups);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.managed-group.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/index-test.js
index 19bcd7534b..cb8cd49551 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/auth-methods/index-test.js
@@ -23,6 +23,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getAuthMethodCount;
@@ -34,8 +35,13 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
authMethod: null,
};
+ const urls = {
+ authMethods: null,
+ };
+
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/index',
@@ -46,6 +52,8 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
scope: instances.scope.global,
});
+ urls.authMethods = '/scopes/global/auth-methods';
+
getAuthMethodCount = () =>
this.server.schema.authMethods.all().models.length;
});
@@ -92,7 +100,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
});
test('cancel action rolls-back changes on the specified model', async function (assert) {
- await visit('/scopes/global/auth-methods');
+ await visit(urls.authMethods);
const authMethod = await store.findRecord(
'auth-method',
instances.authMethod.id,
@@ -107,7 +115,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
});
test('save action saves changes on the specified model', async function (assert) {
- await visit('/scopes/global/auth-methods');
+ await visit(urls.authMethods);
const authMethod = await store.findRecord(
'auth-method',
instances.authMethod.id,
@@ -133,7 +141,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
});
test('makePrimary action updates scope with auth-method id', async function (assert) {
- await visit('/scopes/global/auth-methods');
+ await visit(urls.authMethods);
const authMethod = await store.findRecord(
'auth-method',
instances.authMethod.id,
@@ -146,7 +154,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
});
test('removeAsPrimary action updates scope with null as auth-method id', async function (assert) {
- await visit('/scopes/global/auth-methods');
+ await visit(urls.authMethods);
const authMethod = await store.findRecord(
'auth-method',
instances.authMethod.id,
@@ -230,4 +238,39 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
assert.strictEqual(authMethod.state, 'public');
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.authMethods);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.auth-method.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scope.global.authorized_collection_actions['auth-methods'] = [
+ 'create',
+ ];
+ await visit(urls.authMethods);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.auth-method.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scope.global.authorized_collection_actions['auth-methods'] = [];
+ await visit(urls.authMethods);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.auth-method.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js
index 6a9227f4a8..d2b849aa1e 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js
@@ -35,7 +35,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/authenticate/method/index',
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js
index 03561476a5..55996ed0c5 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/index-test.js
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import { TYPE_CREDENTIAL_STORE_VAULT } from 'api/models/credential-store';
module(
'Unit | Controller | scopes/scope/credential-stores/credential-store/credential-libraries/index',
@@ -19,6 +20,7 @@ module(
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getCredentialLibraryCount;
@@ -37,8 +39,9 @@ module(
credentialLibraries: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credential-libraries/index',
@@ -54,6 +57,7 @@ module(
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.credentialStore = this.server.create('credential-store', {
+ type: TYPE_CREDENTIAL_STORE_VAULT,
scope: instances.scopes.project,
});
instances.credentialLibrary = this.server.create('credential-library', {
@@ -127,5 +131,42 @@ module(
assert.true(credentialLibrary.hasDirtyAttributes);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.credentialLibraries);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.credential-library.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.credentialStore.authorized_collection_actions[
+ 'credential-libraries'
+ ] = ['create'];
+ await visit(urls.credentialLibraries);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.credential-library.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.credentialStore.authorized_collection_actions[
+ 'credential-libraries'
+ ] = [];
+ await visit(urls.credentialLibraries);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.credential-library.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credentials/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credentials/index-test.js
index a4f326e1df..fca13fc6dc 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credentials/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/credentials/index-test.js
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
+import { TYPE_CREDENTIAL_STORE_STATIC } from 'api/models/credential-store';
module(
'Unit | Controller | scopes/scope/credential-stores/credential-store/credentials/index',
@@ -19,6 +20,7 @@ module(
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getCredentialCount;
@@ -37,8 +39,9 @@ module(
credentials: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credentials/index',
@@ -54,6 +57,7 @@ module(
scope: { id: instances.scopes.org.id, type: 'org' },
});
instances.credentialStore = this.server.create('credential-store', {
+ type: TYPE_CREDENTIAL_STORE_STATIC,
scope: instances.scopes.project,
});
instances.credential = this.server.create('credential', {
@@ -111,5 +115,40 @@ module(
assert.strictEqual(getCredentialCount(), credentialCount - 1);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.credentials);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.credential.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.credentialStore.authorized_collection_actions.credentials = [
+ 'create',
+ ];
+ await visit(urls.credentials);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.credential.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.credentialStore.authorized_collection_actions.credentials = [];
+ await visit(urls.credentials);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.credential.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/edit-worker-filter-test.js b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/edit-worker-filter-test.js
new file mode 100644
index 0000000000..2a2981eb8c
--- /dev/null
+++ b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/edit-worker-filter-test.js
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module(
+ 'Unit | Controller | scopes/scope/credential-stores/credential-store/edit-worker-filter',
+ function (hooks) {
+ setupTest(hooks);
+
+ test('it exists', function (assert) {
+ let controller = this.owner.lookup(
+ 'controller:scopes/scope/credential-stores/credential-store/edit-worker-filter',
+ );
+ assert.ok(controller);
+ assert.ok(controller.credentialStores);
+ });
+ },
+);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js
new file mode 100644
index 0000000000..14ee81ec33
--- /dev/null
+++ b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/credential-store/worker-filter-test.js
@@ -0,0 +1,22 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module(
+ 'Unit | Controller | scopes/scope/credential-stores/credential-store/worker-filter',
+ function (hooks) {
+ setupTest(hooks);
+
+ test('it exists', function (assert) {
+ let controller = this.owner.lookup(
+ 'controller:scopes/scope/credential-stores/credential-store/worker-filter',
+ );
+ assert.ok(controller);
+ assert.ok(controller.credentialStores);
+ });
+ },
+);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/index-test.js
index 8e89d88f43..1c14e03900 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/credential-stores/index-test.js
@@ -23,6 +23,7 @@ module(
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let controller;
let store;
let getCredentialStoreCount;
@@ -40,8 +41,9 @@ module(
credentialStores: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/index',
);
@@ -138,5 +140,42 @@ module(
assert.strictEqual(controller.page, 1);
assert.deepEqual(controller.types, selectedItems);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.credentialStores);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.credential-store.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.project.authorized_collection_actions[
+ 'credential-stores'
+ ] = ['create'];
+ await visit(urls.credentialStores);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.credential-store.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.project.authorized_collection_actions[
+ 'credential-stores'
+ ] = [];
+ await visit(urls.credentialStores);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.credential-store.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js b/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js
index c621b608f9..0784b5ec40 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/groups/group/add-members-test.js
@@ -32,8 +32,8 @@ module(
addMembers: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/groups/group/add-members',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/groups/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/groups/index-test.js
index 9b9de64979..4949a96892 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/groups/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/groups/index-test.js
@@ -17,6 +17,7 @@ module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getGroupCount;
@@ -33,8 +34,9 @@ module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
groups: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/groups/index');
@@ -105,4 +107,37 @@ module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
assert.deepEqual(group.member_ids, []);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.groups);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.group.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.groups = ['create'];
+ await visit(urls.groups);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.group.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.groups = [];
+ await visit(urls.groups);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.group.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js
index b826eef37f..ad6891833f 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts-test.js
@@ -33,8 +33,8 @@ module(
addHosts: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js
index 46aadf1710..abd36ff9c7 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host-test.js
@@ -33,8 +33,8 @@ module(
createAndAddHost: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js
index 716afeaf01..aa6c626f52 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/host-sets/index-test.js
@@ -19,6 +19,7 @@ module(
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getHostSetCount;
@@ -37,8 +38,9 @@ module(
hostSets: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/index',
@@ -126,5 +128,40 @@ module(
assert.deepEqual(hostSet.host_ids, []);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.hostSets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.host-set.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.hostCatalog.authorized_collection_actions['host-sets'] = [
+ 'create',
+ ];
+ await visit(urls.hostSets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.host-set.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.hostCatalog.authorized_collection_actions['host-sets'] = [];
+ await visit(urls.hostSets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.host-set.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js
index af5bc9db7e..59fdce4d12 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/host-catalog/hosts/index-test.js
@@ -16,6 +16,7 @@ module(
setupTest(hooks);
setupMirage(hooks);
+ let intl;
let store;
let controller;
let getHostCount;
@@ -34,8 +35,9 @@ module(
hosts: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/hosts/index',
@@ -103,5 +105,38 @@ module(
assert.strictEqual(getHostCount(), hostCount - 1);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.hosts);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.host.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.hostCatalog.authorized_collection_actions.hosts = ['create'];
+ await visit(urls.hosts);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.host.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.hostCatalog.authorized_collection_actions.hosts = [];
+ await visit(urls.hosts);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.host.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/index-test.js
index 100549c02f..527f74dd0b 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/host-catalogs/index-test.js
@@ -19,6 +19,7 @@ module(
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getHostCatalogCount;
@@ -36,8 +37,9 @@ module(
hostCatalogs: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/index',
@@ -114,5 +116,40 @@ module(
assert.strictEqual(getHostCatalogCount(), hostCatalogCount - 1);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.hostCatalogs);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.host-catalog.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.project.authorized_collection_actions['host-catalogs'] =
+ ['create'];
+ await visit(urls.hostCatalogs);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.host-catalog.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.project.authorized_collection_actions['host-catalogs'] =
+ [];
+ await visit(urls.hostCatalogs);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.host-catalog.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/index-test.js
index 996e27da95..e4edcd450c 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/index-test.js
@@ -33,8 +33,8 @@ module('Unit | Controller | scopes/scope/index', function (hooks) {
globalScope: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/index');
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/policies/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/policies/index-test.js
index fda6a713c8..96d37eb3cd 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/policies/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/policies/index-test.js
@@ -17,6 +17,7 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getPolicyCount;
@@ -33,7 +34,8 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/policies/index');
@@ -84,4 +86,37 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
assert.strictEqual(getPolicyCount(), policyCount - 1);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.policies);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.policy.messages.none.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.policies = ['create'];
+ await visit(urls.policies);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.policy.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.policies = [];
+ await visit(urls.policies);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.policy.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/index-test.js
index 3ee4b8beee..cd7779dd66 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/index-test.js
@@ -17,6 +17,7 @@ module('Unit | Controller | scopes/scope/roles/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getRoleCount;
@@ -35,7 +36,8 @@ module('Unit | Controller | scopes/scope/roles/index', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/roles/index');
@@ -110,4 +112,37 @@ module('Unit | Controller | scopes/scope/roles/index', function (hooks) {
assert.deepEqual(role.principals, []);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.roles);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.role.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.roles = ['create'];
+ await visit(urls.roles);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.role.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.roles = [];
+ await visit(urls.roles);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.role.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js
index 8573d9f4df..2e7c236193 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/add-principals-test.js
@@ -33,7 +33,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/add-principals',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/grants-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/grants-test.js
index 808b4b1c0d..b70767d371 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/grants-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/grants-test.js
@@ -28,7 +28,7 @@ module('Unit | Controller | scopes/scope/roles/role/grants', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/roles/role/grants');
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/index-test.js
index 91b5b55ccf..ad75c104ba 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/index-test.js
@@ -33,7 +33,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/manage-scopes/index',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-custom-scopes-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-custom-scopes-test.js
index 359c8215d4..5ff98ab61c 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-custom-scopes-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-custom-scopes-test.js
@@ -35,7 +35,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/manage-scopes/manage-custom-scopes',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-org-projects-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-org-projects-test.js
index 5a923458d6..205b85a69f 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-org-projects-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/manage-scopes/manage-org-projects-test.js
@@ -36,7 +36,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/manage-scopes/manage-org-projects',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/scopes-test.js b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/scopes-test.js
index 8e3ce4eaf1..4f4c0d590a 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/roles/role/scopes-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/roles/role/scopes-test.js
@@ -37,7 +37,7 @@ module('Unit | Controller | scopes/scope/roles/role/scopes', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup('controller:scopes/scope/roles/role/scopes');
instances.scopes.global = this.server.create('scope', { id: 'global' });
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/session-recording/channels-by-connection/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/session-recording/channels-by-connection/index-test.js
index 0f9632808b..e8a8909977 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/session-recording/channels-by-connection/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/session-recording/channels-by-connection/index-test.js
@@ -32,8 +32,8 @@ module(
sessionRecording: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/session-recordings/session-recording/channels-by-connection/index',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/storage-buckets/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/storage-buckets/index-test.js
index 3772353570..b50fc06c66 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/storage-buckets/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/storage-buckets/index-test.js
@@ -19,6 +19,8 @@ module(
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
+ let features;
let store;
let controller;
let getStorageBucketCount;
@@ -34,8 +36,10 @@ module(
storageBuckets: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
+ features = this.owner.lookup('service:features');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/storage-buckets/index',
@@ -95,5 +99,43 @@ module(
assert.strictEqual(getStorageBucketCount(), storageBucketCount - 1);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ features.enable('ssh-session-recording');
+ await visit(urls.storageBuckets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.storage-bucket.messages.none.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ features.enable('ssh-session-recording');
+ instances.scopes.global.authorized_collection_actions['storage-buckets'] =
+ ['create'];
+ await visit(urls.storageBuckets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.storage-bucket.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ features.enable('ssh-session-recording');
+ instances.scopes.global.authorized_collection_actions['storage-buckets'] =
+ [];
+ await visit(urls.storageBuckets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.storage-bucket.title_plural'),
+ }),
+ );
+ });
},
);
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js
index bafba80cfd..2a8100d39d 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/index-test.js
@@ -18,6 +18,7 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getTargetCount;
@@ -42,8 +43,9 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) {
alias: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/targets/index');
@@ -286,4 +288,37 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) {
assert.strictEqual(target.egress_worker_filter, 'test');
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.targets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.target.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.project.authorized_collection_actions.targets = ['create'];
+ await visit(urls.targets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.target.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.project.authorized_collection_actions.targets = [];
+ await visit(urls.targets);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.target.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-brokered-credential-sources-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-brokered-credential-sources-test.js
index ef1c0e57e9..2f2ef602b1 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-brokered-credential-sources-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-brokered-credential-sources-test.js
@@ -34,8 +34,8 @@ module(
credentialSources: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/add-brokered-credential-sources',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js
index ee166228c9..4c43549c6a 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-host-sources-test.js
@@ -35,8 +35,8 @@ module(
hostSources: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/add-host-sources',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-injected-application-credential-sources-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-injected-application-credential-sources-test.js
index 623f27c11a..efda0ae043 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-injected-application-credential-sources-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/add-injected-application-credential-sources-test.js
@@ -34,8 +34,8 @@ module(
credentialSources: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/add-injected-application-credential-sources',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/create-storage-bucket-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/create-storage-bucket-test.js
index 5786fcba3e..609e6b7665 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/create-storage-bucket-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/create-storage-bucket-test.js
@@ -33,8 +33,8 @@ module(
createStorageBucket: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/enable-session-recording/create-storage-bucket',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/index-test.js
index 4f34bc50fb..59b8e9f86c 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/targets/target/enable-session-recording/index-test.js
@@ -32,8 +32,8 @@ module(
enableSessionRecording: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/enable-session-recording/index',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/users/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/users/index-test.js
index d4228b47fb..5e47440daa 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/users/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/users/index-test.js
@@ -17,6 +17,7 @@ module('Unit | Controller | scopes/scope/users/index', function (hooks) {
setupIndexedDb(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getUserCount;
@@ -33,8 +34,9 @@ module('Unit | Controller | scopes/scope/users/index', function (hooks) {
users: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/users/index');
@@ -105,4 +107,37 @@ module('Unit | Controller | scopes/scope/users/index', function (hooks) {
assert.deepEqual(user.account_ids, []);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.users);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.user.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.users = ['create'];
+ await visit(urls.users);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('resources.user.title_plural'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.users = [];
+ await visit(urls.users);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('resources.user.title_plural'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/users/user/add-accounts-test.js b/ui/admin/tests/unit/controllers/scopes/scope/users/user/add-accounts-test.js
index 17d917f5ba..f4b6a05acb 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/users/user/add-accounts-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/users/user/add-accounts-test.js
@@ -31,8 +31,8 @@ module(
addAccounts: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/users/user/add-accounts',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js
index c80f0a8e4c..8c445a1600 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/workers/index-test.js
@@ -15,6 +15,7 @@ module('Unit | Controller | scopes/scope/workers/index', function (hooks) {
setupMirage(hooks);
setupIntl(hooks, 'en-us');
+ let intl;
let store;
let controller;
let getWorkerCount;
@@ -31,8 +32,9 @@ module('Unit | Controller | scopes/scope/workers/index', function (hooks) {
workers: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
+ intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/workers/index');
@@ -109,4 +111,39 @@ module('Unit | Controller | scopes/scope/workers/index', function (hooks) {
assert.deepEqual(route.tags, []);
});
+
+ test('messageDescription returns correct translation with list authorization', async function (assert) {
+ await visit(urls.workers);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('resources.worker.description'),
+ );
+ });
+
+ test('messageDescription returns correct translation with create authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.workers = [
+ 'create:worker-led',
+ ];
+ await visit(urls.workers);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.create-but-not-list', {
+ resource: intl.t('titles.workers'),
+ }),
+ );
+ });
+
+ test('messageDescription returns correct translation with no authorization', async function (assert) {
+ instances.scopes.global.authorized_collection_actions.workers = [];
+ await visit(urls.workers);
+
+ assert.strictEqual(
+ controller.messageDescription,
+ intl.t('descriptions.neither-list-nor-create', {
+ resource: intl.t('titles.workers'),
+ }),
+ );
+ });
});
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/workers/new-test.js b/ui/admin/tests/unit/controllers/scopes/scope/workers/new-test.js
index a033e6940b..3896a97fd7 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/workers/new-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/workers/new-test.js
@@ -27,8 +27,8 @@ module('Unit | Controller | scopes/scope/workers/new', function (hooks) {
workers: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/workers/new');
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/create-tags-test.js b/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/create-tags-test.js
index e65a32dae8..0e8cf7a898 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/create-tags-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/create-tags-test.js
@@ -31,8 +31,8 @@ module(
createTags: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/workers/worker/create-tags',
diff --git a/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/tags-test.js b/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/tags-test.js
index f75e28a438..1824c353a1 100644
--- a/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/tags-test.js
+++ b/ui/admin/tests/unit/controllers/scopes/scope/workers/worker/tags-test.js
@@ -34,8 +34,8 @@ module(
tags: null,
};
- hooks.beforeEach(function () {
- authenticateSession({});
+ hooks.beforeEach(async function () {
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/workers/worker/tags',
diff --git a/ui/admin/tests/unit/instance-initializers/feature-edition-test.js b/ui/admin/tests/unit/instance-initializers/feature-edition-test.js
index b4da0e0649..e00c8ba023 100644
--- a/ui/admin/tests/unit/instance-initializers/feature-edition-test.js
+++ b/ui/admin/tests/unit/instance-initializers/feature-edition-test.js
@@ -30,12 +30,12 @@ module('Unit | Instance Initializer | feature-edition', function (hooks) {
this.instance = this.application.buildInstance();
});
+
hooks.afterEach(function () {
run(this.instance, 'destroy');
run(this.application, 'destroy');
});
- // TODO: Replace this with your real tests.
test('it works', async function (assert) {
await this.instance.boot();
diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/edit-worker-filter-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/edit-worker-filter-test.js
new file mode 100644
index 0000000000..8de8cb806b
--- /dev/null
+++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/edit-worker-filter-test.js
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+import { module, test } from 'qunit';
+import { setupTest } from 'admin/tests/helpers';
+
+module(
+ 'Unit | Route | scopes/scope/credential-stores/credential-store/edit-worker-filter',
+ function (hooks) {
+ setupTest(hooks);
+
+ test('it exists', function (assert) {
+ let route = this.owner.lookup(
+ 'route:scopes/scope/credential-stores/credential-store/edit-worker-filter',
+ );
+ assert.ok(route);
+ });
+ },
+);
diff --git a/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js
new file mode 100644
index 0000000000..23f4e1eb3e
--- /dev/null
+++ b/ui/admin/tests/unit/routes/scopes/scope/credential-stores/credential-store/worker-filter-test.js
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
+import { module, test } from 'qunit';
+import { setupTest } from 'admin/tests/helpers';
+
+module(
+ 'Unit | Route | scopes/scope/credential-stores/credential-store/worker-filter',
+ function (hooks) {
+ setupTest(hooks);
+
+ test('it exists', function (assert) {
+ let route = this.owner.lookup(
+ 'route:scopes/scope/credential-stores/credential-store/worker-filter',
+ );
+ assert.ok(route);
+ });
+ },
+);
diff --git a/ui/admin/tests/unit/services/feature-edition-test.js b/ui/admin/tests/unit/services/feature-edition-test.js
index 9901dc9d33..913b958556 100644
--- a/ui/admin/tests/unit/services/feature-edition-test.js
+++ b/ui/admin/tests/unit/services/feature-edition-test.js
@@ -9,7 +9,6 @@ import { setupTest } from 'admin/tests/helpers';
module('Unit | Service | features', function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:features');
assert.ok(service);
diff --git a/ui/admin/tests/unit/services/session-test.js b/ui/admin/tests/unit/services/session-test.js
index 9b53ab8f40..667431e4e0 100644
--- a/ui/admin/tests/unit/services/session-test.js
+++ b/ui/admin/tests/unit/services/session-test.js
@@ -9,7 +9,6 @@ import { setupTest } from 'admin/tests/helpers';
module('Unit | Service | session', function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:session');
assert.ok(service);
diff --git a/ui/desktop/app/controllers/scopes/scope/authenticate/method/oidc.js b/ui/desktop/app/controllers/scopes/scope/authenticate/method/oidc.js
index c64b230c31..31bbec8799 100644
--- a/ui/desktop/app/controllers/scopes/scope/authenticate/method/oidc.js
+++ b/ui/desktop/app/controllers/scopes/scope/authenticate/method/oidc.js
@@ -3,21 +3,34 @@
* SPDX-License-Identifier: BUSL-1.1
*/
-import Controller from '@ember/controller';
+import Controller, { inject as controller } from '@ember/controller';
+import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class ScopesScopeAuthenticateMethodOidcController extends Controller {
+ @controller('scopes/scope/authenticate/method/index') authenticateMethod;
+
// =services
@service session;
- // =attributes
+ // =actions
/**
- * Authentication URL for the pending OIDC flow, if any.
- * @type {?string}
+ * Retry by starting a new OIDC authentication flow.
+ * @param {object} e
*/
- get authURL() {
- return this.session.data.pending.oidc.attributes.auth_url;
+ @action
+ async retryAuthentication(e) {
+ // TODO: This event handler can be removed when rose dialog gets
+ // refactored to use hds.
+ e.preventDefault();
+
+ const scope = this.authMethod.scope;
+ const authenticatorName = `authenticator:${this.authMethod.type}`;
+ await this.authenticateMethod.startOIDCAuthentication(authenticatorName, {
+ scope,
+ authMethod: this.authMethod,
+ });
}
}
diff --git a/ui/desktop/app/routes/scopes/scope/authenticate/method/oidc.js b/ui/desktop/app/routes/scopes/scope/authenticate/method/oidc.js
index 0c50090f5d..1ca7eccc36 100644
--- a/ui/desktop/app/routes/scopes/scope/authenticate/method/oidc.js
+++ b/ui/desktop/app/routes/scopes/scope/authenticate/method/oidc.js
@@ -31,6 +31,16 @@ export default class ScopesScopeAuthenticateMethodOidcRoute extends Route {
return oidc.attemptFetchToken({ scope, authMethod });
}
+ /**
+ * Adds the auth-method to the controller context.
+ * @param {Controller} controller
+ */
+ setupController(controller) {
+ super.setupController(...arguments);
+ const authMethod = this.modelFor('scopes.scope.authenticate.method');
+ controller.authMethod = authMethod;
+ }
+
@runEvery(POLL_TIMEOUT_SECONDS * 1000)
poller() {
this.refresh();
diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss
index dadfe07e62..8ae7b56c00 100644
--- a/ui/desktop/app/styles/app.scss
+++ b/ui/desktop/app/styles/app.scss
@@ -124,21 +124,6 @@
}
}
-.rose-table {
- p {
- margin-bottom: 0;
- }
-
- .rose-form-checkbox {
- margin-bottom: 0;
-
- .rose-form-checkbox-label-text {
- color: var(--stark);
- text-decoration: underline;
- }
- }
-}
-
.rose-header {
-webkit-app-region: drag;
min-height: sizing.rems(l) * 2;
diff --git a/ui/desktop/app/templates/cluster-url.hbs b/ui/desktop/app/templates/cluster-url.hbs
index 91f9975e0e..2dc38ba70c 100644
--- a/ui/desktop/app/templates/cluster-url.hbs
+++ b/ui/desktop/app/templates/cluster-url.hbs
@@ -15,10 +15,12 @@
@disabled={{(is-loading)}}
as |form|
>
+
+ {{! template-lint-disable no-autofocus-attribute }}
diff --git a/ui/desktop/app/templates/error.hbs b/ui/desktop/app/templates/error.hbs
index 465e90b0aa..d3bbc7c8d5 100644
--- a/ui/desktop/app/templates/error.hbs
+++ b/ui/desktop/app/templates/error.hbs
@@ -8,7 +8,7 @@
-
+
diff --git a/ui/desktop/app/templates/scopes/scope/authenticate.hbs b/ui/desktop/app/templates/scopes/scope/authenticate.hbs
index e9d6953e7f..dea545b3fd 100644
--- a/ui/desktop/app/templates/scopes/scope/authenticate.hbs
+++ b/ui/desktop/app/templates/scopes/scope/authenticate.hbs
@@ -49,16 +49,15 @@
{{/if}}
{{#unless @model.authMethods}}
-
-
- {{t 'resources.auth-method.messages.none.description'}}
-
-
+
+
+
+
{{/unless}}
diff --git a/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs b/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs
index e7be45d82c..4e61d82f50 100644
--- a/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs
+++ b/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs
@@ -5,14 +5,12 @@
{{#unless @model}}
-
-
- {{t 'resources.auth-method.messages.none.description'}}
-
-
+
+
+
+
{{/unless}}
\ No newline at end of file
diff --git a/ui/desktop/app/templates/scopes/scope/authenticate/method/oidc.hbs b/ui/desktop/app/templates/scopes/scope/authenticate/method/oidc.hbs
index 00f529749b..04724a8503 100644
--- a/ui/desktop/app/templates/scopes/scope/authenticate/method/oidc.hbs
+++ b/ui/desktop/app/templates/scopes/scope/authenticate/method/oidc.hbs
@@ -11,7 +11,7 @@
{{t 'resources.auth-method.messages.pending.description'}}
{{t 'resources.auth-method.questions.no-see-window'}}
-
+
{{t 'actions.retry'}}
diff --git a/ui/desktop/app/templates/scopes/scope/projects/error.hbs b/ui/desktop/app/templates/scopes/scope/projects/error.hbs
index 1699834955..623b4f2018 100644
--- a/ui/desktop/app/templates/scopes/scope/projects/error.hbs
+++ b/ui/desktop/app/templates/scopes/scope/projects/error.hbs
@@ -9,7 +9,10 @@
{{#if @model.errors}}
{{#each @model.errors as |error|}}
-
+
{{/each}}
{{/if}}
@@ -17,7 +20,7 @@
{{! But a disconnected state doesn't get normalized errors }}
{{#unless @model.errors}}
-
+
diff --git a/ui/desktop/config/environment.js b/ui/desktop/config/environment.js
index 801c944cfd..7a46410790 100644
--- a/ui/desktop/config/environment.js
+++ b/ui/desktop/config/environment.js
@@ -53,6 +53,7 @@ module.exports = function (environment) {
'/tutorials/oss-getting-started/oss-getting-started-desktop-app#connect',
sessions:
'/tutorials/oss-getting-started/oss-getting-started-desktop-app#connect',
+ 'support-page': 'https://support.hashicorp.com/hc/en-us',
},
},
diff --git a/ui/desktop/electron-app/src/index.js b/ui/desktop/electron-app/src/index.js
index 131c672f5e..e5118aa7a7 100644
--- a/ui/desktop/electron-app/src/index.js
+++ b/ui/desktop/electron-app/src/index.js
@@ -163,7 +163,8 @@ const createWindow = (partition, closeWindowCB) => {
if (
isLocalhost(url) ||
url.startsWith('https://developer.hashicorp.com/') ||
- url.startsWith('https://releases.hashicorp.com/boundary-desktop/')
+ url.startsWith('https://releases.hashicorp.com/boundary-desktop/') ||
+ url.startsWith('https://support.hashicorp.com/hc/en-us')
) {
shell.openExternal(url);
}
diff --git a/ui/desktop/package.json b/ui/desktop/package.json
index a151e3171e..b7fcb432e4 100644
--- a/ui/desktop/package.json
+++ b/ui/desktop/package.json
@@ -43,7 +43,7 @@
"dependencies": {
"ember-named-blocks-polyfill": "^0.2.5",
"lodash": "^4.17.21",
- "uuid": "^9.0.0",
+ "uuid": "^11.0.3",
"@xterm/xterm": "^5.5.0",
"@xterm/addon-canvas": "^0.7.0",
"@xterm/addon-fit": "^0.10.0"
@@ -60,7 +60,6 @@
"@faker-js/faker": "^8.0.2",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
- "@playwright/test": "^1.43.0",
"babel-loader": "^9.2.1",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^9.1.0",
@@ -69,9 +68,7 @@
"doctoc": "^2.2.0",
"ember-a11y-testing": "^7.0.0",
"ember-auto-import": "^2.8.1",
- "ember-autofocus-modifier": "^4.0.1",
"ember-cli": "^5.12.0",
- "ember-cli-app-version": "^6.0.0",
"ember-cli-babel": "^8.2.0",
"ember-cli-code-coverage": "^1.0.3",
"ember-cli-dependency-checker": "^3.3.2",
@@ -101,14 +98,13 @@
"eslint-plugin-qunit": "^8.0.1",
"js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1",
"loader.js": "^4.7.0",
- "playwright": "^1.43.0",
"prettier": "^3.0.0",
"qunit": "^2.22.0",
"qunit-dom": "^3.2.1",
"rose": "*",
"sass": "^1.69.5",
"shx": "^0.3.4",
- "sinon": "^18.0.0",
+ "sinon": "^19.0.2",
"stylelint": "^15.10.1",
"stylelint-config-prettier-scss": "^0.0.1",
"stylelint-config-standard": "^32.0.0",
diff --git a/ui/desktop/tests/acceptance/application-test.js b/ui/desktop/tests/acceptance/application-test.js
index 1bc56832dd..f841c4c34a 100644
--- a/ui/desktop/tests/acceptance/application-test.js
+++ b/ui/desktop/tests/acceptance/application-test.js
@@ -24,8 +24,8 @@ module('Acceptance | index', function (hooks) {
clusterUrl: null,
};
- hooks.beforeEach(function () {
- invalidateSession();
+ hooks.beforeEach(async function () {
+ await invalidateSession();
urls.clusterUrl = '/cluster-url';
diff --git a/ui/desktop/tests/acceptance/authentication-test.js b/ui/desktop/tests/acceptance/authentication-test.js
index e84dc69ca8..3f175756a5 100644
--- a/ui/desktop/tests/acceptance/authentication-test.js
+++ b/ui/desktop/tests/acceptance/authentication-test.js
@@ -64,12 +64,12 @@ module('Acceptance | authentication', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.user = this.server.create('user', {
scope: instances.scopes.global,
});
- invalidateSession();
+ await invalidateSession();
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -193,7 +193,7 @@ module('Acceptance | authentication', function (hooks) {
test('401 responses result in deauthentication', async function (assert) {
assert.expect(3);
- authenticateSession({
+ await authenticateSession({
scope: {
id: instances.scopes.global.id,
type: instances.scopes.global.type,
diff --git a/ui/desktop/tests/acceptance/cluster-url-test.js b/ui/desktop/tests/acceptance/cluster-url-test.js
index b5d6be6015..14d7db3801 100644
--- a/ui/desktop/tests/acceptance/cluster-url-test.js
+++ b/ui/desktop/tests/acceptance/cluster-url-test.js
@@ -63,8 +63,8 @@ module('Acceptance | clusterUrl', function (hooks) {
mockIPC = test.owner.lookup('service:browser/window').mockIPC;
};
- hooks.beforeEach(function () {
- invalidateSession();
+ hooks.beforeEach(async function () {
+ await invalidateSession();
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
diff --git a/ui/desktop/tests/acceptance/projects-test.js b/ui/desktop/tests/acceptance/projects-test.js
index 65d8515f1c..3574276c50 100644
--- a/ui/desktop/tests/acceptance/projects-test.js
+++ b/ui/desktop/tests/acceptance/projects-test.js
@@ -58,8 +58,8 @@ module('Acceptance | projects', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -102,7 +102,7 @@ module('Acceptance | projects', function (hooks) {
});
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
- invalidateSession();
+ await invalidateSession();
assert.expect(2);
await visit(urls.projects);
await a11yAudit();
diff --git a/ui/desktop/tests/acceptance/projects/sessions/index-test.js b/ui/desktop/tests/acceptance/projects/sessions/index-test.js
index 719a31f1da..91bc008d61 100644
--- a/ui/desktop/tests/acceptance/projects/sessions/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/sessions/index-test.js
@@ -74,12 +74,15 @@ module('Acceptance | projects | sessions | index', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.user = this.server.create('user', {
scope: instances.scopes.global,
});
- authenticateSession({ user_id: instances.user.id, username: 'admin' });
+ await authenticateSession({
+ user_id: instances.user.id,
+ username: 'admin',
+ });
// create scopes
instances.scopes.global = this.server.create('scope', {
@@ -163,7 +166,7 @@ module('Acceptance | projects | sessions | index', function (hooks) {
});
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
- invalidateSession();
+ await invalidateSession();
this.stubCacheDaemonSearch();
await visit(urls.sessions);
diff --git a/ui/desktop/tests/acceptance/projects/sessions/session-test.js b/ui/desktop/tests/acceptance/projects/sessions/session-test.js
index c2d48c5f85..0325fecfd5 100644
--- a/ui/desktop/tests/acceptance/projects/sessions/session-test.js
+++ b/ui/desktop/tests/acceptance/projects/sessions/session-test.js
@@ -56,12 +56,15 @@ module('Acceptance | projects | sessions | session', function (hooks) {
let originalUncaughtException = QUnit.onUncaughtException;
- hooks.beforeEach(function () {
+ hooks.beforeEach(async function () {
instances.user = this.server.create('user', {
scope: instances.scopes.global,
});
- authenticateSession({ user_id: instances.user.id, username: 'admin' });
+ await authenticateSession({
+ user_id: instances.user.id,
+ username: 'admin',
+ });
// create scopes
instances.scopes.global = this.server.create('scope', { id: 'global' });
@@ -145,13 +148,125 @@ module('Acceptance | projects | sessions | session', function (hooks) {
await click(TARGET_CONNECT_BUTTON);
assert.strictEqual(currentURL(), urls.session);
- assert.dom('credential-panel-header').doesNotExist();
- assert.dom('credential-panel-body').doesNotExist();
+ assert.dom('.credential-panel-header').doesNotExist();
+ assert.dom('.credential-panel-body').doesNotExist();
assert
.dom('[data-test-no-credentials]')
.hasText(`Connected You can now access ${instances.target.name}`);
});
+ test('visiting session with vault type credentials should display nested data in a key/value format without escape characters', async function (assert) {
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
+ session_id: instances.session.id,
+ address: 'a_123',
+ port: 'p_123',
+ protocol: 'tcp',
+ credentials: [
+ {
+ credential_source: {
+ id: 'clvlt_4cvscMTl0N',
+ name: 'Credential Library 0',
+ description: 'Source Description',
+ credential_store_id: 'csvlt_Q1HFGt7Jpm',
+ type: 'vault-generic',
+ },
+ secret: {
+ raw: 'eyJhcnJheSI6WyJvbmUiLCJ0d28iLCJ0aHJlZSIsIm9uZSIsInR3byIsInRocmVlIiwib25lIiwidHdvIiwidGhyZWUiLCJvbmUiLCJ0d28iLCJ0aHJlZSJdLCJuZXN0ZWQiOnsiYm9vbCI6dHJ1ZSwibG9uZyI6IjEyMjM1MzQ1NmFzZWRmYTQzd3J0ZjIzNGYyM2FzZGdmYXNkZnJnYXdzZWZhd3NlZnNkZjQiLCJzZWNlcmV0Ijoic28gbmVzdGVkIn0sInRlc3QiOiJwaHJhc2UifQ',
+ decoded: {
+ data: {
+ backslash: 'password\\with\\tslash',
+ email: {
+ address: 'test.com',
+ },
+ },
+ metadata: {
+ created_time: '2024-04-12T18:38:36.226715555Z',
+ custom_metadata: null,
+ deletion_time: '',
+ destroyed: false,
+ version: 8,
+ },
+ },
+ },
+ },
+ ],
+ });
+
+ await visit(urls.target);
+ await click(TARGET_CONNECT_BUTTON);
+ assert.strictEqual(currentURL(), urls.session);
+
+ assert.dom('.credential-panel-header').exists();
+ assert.dom('.credential-panel-body').exists();
+ assert.dom('.credential-secret').exists();
+
+ // Check if nested data is displayed in a key/value format without escape characters
+ assert.dom('.secret-container:nth-of-type(1)').includesText('backslash');
+ await click('.secret-container:nth-of-type(1) .hds-icon');
+ const expectedOutput = String.raw`password\with\tslash`;
+ assert
+ .dom('.secret-container:nth-of-type(1) .secret-content')
+ .hasText(expectedOutput);
+
+ assert
+ .dom('.secret-container:nth-of-type(2)')
+ .includesText('email.address');
+ await click('.secret-container:nth-of-type(2) .hds-icon');
+ assert
+ .dom('.secret-container:nth-of-type(2) .secret-content')
+ .hasText('test.com');
+ });
+
+ test('visiting session with static type credentials should display nested data in a key/value format without escape characters', async function (assert) {
+ this.ipcStub.withArgs('cliExists').returns(true);
+ this.ipcStub.withArgs('connect').returns({
+ session_id: instances.session.id,
+ address: 'a_123',
+ port: 'p_123',
+ protocol: 'tcp',
+ credentials: [
+ {
+ credential_source: {
+ id: 'credjson_7cKBbBEkC3',
+ credential_store_id: 'csst_yzlsot2pum',
+ type: 'static',
+ credential_type: 'json',
+ },
+ secret: {
+ raw: 'eyJhcnJheSI6WyJvbmUiLCJ0d28iLCJ0aHJlZSIsIm9uZSIsInR3byIsInRocmVlIiwib25lIiwidHdvIiwidGhyZWUiLCJvbmUiLCJ0d28iLCJ0aHJlZSJdLCJuZXN0ZWQiOnsiYm9vbCI6dHJ1ZSwibG9uZyI6IjEyMjM1MzQ1NmFzZWRmYTQzd3J0ZjIzNGYyM2FzZGdmYXNkZnJnYXdzZWZhd3NlZnNkZjQiLCJzZWNlcmV0Ijoic28gbmVzdGVkIn0sInRlc3QiOiJwaHJhc2UifQ==',
+ decoded: {
+ nested_secret: {
+ complex_nest: {
+ blackslash: 'password\\with\\tslash',
+ },
+ },
+ },
+ },
+ },
+ ],
+ });
+
+ await visit(urls.target);
+ await click(TARGET_CONNECT_BUTTON);
+ assert.strictEqual(currentURL(), urls.session);
+
+ assert.dom('.credential-panel-header').exists();
+ assert.dom('.credential-panel-body').exists();
+ assert.dom('.credential-secret').exists();
+
+ // Check if nested data is displayed in a key/value format without escape characters
+ const expectedOutput = String.raw`password\with\tslash`;
+ assert
+ .dom('.secret-container:nth-of-type(1)')
+ .includesText('nested_secret.complex_nest.blackslash');
+ await click('.secret-container:nth-of-type(1) .hds-icon');
+
+ assert
+ .dom('.secret-container:nth-of-type(1) .secret-content')
+ .hasText(expectedOutput);
+ });
+
test('visiting a session that does not have permissions to read a host', async function (assert) {
assert.expect(1);
this.server.get('/hosts/:id', () => new Response(403));
diff --git a/ui/desktop/tests/acceptance/projects/settings/index-test.js b/ui/desktop/tests/acceptance/projects/settings/index-test.js
index 07eb5ca35f..f99257e2e2 100644
--- a/ui/desktop/tests/acceptance/projects/settings/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/settings/index-test.js
@@ -63,8 +63,8 @@ module('Acceptance | projects | settings | index', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
- authenticateSession();
+ hooks.beforeEach(async function () {
+ await authenticateSession();
// Generate scopes
instances.scopes.global = this.server.create('scope', {
id: 'global',
@@ -134,7 +134,7 @@ module('Acceptance | projects | settings | index', function (hooks) {
});
test('clicking sign-out button logs out the user', async function (assert) {
- authenticateSession({ username: 'testuser' });
+ await authenticateSession({ username: 'testuser' });
assert.expect(2);
await visit(urls.settings);
assert.ok(currentSession().isAuthenticated);
diff --git a/ui/desktop/tests/acceptance/projects/targets/index-test.js b/ui/desktop/tests/acceptance/projects/targets/index-test.js
index 5ba046f5e5..83cde86623 100644
--- a/ui/desktop/tests/acceptance/projects/targets/index-test.js
+++ b/ui/desktop/tests/acceptance/projects/targets/index-test.js
@@ -82,8 +82,8 @@ module('Acceptance | projects | targets | index', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
// bypass mirage config that expects recursive to be passed in as queryParam
this.server.get('/targets', ({ targets }) => targets.all());
@@ -165,7 +165,7 @@ module('Acceptance | projects | targets | index', function (hooks) {
});
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
- invalidateSession();
+ await invalidateSession();
this.stubCacheDaemonSearch();
await visit(urls.targets);
await a11yAudit();
diff --git a/ui/desktop/tests/acceptance/projects/targets/target-test.js b/ui/desktop/tests/acceptance/projects/targets/target-test.js
index bed15c4261..91405be657 100644
--- a/ui/desktop/tests/acceptance/projects/targets/target-test.js
+++ b/ui/desktop/tests/acceptance/projects/targets/target-test.js
@@ -61,8 +61,8 @@ module('Acceptance | projects | targets | target', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
- authenticateSession();
+ hooks.beforeEach(async function () {
+ await authenticateSession();
// bypass mirage config that expects recursive to be passed in as queryParam
this.server.get('/targets', ({ targets }) => targets.all());
diff --git a/ui/desktop/tests/acceptance/scopes-test.js b/ui/desktop/tests/acceptance/scopes-test.js
index 167e6c91b0..0b7b67f422 100644
--- a/ui/desktop/tests/acceptance/scopes-test.js
+++ b/ui/desktop/tests/acceptance/scopes-test.js
@@ -80,8 +80,8 @@ module('Acceptance | scopes', function (hooks) {
clusterUrl.rendererClusterUrl = windowOrigin;
};
- hooks.beforeEach(function () {
- authenticateSession({ username: 'admin' });
+ hooks.beforeEach(async function () {
+ await authenticateSession({ username: 'admin' });
// bypass mirage config that expects recursive to be passed in as queryParam
this.server.get('/targets', ({ targets }) => targets.all());
@@ -239,7 +239,7 @@ module('Acceptance | scopes', function (hooks) {
});
test('visiting index while unauthenticated redirects to global authenticate method', async function (assert) {
- invalidateSession();
+ await invalidateSession();
assert.expect(2);
this.stubCacheDaemonSearch();
@@ -363,7 +363,7 @@ module('Acceptance | scopes', function (hooks) {
});
test('pagination is not supported - navigate to cluster url page', async function (assert) {
- invalidateSession();
+ await invalidateSession();
this.stubCacheDaemonSearch();
this.ipcStub.withArgs('checkOS').returns({
isWindows: true,
diff --git a/ui/desktop/tests/integration/components/credentials-panel-test.js b/ui/desktop/tests/integration/components/credentials-panel-test.js
index e27a365e04..d37fc4d5e2 100644
--- a/ui/desktop/tests/integration/components/credentials-panel-test.js
+++ b/ui/desktop/tests/integration/components/credentials-panel-test.js
@@ -40,6 +40,21 @@ module('Integration | Component | credentials-panel', function (hooks) {
],
};
+ const vaultCredentials = {
+ source: {
+ id: 'clvlt_4cvscMTl0N',
+ name: 'Credential Library 2',
+ description: 'Source Description',
+ type: 'vault',
+ },
+ secrets: [
+ {
+ key: 'username',
+ value: 'password',
+ },
+ ],
+ };
+
test('it renders', async function (assert) {
assert.expect(1);
this.set('credentials', [credential]);
@@ -51,6 +66,17 @@ module('Integration | Component | credentials-panel', function (hooks) {
assert.dom('.credential-name').hasText('Credential Library 1');
});
+ test('it correctly shows parsed secret from vault', async function (assert) {
+ this.set('credentials', [vaultCredentials]);
+
+ await render(hbs`
+
+ `);
+ assert.dom('.credential-name').hasText('Credential Library 2');
+ assert.dom('.secret-container').isVisible();
+ assert.dom('.secret-key').hasText('username');
+ });
+
test('it shows code editor when toggle clicked', async function (assert) {
assert.expect(1);
this.set('credentials', [credential]);
diff --git a/ui/desktop/tests/integration/helpers/group-by-test.js b/ui/desktop/tests/integration/helpers/group-by-test.js
index 8f7dde473e..bfa6d5a045 100644
--- a/ui/desktop/tests/integration/helpers/group-by-test.js
+++ b/ui/desktop/tests/integration/helpers/group-by-test.js
@@ -11,7 +11,6 @@ import { hbs } from 'ember-cli-htmlbars';
module('Integration | Helper | group-by', function (hooks) {
setupRenderingTest(hooks);
- // TODO: Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', [
{ group: 'a', id: '1' },
diff --git a/ui/desktop/tests/unit/controllers/application-test.js b/ui/desktop/tests/unit/controllers/application-test.js
index 651ba7f346..7f4b663607 100644
--- a/ui/desktop/tests/unit/controllers/application-test.js
+++ b/ui/desktop/tests/unit/controllers/application-test.js
@@ -22,7 +22,7 @@ module('Unit | Controller | application', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup('controller:application');
session = this.owner.lookup('service:session');
clusterUrl = this.owner.lookup('service:cluster-url');
diff --git a/ui/desktop/tests/unit/controllers/cluster-url-test.js b/ui/desktop/tests/unit/controllers/cluster-url-test.js
index 7b889735c6..5d4547c5fe 100644
--- a/ui/desktop/tests/unit/controllers/cluster-url-test.js
+++ b/ui/desktop/tests/unit/controllers/cluster-url-test.js
@@ -23,7 +23,7 @@ module('Unit | Controller | cluster-url', function (hooks) {
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup('controller:cluster-url');
clusterUrl = this.owner.lookup('service:cluster-url');
setupMockIpc(this);
diff --git a/ui/desktop/tests/unit/controllers/scopes/scope/authenticate-test.js b/ui/desktop/tests/unit/controllers/scopes/scope/authenticate-test.js
index 97c3893abd..2a653225be 100644
--- a/ui/desktop/tests/unit/controllers/scopes/scope/authenticate-test.js
+++ b/ui/desktop/tests/unit/controllers/scopes/scope/authenticate-test.js
@@ -9,7 +9,6 @@ import { setupTest } from 'ember-qunit';
module('Unit | Controller | scopes/scope/authenticate', function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:scopes/scope/authenticate');
assert.ok(controller);
diff --git a/ui/desktop/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js b/ui/desktop/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js
index 1303957be6..e3722ab153 100644
--- a/ui/desktop/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js
+++ b/ui/desktop/tests/unit/controllers/scopes/scope/authenticate/method/index-test.js
@@ -29,7 +29,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/authenticate/method/index',
);
diff --git a/ui/desktop/tests/unit/controllers/scopes/scope/projects/sessions/index-test.js b/ui/desktop/tests/unit/controllers/scopes/scope/projects/sessions/index-test.js
index 8b6ebd430b..5650f86c95 100644
--- a/ui/desktop/tests/unit/controllers/scopes/scope/projects/sessions/index-test.js
+++ b/ui/desktop/tests/unit/controllers/scopes/scope/projects/sessions/index-test.js
@@ -44,7 +44,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/projects/sessions/index',
diff --git a/ui/desktop/tests/unit/controllers/scopes/scope/projects/settings/index-test.js b/ui/desktop/tests/unit/controllers/scopes/scope/projects/settings/index-test.js
index c642cd49f0..91081e3753 100644
--- a/ui/desktop/tests/unit/controllers/scopes/scope/projects/settings/index-test.js
+++ b/ui/desktop/tests/unit/controllers/scopes/scope/projects/settings/index-test.js
@@ -11,7 +11,6 @@ module(
function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/projects/settings/index',
diff --git a/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js b/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js
index 6bd50c6e21..b7f0ee229d 100644
--- a/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js
+++ b/ui/desktop/tests/unit/controllers/scopes/scope/projects/targets/index-test.js
@@ -44,7 +44,7 @@ module(
};
hooks.beforeEach(async function () {
- authenticateSession({});
+ await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/projects/targets/index',
diff --git a/ui/desktop/tests/unit/services/client-agent-sessions-test.js b/ui/desktop/tests/unit/services/client-agent-sessions-test.js
index 18771d60b3..864a93c22a 100644
--- a/ui/desktop/tests/unit/services/client-agent-sessions-test.js
+++ b/ui/desktop/tests/unit/services/client-agent-sessions-test.js
@@ -9,7 +9,6 @@ import { setupTest } from 'desktop/tests/helpers';
module('Unit | Service | client-agent-sessions', function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:client-agent-sessions');
assert.ok(service);
diff --git a/ui/desktop/tests/unit/services/session-test.js b/ui/desktop/tests/unit/services/session-test.js
index 9f7b49d1b7..84dfbdfc70 100644
--- a/ui/desktop/tests/unit/services/session-test.js
+++ b/ui/desktop/tests/unit/services/session-test.js
@@ -9,7 +9,6 @@ import { setupTest } from 'desktop/tests/helpers';
module('Unit | Service | session', function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:session');
assert.ok(service);
diff --git a/ui/desktop/tests/unit/services/store-test.js b/ui/desktop/tests/unit/services/store-test.js
index 680c942f55..3e6e8e8141 100644
--- a/ui/desktop/tests/unit/services/store-test.js
+++ b/ui/desktop/tests/unit/services/store-test.js
@@ -9,7 +9,6 @@ import { setupTest } from 'desktop/tests/helpers';
module('Unit | Service | store', function (hooks) {
setupTest(hooks);
- // TODO: Replace this with your real tests.
test('it exists', function (assert) {
let service = this.owner.lookup('service:store');
assert.ok(service);
diff --git a/yarn.lock b/yarn.lock
index c73d3afd70..4e1076a9f5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4735,12 +4735,12 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"
-"@playwright/test@^1.43.0":
- version "1.43.1"
- resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.1.tgz#16728a59eb8ce0f60472f98d8886d6cab0fa3e42"
- integrity sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA==
+"@playwright/test@^1.49.0":
+ version "1.49.0"
+ resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.0.tgz#74227385b58317ee076b86b56d0e1e1b25cff01e"
+ integrity sha512-DMulbwQURa8rNIQrf94+jPJQ4FmOVdpE5ZppRNvWVjvhC+6sOeo28r8MgIpQRYouXRtt/FCCXU7zn20jnHR4Qw==
dependencies:
- playwright "1.43.1"
+ playwright "1.49.0"
"@pnpm/constants@7.1.1":
version "7.1.1"
@@ -4797,13 +4797,6 @@
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.0.1.tgz#d26729db850fa327b7cacc5522252194404226f5"
integrity sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==
-"@sinonjs/commons@^2.0.0":
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3"
- integrity sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==
- dependencies:
- type-detect "4.0.8"
-
"@sinonjs/commons@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72"
@@ -4825,23 +4818,23 @@
dependencies:
"@sinonjs/commons" "^3.0.0"
-"@sinonjs/fake-timers@^11.2.2":
- version "11.2.2"
- resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz#50063cc3574f4a27bd8453180a04171c85cc9699"
- integrity sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==
+"@sinonjs/fake-timers@^13.0.1", "@sinonjs/fake-timers@^13.0.2":
+ version "13.0.5"
+ resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz#36b9dbc21ad5546486ea9173d6bea063eb1717d5"
+ integrity sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==
dependencies:
- "@sinonjs/commons" "^3.0.0"
+ "@sinonjs/commons" "^3.0.1"
-"@sinonjs/samsam@^8.0.0":
- version "8.0.0"
- resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-8.0.0.tgz#0d488c91efb3fa1442e26abea81759dfc8b5ac60"
- integrity sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==
+"@sinonjs/samsam@^8.0.1":
+ version "8.0.2"
+ resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-8.0.2.tgz#e4386bf668ff36c95949e55a38dc5f5892fc2689"
+ integrity sha512-v46t/fwnhejRSFTGqbpn9u+LQ9xJDse10gNnPgAcxgdoCDMXj/G2asWAC/8Qs+BAZDicX+MNZouXT1A7c83kVw==
dependencies:
- "@sinonjs/commons" "^2.0.0"
+ "@sinonjs/commons" "^3.0.1"
lodash.get "^4.4.2"
- type-detect "^4.0.8"
+ type-detect "^4.1.0"
-"@sinonjs/text-encoding@^0.7.2":
+"@sinonjs/text-encoding@^0.7.3":
version "0.7.3"
resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz#282046f03e886e352b2d5f5da5eb755e01457f3f"
integrity sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==
@@ -5524,6 +5517,13 @@ ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.2:
dependencies:
type-fest "^0.21.3"
+ansi-escapes@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-7.0.0.tgz#00fc19f491bbb18e1d481b97868204f92109bfe7"
+ integrity sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw==
+ dependencies:
+ environment "^1.0.0"
+
ansi-html@^0.0.7, ansi-html@^0.0.9:
version "0.0.9"
resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.9.tgz#6512d02342ae2cc68131952644a129cb734cd3f0"
@@ -5578,6 +5578,11 @@ ansi-styles@^6.0.0:
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.1.0.tgz#87313c102b8118abd57371afab34618bf7350ed3"
integrity sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==
+ansi-styles@^6.2.1:
+ version "6.2.1"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5"
+ integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==
+
ansi-styles@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178"
@@ -7020,7 +7025,7 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
-chalk@^5.3.0:
+chalk@^5.3.0, chalk@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385"
integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==
@@ -7169,6 +7174,13 @@ cli-cursor@^3.1.0:
dependencies:
restore-cursor "^3.1.0"
+cli-cursor@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-5.0.0.tgz#24a4831ecf5a6b01ddeb32fb71a4b2088b0dce38"
+ integrity sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==
+ dependencies:
+ restore-cursor "^5.0.0"
+
cli-progress@^3.9.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/cli-progress/-/cli-progress-3.9.0.tgz#25db83447deb812e62d05bac1af9aec5387ef3d4"
@@ -7207,13 +7219,13 @@ cli-truncate@^2.1.0:
slice-ansi "^3.0.0"
string-width "^4.2.0"
-cli-truncate@^3.1.0:
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-3.1.0.tgz#3f23ab12535e3d73e839bb43e73c9de487db1389"
- integrity sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==
+cli-truncate@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-4.0.0.tgz#6cc28a2924fee9e25ce91e973db56c7066e6172a"
+ integrity sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==
dependencies:
slice-ansi "^5.0.0"
- string-width "^5.0.0"
+ string-width "^7.0.0"
cli-width@^2.0.0:
version "2.2.1"
@@ -7337,12 +7349,7 @@ colord@^2.9.3:
resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43"
integrity sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==
-colorette@^2.0.16, colorette@^2.0.17:
- version "2.0.19"
- resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798"
- integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==
-
-colorette@^2.0.19:
+colorette@^2.0.19, colorette@^2.0.20:
version "2.0.20"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a"
integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==
@@ -7387,10 +7394,10 @@ commander@^8.3.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
-commander@^9.3.0:
- version "9.3.0"
- resolved "https://registry.yarnpkg.com/commander/-/commander-9.3.0.tgz#f619114a5a2d2054e0d9ff1b31d5ccf89255e26b"
- integrity sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==
+commander@~12.1.0:
+ version "12.1.0"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3"
+ integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==
commitizen@^4.0.3:
version "4.3.1"
@@ -7867,6 +7874,13 @@ debug@~4.3.4:
dependencies:
ms "2.1.2"
+debug@~4.3.6:
+ version "4.3.7"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
+ integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
+ dependencies:
+ ms "^2.1.3"
+
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
@@ -8044,10 +8058,10 @@ diff@^5.1.0:
resolved "https://registry.yarnpkg.com/diff/-/diff-5.1.0.tgz#bc52d298c5ea8df9194800224445ed43ffc87e40"
integrity sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==
-diff@^5.2.0:
- version "5.2.0"
- resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531"
- integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==
+diff@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/diff/-/diff-7.0.0.tgz#3fb34d387cd76d803f6eebea67b921dab0182a9a"
+ integrity sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==
dir-compare@^3.0.0:
version "3.3.0"
@@ -8175,11 +8189,6 @@ dotenv@^16.4.5:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f"
integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==
-eastasianwidth@^0.2.0:
- version "0.2.0"
- resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"
- integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
-
editions@^1.1.1:
version "1.3.4"
resolved "https://registry.yarnpkg.com/editions/-/editions-1.3.4.tgz#3662cb592347c3168eb8e498a0ff73271d67f50b"
@@ -8315,14 +8324,6 @@ ember-auto-import@2.8.1, ember-auto-import@^2.2.3, ember-auto-import@^2.2.4, emb
typescript-memoize "^1.0.0-alpha.3"
walk-sync "^3.0.0"
-ember-autofocus-modifier@^4.0.1:
- version "4.0.1"
- resolved "https://registry.yarnpkg.com/ember-autofocus-modifier/-/ember-autofocus-modifier-4.0.1.tgz#3ebfed826b2544831fd1e4b77540142cd4d3ac2b"
- integrity sha512-WhRXG3JvrwNW7O/CFgduJ9V7zqD2QI2K89BYLD8Ai18D3nLJfKDdAkizYb+noIfHone6ttZ/PxNmW8+KdfapNg==
- dependencies:
- ember-cli-babel "^7.26.6"
- ember-modifier "^3.2.7"
-
ember-browser-services@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/ember-browser-services/-/ember-browser-services-4.0.3.tgz#c32b4127c2868a5668c4bfe8d8413885a613ec8c"
@@ -8362,14 +8363,6 @@ ember-can@^4.2.0:
ember-cli-htmlbars "^6.0.0"
ember-inflector "^4.0.2"
-ember-cli-app-version@^6.0.0:
- version "6.0.1"
- resolved "https://registry.yarnpkg.com/ember-cli-app-version/-/ember-cli-app-version-6.0.1.tgz#401cdd440c7fef2059aa54bbadae9ca581d4faa0"
- integrity sha512-XA1FwkWA5QytmWF0jcJqEr3jcZoiCl9Fb33TZgOVfClL7Voxe+/RwzISEprBRQgbf7j8z1xf8/RJCKfclUy3rQ==
- dependencies:
- ember-cli-babel "^7.26.11"
- git-repo-info "^2.1.1"
-
ember-cli-babel-plugin-helpers@^1.0.0, ember-cli-babel-plugin-helpers@^1.1.0, ember-cli-babel-plugin-helpers@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.1.1.tgz#5016b80cdef37036c4282eef2d863e1d73576879"
@@ -9516,14 +9509,6 @@ ember-truth-helpers@^4.0.3:
"@embroider/addon-shim" "^1.8.6"
ember-functions-as-helper-polyfill "^2.1.2"
-ember-uuid@^2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/ember-uuid/-/ember-uuid-2.1.0.tgz#a65d030534d47ced1ea22be9b7d3821eff71f99c"
- integrity sha512-oiUNIBPCyJtzkcRUAi3qCRwU+yq5r9gzlPLKRG1pQ2WA209lphmZQRR+TyaeNwOijs9bjttzFV6YOyaTO40B/A==
- dependencies:
- ember-cli-babel "^7.11.1"
- ember-cli-htmlbars "^4.0.0"
-
ember-window-mock@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/ember-window-mock/-/ember-window-mock-0.8.1.tgz#1fc5db20b3d9fc3592d4ef6f83d6b5a629c79174"
@@ -9545,16 +9530,16 @@ emittery@^0.13.1:
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad"
integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==
+emoji-regex@^10.3.0:
+ version "10.4.0"
+ resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.4.0.tgz#03553afea80b3975749cfcb36f776ca268e413d4"
+ integrity sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==
+
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
-emoji-regex@^9.2.2:
- version "9.2.2"
- resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"
- integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
-
emoji-regex@~6.1.0:
version "6.1.3"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.3.tgz#ec79a3969b02d2ecf2b72254279bf99bc7a83932"
@@ -9645,6 +9630,11 @@ env-paths@^2.2.0:
resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
+environment@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/environment/-/environment-1.1.0.tgz#8e86c66b180f363c7ab311787e0259665f45a9f1"
+ integrity sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==
+
err-code@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9"
@@ -10262,19 +10252,19 @@ execa@^5.0.0, execa@^5.1.1:
signal-exit "^3.0.3"
strip-final-newline "^2.0.0"
-execa@^6.1.0:
- version "6.1.0"
- resolved "https://registry.yarnpkg.com/execa/-/execa-6.1.0.tgz#cea16dee211ff011246556388effa0818394fb20"
- integrity sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==
+execa@~8.0.1:
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c"
+ integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==
dependencies:
cross-spawn "^7.0.3"
- get-stream "^6.0.1"
- human-signals "^3.0.1"
+ get-stream "^8.0.1"
+ human-signals "^5.0.0"
is-stream "^3.0.0"
merge-stream "^2.0.0"
npm-run-path "^5.1.0"
onetime "^6.0.0"
- signal-exit "^3.0.7"
+ signal-exit "^4.1.0"
strip-final-newline "^3.0.0"
exit@^0.1.2:
@@ -11040,6 +11030,11 @@ get-caller-file@^2.0.5:
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
+get-east-asian-width@^1.0.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz#21b4071ee58ed04ee0db653371b55b4299875389"
+ integrity sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==
+
get-installed-path@^2.0.3:
version "2.1.1"
resolved "https://registry.yarnpkg.com/get-installed-path/-/get-installed-path-2.1.1.tgz#a1f33dc6b8af542c9331084e8edbe37fe2634152"
@@ -11110,11 +11105,16 @@ get-stream@^5.0.0, get-stream@^5.1.0:
dependencies:
pump "^3.0.0"
-get-stream@^6.0.0, get-stream@^6.0.1:
+get-stream@^6.0.0:
version "6.0.1"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
+get-stream@^8.0.1:
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2"
+ integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==
+
get-symbol-description@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6"
@@ -11708,10 +11708,10 @@ human-signals@^2.1.0:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0"
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==
-human-signals@^3.0.1:
- version "3.0.1"
- resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-3.0.1.tgz#c740920859dafa50e5a3222da9d3bf4bb0e5eef5"
- integrity sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==
+human-signals@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28"
+ integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==
humanize-ms@^1.2.1:
version "1.2.1"
@@ -12121,6 +12121,13 @@ is-fullwidth-code-point@^4.0.0:
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88"
integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==
+is-fullwidth-code-point@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz#9609efced7c2f97da7b60145ef481c787c7ba704"
+ integrity sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==
+ dependencies:
+ get-east-asian-width "^1.0.0"
+
is-generator-fn@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118"
@@ -13045,10 +13052,10 @@ license-checker@^25.0.1:
spdx-satisfies "^4.0.0"
treeify "^1.1.0"
-lilconfig@2.0.5:
- version "2.0.5"
- resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.5.tgz#19e57fd06ccc3848fd1891655b5a447092225b25"
- integrity sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==
+lilconfig@~3.1.2:
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.2.tgz#e4a7c3cb549e3a606c8dcc32e5ae1005e62c05cb"
+ integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==
line-column@^1.0.2:
version "1.0.2"
@@ -13075,38 +13082,21 @@ linkify-it@^4.0.1:
dependencies:
uc.micro "^1.0.1"
-lint-staged@^13.0.2:
- version "13.0.2"
- resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.0.2.tgz#35a1c57130e9ad5b1dea784972a40777ba433dd5"
- integrity sha512-qQLfLTh9z34eMzfEHENC+QBskZfxjomrf+snF3xJ4BzilORbD989NLqQ00ughsF/A+PT41e87+WsMFabf9++pQ==
- dependencies:
- cli-truncate "^3.1.0"
- colorette "^2.0.17"
- commander "^9.3.0"
- debug "^4.3.4"
- execa "^6.1.0"
- lilconfig "2.0.5"
- listr2 "^4.0.5"
- micromatch "^4.0.5"
- normalize-path "^3.0.0"
- object-inspect "^1.12.2"
- pidtree "^0.6.0"
- string-argv "^0.3.1"
- yaml "^2.1.1"
-
-listr2@^4.0.5:
- version "4.0.5"
- resolved "https://registry.yarnpkg.com/listr2/-/listr2-4.0.5.tgz#9dcc50221583e8b4c71c43f9c7dfd0ef546b75d5"
- integrity sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==
- dependencies:
- cli-truncate "^2.1.0"
- colorette "^2.0.16"
- log-update "^4.0.0"
- p-map "^4.0.0"
- rfdc "^1.3.0"
- rxjs "^7.5.5"
- through "^2.3.8"
- wrap-ansi "^7.0.0"
+lint-staged@^15.2.10:
+ version "15.2.10"
+ resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.10.tgz#92ac222f802ba911897dcf23671da5bb80643cd2"
+ integrity sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==
+ dependencies:
+ chalk "~5.3.0"
+ commander "~12.1.0"
+ debug "~4.3.6"
+ execa "~8.0.1"
+ lilconfig "~3.1.2"
+ listr2 "~8.2.4"
+ micromatch "~4.0.8"
+ pidtree "~0.6.0"
+ string-argv "~0.3.2"
+ yaml "~2.5.0"
listr2@^5.0.3:
version "5.0.8"
@@ -13122,6 +13112,18 @@ listr2@^5.0.3:
through "^2.3.8"
wrap-ansi "^7.0.0"
+listr2@~8.2.4:
+ version "8.2.5"
+ resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.2.5.tgz#5c9db996e1afeb05db0448196d3d5f64fec2593d"
+ integrity sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==
+ dependencies:
+ cli-truncate "^4.0.0"
+ colorette "^2.0.20"
+ eventemitter3 "^5.0.1"
+ log-update "^6.1.0"
+ rfdc "^1.4.1"
+ wrap-ansi "^9.0.0"
+
livereload-js@^3.3.1:
version "3.3.2"
resolved "https://registry.yarnpkg.com/livereload-js/-/livereload-js-3.3.2.tgz#c88b009c6e466b15b91faa26fd7c99d620e12651"
@@ -13321,6 +13323,17 @@ log-update@^4.0.0:
slice-ansi "^4.0.0"
wrap-ansi "^6.2.0"
+log-update@^6.1.0:
+ version "6.1.0"
+ resolved "https://registry.yarnpkg.com/log-update/-/log-update-6.1.0.tgz#1a04ff38166f94647ae1af562f4bd6a15b1b7cd4"
+ integrity sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==
+ dependencies:
+ ansi-escapes "^7.0.0"
+ cli-cursor "^5.0.0"
+ slice-ansi "^7.1.0"
+ strip-ansi "^7.1.0"
+ wrap-ansi "^9.0.0"
+
longest-streak@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4"
@@ -13783,7 +13796,7 @@ micromark@^2.11.3, micromark@~2.11.0, micromark@~2.11.3:
debug "^4.0.0"
parse-entities "^2.0.0"
-micromatch@^3.1.4, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5, micromatch@^4.0.8:
+micromatch@^3.1.4, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5, micromatch@^4.0.8, micromatch@~4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
@@ -13828,6 +13841,11 @@ mimic-fn@^4.0.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc"
integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==
+mimic-function@^5.0.0:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/mimic-function/-/mimic-function-5.0.1.tgz#acbe2b3349f99b9deaca7fb70e48b83e94e67076"
+ integrity sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==
+
mimic-response@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
@@ -14044,7 +14062,7 @@ ms@2.1.2:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
-ms@2.1.3, ms@^2.0.0, ms@^2.1.1:
+ms@2.1.3, ms@^2.0.0, ms@^2.1.1, ms@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
@@ -14074,6 +14092,11 @@ nanoid@^3.3.6:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
+nanoid@^5.0.9:
+ version "5.0.9"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-5.0.9.tgz#977dcbaac055430ce7b1e19cf0130cea91a20e50"
+ integrity sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==
+
natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
@@ -14104,14 +14127,14 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
-nise@^6.0.0:
- version "6.0.1"
- resolved "https://registry.yarnpkg.com/nise/-/nise-6.0.1.tgz#582a347929828924d9e4e9c93f7549800cd0912c"
- integrity sha512-DAyWGPQEuJVlL2eqKw6gdZKT+E/jo/ZrjEUDAslJLluCz81nWy+KSYybNp3KFm887Yvp7hv12jSM82ld8BmLxg==
+nise@^6.1.1:
+ version "6.1.1"
+ resolved "https://registry.yarnpkg.com/nise/-/nise-6.1.1.tgz#78ea93cc49be122e44cb7c8fdf597b0e8778b64a"
+ integrity sha512-aMSAzLVY7LyeM60gvBS423nBmIPP+Wy7St7hsb+8/fc1HmeoHJfLO8CKse4u3BtOZvQLJghYPI2i/1WZrEj5/g==
dependencies:
- "@sinonjs/commons" "^3.0.0"
- "@sinonjs/fake-timers" "^11.2.2"
- "@sinonjs/text-encoding" "^0.7.2"
+ "@sinonjs/commons" "^3.0.1"
+ "@sinonjs/fake-timers" "^13.0.1"
+ "@sinonjs/text-encoding" "^0.7.3"
just-extend "^6.2.0"
path-to-regexp "^8.1.0"
@@ -14381,16 +14404,16 @@ object-inspect@^1.11.0:
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1"
integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==
-object-inspect@^1.12.2, object-inspect@^1.9.0:
- version "1.12.2"
- resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea"
- integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==
-
object-inspect@^1.13.1:
version "1.13.2"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff"
integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==
+object-inspect@^1.9.0:
+ version "1.12.2"
+ resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea"
+ integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==
+
object-keys@^1.0.12, object-keys@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e"
@@ -14471,6 +14494,13 @@ onetime@^6.0.0:
dependencies:
mimic-fn "^4.0.0"
+onetime@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/onetime/-/onetime-7.0.0.tgz#9f16c92d8c9ef5120e3acd9dd9957cceecc1ab60"
+ integrity sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==
+ dependencies:
+ mimic-function "^5.0.0"
+
optionator@^0.9.1:
version "0.9.1"
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499"
@@ -14841,7 +14871,7 @@ picomatch@^2.3.1:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
-pidtree@^0.6.0:
+pidtree@~0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c"
integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==
@@ -14889,17 +14919,17 @@ pkg-up@^3.1.0:
dependencies:
find-up "^3.0.0"
-playwright-core@1.43.1:
- version "1.43.1"
- resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.43.1.tgz#0eafef9994c69c02a1a3825a4343e56c99c03b02"
- integrity sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg==
+playwright-core@1.49.0:
+ version "1.49.0"
+ resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.0.tgz#8e69ffed3f41855b854982f3632f2922c890afcb"
+ integrity sha512-R+3KKTQF3npy5GTiKH/T+kdhoJfJojjHESR1YEWhYuEKRVfVaxH3+4+GvXE5xyCngCxhxnykk0Vlah9v8fs3jA==
-playwright@1.43.1, playwright@^1.43.0:
- version "1.43.1"
- resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.43.1.tgz#8ad08984ac66c9ef3d0db035be54dd7ec9f1c7d9"
- integrity sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA==
+playwright@1.49.0:
+ version "1.49.0"
+ resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.0.tgz#df6b9e05423377a99658202844a294a8afb95d0a"
+ integrity sha512-eKpmys0UFDnfNb3vfsf8Vx2LEOtflgRebl0Im2eQQnYMA4Aqd+Zw8bEOB+7ZKvN76901mRnqdsiOGKxzVTbi7A==
dependencies:
- playwright-core "1.43.1"
+ playwright-core "1.49.0"
optionalDependencies:
fsevents "2.3.2"
@@ -15872,6 +15902,14 @@ restore-cursor@^3.1.0:
onetime "^5.1.0"
signal-exit "^3.0.2"
+restore-cursor@^5.0.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-5.1.0.tgz#0766d95699efacb14150993f55baf0953ea1ebe7"
+ integrity sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==
+ dependencies:
+ onetime "^7.0.0"
+ signal-exit "^4.1.0"
+
retry@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b"
@@ -15887,6 +15925,11 @@ rfdc@^1.3.0:
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b"
integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==
+rfdc@^1.4.1:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.4.1.tgz#778f76c4fb731d93414e8f925fbecf64cce7f6ca"
+ integrity sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==
+
rimraf@^2.2.8, rimraf@^2.3.4, rimraf@^2.4.3, rimraf@^2.5.3, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3:
version "2.7.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"
@@ -16287,6 +16330,11 @@ signal-exit@^4.0.1:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.0.2.tgz#ff55bb1d9ff2114c13b400688fa544ac63c36967"
integrity sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==
+signal-exit@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
+ integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==
+
silent-error@^1.0.0, silent-error@^1.0.1, silent-error@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/silent-error/-/silent-error-1.1.1.tgz#f72af5b0d73682a2ba1778b7e32cd8aa7c2d8662"
@@ -16299,17 +16347,17 @@ simple-html-tokenizer@^0.5.11:
resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.5.11.tgz#4c5186083c164ba22a7b477b7687ac056ad6b1d9"
integrity sha512-C2WEK/Z3HoSFbYq8tI7ni3eOo/NneSPRoPpcM7WdLjFOArFuyXEjAoCdOC3DgMfRyziZQ1hCNR4mrNdWEvD0og==
-sinon@^18.0.0:
- version "18.0.0"
- resolved "https://registry.yarnpkg.com/sinon/-/sinon-18.0.0.tgz#69ca293dbc3e82590a8b0d46c97f63ebc1e5fc01"
- integrity sha512-+dXDXzD1sBO6HlmZDd7mXZCR/y5ECiEiGCBSGuFD/kZ0bDTofPYc6JaeGmPSF+1j1MejGUWkORbYOLDyvqCWpA==
+sinon@^19.0.2:
+ version "19.0.2"
+ resolved "https://registry.yarnpkg.com/sinon/-/sinon-19.0.2.tgz#944cf771d22236aa84fc1ab70ce5bffc3a215dad"
+ integrity sha512-euuToqM+PjO4UgXeLETsfQiuoyPXlqFezr6YZDFwHR3t4qaX0fZUe1MfPMznTL5f8BWrVS89KduLdMUsxFCO6g==
dependencies:
"@sinonjs/commons" "^3.0.1"
- "@sinonjs/fake-timers" "^11.2.2"
- "@sinonjs/samsam" "^8.0.0"
- diff "^5.2.0"
- nise "^6.0.0"
- supports-color "^7"
+ "@sinonjs/fake-timers" "^13.0.2"
+ "@sinonjs/samsam" "^8.0.1"
+ diff "^7.0.0"
+ nise "^6.1.1"
+ supports-color "^7.2.0"
sisteransi@^1.0.5:
version "1.0.5"
@@ -16352,6 +16400,14 @@ slice-ansi@^5.0.0:
ansi-styles "^6.0.0"
is-fullwidth-code-point "^4.0.0"
+slice-ansi@^7.1.0:
+ version "7.1.0"
+ resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-7.1.0.tgz#cd6b4655e298a8d1bdeb04250a433094b347b9a9"
+ integrity sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==
+ dependencies:
+ ansi-styles "^6.2.1"
+ is-fullwidth-code-point "^5.0.0"
+
slide@~1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707"
@@ -16622,10 +16678,10 @@ statuses@2.0.1:
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=
-string-argv@^0.3.1:
- version "0.3.1"
- resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
- integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==
+string-argv@~0.3.2:
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6"
+ integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==
string-length@^4.0.1:
version "4.0.2"
@@ -16675,14 +16731,14 @@ string-width@^4.1.0, string-width@^4.2.0:
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
-string-width@^5.0.0:
- version "5.1.2"
- resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
- integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
+string-width@^7.0.0:
+ version "7.2.0"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.2.0.tgz#b5bb8e2165ce275d4d43476dd2700ad9091db6dc"
+ integrity sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==
dependencies:
- eastasianwidth "^0.2.0"
- emoji-regex "^9.2.2"
- strip-ansi "^7.0.1"
+ emoji-regex "^10.3.0"
+ get-east-asian-width "^1.0.0"
+ strip-ansi "^7.1.0"
string.prototype.matchall@^4.0.4:
version "4.0.5"
@@ -16796,10 +16852,10 @@ strip-ansi@^6.0.1:
dependencies:
ansi-regex "^5.0.1"
-strip-ansi@^7.0.1:
- version "7.0.1"
- resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
- integrity sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==
+strip-ansi@^7.1.0:
+ version "7.1.0"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
+ integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==
dependencies:
ansi-regex "^6.0.1"
@@ -16999,7 +17055,7 @@ supports-color@^5.3.0:
dependencies:
has-flag "^3.0.0"
-supports-color@^7, supports-color@^7.0.0, supports-color@^7.1.0:
+supports-color@^7.0.0, supports-color@^7.1.0, supports-color@^7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
@@ -17437,11 +17493,16 @@ type-check@^0.4.0, type-check@~0.4.0:
dependencies:
prelude-ls "^1.2.1"
-type-detect@4.0.8, type-detect@^4.0.8:
+type-detect@4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
+type-detect@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.1.0.tgz#deb2453e8f08dcae7ae98c626b13dddb0155906c"
+ integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==
+
type-fest@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1"
@@ -17739,16 +17800,16 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==
+uuid@^11.0.3:
+ version "11.0.3"
+ resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.0.3.tgz#248451cac9d1a4a4128033e765d137e2b2c49a3d"
+ integrity sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==
+
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
-uuid@^9.0.0:
- version "9.0.0"
- resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
- integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
-
v8-compile-cache@^2.0.3, v8-compile-cache@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
@@ -18083,6 +18144,15 @@ wrap-ansi@^7.0.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"
+wrap-ansi@^9.0.0:
+ version "9.0.0"
+ resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-9.0.0.tgz#1a3dc8b70d85eeb8398ddfb1e4a02cd186e58b3e"
+ integrity sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==
+ dependencies:
+ ansi-styles "^6.2.1"
+ string-width "^7.0.0"
+ strip-ansi "^7.1.0"
+
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
@@ -18162,10 +18232,10 @@ yaml@^1.10.0:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
-yaml@^2.1.1:
- version "2.2.2"
- resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.2.tgz#ec551ef37326e6d42872dad1970300f8eb83a073"
- integrity sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==
+yaml@~2.5.0:
+ version "2.5.1"
+ resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130"
+ integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==
yargs-parser@^20.2.9:
version "20.2.9"