Files
vault/ui/tests/acceptance/aws-test.js
claire bontempo 3403203471 UI: HDS adoption replace Breadcrumbs (#24387)
* upgrade to 3.1.0

* VAULT-22471 upgrade to latest version

* fix other selectors

* fix pki tests

* fix copy dropdown

* generated breadcrumbs

* mfa crumbs

* oidc crumbs

* identity crumbs

* use hds crumbs in page::breadcrumbs file

* rename selectors to be consistent

* remaining oidc

* update empty state link style to match hds

* repl empty state

* rep empty state 2

* policy and secret error template

* replace yielded KeyValueHeader elements directly with HDS breadcrumbs

* remove yield from KeyValueHeader

* use key value header in secret header

* update pki header

* kmip breadcrumbs

* replace key-value-header classes

* ssh sign

* replace key value with breadcrumbs

* update selectors part 1

* add a tags

* policy tests

* add crumb index back

* add current route to generated item

* another round of test updates

* remove root link test selector

* secrets/secrete test

* add changelog

* trailing icon

* delete breadcrumb css

* consistently change to sentence case

* titlsecase!
2023-12-06 10:56:01 -08:00

91 lines
3.2 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { click, fillIn, findAll, currentURL, find, settled, waitUntil } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { v4 as uuidv4 } from 'uuid';
import authPage from 'vault/tests/pages/auth';
import enablePage from 'vault/tests/pages/settings/mount-secret-backend';
module('Acceptance | aws secret backend', function (hooks) {
setupApplicationTest(hooks);
hooks.beforeEach(function () {
this.uid = uuidv4();
return authPage.login();
});
test('aws backend', async function (assert) {
assert.expect(12);
const path = `aws-${this.uid}`;
const roleName = 'awsrole';
await enablePage.enable('aws', path);
await settled();
await click('[data-test-configuration-tab]');
await click('[data-test-secret-backend-configure]');
assert.strictEqual(currentURL(), `/vault/settings/secrets/configure/${path}`);
assert.ok(findAll('[data-test-aws-root-creds-form]').length, 'renders the empty root creds form');
assert.ok(findAll('[data-test-aws-link="root-creds"]').length, 'renders the root creds link');
assert.ok(findAll('[data-test-aws-link="leases"]').length, 'renders the leases config link');
await fillIn('[data-test-aws-input="accessKey"]', 'foo');
await fillIn('[data-test-aws-input="secretKey"]', 'bar');
await click('[data-test-aws-input="root-save"]');
assert.ok(
find('[data-test-flash-message]').textContent.trim(),
`The backend configuration saved successfully!`
);
await click('[data-test-aws-link="leases"]');
await click('[data-test-aws-input="lease-save"]');
assert.ok(
find('[data-test-flash-message]').textContent.trim(),
`The backend configuration saved successfully!`
);
await click('[data-test-backend-view-link]');
assert.strictEqual(currentURL(), `/vault/secrets/${path}/list`, `navigates to the roles list`);
await click('[data-test-secret-create]');
assert.ok(
find('[data-test-secret-header]').textContent.includes('AWS Role'),
`aws: renders the create page`
);
await fillIn('[data-test-input="name"]', roleName);
// save the role
await click('[data-test-role-aws-create]');
await waitUntil(() => currentURL() === `/vault/secrets/${path}/show/${roleName}`); // flaky without this
assert.strictEqual(
currentURL(),
`/vault/secrets/${path}/show/${roleName}`,
`$aws: navigates to the show page on creation`
);
await click(`[data-test-secret-breadcrumb="${path}"] a`);
assert.strictEqual(currentURL(), `/vault/secrets/${path}/list`);
assert.ok(findAll(`[data-test-secret-link="${roleName}"]`).length, `aws: role shows in the list`);
//and delete
await click(`[data-test-secret-link="${roleName}"] [data-test-popup-menu-trigger]`);
await waitUntil(() => find(`[data-test-aws-role-delete="${roleName}"]`)); // flaky without
await click(`[data-test-aws-role-delete="${roleName}"]`);
await click(`[data-test-confirm-button]`);
assert.dom(`[data-test-secret-link="${roleName}"]`).doesNotExist(`aws: role is no longer in the list`);
});
});