(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

@@ -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');