open-nomad/ui/tests/pages/clients/list.js

89 lines
2.2 KiB
JavaScript
Raw Normal View History

2018-07-10 08:11:27 +00:00
import {
attribute,
2018-07-10 08:11:27 +00:00
create,
collection,
clickable,
fillable,
hasClass,
isHidden,
isPresent,
2018-07-10 08:11:27 +00:00
text,
visitable,
} from 'ember-cli-page-object';
import facet from 'nomad-ui/tests/pages/components/facet';
2018-07-10 08:11:27 +00:00
export default create({
pageSize: 25,
2018-07-10 08:11:27 +00:00
visit: visitable('/clients'),
search: fillable('.search-box input'),
sortOptions: collection('[data-test-sort-by]', {
id: attribute('data-test-sort-by'),
sort: clickable(),
}),
sortBy(id) {
return this.sortOptions
.toArray()
.findBy('id', id)
.sort();
},
2018-07-10 08:11:27 +00:00
nodes: collection('[data-test-client-node-row]', {
id: text('[data-test-client-id]'),
name: text('[data-test-client-name]'),
compositeStatus: {
scope: '[data-test-client-composite-status]',
tooltip: attribute('aria-label', '.tooltip'),
isInfo: hasClass('is-info', '.status-text'),
isWarning: hasClass('is-warning', '.status-text'),
isUnformatted: isHidden('.status-text'),
},
2018-07-10 08:11:27 +00:00
address: text('[data-test-client-address]'),
datacenter: text('[data-test-client-datacenter]'),
allocations: text('[data-test-client-allocations]'),
clickRow: clickable(),
clickName: clickable('[data-test-client-name] a'),
}),
hasPagination: isPresent('[data-test-pagination]'),
2018-07-10 08:11:27 +00:00
isEmpty: isPresent('[data-test-empty-clients-list]'),
2018-07-10 08:11:27 +00:00
empty: {
headline: text('[data-test-empty-clients-list-headline]'),
},
pageSizeSelect: {
isPresent: isPresent('[data-test-page-size-select]'),
open: clickable('[data-test-page-size-select] .ember-power-select-trigger'),
selectedOption: text('[data-test-page-size-select] .ember-power-select-selected-item'),
options: collection('.ember-power-select-option', {
testContainer: '#ember-testing',
resetScope: true,
label: text(),
}),
},
2018-07-10 08:11:27 +00:00
error: {
isPresent: isPresent('[data-test-error]'),
2018-07-10 08:11:27 +00:00
title: text('[data-test-error-title]'),
message: text('[data-test-error-message]'),
seekHelp: clickable('[data-test-error-message] a'),
},
facets: {
class: facet('[data-test-class-facet]'),
state: facet('[data-test-state-facet]'),
datacenter: facet('[data-test-datacenter-facet]'),
2020-03-13 18:31:06 +00:00
volume: facet('[data-test-volume-facet]'),
},
2018-07-10 08:11:27 +00:00
});