Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: add assertions for title-area buttons #7836

Merged
merged 3 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ui/tests/acceptance/allocation-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);

Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 12 additions & 0 deletions ui/tests/helpers/module-for-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 4 additions & 0 deletions ui/tests/pages/allocations/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]',

Expand Down
8 changes: 8 additions & 0 deletions ui/tests/pages/jobs/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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(),
Expand Down