Files
threshold-ui/ui/admin/tests/acceptance/onboarding/success-test.js
T
hashicc dc9376a460 (HACK WEEK 2025) a11y-audit-ignore codemod (#2946)
* chore: 🤖 add ember-a11y-ignore tool

* chore: 🤖 fix handling existing setRunOptions imports

* chore: 🤖 move codemod to support folder

* chore: 🤖 fix edge case for handling property key names

* chore: 🤖 handle case where multiple of same violation in test

This fixes a bug where multiple cases of the same violation would end up
with multiple entries

* chore: 🤖 ignore axe rules that are currently failing in admin

* chore: 🤖 ignore axe rules that are currently failing in desktop

* docs: ✏️ add a comment explaining the codemod

* chore: 🤖 include test.each cases for a11y ignores

* fix: 🐛 handle test.each test cases for a11y ignore codemod
2025-08-19 10:51:44 -05:00

90 lines
2.6 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 setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
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);
setupMirage(hooks);
hooks.beforeEach(async function () {
await authenticateSession({});
});
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);
});
});