(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

@@ -11,6 +11,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 | groups | delete', function (hooks) {
setupApplicationTest(hooks);
@@ -50,6 +51,15 @@ module('Acceptance | groups | delete', function (hooks) {
});
test('can delete a group', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const count = getGroupsCount();
await visit(urls.group);
@@ -70,6 +80,15 @@ module('Acceptance | groups | delete', function (hooks) {
});
test('deleting a group which 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,
},
},
});
this.server.del('/groups/:id', () => {
return new Response(
490,
@@ -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 | groups | members', function (hooks) {
setupApplicationTest(hooks);
@@ -56,6 +57,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('visiting group members', 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.members);
assert.strictEqual(currentURL(), urls.members);
@@ -63,6 +73,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('can remove a member', 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.members);
assert.dom(commonSelectors.TABLE_ROWS).exists({ count: membersCount });
@@ -74,6 +93,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('cannot remove a member 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,
},
},
});
const authorized_actions = instances.group.authorized_actions.filter(
(item) => item !== 'remove-members',
);
@@ -86,6 +114,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('shows error message on member remove', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const errorMsg = 'The request was invalid.';
this.server.post('/groups/:idMethod', () => {
return new Response(
@@ -109,18 +146,45 @@ module('Acceptance | groups | members', function (hooks) {
});
test('visiting member selection', 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.addMembers);
assert.strictEqual(currentURL(), urls.addMembers);
});
test('can navigate to add members 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,
},
},
});
await visit(urls.group);
await click(selectors.MANAGE_DROPDOWN);
assert.dom(selectors.MANAGE_DROPDOWN_ADD_MEMBER).isVisible();
});
test('cannot navigate to add members 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,
},
},
});
const authorized_actions = instances.group.authorized_actions.filter(
(item) => item !== 'add-members',
);
@@ -133,6 +197,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('select and save members to add', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
instances.group.update({ memberIds: [] });
await visit(urls.members);
@@ -152,6 +225,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('select and cancel members to add', 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.members);
assert.dom(commonSelectors.TABLE_ROWS).exists({ count: membersCount });
@@ -175,6 +257,15 @@ module('Acceptance | groups | members', function (hooks) {
});
test('shows error message on member add', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
enabled: false,
},
},
});
const errorMsg = 'The request was invalid.';
this.server.post('/groups/:idMethod', () => {
return new Response(
@@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | groups | read', function (hooks) {
setupApplicationTest(hooks);
@@ -60,6 +61,15 @@ module('Acceptance | groups | read', function (hooks) {
});
test('users can navigate to group and incorrect url auto-corrects', 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' },