UI: fix failing policy test (#27430)

* add spy to assert flash

* user general selector instead

* attempt to stabilize oidc-config test
This commit is contained in:
claire bontempo 2024-06-11 09:23:38 -07:00 committed by GitHub
parent 5517d0764c
commit 3fb78e39c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -4,7 +4,7 @@
*/
import { module, test } from 'qunit';
import { visit, click, fillIn, findAll, currentRouteName } from '@ember/test-helpers';
import { visit, click, fillIn, findAll, currentRouteName, waitFor } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import oidcConfigHandlers from 'vault/mirage/handlers/oidc-config';
@ -89,6 +89,7 @@ module('Acceptance | oidc-config clients and keys', function (hooks) {
'key edit form navigates back to details on cancel'
);
await click(SELECTORS.keyClientsTab);
waitFor('[data-test-oidc-client-linked-block="client-with-default-key"]');
assert
.dom('[data-test-oidc-client-linked-block="client-with-default-key"]')
.exists('lists correct app with default');

View file

@ -20,6 +20,7 @@ import { v4 as uuidv4 } from 'uuid';
import authPage from 'vault/tests/pages/auth';
import { runCmd } from 'vault/tests/helpers/commands';
import codemirror from 'vault/tests/helpers/codemirror';
import { GENERAL } from 'vault/tests/helpers/general-selectors';
const SELECT = {
policyByName: (name) => `[data-test-policy-link="${name}"]`,
@ -33,6 +34,7 @@ const SELECT = {
policyTitle: '[data-test-policy-name]',
listBreadcrumb: '[data-test-policy-list-link] a',
};
module('Acceptance | policies/acl', function (hooks) {
setupApplicationTest(hooks);
@ -120,8 +122,7 @@ module('Acceptance | policies/acl', function (hooks) {
'navigates to policy show on successful save'
);
assert.dom(SELECT.policyTitle).hasText(policyLower, 'displays the policy name on the show page');
// will fail if you have a license about to expire.
assert.dom('[data-test-flash-message].is-info').doesNotExist('no flash message is displayed on save');
assert.dom(GENERAL.latestFlashContent).hasText(`ACL policy "${policyLower}" was successfully created.`);
await click(SELECT.listBreadcrumb);
assert.strictEqual(currentURL(), `/vault/policies/acl`, 'navigates to policy list from breadcrumb');