open-nomad/ui/tests/pages/exec.js
Buck Doyle f10906e006
UI: add exec handling for dead jobs/task states (#7637)
This closes #7456. It hides the terminal when the job is dead and
displays an error when trying to open an exec session for a task
that isn’t running. There’s a skipped test for the latter behaviour
that I’ll have to come back for.
2020-04-06 14:08:22 -05:00

51 lines
1.2 KiB
JavaScript

import {
clickable,
collection,
create,
hasClass,
isPresent,
text,
triggerable,
visitable,
} from 'ember-cli-page-object';
export default create({
visitJob: visitable('/exec/:job'),
visitTaskGroup: visitable('/exec/:job/:task_group'),
visitTask: visitable('/exec/:job/:task_group/:task_name'),
header: {
region: { scope: '[data-test-region]' },
namespace: { scope: '[data-test-namespace]' },
job: text('[data-test-job]'),
},
taskGroups: collection('[data-test-task-group]', {
click: clickable('[data-test-task-group-name]'),
name: text('[data-test-task-group-name]'),
isLoading: hasClass('is-loading', '[data-test-task-group-name]'),
chevron: {
scope: '.toggle-button .icon',
isDown: hasClass('icon-is-chevron-down'),
isRight: hasClass('icon-is-chevron-right'),
},
tasks: collection('[data-test-task]', {
name: text(),
isActive: isPresent('[data-test-task-active]'),
}),
}),
terminal: {
scope: '.xterm-helper-textarea',
pressEnter: triggerable('keydown', '', { eventProperties: { keyCode: 13 } }),
},
jobDead: {
scope: '[data-test-exec-job-dead]',
message: text('[data-test-exec-job-dead-message]'),
},
});