Files
threshold-ui/ui/admin/tests/acceptance/onboarding/choose-path-test.js
T
Randall Morey d32a854a94 chore: 🤖 improve scopes/new titling - icu-6714 (#1407)
* chore: 🤖 improve scopes/new titling - icu-6714

✅ Closes: icu-6714

* chore: 🤖 improve new scope link text
2022-11-03 18:37:42 -07:00

51 lines
1.8 KiB
JavaScript

import { module, test } from 'qunit';
import { visit, currentURL, find, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | onboarding | choose-path', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const urls = {
choosePath: '/onboarding/quick-setup/choose-path',
newOrg: '/scopes/global/scopes/new',
createResources: '/onboarding/quick-setup/create-resources',
};
hooks.beforeEach(function () {
authenticateSession({});
});
test('defaults to the guided path', async function (assert) {
assert.expect(2);
await visit(urls.choosePath);
assert.strictEqual(find('input[name=paths]:checked').value, 'guided');
assert.false(find('input[value=manual]').checked);
});
test('updates to the manual path when manual card clicked', async function (assert) {
assert.expect(2);
await visit(urls.choosePath);
await click('[name="paths"][value="manual"]');
assert.strictEqual(find('input[name=paths]:checked').value, 'manual');
assert.false(find('input[value=guided]').checked);
});
test('guided path directs user to /create-resources route', async function (assert) {
assert.expect(1);
await visit(urls.choosePath);
await click('[type="submit"]');
assert.strictEqual(currentURL(), urls.createResources);
});
test('guided path directs user to /global/new route', async function (assert) {
assert.expect(1);
await visit(urls.choosePath);
await click('[name="paths"][value="manual"]');
await click('[type="submit"]');
assert.strictEqual(currentURL(), urls.newOrg);
});
});