From 8154d68b95ef70775a6bcaf90a05eda4c45144e8 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 11 Jul 2018 12:42:43 -0700 Subject: [PATCH] Consistently use PageObjects now that they all exist --- ui/tests/acceptance/job-detail-test.js | 3 +-- ui/tests/acceptance/task-detail-test.js | 3 +-- ui/tests/acceptance/token-test.js | 17 ++++++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ui/tests/acceptance/job-detail-test.js b/ui/tests/acceptance/job-detail-test.js index b4950ab7b..0ea4acfa0 100644 --- a/ui/tests/acceptance/job-detail-test.js +++ b/ui/tests/acceptance/job-detail-test.js @@ -1,4 +1,4 @@ -import { currentURL, visit } from 'ember-native-dom-helpers'; +import { currentURL } from 'ember-native-dom-helpers'; import { test } from 'qunit'; import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance'; import moduleForJob from 'nomad-ui/tests/helpers/module-for-job'; @@ -35,7 +35,6 @@ moduleForJob('Acceptance | job detail (service)', () => server.create('job', { t let job; test('when the job is not found, an error message is shown, but the URL persists', function(assert) { - visit('/jobs/not-a-real-job'); JobDetail.visit({ id: 'not-a-real-job' }); andThen(() => { diff --git a/ui/tests/acceptance/task-detail-test.js b/ui/tests/acceptance/task-detail-test.js index e2c6754a2..c4e43c56c 100644 --- a/ui/tests/acceptance/task-detail-test.js +++ b/ui/tests/acceptance/task-detail-test.js @@ -1,4 +1,4 @@ -import { currentURL, visit } from 'ember-native-dom-helpers'; +import { currentURL } from 'ember-native-dom-helpers'; import { test } from 'qunit'; import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance'; import Task from 'nomad-ui/tests/pages/allocations/task/detail'; @@ -189,7 +189,6 @@ moduleForAcceptance('Acceptance | task detail (no addresses)', { allocation = server.create('allocation', 'withoutTaskWithPorts'); task = server.db.taskStates.where({ allocationId: allocation.id })[0]; - visit(`/allocations/${allocation.id}/${task.name}`); Task.visit({ id: allocation.id, name: task.name }); }, }); diff --git a/ui/tests/acceptance/token-test.js b/ui/tests/acceptance/token-test.js index e0acd37ca..1b48a241b 100644 --- a/ui/tests/acceptance/token-test.js +++ b/ui/tests/acceptance/token-test.js @@ -1,7 +1,10 @@ -import { find, visit } from 'ember-native-dom-helpers'; +import { find } from 'ember-native-dom-helpers'; import { test, skip } from 'ember-qunit'; import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance'; import Tokens from 'nomad-ui/tests/pages/settings/tokens'; +import Jobs from 'nomad-ui/tests/pages/jobs/list'; +import JobDetail from 'nomad-ui/tests/pages/jobs/detail'; +import ClientDetail from 'nomad-ui/tests/pages/clients/detail'; let job; let node; @@ -39,8 +42,8 @@ skip('the X-Nomad-Token header gets sent with requests once it is set', function const { secretId } = managementToken; let requestPosition = 0; - visit(`/jobs/${job.id}`); - visit(`/clients/${node.id}`); + JobDetail.visit({ id: job.id }); + ClientDetail.visit({ id: node.id }); andThen(() => { assert.ok(server.pretender.handledRequests.length > 1, 'Requests have been made'); @@ -58,8 +61,8 @@ skip('the X-Nomad-Token header gets sent with requests once it is set', function Tokens.secret(secretId).submit(); }); - visit(`/jobs/${job.id}`); - visit(`/clients/${node.id}`); + JobDetail.visit({ id: job.id }); + ClientDetail.visit({ id: node.id }); andThen(() => { const newRequests = server.pretender.handledRequests.slice(requestPosition); @@ -147,7 +150,7 @@ test('a success message and associated policies are shown when authenticating su test('setting a token clears the store', function(assert) { const { secretId } = clientToken; - visit('/jobs'); + Jobs.visit(); andThen(() => { assert.ok(find('.job-row'), 'Jobs found'); @@ -166,7 +169,7 @@ test('setting a token clears the store', function(assert) { }); }); - visit('/jobs'); + Jobs.visit(); // If jobs are lingering in the store, they would show up assert.notOk(find('[data-test-job-row]'), 'No jobs found');