Files
threshold-ui/ui/admin/tests/acceptance/onboarding/success-test.js
T
Lisbet Alvarez 72f7c8a92d fix: 🐛 OIDC authentications not properly showing username (#2930)
* fix: 🐛 properly show username for oidc auth method in user menu

* test: 💍 fix admin ui tests

* test: 💍 fix desktop ui tests

* refactor: 💡 admin to not store username in authenticated object

* refactor: 💡 use getter in app controller

* test: 💍 POC for how we could update our tests to use auth account

* refactor: 💡 remove unused service

* test: 💍 fix all tests in ui/admin

* test: 💍 revert one change

* refactor: 💡 update ui/desktop w/ feedback + fix tests

* refactor: 💡 add in error handling

* refactor: 💡 cleanup unused service

* test: 💍 fix e2e test selector

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17231
2025-10-30 12:49:30 -07:00

85 lines
2.4 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | onboarding | success', function (hooks) {
setupApplicationTest(hooks);
setupSqlite(hooks);
const urls = {
onboarding: '/onboarding',
success: '/onboarding/success',
target: null,
};
test('check if the done button is present', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.success);
assert.dom(selectors.DONE_BTN).isVisible();
});
test('check the controller url is copyable', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const origin = window.location.origin;
await visit(urls.success);
assert.dom(selectors.COPY_TEXT_BTN).isVisible().hasText(origin);
});
test('fill the onboarding form and redirect user to target detail when done is clicked', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.onboarding);
await fillIn(
selectors.FIELD_TARGET_ADDRESS,
selectors.FIELD_TARGET_ADDRESS_VALUE,
);
await fillIn(
selectors.FIELD_TARGET_PORT,
selectors.FIELD_TARGET_PORT_VALUE,
);
await click(commonSelectors.SAVE_BTN);
await click(selectors.DONE_BTN);
const projectId = this.server.schema.scopes.where({ type: 'project' })
.models[0].id;
const targetId = this.server.schema.targets.all().models[0].id;
urls.target = `/scopes/${projectId}/targets/${targetId}`;
assert.strictEqual(currentURL(), urls.target);
});
});