open-nomad/ui/tests/pages/jobs/list.js
Buck Doyle 07831ab455
Update to v4 of Ember Power Select (#10226)
This closes #10146.

Because of cibernox/ember-power-select#1203, which documents
the current impossibility of attaching test selectors to a
PowerSelect invocation, this uses test selectors on parent
containers instead, occasionally adding wrappers when needed.
I chose to leave the existing test selectors in the hopes that
we can return to using them eventually, but I could easily
remove them if it seems like extra noise now.

Presumably for the same reason, @class no longer works, so
this adjusts the scoping of global search CSS to preserve the style
of the search control.

I also included an update to the latest version of
ember-test-selectors, since we were far behind and I tried
that before finding the aforelinked issue.

Finally, this replaces ember-cli-uglify with ember-cli-terser to address
production build failures as described at ember-cli/ember-cli#9290.
2021-03-26 08:55:12 -05:00

80 lines
2.1 KiB
JavaScript

import {
attribute,
create,
collection,
clickable,
isPresent,
property,
text,
triggerable,
visitable,
} from 'ember-cli-page-object';
import facet from 'nomad-ui/tests/pages/components/facet';
import pageSizeSelect from 'nomad-ui/tests/pages/components/page-size-select';
export default create({
pageSize: 25,
visit: visitable('/jobs'),
search: {
scope: '[data-test-jobs-search] input',
keydown: triggerable('keydown'),
},
runJobButton: {
scope: '[data-test-run-job]',
isDisabled: property('disabled'),
},
jobs: collection('[data-test-job-row]', {
id: attribute('data-test-job-row'),
name: text('[data-test-job-name]'),
link: attribute('href', '[data-test-job-name] a'),
status: text('[data-test-job-status]'),
type: text('[data-test-job-type]'),
priority: text('[data-test-job-priority]'),
taskGroups: text('[data-test-job-task-groups]'),
clickRow: clickable(),
clickName: clickable('[data-test-job-name] a'),
}),
nextPage: clickable('[data-test-pager="next"]'),
prevPage: clickable('[data-test-pager="prev"]'),
isEmpty: isPresent('[data-test-empty-jobs-list]'),
emptyState: {
headline: text('[data-test-empty-jobs-list-headline]'),
},
error: {
isPresent: isPresent('[data-test-error]'),
title: text('[data-test-error-title]'),
message: text('[data-test-error-message]'),
seekHelp: clickable('[data-test-error-message] a'),
gotoJobs: clickable('[data-test-error-jobs-link]'),
gotoClients: clickable('[data-test-error-clients-link]'),
},
namespaceSwitcher: {
isPresent: isPresent('[data-test-namespace-switcher-parent]'),
open: clickable('[data-test-namespace-switcher-parent] .ember-power-select-trigger'),
options: collection('.ember-power-select-option', {
testContainer: '#ember-testing',
resetScope: true,
label: text(),
}),
},
pageSizeSelect: pageSizeSelect(),
facets: {
type: facet('[data-test-type-facet]'),
status: facet('[data-test-status-facet]'),
datacenter: facet('[data-test-datacenter-facet]'),
prefix: facet('[data-test-prefix-facet]'),
},
});