(HACK WEEK 2025) a11y-audit-ignore codemod (#2946)

* chore: 🤖 add ember-a11y-ignore tool

* chore: 🤖 fix handling existing setRunOptions imports

* chore: 🤖 move codemod to support folder

* chore: 🤖 fix edge case for handling property key names

* chore: 🤖 handle case where multiple of same violation in test

This fixes a bug where multiple cases of the same violation would end up
with multiple entries

* chore: 🤖 ignore axe rules that are currently failing in admin

* chore: 🤖 ignore axe rules that are currently failing in desktop

* docs: ✏️ add a comment explaining the codemod

* chore: 🤖 include test.each cases for a11y ignores

* fix: 🐛 handle test.each test cases for a11y ignore codemod
This commit is contained in:
hashicc authored and Cameron Perera committed 2025-08-19 10:51:44 -05:00
1 parent 1f4076d8d4
commit dc9376a460
114 files changed
+8044

No files matched your search

@@ -12,6 +12,7 @@ import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | create', function (hooks) {
setupApplicationTest(hooks);
@@ -85,6 +86,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('Users can create new oidc auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const count = getAuthMethodsCount();
await visit(`${urls.authMethods}/new?type=oidc`);
@@ -184,6 +194,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('Users can create a new ldap auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
const authMethodsCount = getAuthMethodsCount();
await visit(urls.authMethods);
@@ -310,6 +329,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('Users can navigate to new auth-methods route with proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.orgScope.authorized_collection_actions['auth-methods'] = [
'create',
'list',
@@ -329,6 +357,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('Users cannot navigate to new auth-methods route without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.orgScope.authorized_collection_actions['auth-methods'] = ['list'];
await visit(urls.orgScope);
@@ -343,6 +380,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('Users can navigate to new ldap auth-method route with proper authorization and feature flag enabled', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.orgScope.authorized_collection_actions['auth-methods'] = [
'create',
'list',
@@ -363,6 +409,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('Users cannot navigate to new ldap auth-method route when feature flag disabled', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.orgScope.authorized_collection_actions['auth-methods'] = [
'create',
'list',
@@ -382,6 +437,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('can cancel new auth method creation', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const count = getAuthMethodsCount();
await visit(urls.authMethods);
@@ -399,6 +463,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('user can make primary an auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
assert.notOk(
instances.orgScope.primaryAuthMethodId,
'Primary auth method is not yet set.',
@@ -418,6 +491,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('user is notified of error on make primary an auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
this.server.patch('/scopes/:id', () => {
return new Response(
400,
@@ -442,6 +524,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('user can remove as primary an auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.orgScope.update({
primaryAuthMethodId: instances.authMethod.id,
});
@@ -459,6 +550,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('user is notified of error on remove as primary an auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
this.server.patch('/scopes/:id', () => {
return new Response(
400,
@@ -488,6 +588,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('user can make and remove primary auth methods from index', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
assert.notOk(
instances.orgScope.primaryAuthMethodId,
'Primary auth method is not yet set.',
@@ -514,6 +623,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('saving a new ldap auth method 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-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
this.server.post('/auth-methods', () => {
return new Response(
@@ -550,6 +668,15 @@ module('Acceptance | auth-methods | create', function (hooks) {
});
test('users cannot directly navigate to new auth method route without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.orgScope.authorized_collection_actions['auth-methods'] = ['list'];
await visit(urls.newAuthMethod);
@@ -13,6 +13,7 @@ import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_LDAP } from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -64,6 +65,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('can delete an auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const authMethodsCount = getAuthMethodCount();
await visit(urls.authMethods);
@@ -75,6 +85,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('can delete an ldap auth method', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
const authMethodsCount = getAuthMethodCount();
await visit(urls.authMethods);
@@ -87,6 +106,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('errors are displayed when delete on an auth method fails', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
this.server.del('/auth-methods/:id', () => {
return new Response(
490,
@@ -108,6 +136,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('errors are displayed when delete on an ldap auth method fails', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
this.server.del('/auth-methods/:id', () => {
return new Response(
@@ -130,6 +167,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('cannot delete an auth method without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.authMethod.authorized_actions =
instances.authMethod.authorized_actions.filter(
(item) => item !== 'delete',
@@ -143,6 +189,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('cannot delete an ldap auth method without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
instances.ldapAuthMethod.authorized_actions =
instances.ldapAuthMethod.authorized_actions.filter(
@@ -157,6 +212,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('user can accept delete auth method via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
const authMethodCount = getAuthMethodCount();
@@ -172,6 +236,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('user can accept delete ldap auth method via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
featuresService.enable('ldap-auth-methods');
@@ -188,6 +261,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('user can cancel delete auth method via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
const authMethodCount = getAuthMethodCount();
@@ -203,6 +285,15 @@ module('Acceptance | auth-methods | delete', function (hooks) {
});
test('user can cancel delete ldap auth method via dialog', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const confirmService = this.owner.lookup('service:confirm');
confirmService.enabled = true;
featuresService.enable('ldap-auth-methods');
@@ -16,6 +16,7 @@ import {
} from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | list', function (hooks) {
setupApplicationTest(hooks);
@@ -104,6 +105,15 @@ module('Acceptance | auth-methods | list', function (hooks) {
});
test('user can search for a specifc auth-method by id', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.orgScope);
await click(commonSelectors.HREF(urls.authMethods));
@@ -118,6 +128,15 @@ module('Acceptance | auth-methods | list', function (hooks) {
});
test('user can search for auth-methods and get no results', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.orgScope);
await click(commonSelectors.HREF(urls.authMethods));
@@ -135,6 +154,15 @@ module('Acceptance | auth-methods | list', function (hooks) {
});
test('user can filter for auth-methods by type', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.orgScope);
await click(commonSelectors.HREF(urls.authMethods));
@@ -152,6 +180,15 @@ module('Acceptance | auth-methods | list', function (hooks) {
});
test('user can filter for auth-methods by primary', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.orgScope);
await click(commonSelectors.HREF(urls.authMethods));
@@ -176,6 +213,15 @@ module('Acceptance | auth-methods | list', function (hooks) {
});
test('auth-methods table is sorted by `created_time` descending by default', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
this.server.schema.authMethods.all().destroy();
const years = ['2006', '2005', '2004', '2003'];
faker.helpers.shuffle(years).map((year) => {
@@ -228,6 +274,15 @@ module('Acceptance | auth-methods | list', function (hooks) {
},
},
async function (assert, input) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-04
enabled: false,
},
},
});
this.server.schema.authMethods.all().destroy();
faker.helpers.shuffle(input.attribute.values).forEach((value) => {
this.server.create('auth-method', {
@@ -16,6 +16,7 @@ import {
} from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | read', function (hooks) {
setupApplicationTest(hooks);
@@ -67,6 +68,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('visiting auth methods in org scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.orgScope);
await click(commonSelectors.HREF(urls.orgAuthMethods));
@@ -75,6 +85,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('visiting auth methods in global scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.globalScope);
await click(commonSelectors.HREF(urls.globalAuthMethods));
@@ -83,6 +102,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('can navigate to an auth method form in org scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.orgScope);
await click(commonSelectors.HREF(urls.orgAuthMethods));
@@ -102,6 +130,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('can navigate to an auth method form in global scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.globalScope);
await click(commonSelectors.HREF(urls.globalAuthMethods));
@@ -121,6 +158,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('cannot navigate to an auth method form without proper authorization in org scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.passwordAuthMethodOrg.authorized_actions =
instances.passwordAuthMethodOrg.authorized_actions.filter(
(item) => item !== 'read',
@@ -135,6 +181,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('cannot navigate to an auth method form without proper authorization in global scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.oidcAuthMethodGlobal.authorized_actions =
instances.oidcAuthMethodGlobal.authorized_actions.filter(
(item) => item !== 'read',
@@ -149,6 +204,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('cannot navigate to an ldap auth method form in global scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.ldapAuthMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_LDAP,
@@ -169,6 +233,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('cannot navigate to an ldap auth method form in org scope', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.ldapAuthMethod = this.server.create('auth-method', {
scope: instances.scopes.org,
type: TYPE_AUTH_METHOD_LDAP,
@@ -189,6 +262,15 @@ module('Acceptance | auth-methods | read', function (hooks) {
});
test('users can navigate to auth method and incorrect url autocorrects', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const orgScope = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -16,6 +16,7 @@ import {
} from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | update', function (hooks) {
setupApplicationTest(hooks);
@@ -66,6 +67,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('can update an auth method and save changes', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
await visit(urls.authMethods);
await click(commonSelectors.HREF(urls.authMethod));
@@ -85,6 +95,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('can update an oidc auth method and save changes', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.org,
type: TYPE_AUTH_METHOD_OIDC,
@@ -232,6 +251,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('can update an ldap auth method and save changes', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
await visit(urls.authMethods);
@@ -362,6 +390,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('can update an ldap auth method and cancel changes', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
await visit(urls.authMethods);
const name = instances.ldapAuthMethod.name;
@@ -392,6 +429,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('cannot make changes to an existing auth method without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.authMethod.authorized_actions =
instances.authMethod.authorized_actions.filter(
(item) => item !== 'update',
@@ -404,6 +450,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('cannot make changes to an existing ldap auth method without proper authorization', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
instances.ldapAuthMethod.authorized_actions =
instances.ldapAuthMethod.authorized_actions.filter(
@@ -417,6 +472,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('saving an existing auth method 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-01
enabled: false,
},
},
});
const errorMessage = 'The request was invalid.';
const errorDescription = 'Name is required.';
this.server.patch('/auth-methods/:id', () => {
@@ -450,6 +514,15 @@ module('Acceptance | auth-methods | update', function (hooks) {
});
test('saving an existing ldap auth method 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-01
enabled: false,
},
},
});
featuresService.enable('ldap-auth-methods');
const errorMessage = 'The request was invalid.';
const errorDescription = 'URL field is required';