From d49631bb8aa27918aed5b5c8d02c641fdce953ec Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 7 Nov 2018 16:19:45 -0800 Subject: [PATCH] Test coverage for error page escape hatch links --- ui/app/templates/application.hbs | 4 +-- .../acceptance/application-errors-test.js | 25 +++++++++++++++++++ ui/tests/pages/jobs/list.js | 2 ++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ui/app/templates/application.hbs b/ui/app/templates/application.hbs index fdade0d70..cfa4247bf 100644 --- a/ui/app/templates/application.hbs +++ b/ui/app/templates/application.hbs @@ -31,8 +31,8 @@ {{/if}} {{/unless}} diff --git a/ui/tests/acceptance/application-errors-test.js b/ui/tests/acceptance/application-errors-test.js index b07dbdd63..266375c52 100644 --- a/ui/tests/acceptance/application-errors-test.js +++ b/ui/tests/acceptance/application-errors-test.js @@ -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'); + }); +}); diff --git a/ui/tests/pages/jobs/list.js b/ui/tests/pages/jobs/list.js index 37ebd6746..24aff62f2 100644 --- a/ui/tests/pages/jobs/list.js +++ b/ui/tests/pages/jobs/list.js @@ -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: {