5c2a08de6d
* Update browserslist * Add browserslistrc * ember-cli-update --to 3.26, fix conflicts * Run codemodes that start with ember-* * More codemods - before cp* * More codemods (curly data-test-*) * WIP ember-basic-dropdown template errors * updates ember-basic-dropdown and related deps to fix build issues * updates basic dropdown instances to new version API * updates more deps -- ember-template-lint is working again * runs no-implicit-this codemod * creates and runs no-quoteless-attributes codemod * runs angle brackets codemod * updates lint:hbs globs to only touch hbs files * removes yield only templates * creates and runs deprecated args transform * supresses lint error for invokeAction on LinkTo component * resolves remaining ambiguous path lint errors * resolves simple-unless lint errors * adds warnings for deprecated tagName arg on LinkTo components * adds warnings for remaining curly component invocation * updates global template lint rules * resolves remaining template lint errors * disables some ember specfic lint rules that target pre octane patterns * js lint fix run * resolves remaining js lint errors * fixes test run * adds npm-run-all dep * fixes test attribute issues * fixes console acceptance tests * fixes tests * adds yield only wizard/tutorial-active template * fixes more tests * attempts to fix more flaky tests * removes commented out settled in transit test * updates deprecations workflow and adds initializer to filter by version * updates flaky policies acl old test * updates to flaky transit test * bumps ember deps down to LTS version * runs linters after main merge * fixes client count tests after bad merge conflict fixes * fixes client count history test * more updates to lint config * another round of hbs lint fixes after extending stylistic rule * updates lint-staged commands * removes indent eslint rule since it seems to break things * fixes bad attribute in transform-edit-form template * test fixes * fixes enterprise tests * adds changelog * removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters * flaky test fix Co-authored-by: hashishaw <cshaw@hashicorp.com>
112 lines
4 KiB
JavaScript
112 lines
4 KiB
JavaScript
import { click, findAll, fillIn, settled, visit, triggerKeyEvent } from '@ember/test-helpers';
|
|
import { module, test } from 'qunit';
|
|
import { setupApplicationTest } from 'ember-qunit';
|
|
import authPage from 'vault/tests/pages/auth';
|
|
import logout from 'vault/tests/pages/logout';
|
|
import enablePage from 'vault/tests/pages/settings/auth/enable';
|
|
import { supportedAuthBackends } from 'vault/helpers/supported-auth-backends';
|
|
import { supportedManagedAuthBackends } from 'vault/helpers/supported-managed-auth-backends';
|
|
|
|
module('Acceptance | auth backend list', function (hooks) {
|
|
setupApplicationTest(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
return authPage.login();
|
|
});
|
|
|
|
hooks.afterEach(function () {
|
|
return logout.visit();
|
|
});
|
|
|
|
test('userpass secret backend', async function (assert) {
|
|
let n = Math.random();
|
|
const path1 = `userpass-${++n}`;
|
|
const path2 = `userpass-${++n}`;
|
|
const user1 = 'user1';
|
|
const user2 = 'user2';
|
|
|
|
// enable the first userpass method with one username
|
|
await enablePage.enable('userpass', path1);
|
|
await settled();
|
|
await click('[data-test-save-config="true"]');
|
|
|
|
await visit(`/vault/access/${path1}/item/user/create`);
|
|
|
|
await fillIn('[data-test-input="username"]', user1);
|
|
await triggerKeyEvent('[data-test-input="username"]', 'keyup', 65);
|
|
await fillIn('[data-test-textarea]', user1);
|
|
await triggerKeyEvent('[data-test-textarea]', 'keyup', 65);
|
|
await click('[data-test-save-config="true"]');
|
|
|
|
// enable the first userpass method with one username
|
|
await visit(`/vault/settings/auth/enable`);
|
|
|
|
await click('[data-test-mount-type="userpass"]');
|
|
|
|
await click('[data-test-mount-next]');
|
|
|
|
await fillIn('[data-test-input="path"]', path2);
|
|
|
|
await click('[data-test-mount-submit="true"]');
|
|
|
|
await click('[data-test-save-config="true"]');
|
|
|
|
await click(`[data-test-auth-backend-link="${path2}"]`);
|
|
|
|
await click('[data-test-entity-create-link="user"]');
|
|
|
|
await fillIn('[data-test-input="username"]', user2);
|
|
await triggerKeyEvent('[data-test-input="username"]', 'keyup', 65);
|
|
await fillIn('[data-test-textarea]', user2);
|
|
await triggerKeyEvent('[data-test-textarea]', 'keyup', 65);
|
|
await click('[data-test-save-config="true"]');
|
|
|
|
//confirming that the user was created. There was a bug where the apiPath was not being updated when toggling between auth routes
|
|
assert
|
|
.dom('[data-test-list-item-content]')
|
|
.hasText(user2, 'user just created shows in current auth list');
|
|
|
|
//confirm that the auth method 1 shows the user1. There was a bug where it was not updated the list when toggling between auth routes
|
|
await visit(`/vault/access/${path1}/item/user`);
|
|
|
|
assert
|
|
.dom('[data-test-list-item-content]')
|
|
.hasText(user1, 'first user created shows in current auth list');
|
|
});
|
|
|
|
test('auth methods are linkable and link to correct view', async function (assert) {
|
|
await visit('/vault/access');
|
|
|
|
let supportManaged = supportedManagedAuthBackends();
|
|
let backends = supportedAuthBackends();
|
|
|
|
for (let backend of backends) {
|
|
let { type } = backend;
|
|
|
|
if (type !== 'token') {
|
|
await enablePage.enable(type, type);
|
|
}
|
|
await settled();
|
|
await visit('/vault/access');
|
|
|
|
// all auth methods should be linkable
|
|
await click(`[data-test-auth-backend-link="${type}"]`);
|
|
|
|
if (!supportManaged.includes(type)) {
|
|
assert.dom('[data-test-auth-section-tab]').exists({ count: 1 });
|
|
assert
|
|
.dom('[data-test-auth-section-tab]')
|
|
.hasText('Configuration', `only shows configuration tab for ${type} auth method`);
|
|
assert.dom('[data-test-doc-link] .doc-link').exists(`includes doc link for ${type} auth method`);
|
|
} else {
|
|
// managed auth methods should have more than 1 tab
|
|
assert.notEqual(
|
|
findAll('[data-test-auth-section-tab]').length,
|
|
1,
|
|
`has management tabs for ${type} auth method`
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|