2023-03-01 09:39:41 -06:00
/**
2026-01-28 17:09:06 -08:00
* Copyright IBM Corp. 2021, 2026
2024-05-31 11:29:24 -07:00
* SPDX-License-Identifier: BUSL-1.1
2023-03-01 09:39:41 -06:00
*/
2021-03-05 17:49:47 -05:00
import Application from 'desktop/app' ;
import config from 'desktop/config/environment' ;
import * as QUnit from 'qunit' ;
2020-06-29 18:11:11 -04:00
import { setApplication } from '@ember/test-helpers' ;
2021-03-05 17:49:47 -05:00
import { setup } from 'qunit-dom' ;
2023-01-10 18:25:09 -05:00
import start from 'ember-exam/test-support/start' ;
2025-07-22 19:16:15 -04:00
import {
DEFAULT_A11Y_TEST_HELPER_NAMES ,
setRunOptions ,
setupGlobalA11yHooks ,
setupQUnitA11yAuditToggle ,
shouldForceAudit ,
setEnableA11yAudit ,
useMiddlewareReporter ,
setupMiddlewareReporter ,
} from 'ember-a11y-testing/test-support' ;
2020-06-29 18:11:11 -04:00
setApplication ( Application . create ( config . APP ));
2025-07-22 19:16:15 -04:00
setupGlobalA11yHooks (() => true , {
helpers : [
... DEFAULT_A11Y_TEST_HELPER_NAMES ,
'fillIn' ,
'render' ,
'tab' ,
'focus' ,
'select' ,
],
});
setupQUnitA11yAuditToggle ( QUnit );
2025-07-23 14:49:56 -05:00
const runOnly =
config . COLOR_THEME === 'dark'
? 'color-contrast'
: {
type : 'tag' ,
values : [
'wcag2a' ,
'wcag2aa' ,
'wcag21a' ,
'wcag21aa' ,
'wcag22aa' ,
'best-practice' ,
],
};
2025-07-22 19:16:15 -04:00
setRunOptions ({
2025-07-23 14:49:56 -05:00
runOnly ,
2025-07-22 19:16:15 -04:00
include : [[ '#ember-testing-container' ]],
exclude : [[ '.flight-sprite-container' ]],
});
// This will be used by developers to run the tests locally
// Either with the `enableA11yAudit` as a query param in the URL
// or `pnpm test-a11y` in the CLI
// Note: if you want to filter what test is run from the start, use the --filter flag: `pnpm test-a11y --filter="alert"`
// Docs: https://guides.emberjs.com/release/testing/#toc_how-to-filter-tests
if ( shouldForceAudit ()) {
setEnableA11yAudit ( true );
}
// Note, as a convenience, useMiddlewareReporter automatically forces audits, thus explicitly specifying the enableA11yAudit query param or the ENABLE_A11Y_AUDIT environment variable is unnecessary.
if ( useMiddlewareReporter ()) {
// Only runs if `enableA11yMiddlewareReporter` is set in URL
setupMiddlewareReporter ();
}
2021-03-05 17:49:47 -05:00
setup ( QUnit . assert );
2020-06-29 18:11:11 -04:00
start ();