fix: 🐛 a11y tests

This commit is contained in:
Dharini committed 2025-09-03 17:01:43 -07:00
1 parent 9077a747d6
commit 27567c88c9
17 files changed
+388 -17

No files matched your search

@@ -150,6 +150,15 @@ module('Acceptance | credential-libraries | create', function (hooks) {
});
test('can create a new credential library with username, password and domain type for vault generic', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const credentialLibraryCount = getCredentialLibraryCount();
const usernamePasswordDomainCredentialLibraryCount =
getUsernamePasswordDomainCredentialLibraryCount();
@@ -432,6 +441,15 @@ module('Acceptance | credential-libraries | create', function (hooks) {
});
test('can create a new credential library of type vault ldap', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.newCredentialLibrary);
await click(selectors.TYPE_VAULT_LDAP);
@@ -466,6 +484,15 @@ module('Acceptance | credential-libraries | create', function (hooks) {
});
test('can create a new credential library with username, password and domain type for vault ldap', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const credentialLibraryCount = getCredentialLibraryCount();
const usernamePasswordDomainCredentialLibraryCount =
getUsernamePasswordDomainCredentialLibraryCount();
@@ -509,6 +536,15 @@ module('Acceptance | credential-libraries | create', function (hooks) {
});
test('default `vault-generic` credential library is selected when `ssh-target` feature is not enabled and user manually sets `type` in the query params', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(`${urls.newCredentialLibrary}?type=vault-ssh-certificate`);
assert.dom(selectors.TYPE_VAULT_SSH_CERT).isNotVisible();
@@ -215,6 +215,15 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
});
test('can delete username password and domain credential library type', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const usernamePasswordDomainCredentialLibraryCount =
getUsernamePasswordDomainCredentialLibraryCount();
await visit(urls.usernamePasswordDomainCredentialLibrary);
@@ -229,6 +238,15 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
});
test('can delete vault ldap credential library type', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const vaultLDAPCredentialLibraryCount =
getVaultLDAPCredentialLibraryCount();
await visit(urls.vaultLDAPCredentialLibrary);
@@ -11,6 +11,7 @@ import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { TYPE_CREDENTIAL_LIBRARY_VAULT_LDAP } from 'api/models/credential-library';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-libraries | list', function (hooks) {
setupApplicationTest(hooks);
@@ -102,6 +103,15 @@ module('Acceptance | credential-libraries | list', function (hooks) {
});
test('User can navigate to vault ldap credential library details', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.credentialLibraries);
assert
@@ -193,6 +193,15 @@ module('Acceptance | credential-libraries | read', function (hooks) {
});
test('visiting vault ldap credential library', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const vaultLDAPCredentialLibrary = this.server.create(
'credential-library',
{
@@ -207,7 +216,6 @@ module('Acceptance | credential-libraries | read', function (hooks) {
const url = `${urls.credentialLibraries}/${vaultLDAPCredentialLibrary.id}`;
await visit(url);
await a11yAudit();
assert.strictEqual(currentURL(), url);
});
@@ -180,6 +180,15 @@ module('Acceptance | credential-libraries | update', function (hooks) {
});
test('can update a vault generic credential library of username, password and domain type and save changes', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.usernamePasswordDomainCredentialLibrary);
await click(commonSelectors.EDIT_BTN);
@@ -443,6 +452,15 @@ module('Acceptance | credential-libraries | update', function (hooks) {
});
test('cannot update credential type in a vault ldap credential library', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.vaultLDAPCredentialLibrary);
await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
@@ -451,6 +469,15 @@ module('Acceptance | credential-libraries | update', function (hooks) {
});
test('can update a vault ldap credential library and save changes', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.vaultLDAPCredentialLibrary);
await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
@@ -83,7 +83,7 @@ module(
};
getUsernamePasswordDomainCredentialCount = () => {
return this.server.schema.credentials.where({
type: 'username_password_domain'
type: 'username_password_domain',
}).length;
};
await authenticateSession({});
@@ -119,6 +119,15 @@ module(
});
test('users can create a new username, password & domain credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const credentialsCount = getCredentialsCount();
const usernamePasswordDomainCredentialCount =
getUsernamePasswordDomainCredentialCount();
@@ -145,6 +154,15 @@ module(
});
test('users can create a new username & password credential with domain in username field', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const credentialsCount = getCredentialsCount();
const usernamePasswordDomainCredentialCount =
getUsernamePasswordDomainCredentialCount();
@@ -156,10 +174,12 @@ module(
commonSelectors.FIELD_NAME_VALUE,
);
await click(selectors.FIELD_TYPE_USERNAME_PASSWORD_DOMAIN);
await fillIn(selectors.FIELD_USERNAME, selectors.FIELD_USERNAME_WITH_DOMAIN_VALUE);
await fillIn(
selectors.FIELD_USERNAME,
selectors.FIELD_USERNAME_WITH_DOMAIN_VALUE,
);
await fillIn(selectors.FIELD_PASSWORD, selectors.FIELD_PASSWORD_VALUE);
// check that the domain field is filled in
assert.dom(selectors.FIELD_DOMAIN).hasValue(selectors.FIELD_DOMAIN_VALUE);
@@ -172,7 +192,6 @@ module(
);
});
test('users can create a new username & key pair credential', async function (assert) {
setRunOptions({
rules: {
@@ -316,6 +335,15 @@ module(
});
test('users can cancel creation of new username, password & domain credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const credentialsCount = getCredentialsCount();
await visit(urls.credentials);
@@ -475,6 +503,15 @@ module(
});
test('saving a new username, password & domain credential with invalid fields displays error messages', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const errorMessage = 'Error in provided request.';
const errorDescription =
'Field required for creating a username-password-domain credential.';
@@ -498,8 +535,7 @@ module(
},
},
);
}
);
});
await click(commonSelectors.HREF(urls.newCredential));
await click(selectors.FIELD_TYPE_USERNAME_PASSWORD_DOMAIN);
await click(commonSelectors.SAVE_BTN);
@@ -507,7 +543,9 @@ module(
assert
.dom(selectors.FIELD_DOMAIN_ERROR)
.hasText('Field required for creating a username-password-domain credential.');
.hasText(
'Field required for creating a username-password-domain credential.',
);
});
test('saving a new json credential with invalid fields displays error messages', async function (assert) {
@@ -199,6 +199,15 @@ module(
});
test('can delete username, password & domain credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const usernamePasswordDomainCredentialCount =
getUsernamePasswordDomainCredentialCount();
@@ -409,6 +418,15 @@ module(
});
test('can cancel delete username, password & domain credential via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
const usernamePasswordDomainCredentialCount =
@@ -507,6 +525,15 @@ module(
});
test('deleting a username, password & domain credential which errors displays error message', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
this.server.del('/credentials/:id', () => {
return new Response(
490,
@@ -157,16 +157,23 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
});
test('visiting username, password & domain credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.staticCredentialStore);
await click(commonSelectors.HREF(urls.credentials));
await a11yAudit();
assert.strictEqual(currentURL(), urls.credentials);
await click(commonSelectors.HREF(urls.usernamePasswordDomainCredential));
await a11yAudit();
assert.strictEqual(currentURL(), urls.usernamePasswordDomainCredential);
});
@@ -243,6 +250,15 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
});
test('cannot navigate to a username, password & domain credential form without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
instances.usernamePasswordDomainCredential.authorized_actions =
instances.usernamePasswordDomainCredential.authorized_actions.filter(
(item) => item != 'read',
@@ -130,6 +130,15 @@ module(
});
test('can save changes to existing username & password credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
assert.notEqual(
instances.usernamePasswordCredential.name,
commonSelectors.FIELD_NAME_VALUE,
@@ -205,6 +214,15 @@ module(
});
test('can save changes to existing username, password & domain credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const mockInput = 'random string';
await visit(urls.usernamePasswordDomainCredential);
@@ -256,6 +274,15 @@ module(
});
test('can cancel changes to existing username & password credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.usernamePasswordCredential);
await click(commonSelectors.EDIT_BTN, 'Activate edit mode');
await fillIn(
@@ -321,6 +348,15 @@ module(
});
test('saving an existing username & password credential with invalid fields displays error message', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
this.server.patch('/credentials/:id', mockResponse);
await visit(urls.usernamePasswordCredential);
@@ -506,6 +542,15 @@ module(
});
test('can cancel discard unsaved username & password credential changes via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
assert.expect(6);
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
@@ -591,6 +636,15 @@ module(
});
test('can cancel unsaved username, password & domain credential changes via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
const name = instances.usernamePasswordDomainCredential.name;
await visit(urls.usernamePasswordDomainCredential);
@@ -637,6 +691,15 @@ module(
});
test('password field renders in edit mode only for a username & password credential', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.usernamePasswordCredential);
assert.dom(commonSelectors.FIELD_PASSWORD).doesNotExist();
@@ -171,7 +171,6 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
});
await visit(urls[input.route]);
await a11yAudit();
assert.strictEqual(currentURL(), urls[input.route]);
assert
@@ -240,7 +239,6 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
await visit(urls[input.route]);
await click(commonSelectors.TABLE_RESOURCE_LINK(urls[input.link]));
await a11yAudit();
assert.strictEqual(currentURL(), urls[input.expectedUrl]);
},
@@ -303,7 +301,6 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
});
await visit(urls[input.route]);
await a11yAudit();
assert.strictEqual(currentURL(), urls[input.route]);
},
@@ -516,6 +516,15 @@ module('Acceptance | targets | create', function (hooks) {
});
test('defaults to type `tcp` when no query param provided and rdp feature is enabled', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
await visit(urls.targets);
@@ -525,6 +534,15 @@ module('Acceptance | targets | create', function (hooks) {
});
test('cannot navigate to new RDP targets route when rdp feature is disabled', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
await visit(urls.targets);
await click(commonSelectors.HREF(urls.newTarget));
@@ -540,6 +558,15 @@ module('Acceptance | targets | create', function (hooks) {
});
test('default port is not marked required for RDP targets', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
await visit(urls.targets);
@@ -550,6 +577,15 @@ module('Acceptance | targets | create', function (hooks) {
});
test('can cancel create new RDP target', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
const targetCount = getTargetCount();
const rdpTargetCount = getRDPTargetCount();
@@ -566,6 +602,15 @@ module('Acceptance | targets | create', function (hooks) {
});
test('can create a type `rdp` target', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
const targetCount = getTargetCount();
@@ -598,6 +643,15 @@ module('Acceptance | targets | create', function (hooks) {
});
test('saving a new RDP target with invalid fields displays error messages', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
this.server.post('/targets', () => {
return new Response(
400,
@@ -200,6 +200,15 @@ module('Acceptance | targets | delete', function (hooks) {
});
test('can delete rdp target', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
const rdpTargetCount = getRDPTargetCount();
await visit(urls.targets);
@@ -252,8 +252,6 @@ module(
await visit(url);
await a11yAudit();
assert.strictEqual(currentURL(), url);
assert
.dom(commonSelectors.TABLE_ROWS)
@@ -486,6 +486,15 @@ module('Acceptance | targets | list', function (hooks) {
);
test('user can only see RDP and TCP targets when rdp-target feature is enabled', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.disable('ssh-target');
await visit(urls.projectScope);
@@ -504,6 +513,15 @@ module('Acceptance | targets | list', function (hooks) {
});
test('user can only see SSH and TCP targets when ssh-target feature is enabled', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.disable('rdp-target');
await visit(urls.projectScope);
+18 -2
View File
@@ -331,6 +331,15 @@ module('Acceptance | targets | read', function (hooks) {
});
test('cannot navigate to a rdp target form without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
instances.rdpTarget.authorized_actions =
instances.rdpTarget.authorized_actions.filter((item) => item !== 'read');
@@ -344,16 +353,23 @@ module('Acceptance | targets | read', function (hooks) {
});
test('visiting rdp target', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
await visit(urls.projectScope);
await click(commonSelectors.HREF(urls.targets));
await a11yAudit();
assert.strictEqual(currentURL(), urls.targets);
await click(commonSelectors.HREF(urls.rdpTarget));
await a11yAudit();
assert.strictEqual(currentURL(), urls.rdpTarget);
});
@@ -363,6 +363,15 @@ module('Acceptance | targets | update', function (hooks) {
});
test('can save changes to existing rdp target', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('rdp-target');
featuresService.enable('ssh-target');
@@ -393,6 +402,15 @@ module('Acceptance | targets | update', function (hooks) {
});
test('displays add injected credentials alert for ssh target', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
featuresService.enable('ssh-target');
await visit(urls.targets);
@@ -335,6 +335,15 @@ module('Acceptance | projects | sessions | session', function (hooks) {
});
test('visiting an RDP session should display a toast notification', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
this.ipcStub.withArgs('cliExists').returns(true);
this.ipcStub.withArgs('connect').returns({
session_id: instances.rdpSession.id,
@@ -362,6 +371,15 @@ module('Acceptance | projects | sessions | session', function (hooks) {
});
test('clicking on `do not show again` button prevents the toast warning from showing again', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-26
enabled: false,
},
},
});
// First RDP Session visit should show the toast notification
this.ipcStub.withArgs('cliExists').returns(true);
this.ipcStub.withArgs('connect').returns({