Test coverage for error page escape hatch links

This commit is contained in:
Michael Lange 2018-11-07 16:19:45 -08:00
parent 177a998b1d
commit f3110f978e
3 changed files with 29 additions and 2 deletions

View file

@ -31,8 +31,8 @@
{{/if}}
</div>
<div class="error-links">
{{#link-to "jobs" class="button is-white"}}Go to Jobs{{/link-to}}
{{#link-to "clients" class="button is-white"}}Go to Clients{{/link-to}}
{{#link-to "jobs" data-test-error-jobs-link class="button is-white"}}Go to Jobs{{/link-to}}
{{#link-to "clients" data-test-error-clients-link class="button is-white"}}Go to Clients{{/link-to}}
</div>
</div>
{{/unless}}

View file

@ -67,3 +67,28 @@ test('the no leader error state gets its own error message', function(assert) {
);
});
});
test('error pages include links to the jobs and clients pages', function(assert) {
visit('/a/non-existent/page');
andThen(() => {
assert.ok(JobsList.error.isPresent, 'An error is shown');
JobsList.error.gotoJobs();
});
andThen(() => {
assert.equal(currentURL(), '/jobs', 'Now on the jobs page');
assert.notOk(JobsList.error.isPresent, 'The error is gone now');
visit('/a/non-existent/page');
});
andThen(() => {
assert.ok(JobsList.error.isPresent, 'An error is shown');
JobsList.error.gotoClients();
});
andThen(() => {
assert.equal(currentURL(), '/clients', 'Now on the clients page');
assert.notOk(JobsList.error.isPresent, 'The error is gone now');
});
});

View file

@ -44,6 +44,8 @@ export default create({
title: text('[data-test-error-title]'),
message: text('[data-test-error-message]'),
seekHelp: clickable('[data-test-error-message] a'),
gotoJobs: clickable('[data-test-error-jobs-link]'),
gotoClients: clickable('[data-test-error-clients-link]'),
},
namespaceSwitcher: {