Add assertions for title-area buttons (#7836)

This closes #7452.
This commit is contained in:
Buck Doyle
2020-05-11 11:29:30 -05:00
committed by GitHub
parent 521eed273b
commit 8fb57c408c
4 changed files with 31 additions and 0 deletions

View File

@@ -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`);
@@ -452,6 +453,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) {

View File

@@ -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');

View File

@@ -20,6 +20,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]',

View File

@@ -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(),