Files
threshold-ui/ui/admin/tests/acceptance/onboarding/create-resource-test.js
T
Randall MoreyandCameron Perera 15dc735322 chore: move onboarding to top level (#1131)
* chore: move onboarding to top level

* chore: add types

* Update ui/admin/app/routes/onboarding.js

Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>

* fix: broken paths

* chore: fix broken success route and simplify error handling

* fix: tests

Co-authored-by: Cameron Perera <cameron.perera@hashicorp.com>
2022-06-13 16:38:18 -04:00

35 lines
1.2 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 | create-resources', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const urls = {
createResources: '/onboarding/quick-setup/create-resources',
successPath: '/onboarding/quick-setup/create-resources/success',
};
hooks.beforeEach(function () {
authenticateSession({});
});
test('show hostAddress and targetPort fields when the checkbox is checked', async function (assert) {
assert.expect(2);
await visit(urls.createResources);
await click('[type="checkbox"]');
assert.ok(find('[name="hostAddress"]'));
assert.ok(find('[name="targetPort"]'));
});
test('redirects user to success screen when next is clicked', async function (assert) {
assert.expect(1);
await visit(urls.createResources);
await click('[type="submit"]');
assert.equal(currentURL(), urls.successPath);
});
});