mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 09:25:46 +03:00
Add component accessibility auditing and fixes (#8679)
This continues #8455 by adding accessibility audits to component integration tests and fixing associated errors. It adds audits to existing tests rather than adding separate ones to facilitate auditing the various permutations a component’s rendering can go through. It also adds linting to ensure audits happen in component tests. This necessitated consolidating test files that were scattered.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<button data-test-log-action="tail" class="button is-white is-compact" onclick={{action "gotoTail"}} type="button">Tail</button>
|
||||
{{/if}}
|
||||
{{#if this.isStreamable}}
|
||||
<button data-test-log-action="toggle-stream" class="button is-white is-compact" onclick={{action "toggleStream"}} type="button">
|
||||
<button data-test-log-action="toggle-stream" class="button is-white is-compact" onclick={{action "toggleStream"}} type="button" title="{{if this.logger.isStreaming "Pause" "Start"}} streaming">
|
||||
{{x-icon (if this.logger.isStreaming "media-pause" "media-play") class="is-text"}}
|
||||
</button>
|
||||
{{/if}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@onClose={{action (mut this.isOpen) false}} as |dd|
|
||||
>
|
||||
<dd.Trigger data-test-dropdown-trigger class="dropdown-trigger" {{on "keydown" (action "openOnArrowDown" dd)}}>
|
||||
<div class="dropdown-trigger-label">
|
||||
<div class="dropdown-trigger-label" id="{{this.elementId}}-label">
|
||||
{{this.label}}
|
||||
{{#if this.selection.length}}
|
||||
<span data-test-dropdown-count class="tag is-light">
|
||||
@@ -15,29 +15,34 @@
|
||||
<span class="dropdown-trigger-icon ember-power-select-status-icon"></span>
|
||||
</dd.Trigger>
|
||||
<dd.Content class="dropdown-options">
|
||||
<ul role="listbox" data-test-dropdown-options>
|
||||
{{#each this.options key="key" as |option|}}
|
||||
<li
|
||||
data-test-dropdown-option={{option.key}}
|
||||
class="dropdown-option"
|
||||
tabindex="0"
|
||||
onkeydown={{action "traverseList" option}}
|
||||
>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
tabindex="-1"
|
||||
checked={{contains option.key this.selection}}
|
||||
onchange={{action "toggle" option}}
|
||||
/>
|
||||
{{option.label}}
|
||||
</label>
|
||||
</li>
|
||||
{{else}}
|
||||
<em data-test-dropdown-empty class="dropdown-empty">
|
||||
{{#if this.options}}
|
||||
<ul role="listbox" aria-labelledby="{{this.elementId}}-label" data-test-dropdown-options>
|
||||
{{#each this.options key="key" as |option|}}
|
||||
<div
|
||||
data-test-dropdown-option={{option.key}}
|
||||
class="dropdown-option"
|
||||
tabindex="0"
|
||||
onkeydown={{action "traverseList" option}}
|
||||
>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
tabindex="-1"
|
||||
checked={{contains option.key this.selection}}
|
||||
role="option"
|
||||
onchange={{action "toggle" option}}
|
||||
/>
|
||||
{{option.label}}
|
||||
</label>
|
||||
</div>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<ul aria-labelledby="{{this.elementId}}-label" data-test-dropdown-options>
|
||||
<li data-test-dropdown-empty class="dropdown-empty">
|
||||
No options
|
||||
</em>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{{/if}}
|
||||
</dd.Content>
|
||||
</BasicDropdown>
|
||||
@@ -10,19 +10,36 @@ module.exports = {
|
||||
env: {
|
||||
embertest: true,
|
||||
},
|
||||
overrides: {
|
||||
files: ['acceptance/**/*-test.js'],
|
||||
plugins: ['ember-a11y-testing'],
|
||||
rules: {
|
||||
'ember-a11y-testing/a11y-audit-called': 'error',
|
||||
},
|
||||
settings: {
|
||||
'ember-a11y-testing': {
|
||||
auditModule: {
|
||||
package: 'nomad-ui/tests/helpers/a11y-audit',
|
||||
exportName: 'default',
|
||||
overrides: [
|
||||
{
|
||||
files: ['acceptance/**/*-test.js'],
|
||||
plugins: ['ember-a11y-testing'],
|
||||
rules: {
|
||||
'ember-a11y-testing/a11y-audit-called': 'error',
|
||||
},
|
||||
settings: {
|
||||
'ember-a11y-testing': {
|
||||
auditModule: {
|
||||
package: 'nomad-ui/tests/helpers/a11y-audit',
|
||||
exportName: 'default',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['integration/components/**/*-test.js'],
|
||||
plugins: ['ember-a11y-testing'],
|
||||
rules: {
|
||||
'ember-a11y-testing/a11y-audit-called': 'error',
|
||||
},
|
||||
settings: {
|
||||
'ember-a11y-testing': {
|
||||
auditModule: {
|
||||
package: 'nomad-ui/tests/helpers/a11y-audit',
|
||||
exportName: 'componentA11yAudit',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -49,8 +49,7 @@ module('Acceptance | allocation detail', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/allocation/:id should name the allocation and link to the corresponding job and node', async function(assert) {
|
||||
|
||||
@@ -20,9 +20,7 @@ module('Acceptance | application errors ', function(hooks) {
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
server.pretender.get('/v1/nodes', () => [500, {}, null]);
|
||||
await ClientsList.visit();
|
||||
await a11yAudit();
|
||||
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('transitioning away from an error page resets the global error', async function(assert) {
|
||||
|
||||
@@ -24,17 +24,31 @@ const fileSort = (prop, files) => {
|
||||
return dir.sortBy(prop).concat(file.sortBy(prop));
|
||||
};
|
||||
|
||||
export default function browseFilesystem({ pageObjectVisitPathFunctionName, pageObjectVisitFunctionName, visitSegments, getExpectedPathBase, getTitleComponent, getBreadcrumbComponent, getFilesystemRoot }) {
|
||||
export default function browseFilesystem({
|
||||
pageObjectVisitPathFunctionName,
|
||||
pageObjectVisitFunctionName,
|
||||
visitSegments,
|
||||
getExpectedPathBase,
|
||||
getTitleComponent,
|
||||
getBreadcrumbComponent,
|
||||
getFilesystemRoot,
|
||||
}) {
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await FS[pageObjectVisitFunctionName](visitSegments({allocation: this.allocation, task: this.task }));
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await FS[pageObjectVisitFunctionName](
|
||||
visitSegments({ allocation: this.allocation, task: this.task })
|
||||
);
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('visiting filesystem root', async function(assert) {
|
||||
await FS[pageObjectVisitFunctionName](visitSegments({allocation: this.allocation, task: this.task }));
|
||||
await FS[pageObjectVisitFunctionName](
|
||||
visitSegments({ allocation: this.allocation, task: this.task })
|
||||
);
|
||||
|
||||
const pathBaseWithTrailingSlash = getExpectedPathBase({ allocation: this.allocation, task: this.task });
|
||||
const pathBaseWithTrailingSlash = getExpectedPathBase({
|
||||
allocation: this.allocation,
|
||||
task: this.task,
|
||||
});
|
||||
const pathBaseWithoutTrailingSlash = pathBaseWithTrailingSlash.slice(0, -1);
|
||||
|
||||
assert.equal(currentURL(), pathBaseWithoutTrailingSlash, 'No redirect');
|
||||
@@ -50,17 +64,32 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
pathWithLeadingSlash = `/${filePath}`;
|
||||
}
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({allocation: this.allocation, task: this.task }), path: filePath });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: filePath,
|
||||
});
|
||||
assert.equal(
|
||||
currentURL(),
|
||||
`${getExpectedPathBase({allocation: this.allocation, task: this.task })}${encodeURIComponent(filePath)}`,
|
||||
`${getExpectedPathBase({
|
||||
allocation: this.allocation,
|
||||
task: this.task,
|
||||
})}${encodeURIComponent(filePath)}`,
|
||||
'No redirect'
|
||||
);
|
||||
assert.equal(
|
||||
document.title,
|
||||
`${pathWithLeadingSlash} - ${getTitleComponent({allocation: this.allocation, task: this.task})} - Nomad`
|
||||
`${pathWithLeadingSlash} - ${getTitleComponent({
|
||||
allocation: this.allocation,
|
||||
task: this.task,
|
||||
})} - Nomad`
|
||||
);
|
||||
assert.equal(
|
||||
FS.breadcrumbsText,
|
||||
`${getBreadcrumbComponent({
|
||||
allocation: this.allocation,
|
||||
task: this.task,
|
||||
})} ${filePath.replace(/\//g, ' ')}`.trim()
|
||||
);
|
||||
assert.equal(FS.breadcrumbsText, `${getBreadcrumbComponent({allocation: this.allocation, task: this.task})} ${filePath.replace(/\//g, ' ')}`.trim());
|
||||
};
|
||||
|
||||
await paths.reduce(async (prev, filePath) => {
|
||||
@@ -73,7 +102,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
const objects = { allocation: this.allocation, task: this.task };
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments(objects), path: '/' });
|
||||
|
||||
const sortedFiles = fileSort('name', filesForPath(this.server.schema.allocFiles, getFilesystemRoot(objects)).models);
|
||||
const sortedFiles = fileSort(
|
||||
'name',
|
||||
filesForPath(this.server.schema.allocFiles, getFilesystemRoot(objects)).models
|
||||
);
|
||||
|
||||
assert.ok(FS.fileViewer.isHidden);
|
||||
|
||||
@@ -123,7 +155,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
);
|
||||
|
||||
assert.equal(FS.breadcrumbs.length, 3);
|
||||
assert.equal(FS.breadcrumbsText, `${getBreadcrumbComponent(objects)} ${this.directory.name} ${this.nestedDirectory.name}`);
|
||||
assert.equal(
|
||||
FS.breadcrumbsText,
|
||||
`${getBreadcrumbComponent(objects)} ${this.directory.name} ${this.nestedDirectory.name}`
|
||||
);
|
||||
assert.equal(FS.breadcrumbs[2].text, this.nestedDirectory.name);
|
||||
|
||||
assert.notOk(
|
||||
@@ -190,7 +225,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
];
|
||||
});
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({allocation: this.allocation, task: this.task }), path: '/' });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: '/',
|
||||
});
|
||||
|
||||
assert.deepEqual(FS.directoryEntryNames(), [
|
||||
'aaa-big-old-directory',
|
||||
@@ -275,7 +313,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments(objects), path: '/' });
|
||||
|
||||
const sortedFiles = fileSort('name', filesForPath(this.server.schema.allocFiles, getFilesystemRoot(objects)).models);
|
||||
const sortedFiles = fileSort(
|
||||
'name',
|
||||
filesForPath(this.server.schema.allocFiles, getFilesystemRoot(objects)).models
|
||||
);
|
||||
const fileRecord = sortedFiles.find(f => !f.isDir);
|
||||
const fileIndex = sortedFiles.indexOf(fileRecord);
|
||||
|
||||
@@ -303,7 +344,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
});
|
||||
|
||||
test('viewing an empty directory', async function(assert) {
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({ allocation: this.allocation, task: this.task }), path: 'empty-directory' });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: 'empty-directory',
|
||||
});
|
||||
|
||||
assert.ok(FS.isEmptyDirectory);
|
||||
});
|
||||
@@ -313,7 +357,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
return new Response(500, {}, 'no such file or directory');
|
||||
});
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({ allocation: this.allocation, task: this.task }), path: '/what-is-this' });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: '/what-is-this',
|
||||
});
|
||||
assert.equal(FS.error.title, 'Not Found', '500 is interpreted as 404');
|
||||
|
||||
await visit('/');
|
||||
@@ -322,7 +369,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
return new Response(999);
|
||||
});
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({ allocation: this.allocation, task: this.task }), path: '/what-is-this' });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: '/what-is-this',
|
||||
});
|
||||
assert.equal(FS.error.title, 'Error', 'other statuses are passed through');
|
||||
});
|
||||
|
||||
@@ -331,7 +381,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
return new Response(500, {}, 'no such file or directory');
|
||||
});
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({ allocation: this.allocation, task: this.task }), path: this.directory.name });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: this.directory.name,
|
||||
});
|
||||
assert.equal(FS.error.title, 'Not Found', '500 is interpreted as 404');
|
||||
|
||||
await visit('/');
|
||||
@@ -340,7 +393,10 @@ export default function browseFilesystem({ pageObjectVisitPathFunctionName, page
|
||||
return new Response(999);
|
||||
});
|
||||
|
||||
await FS[pageObjectVisitPathFunctionName]({ ...visitSegments({ allocation: this.allocation, task: this.task }), path: this.directory.name });
|
||||
await FS[pageObjectVisitPathFunctionName]({
|
||||
...visitSegments({ allocation: this.allocation, task: this.task }),
|
||||
path: this.directory.name,
|
||||
});
|
||||
assert.equal(FS.error.title, 'Error', 'other statuses are passed through');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ module('Acceptance | client detail', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await ClientDetail.visit({ id: node.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/clients/:id should have a breadcrumb trail linking back to clients', async function(assert) {
|
||||
|
||||
@@ -28,8 +28,7 @@ module('Acceptance | client monitor', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await ClientMonitor.visit({ id: node.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/clients/:id/monitor should have a breadcrumb trail linking back to clients', async function(assert) {
|
||||
|
||||
@@ -21,8 +21,7 @@ module('Acceptance | clients list', function(hooks) {
|
||||
server.createList('agent', 1);
|
||||
|
||||
await ClientsList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/clients should list one page of clients', async function(assert) {
|
||||
|
||||
@@ -36,8 +36,7 @@ module('Acceptance | exec', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await Exec.visitJob({ job: this.job.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/exec/:job should show the region, namespace, and job name', async function(assert) {
|
||||
|
||||
@@ -34,8 +34,7 @@ module('Acceptance | job allocations', function(hooks) {
|
||||
allocations = server.schema.allocations.where({ jobId: job.id }).models;
|
||||
|
||||
await Allocations.visit({ id: job.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('lists all allocations for the job', async function(assert) {
|
||||
|
||||
@@ -21,8 +21,7 @@ module('Acceptance | job definition', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit('scrollable-region-focusable');
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert, 'scrollable-region-focusable');
|
||||
});
|
||||
|
||||
test('visiting /jobs/:job_id/definition', async function(assert) {
|
||||
|
||||
@@ -36,8 +36,7 @@ module('Acceptance | job deployments', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await Deployments.visit({ id: job.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/jobs/:id/deployments should list all job deployments', async function(assert) {
|
||||
|
||||
@@ -70,7 +70,11 @@ module('Acceptance | job detail (with namespaces)', function(hooks) {
|
||||
hooks.beforeEach(function() {
|
||||
server.createList('namespace', 2);
|
||||
server.create('node');
|
||||
job = server.create('job', { type: 'service', status: 'running', namespaceId: server.db.namespaces[1].name });
|
||||
job = server.create('job', {
|
||||
type: 'service',
|
||||
status: 'running',
|
||||
namespaceId: server.db.namespaces[1].name,
|
||||
});
|
||||
server.createList('job', 3, { namespaceId: server.db.namespaces[0].name });
|
||||
|
||||
server.create('token');
|
||||
@@ -80,8 +84,7 @@ module('Acceptance | job detail (with namespaces)', function(hooks) {
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
const namespace = server.db.namespaces.find(job.namespaceId);
|
||||
await JobDetail.visit({ id: job.id, namespace: namespace.name });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('when there are namespaces, the job detail page states the namespace for the job', async function(assert) {
|
||||
@@ -114,8 +117,14 @@ module('Acceptance | job detail (with namespaces)', function(hooks) {
|
||||
});
|
||||
|
||||
test('the exec button state can change between namespaces', async function(assert) {
|
||||
const job1 = server.create('job', { status: 'running', namespaceId: server.db.namespaces[0].id });
|
||||
const job2 = server.create('job', { status: 'running', namespaceId: server.db.namespaces[1].id });
|
||||
const job1 = server.create('job', {
|
||||
status: 'running',
|
||||
namespaceId: server.db.namespaces[0].id,
|
||||
});
|
||||
const job2 = server.create('job', {
|
||||
status: 'running',
|
||||
namespaceId: server.db.namespaces[1].id,
|
||||
});
|
||||
|
||||
window.localStorage.nomadTokenSecret = clientToken.secretId;
|
||||
|
||||
@@ -163,7 +172,7 @@ module('Acceptance | job detail (with namespaces)', function(hooks) {
|
||||
},
|
||||
});
|
||||
|
||||
await JobDetail.visit({ id: job.id, namespace: server.db.namespaces[1].name });
|
||||
await JobDetail.visit({ id: job.id, namespace: server.db.namespaces[1].name });
|
||||
assert.notOk(JobDetail.execButton.isDisabled);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,8 +20,7 @@ module('Acceptance | job evaluations', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('lists all evaluations for the job', async function(assert) {
|
||||
|
||||
@@ -57,8 +57,7 @@ module('Acceptance | job run', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await JobRun.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('visiting /jobs/run', async function(assert) {
|
||||
|
||||
@@ -21,8 +21,7 @@ module('Acceptance | job versions', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/jobs/:id/versions should list all job versions', async function(assert) {
|
||||
|
||||
@@ -26,8 +26,7 @@ module('Acceptance | jobs list', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await JobsList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('visiting /jobs', async function(assert) {
|
||||
|
||||
@@ -50,8 +50,7 @@ module('Acceptance | namespaces (enabled)', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await JobsList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('the namespace switcher lists all namespaces', async function(assert) {
|
||||
|
||||
@@ -26,8 +26,7 @@ module('Acceptance | plugin allocations', function(hooks) {
|
||||
});
|
||||
|
||||
await PluginAllocations.visit({ id: plugin.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/csi/plugins/:id/allocations shows all allocations in a single table', async function(assert) {
|
||||
|
||||
@@ -20,8 +20,7 @@ module('Acceptance | plugin detail', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await PluginDetail.visit({ id: plugin.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/csi/plugins/:id should have a breadcrumb trail linking back to Plugins and Storage', async function(assert) {
|
||||
|
||||
@@ -17,8 +17,7 @@ module('Acceptance | plugins list', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await PluginsList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('visiting /csi/plugins', async function(assert) {
|
||||
|
||||
@@ -21,8 +21,7 @@ module('Acceptance | regions (only one)', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await JobsList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('when there is only one region, the region switcher is not shown in the nav bar and the region is not in the page title', async function(assert) {
|
||||
|
||||
@@ -18,8 +18,7 @@ module('Acceptance | server detail', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('visiting /servers/:server_name', async function(assert) {
|
||||
|
||||
@@ -27,8 +27,7 @@ module('Acceptance | server monitor', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await ServerMonitor.visit({ name: agent.name });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/servers/:id/monitor should have a breadcrumb trail linking back to servers', async function(assert) {
|
||||
|
||||
@@ -27,8 +27,7 @@ module('Acceptance | servers list', function(hooks) {
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
minimumSetup();
|
||||
await ServersList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/servers should list all servers', async function(assert) {
|
||||
|
||||
@@ -24,8 +24,7 @@ module('Acceptance | task detail', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/allocation/:id/:task_name should name the task and list high-level task information', async function(assert) {
|
||||
|
||||
@@ -70,8 +70,7 @@ module('Acceptance | task group detail', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await TaskGroup.visit({ id: job.id, name: taskGroup.name });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/jobs/:id/:task-group should list high-level metrics for the allocation', async function(assert) {
|
||||
|
||||
@@ -26,8 +26,7 @@ module('Acceptance | task logs', function(hooks) {
|
||||
});
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/allocation/:id/:task_name/logs should have a log component', async function(assert) {
|
||||
|
||||
@@ -30,8 +30,7 @@ module('Acceptance | tokens', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await Tokens.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('the token form sets the token in local storage', async function(assert) {
|
||||
|
||||
@@ -31,8 +31,7 @@ module('Acceptance | volume detail', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await VolumeDetail.visit({ id: volume.id });
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('/csi/volumes/:id should have a breadcrumb trail linking back to Volumes and Storage', async function(assert) {
|
||||
|
||||
@@ -29,8 +29,7 @@ module('Acceptance | volumes list', function(hooks) {
|
||||
|
||||
test('it passes an accessibility audit', async function(assert) {
|
||||
await VolumesList.visit();
|
||||
await a11yAudit();
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
await a11yAudit(assert);
|
||||
});
|
||||
|
||||
test('visiting /csi redirects to /csi/volumes', async function(assert) {
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
||||
|
||||
export default async function defaultA11yAudit(...overriddenRules) {
|
||||
function appendRuleOverrides(overriddenRules) {
|
||||
const rules = {
|
||||
'color-contrast': {
|
||||
enabled: false
|
||||
enabled: false,
|
||||
},
|
||||
'heading-order': {
|
||||
enabled: false
|
||||
}
|
||||
enabled: false,
|
||||
},
|
||||
};
|
||||
|
||||
overriddenRules.forEach(rule => rules[rule] = { enabled: false });
|
||||
overriddenRules.forEach(rule => (rules[rule] = { enabled: false }));
|
||||
|
||||
await a11yAudit({rules});
|
||||
return rules;
|
||||
}
|
||||
|
||||
export default async function defaultA11yAudit(assert, ...overriddenRules) {
|
||||
await a11yAudit({ rules: appendRuleOverrides(overriddenRules) });
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
}
|
||||
|
||||
export async function componentA11yAudit(element, assert, ...overriddenRules) {
|
||||
await a11yAudit(element, { rules: appendRuleOverrides(overriddenRules) });
|
||||
assert.ok(true, 'a11y audit passes');
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ import { find, render, settled } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import Pretender from 'pretender';
|
||||
import sinon from 'sinon';
|
||||
import { logEncode } from '../../mirage/data/logs';
|
||||
import { selectOpen, selectOpenChoose } from '../utils/ember-power-select-extensions';
|
||||
import { logEncode } from '../../../mirage/data/logs';
|
||||
import { selectOpen, selectOpenChoose } from '../../utils/ember-power-select-extensions';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | agent-monitor', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -53,6 +54,8 @@ module('Integration | Component | agent-monitor', function(hooks) {
|
||||
assert.ok(find('[data-test-toggle]'));
|
||||
assert.ok(find('[data-test-log-box]'));
|
||||
assert.ok(find('[data-test-log-box].is-full-bleed.is-dark'));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when provided with a client, AgentMonitor streams logs for the client', async function(assert) {
|
||||
@@ -1,11 +1,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import generateResources from '../../mirage/data/generate-resources';
|
||||
import generateResources from '../../../mirage/data/generate-resources';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { find, render } from '@ember/test-helpers';
|
||||
import Response from 'ember-cli-mirage/response';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | allocation row', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -105,6 +106,7 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
`);
|
||||
|
||||
assert.ok(find('[data-test-icon="unhealthy-driver"]'), 'Unhealthy driver icon is shown');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Allocation row shows an icon indicator when it was preempted', async function(assert) {
|
||||
@@ -119,6 +121,7 @@ module('Integration | Component | allocation row', function(hooks) {
|
||||
`);
|
||||
|
||||
assert.ok(find('[data-test-icon="preemption"]'), 'Preempted icon is shown');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when an allocation is not running, the utilization graphs are omitted', async function(assert) {
|
||||
@@ -5,6 +5,7 @@ import { setupRenderingTest } from 'ember-qunit';
|
||||
import { findAll, render, settled } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import PromiseObject from 'nomad-ui/utils/classes/promise-object';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | app breadcrumbs', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -24,7 +25,7 @@ module('Integration | Component | app breadcrumbs', function(hooks) {
|
||||
const commonCrumbs = [{ label: 'One', args: ['one'] }, { label: 'Two', args: ['two'] }];
|
||||
|
||||
const template = hbs`
|
||||
<AppBreadcrumbs />
|
||||
<ul><AppBreadcrumbs /></ul>
|
||||
`;
|
||||
|
||||
test('breadcrumbs comes from the breadcrumbs service', async function(assert) {
|
||||
@@ -75,6 +76,8 @@ module('Integration | Component | app breadcrumbs', function(hooks) {
|
||||
'Promise breadcrumb is in a loading state'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
resolvePromise({ label: 'Two', args: ['two'] });
|
||||
|
||||
return settled().then(() => {
|
||||
@@ -2,6 +2,7 @@ import { find, findAll, render } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import flat from 'flat';
|
||||
|
||||
const { flatten } = flat;
|
||||
@@ -36,6 +37,8 @@ module('Integration | Component | attributes table', function(hooks) {
|
||||
rowsCount,
|
||||
`Table has ${rowsCount} rows with values`
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('should render the full path of key/value pair from the root of the object', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { click, render } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
import sinon from 'sinon';
|
||||
|
||||
@@ -14,10 +15,11 @@ module('Integration | Component | copy-button', function(hooks) {
|
||||
await render(hbs`<CopyButton @class="copy-button" />`);
|
||||
|
||||
assert.dom('.copy-button .icon-is-copy-action').exists();
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('it shows the success icon on success and resets afterward', async function(assert) {
|
||||
const clock = sinon.useFakeTimers();
|
||||
const clock = sinon.useFakeTimers({ shouldAdvanceTime: true });
|
||||
|
||||
await render(hbs`<CopyButton @class="copy-button" />`);
|
||||
|
||||
@@ -25,6 +27,7 @@ module('Integration | Component | copy-button', function(hooks) {
|
||||
await triggerCopySuccess('.copy-button button');
|
||||
|
||||
assert.dom('.copy-button .icon-is-copy-success').exists();
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
clock.runAll();
|
||||
|
||||
@@ -41,5 +44,6 @@ module('Integration | Component | copy-button', function(hooks) {
|
||||
await triggerCopyError('.copy-button button');
|
||||
|
||||
assert.dom('.copy-button .icon-is-alert-triangle').exists();
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,8 @@ import { setupRenderingTest } from 'ember-qunit';
|
||||
import { find, render, settled } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import Pretender from 'pretender';
|
||||
import { logEncode } from '../../../mirage/data/logs';
|
||||
import { logEncode } from '../../../../mirage/data/logs';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
const { assign } = Object;
|
||||
const HOST = '1.1.1.1:1111';
|
||||
@@ -77,6 +78,8 @@ module('Integration | Component | fs/file', function(hooks) {
|
||||
find('[data-test-file-box] [data-test-image-file]'),
|
||||
'The image file component was not rendered'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('When a file is an image, the file mode is image', async function(assert) {
|
||||
@@ -93,6 +96,8 @@ module('Integration | Component | fs/file', function(hooks) {
|
||||
find('[data-test-file-box] [data-test-log-cli]'),
|
||||
'The streaming file component was not rendered'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('When the file is neither text-based or an image, the unsupported file type empty state is shown', async function(assert) {
|
||||
@@ -110,6 +115,7 @@ module('Integration | Component | fs/file', function(hooks) {
|
||||
'The streaming file component was not rendered'
|
||||
);
|
||||
assert.ok(find('[data-test-unsupported-type]'), 'Unsupported file type message is shown');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('The unsupported file type empty state includes a link to the raw file', async function(assert) {
|
||||
@@ -220,6 +226,8 @@ module('Integration | Component | fs/file', function(hooks) {
|
||||
find('[data-test-header] [data-test-yield-spy]'),
|
||||
'Yielded content shows up in the header'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('The body is full-bleed and dark when the file is streaming', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { find, render } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
import gaugeChart from 'nomad-ui/tests/pages/components/gauge-chart';
|
||||
|
||||
@@ -30,6 +31,8 @@ module('Integration | Component | gauge chart', function(hooks) {
|
||||
assert.equal(GaugeChart.label, props.label);
|
||||
assert.equal(GaugeChart.percentage, '50%');
|
||||
assert.ok(GaugeChart.svgIsPresent);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the width of the chart is determined based on the container and the height is a function of the width', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { find, settled } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import sinon from 'sinon';
|
||||
import RSVP from 'rsvp';
|
||||
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
|
||||
@@ -30,6 +31,8 @@ module('Integration | Component | image file', function(hooks) {
|
||||
commonProperties.src,
|
||||
`src is ${commonProperties.src}`
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the image is wrapped in an anchor that links directly to the image', async function(assert) {
|
||||
@@ -2,7 +2,8 @@ import { findAll, find, render } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import cleanWhitespace from '../utils/clean-whitespace';
|
||||
import cleanWhitespace from '../../utils/clean-whitespace';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job diff', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -55,6 +56,8 @@ module('Integration | Component | job diff', function(hooks) {
|
||||
'- Removed Field: "12"',
|
||||
'Removed field is rendered correctly'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('job object diffs', async function(assert) {
|
||||
@@ -156,6 +159,8 @@ module('Integration | Component | job diff', function(hooks) {
|
||||
this.get('diff').Objects[1].Objects[0].Fields.length,
|
||||
'Objects within objects are rendered'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
function field(name, type, newVal, oldVal) {
|
||||
@@ -8,6 +8,7 @@ import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import jobEditor from 'nomad-ui/tests/pages/components/job-editor';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import setupCodeMirror from 'nomad-ui/tests/helpers/codemirror';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
const Editor = create(jobEditor());
|
||||
|
||||
@@ -109,6 +110,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
await renderNewJob(this, job);
|
||||
assert.ok(Editor.editorHelp.isPresent, 'Editor explanation popup is present');
|
||||
assert.ok(Editor.editor.isPresent, 'Editor is present');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the explanation popup can be dismissed', async function(assert) {
|
||||
@@ -168,6 +171,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
assert.ok(Editor.planOutput, 'The plan is outputted');
|
||||
assert.notOk(Editor.editor.isPresent, 'The editor is replaced with the plan output');
|
||||
assert.ok(Editor.planHelp.isPresent, 'The plan explanation popup is shown');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('from the plan screen, the cancel button goes back to the editor with the job still in tact', async function(assert) {
|
||||
@@ -199,6 +204,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
errorMessage,
|
||||
'The error message from the server is shown in the error in the UI'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when plan fails, the plan error message is shown', async function(assert) {
|
||||
@@ -219,6 +226,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
errorMessage,
|
||||
'The error message from the server is shown in the error in the UI'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when run fails, the run error message is shown', async function(assert) {
|
||||
@@ -240,6 +249,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
errorMessage,
|
||||
'The error message from the server is shown in the error in the UI'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the scheduler dry-run has warnings, the warnings are shown to the user', async function(assert) {
|
||||
@@ -260,6 +271,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
Editor.dryRunMessage.body.includes(newJobTaskGroupName),
|
||||
'The scheduler dry-run message includes the warning from send back by the API'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the scheduler dry-run has no warnings, a success message is shown to the user', async function(assert) {
|
||||
@@ -276,6 +289,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
Editor.dryRunMessage.errored,
|
||||
'The warning message is not shown in addition to the success message'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when a job is submitted in the edit context, a POST request is made to the update job endpoint', async function(assert) {
|
||||
@@ -330,6 +345,8 @@ module('Integration | Component | job-editor', function(hooks) {
|
||||
|
||||
await renderEditJob(this, job);
|
||||
assert.ok(Editor.cancelEditingIsAvailable, 'Cancel editing button exists');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the job-editor cancel button is clicked, the onCancel hook is called', async function(assert) {
|
||||
@@ -3,6 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
|
||||
import { find, findAll, render } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/parts/body', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -49,6 +50,8 @@ module('Integration | Component | job-page/parts/body', function(hooks) {
|
||||
assert.ok(subnavLabels.some(label => label === 'Definition'), 'Definition link');
|
||||
assert.ok(subnavLabels.some(label => label === 'Versions'), 'Versions link');
|
||||
assert.ok(subnavLabels.some(label => label === 'Deployments'), 'Deployments link');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the subnav does not include the deployments link when the job is not a service', async function(assert) {
|
||||
@@ -5,6 +5,7 @@ import sinon from 'sinon';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/parts/children', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -92,6 +93,8 @@ module('Integration | Component | job-page/parts/children', function(hooks) {
|
||||
assert.ok(
|
||||
new RegExp(`1.10.+?${childrenCount}`).test(find('.pagination-numbers').textContent.trim())
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('is sorted based on the sortProperty and sortDescending properties', async function(assert) {
|
||||
@@ -5,6 +5,7 @@ import hbs from 'htmlbars-inline-precompile';
|
||||
import moment from 'moment';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/parts/latest-deployment', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -108,6 +109,8 @@ module('Integration | Component | job-page/parts/latest-deployment', function(ho
|
||||
deployment.get('statusDescription'),
|
||||
'Status description is in the metrics block'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when there is no running deployment, the latest deployment section shows up for the last deployment', async function(assert) {
|
||||
@@ -149,6 +152,8 @@ module('Integration | Component | job-page/parts/latest-deployment', function(ho
|
||||
|
||||
assert.ok(find('[data-test-deployment-task-groups]'), 'Task groups found');
|
||||
assert.ok(find('[data-test-deployment-allocations]'), 'Allocations found');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('each task group in the expanded task group section shows task group details', async function(assert) {
|
||||
@@ -4,6 +4,7 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/parts/placement-failures', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -58,6 +59,8 @@ module('Integration | Component | job-page/parts/placement-failures', function(h
|
||||
'The number of unplaced allocs = CoalescedFailures + 1'
|
||||
);
|
||||
});
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the job has no placement failures, the placement failures section is gone', async function(assert) {
|
||||
@@ -4,6 +4,7 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/parts/summary', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -36,6 +37,8 @@ module('Integration | Component | job-page/parts/summary', function(hooks) {
|
||||
|
||||
assert.ok(find('[data-test-children-status-bar]'), 'Children status bar found');
|
||||
assert.notOk(find('[data-test-allocation-status-bar]'), 'Allocation status bar not found');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('jobs without children use the allocations diagram', async function(assert) {
|
||||
@@ -53,6 +56,8 @@ module('Integration | Component | job-page/parts/summary', function(hooks) {
|
||||
|
||||
assert.ok(find('[data-test-allocation-status-bar]'), 'Allocation status bar found');
|
||||
assert.notOk(find('[data-test-children-status-bar]'), 'Children status bar not found');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the allocations diagram lists all allocation status figures', async function(assert) {
|
||||
@@ -176,6 +181,8 @@ module('Integration | Component | job-page/parts/summary', function(hooks) {
|
||||
find('.inline-chart [data-test-allocation-status-bar]'),
|
||||
'Allocation bar is rendered in an inline-chart container'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the collapsed/expanded state is persisted to localStorage', async function(assert) {
|
||||
@@ -5,6 +5,7 @@ import { module, test } from 'qunit';
|
||||
import sinon from 'sinon';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/parts/task-groups', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -56,6 +57,8 @@ module('Integration | Component | job-page/parts/task-groups', function(hooks) {
|
||||
job.get('taskGroups.length'),
|
||||
'One row per task group'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('each row in the task group table should show basic information about the task group', async function(assert) {
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
expectDeleteRequest,
|
||||
expectStartRequest,
|
||||
} from './helpers';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/periodic', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -155,6 +156,8 @@ module('Integration | Component | job-page/periodic', function(hooks) {
|
||||
|
||||
await stopJob();
|
||||
expectError(assert, 'Could Not Stop Job');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Starting a job sends a post request for the job using the current definition', async function(assert) {
|
||||
@@ -7,6 +7,7 @@ import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { startJob, stopJob, expectError, expectDeleteRequest, expectStartRequest } from './helpers';
|
||||
import Job from 'nomad-ui/tests/pages/jobs/detail';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | job-page/service', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -81,6 +82,8 @@ module('Integration | Component | job-page/service', function(hooks) {
|
||||
|
||||
await stopJob();
|
||||
expectError(assert, 'Could Not Stop Job');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Starting a job sends a post request for the job using the current definition', async function(assert) {
|
||||
@@ -126,6 +129,8 @@ module('Integration | Component | job-page/service', function(hooks) {
|
||||
|
||||
assert.equal(allocationRow.shortId, allocation.id.split('-')[0], 'ID');
|
||||
assert.equal(allocationRow.taskGroup, allocation.taskGroup, 'Task Group name');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Recent allocations caps out at five', async function(assert) {
|
||||
@@ -162,6 +167,8 @@ module('Integration | Component | job-page/service', function(hooks) {
|
||||
Job.recentAllocationsEmptyState.headline.includes('No Allocations'),
|
||||
'No allocations empty message'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Active deployment can be promoted', async function(assert) {
|
||||
@@ -213,6 +220,8 @@ module('Integration | Component | job-page/service', function(hooks) {
|
||||
'The error message mentions ACLs'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
await click('[data-test-job-error-close]');
|
||||
|
||||
assert.notOk(find('[data-test-job-error-title]'), 'Error message is dismissable');
|
||||
@@ -2,6 +2,7 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render, settled } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
import LifecycleChart from 'nomad-ui/tests/pages/components/lifecycle-chart';
|
||||
|
||||
@@ -56,6 +57,8 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||
assert.notOk(task.isActive);
|
||||
assert.notOk(task.isFinished);
|
||||
});
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('it doesn’t render when there’s only one phase', async function(assert) {
|
||||
@@ -92,6 +95,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||
|
||||
assert.ok(Chart.phases[1].isActive);
|
||||
assert.ok(Chart.tasks[3].isActive);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
this.set('taskStates.firstObject.finishedAt', new Date());
|
||||
await settled();
|
||||
|
||||
@@ -4,6 +4,7 @@ import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import sinon from 'sinon';
|
||||
import moment from 'moment';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
const REF_DATE = new Date();
|
||||
|
||||
@@ -33,6 +34,8 @@ module('Integration | Component | line chart', function(hooks) {
|
||||
`${datum.type} event at ${datum.x}`
|
||||
);
|
||||
});
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when a chart has annotations and is timeseries, annotations are sorted reverse-chronologically', async function(assert) {
|
||||
@@ -123,5 +126,7 @@ module('Integration | Component | line chart', function(hooks) {
|
||||
assert.notOk(annotationEls[0].classList.contains('is-staggered'));
|
||||
assert.ok(annotationEls[1].classList.contains('is-staggered'));
|
||||
assert.notOk(annotationEls[2].classList.contains('is-staggered'));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import { findAll, find, render } from '@ember/test-helpers';
|
||||
import { module, skip, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | list pagination', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -38,6 +39,7 @@ module('Integration | Component | list pagination', function(hooks) {
|
||||
|
||||
assert.ok(!findAll('.first').length, 'On the first page, there is no first link');
|
||||
assert.ok(!findAll('.prev').length, 'On the first page, there is no prev link');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
assert.equal(
|
||||
findAll('.link').length,
|
||||
@@ -51,6 +53,7 @@ module('Integration | Component | list pagination', function(hooks) {
|
||||
|
||||
assert.ok(findAll('.next').length, 'While not on the last page, there is a next link');
|
||||
assert.ok(findAll('.last').length, 'While not on the last page, there is a last link');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
assert.ok(
|
||||
findAll('.item').length,
|
||||
@@ -3,6 +3,7 @@ import { module, skip, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import faker from 'nomad-ui/mirage/faker';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | list table', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -64,6 +65,8 @@ module('Integration | Component | list table', function(hooks) {
|
||||
assert.equal($item.querySelectorAll('td')[1].innerHTML.trim(), item.lastName, 'Last name');
|
||||
assert.equal($item.querySelectorAll('td')[2].innerHTML.trim(), item.age, 'Age');
|
||||
});
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
// Ember doesn't support query params (or controllers or routes) in integration tests,
|
||||
@@ -3,6 +3,7 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import sinon from 'sinon';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
const TAB = 9;
|
||||
const ESC = 27;
|
||||
@@ -47,6 +48,8 @@ module('Integration | Component | multi-select dropdown', function(hooks) {
|
||||
'Trigger is appropriately labeled'
|
||||
);
|
||||
assert.notOk(find('[data-test-dropdown-options]'), 'Options are not rendered');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('component opens the options dropdown when clicked', async function(assert) {
|
||||
@@ -57,6 +60,8 @@ module('Integration | Component | multi-select dropdown', function(hooks) {
|
||||
await click('[data-test-dropdown-trigger]');
|
||||
|
||||
await assert.ok(find('[data-test-dropdown-options]'), 'Options are shown now');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
await click('[data-test-dropdown-trigger]');
|
||||
|
||||
assert.notOk(find('[data-test-dropdown-options]'), 'Options are hidden after clicking again');
|
||||
@@ -114,6 +119,8 @@ module('Integration | Component | multi-select dropdown', function(hooks) {
|
||||
'The count is accurate'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
|
||||
await this.set('selection', []);
|
||||
|
||||
assert.notOk(
|
||||
@@ -301,5 +308,6 @@ module('Integration | Component | multi-select dropdown', function(hooks) {
|
||||
assert.ok(find('[data-test-dropdown-options]'), 'The dropdown is still shown');
|
||||
assert.ok(find('[data-test-dropdown-empty]'), 'The empty state is shown');
|
||||
assert.notOk(find('[data-test-dropdown-option]'), 'No options are shown');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
});
|
||||
@@ -3,6 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
|
||||
import { find, click, render } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | page layout', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -25,6 +26,7 @@ module('Integration | Component | page layout', function(hooks) {
|
||||
await click('[data-test-header-gutter-toggle]');
|
||||
|
||||
assert.ok(find('[data-test-gutter-menu]').classList.contains('is-open'), 'Gutter menu is open');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the gutter-menu hamburger menu closes the gutter menu', async function(assert) {
|
||||
@@ -3,7 +3,8 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { assign } from '@ember/polyfills';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import cleanWhitespace from '../utils/clean-whitespace';
|
||||
import cleanWhitespace from '../../utils/clean-whitespace';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | placement failures', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -78,6 +79,8 @@ module('Integration | Component | placement failures', function(hooks) {
|
||||
'Quota exhausted message shown'
|
||||
);
|
||||
assert.equal(findAll('[data-test-placement-failure-scores]').length, 1, 'Scores message shown');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('should render correctly when a node is not evaluated', async function(assert) {
|
||||
@@ -101,6 +104,8 @@ module('Integration | Component | placement failures', function(hooks) {
|
||||
0,
|
||||
'Nodes exhausted message NOT shown when there are no nodes exhausted'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
function createFixture(obj = {}, name = 'Placement Failure') {
|
||||
@@ -4,6 +4,7 @@ import hbs from 'htmlbars-inline-precompile';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { render, settled } from '@ember/test-helpers';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | plugin allocation row', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -39,6 +40,7 @@ module('Integration | Component | plugin allocation row', function(hooks) {
|
||||
req.url.startsWith('/v1/allocation')
|
||||
);
|
||||
assert.equal(allocationRequest.url, `/v1/allocation/${storageController.allocID}`);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('After the plugin allocation row fetches the plugin allocation, allocation stats are fetched', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { click } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
import popoverMenuPageObject from 'nomad-ui/tests/pages/components/popover-menu';
|
||||
|
||||
@@ -39,6 +40,7 @@ module('Integration | Component | popover-menu', function(hooks) {
|
||||
assert.ok(PopoverMenu.labelHasIcon);
|
||||
assert.notOk(PopoverMenu.menu.isOpen);
|
||||
assert.equal(PopoverMenu.label, props.label);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('clicking the trigger button toggles the popover menu', async function(assert) {
|
||||
@@ -50,6 +52,7 @@ module('Integration | Component | popover-menu', function(hooks) {
|
||||
await PopoverMenu.toggle();
|
||||
|
||||
assert.ok(PopoverMenu.menu.isOpen);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the trigger gets the triggerClass prop assigned as a class', async function(assert) {
|
||||
@@ -4,6 +4,7 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { find, render } from '@ember/test-helpers';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import { task } from 'ember-concurrency';
|
||||
import sinon from 'sinon';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
@@ -75,6 +76,7 @@ module('Integration | Component | primary metric', function(hooks) {
|
||||
assert.ok(find('[data-test-percentage-bar]'), 'Percentage bar');
|
||||
assert.ok(find('[data-test-percentage]'), 'Percentage figure');
|
||||
assert.ok(find('[data-test-absolute-value]'), 'Absolute usage figure');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('The CPU metric maps to is-info', async function(assert) {
|
||||
@@ -3,6 +3,7 @@ import { setupRenderingTest } from 'ember-qunit';
|
||||
import { find, findAll, render } from '@ember/test-helpers';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import moment from 'moment';
|
||||
|
||||
module('Integration | Component | reschedule event timeline', function(hooks) {
|
||||
@@ -69,6 +70,8 @@ module('Integration | Component | reschedule event timeline', function(hooks) {
|
||||
allocation.get('clientStatus'),
|
||||
'Allocation shows the status'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the allocation has failed and there is a follow up evaluation, a note with a time is shown', async function(assert) {
|
||||
@@ -93,6 +96,8 @@ module('Integration | Component | reschedule event timeline', function(hooks) {
|
||||
'Stop warning is shown since the last allocation failed'
|
||||
);
|
||||
assert.notOk(find('[data-test-attempt-notice]'), 'Reschdule attempt notice is not shown');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the allocation has failed and there is no follow up evaluation, a warning is shown', async function(assert) {
|
||||
@@ -126,6 +131,8 @@ module('Integration | Component | reschedule event timeline', function(hooks) {
|
||||
'Reschedule notice is shown since the follow up eval says so'
|
||||
);
|
||||
assert.notOk(find('[data-test-stop-warning]'), 'Stop warning is not shown');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when the allocation has a next allocation already, it is shown in the timeline', async function(assert) {
|
||||
@@ -5,6 +5,7 @@ import hbs from 'htmlbars-inline-precompile';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import setupCodeMirror from 'nomad-ui/tests/helpers/codemirror';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | scale-events-accordion', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -40,6 +41,7 @@ module('Integration | Component | scale-events-accordion', function(hooks) {
|
||||
await render(commonTemplate);
|
||||
|
||||
assert.equal(findAll('[data-test-scale-events] [data-test-accordion-head]').length, eventCount);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when an event is an error, an error icon is shown', async function(assert) {
|
||||
@@ -51,6 +53,7 @@ module('Integration | Component | scale-events-accordion', function(hooks) {
|
||||
await render(commonTemplate);
|
||||
|
||||
assert.ok(find('[data-test-error]'));
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when an event has a count higher than previous count, a danger up arrow is shown', async function(assert) {
|
||||
@@ -69,6 +72,7 @@ module('Integration | Component | scale-events-accordion', function(hooks) {
|
||||
.querySelector('.icon')
|
||||
.classList.contains('is-danger')
|
||||
);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when an event has a count lower than previous count, a primary down arrow is shown', async function(assert) {
|
||||
@@ -110,6 +114,7 @@ module('Integration | Component | scale-events-accordion', function(hooks) {
|
||||
await render(commonTemplate);
|
||||
|
||||
assert.ok(find('[data-test-accordion-toggle]').classList.contains('is-invisible'));
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when an event has meta properties, the accordion entry is expanding, presenting the meta properties in a json viewer', async function(assert) {
|
||||
@@ -134,5 +139,6 @@ module('Integration | Component | scale-events-accordion', function(hooks) {
|
||||
getCodeMirrorInstance('[data-test-json-viewer]').getValue(),
|
||||
JSON.stringify(meta, null, 2)
|
||||
);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import { click, find, findAll, render } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import moment from 'moment';
|
||||
import setupCodeMirror from 'nomad-ui/tests/helpers/codemirror';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
module('Integration | Component | scale-events-chart', function(hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@@ -58,6 +59,7 @@ module('Integration | Component | scale-events-chart', function(hooks) {
|
||||
findAll('[data-test-annotation]').length,
|
||||
events.filter(ev => ev.count == null).length
|
||||
);
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('clicking an annotation presents details for the event', async function(assert) {
|
||||
@@ -82,6 +84,8 @@ module('Integration | Component | scale-events-chart', function(hooks) {
|
||||
getCodeMirrorInstance('[data-test-json-viewer]').getValue(),
|
||||
JSON.stringify(annotation.meta, null, 2)
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('clicking an active annotation closes event details', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { find, render, settled, triggerEvent, waitUntil } from '@ember/test-help
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import sinon from 'sinon';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
import stepperInput from 'nomad-ui/tests/pages/components/stepper-input';
|
||||
@@ -49,6 +50,8 @@ module('Integration | Component | stepper input', function(hooks) {
|
||||
assert.ok(StepperInput.increment.isPresent);
|
||||
assert.ok(StepperInput.decrement.classNames.split(' ').includes(this.classVariant));
|
||||
assert.ok(StepperInput.increment.classNames.split(' ').includes(this.classVariant));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('clicking the increment and decrement buttons immediately changes the shown value in the input but debounces the onUpdate call', async function(assert) {
|
||||
@@ -3,8 +3,9 @@ import { find, settled, triggerKeyEvent } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import Pretender from 'pretender';
|
||||
import { logEncode } from '../../mirage/data/logs';
|
||||
import { logEncode } from '../../../mirage/data/logs';
|
||||
import fetch from 'nomad-ui/utils/fetch';
|
||||
import Log from 'nomad-ui/utils/classes/log';
|
||||
|
||||
@@ -64,6 +65,7 @@ module('Integration | Component | streaming file', function(hooks) {
|
||||
'Query params are correct'
|
||||
);
|
||||
assert.equal(find('[data-test-output]').textContent, 'Hello World');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when mode is `tail`, the logger signals tail', async function(assert) {
|
||||
@@ -4,6 +4,7 @@ import { click, find, render, settled, waitUntil } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { startMirage } from 'nomad-ui/initializers/ember-cli-mirage';
|
||||
import { initialize as fragmentSerializerInitializer } from 'nomad-ui/initializers/fragment-serializer';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
|
||||
const jobName = 'test-job';
|
||||
const jobId = JSON.stringify([jobName, 'default']);
|
||||
@@ -83,6 +84,8 @@ module('Integration | Component | task group row', function(hooks) {
|
||||
|
||||
await settled();
|
||||
assert.ok(find('[data-test-scale]'));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Clicking scaling buttons immediately updates the rendered count but debounces the scaling API request', async function(assert) {
|
||||
@@ -130,6 +133,8 @@ module('Integration | Component | task group row', function(hooks) {
|
||||
|
||||
await render(commonTemplate);
|
||||
assert.ok(find('[data-test-scale="increment"]:disabled'));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('When the current count is equal to the min count, the decrement count button is disabled', async function(assert) {
|
||||
@@ -144,6 +149,8 @@ module('Integration | Component | task group row', function(hooks) {
|
||||
|
||||
await render(commonTemplate);
|
||||
assert.ok(find('[data-test-scale="decrement"]:disabled'));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('When there is an active deployment, both scale buttons are disabled', async function(assert) {
|
||||
@@ -157,6 +164,8 @@ module('Integration | Component | task group row', function(hooks) {
|
||||
await render(commonTemplate);
|
||||
assert.ok(find('[data-test-scale="increment"]:disabled'));
|
||||
assert.ok(find('[data-test-scale="decrement"]:disabled'));
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('When the current ACL token does not have the namespace:scale-job or namespace:submit-job policy rule', async function(assert) {
|
||||
@@ -3,8 +3,9 @@ import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { find, click, render, settled } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import Pretender from 'pretender';
|
||||
import { logEncode } from '../../mirage/data/logs';
|
||||
import { logEncode } from '../../../mirage/data/logs';
|
||||
|
||||
const HOST = '1.1.1.1:1111';
|
||||
const allowedConnectionTime = 100;
|
||||
@@ -85,6 +86,8 @@ module('Integration | Component | task log', function(hooks) {
|
||||
find('pre.cli-window'),
|
||||
'Cli is preformatted and using the cli-window component class'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Streaming starts on creation', async function(assert) {
|
||||
@@ -105,6 +108,8 @@ module('Integration | Component | task log', function(hooks) {
|
||||
streamFrames[0],
|
||||
'First chunk of streaming log is shown'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('Clicking Head loads the log head', async function(assert) {
|
||||
@@ -285,6 +290,8 @@ module('Integration | Component | task log', function(hooks) {
|
||||
|
||||
await click('[data-test-connection-error-dismiss]');
|
||||
assert.notOk(find('[data-test-connection-error]'), 'The error message is dismissable');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('When the client is inaccessible, the server is accessible, and stderr is pressed before the client timeout occurs, the no connection error is not shown', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { find, settled } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import sinon from 'sinon';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
import togglePageObject from 'nomad-ui/tests/pages/components/toggle';
|
||||
@@ -46,6 +47,8 @@ module('Integration | Component | toggle', function(hooks) {
|
||||
'checkbox',
|
||||
'The input type is checkbox'
|
||||
);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the isActive property dictates the active state and class', async function(assert) {
|
||||
@@ -61,6 +64,8 @@ module('Integration | Component | toggle', function(hooks) {
|
||||
|
||||
assert.ok(Toggle.isActive);
|
||||
assert.ok(Toggle.hasActiveClass);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('the isDisabled property dictates the disabled state and class', async function(assert) {
|
||||
@@ -76,6 +81,8 @@ module('Integration | Component | toggle', function(hooks) {
|
||||
|
||||
assert.ok(Toggle.isDisabled);
|
||||
assert.ok(Toggle.hasDisabledClass);
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('toggling the input calls the onToggle action', async function(assert) {
|
||||
@@ -2,6 +2,7 @@ import { find, click, render } from '@ember/test-helpers';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { componentA11yAudit } from 'nomad-ui/tests/helpers/a11y-audit';
|
||||
import sinon from 'sinon';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
|
||||
@@ -45,6 +46,8 @@ module('Integration | Component | two step button', function(hooks) {
|
||||
assert.notOk(find('[data-test-cancel-button]'), 'No cancel button yet');
|
||||
assert.notOk(find('[data-test-confirm-button]'), 'No confirm button yet');
|
||||
assert.notOk(find('[data-test-confirmation-message]'), 'No confirmation message yet');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('clicking the idle state button transitions into the promptForConfirmation state', async function(assert) {
|
||||
@@ -67,6 +70,7 @@ module('Integration | Component | two step button', function(hooks) {
|
||||
);
|
||||
|
||||
assert.notOk(find('[data-test-idle-button]'), 'No more idle button');
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('canceling in the promptForConfirmation state calls the onCancel hook and resets to the idle state', async function(assert) {
|
||||
@@ -106,6 +110,8 @@ module('Integration | Component | two step button', function(hooks) {
|
||||
assert.ok(TwoStepButton.cancelIsDisabled, 'The cancel button is disabled');
|
||||
assert.ok(TwoStepButton.confirmIsDisabled, 'The confirm button is disabled');
|
||||
assert.ok(TwoStepButton.isRunning, 'The confirm button is in a loading state');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
|
||||
test('when in the prompt state, clicking outside will reset state back to idle', async function(assert) {
|
||||
@@ -161,5 +167,7 @@ module('Integration | Component | two step button', function(hooks) {
|
||||
|
||||
await TwoStepButton.idle();
|
||||
assert.ok(find('[data-test-idle-button]'), 'Still in the idle state after clicking');
|
||||
|
||||
await componentA11yAudit(this.element, assert);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user