diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index 25e017d5914..7d1cf51f166 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -54,6 +54,7 @@ module('Acceptance | allocation detail', function(hooks) { node.id.split('-')[0], 'Node short id is in the subheading' ); + assert.ok(Allocation.execButton.isPresent); assert.equal(document.title, `Allocation ${allocation.name} - Nomad`); @@ -347,6 +348,12 @@ module('Acceptance | allocation detail (not running)', function(hooks) { 'Empty message is appropriate' ); }); + + test('the exec and stop/restart buttons are absent', async function(assert) { + assert.notOk(Allocation.execButton.isPresent); + assert.notOk(Allocation.stop.isPresent); + assert.notOk(Allocation.restart.isPresent); + }); }); module('Acceptance | allocation detail (preemptions)', function(hooks) { diff --git a/ui/tests/helpers/module-for-job.js b/ui/tests/helpers/module-for-job.js index f5e069cf745..55a5aa4f48f 100644 --- a/ui/tests/helpers/module-for-job.js +++ b/ui/tests/helpers/module-for-job.js @@ -49,6 +49,18 @@ export default function moduleForJob(title, context, jobFactory, additionalTests assert.equal(currentURL(), `/jobs/${job.id}/evaluations`); }); + test('the title buttons are dependent on job status', async function(assert) { + if (job.status === 'dead') { + assert.ok(JobDetail.start.isPresent); + assert.notOk(JobDetail.stop.isPresent); + assert.notOk(JobDetail.execButton.isPresent); + } else { + assert.notOk(JobDetail.start.isPresent); + assert.ok(JobDetail.stop.isPresent); + assert.ok(JobDetail.execButton.isPresent); + } + }); + if (context === 'allocations') { test('allocations for the job are shown in the overview', async function(assert) { assert.ok(JobDetail.allocationsSummary, 'Allocations are shown in the summary section'); diff --git a/ui/tests/pages/allocations/detail.js b/ui/tests/pages/allocations/detail.js index f0ddf45f5e4..9d268d0ef5d 100644 --- a/ui/tests/pages/allocations/detail.js +++ b/ui/tests/pages/allocations/detail.js @@ -19,6 +19,10 @@ export default create({ stop: twoStepButton('[data-test-stop]'), restart: twoStepButton('[data-test-restart]'), + execButton: { + scope: '[data-test-exec-button]', + }, + details: { scope: '[data-test-allocation-details]', diff --git a/ui/tests/pages/jobs/detail.js b/ui/tests/pages/jobs/detail.js index f7676811103..654f9ec4e40 100644 --- a/ui/tests/pages/jobs/detail.js +++ b/ui/tests/pages/jobs/detail.js @@ -9,6 +9,7 @@ import { } from 'ember-cli-page-object'; import allocations from 'nomad-ui/tests/pages/components/allocations'; +import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button'; export default create({ visit: visitable('/jobs/:id'), @@ -22,6 +23,13 @@ export default create({ return this.tabs.toArray().findBy('id', id); }, + stop: twoStepButton('[data-test-stop]'), + start: twoStepButton('[data-test-start]'), + + execButton: { + scope: '[data-test-exec-button]', + }, + stats: collection('[data-test-job-stat]', { id: attribute('data-test-job-stat'), text: text(),