(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);