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

167 lines
6.0 KiB
JavaScript
Raw Normal View History

2018-07-10 18:28:52 +00:00
import {
attribute,
create,
collection,
clickable,
2019-11-22 02:39:42 +00:00
fillable,
2018-07-10 18:28:52 +00:00
text,
isPresent,
visitable,
} from 'ember-cli-page-object';
import allocations from 'nomad-ui/tests/pages/components/allocations';
2019-11-22 02:39:42 +00:00
import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
import notification from 'nomad-ui/tests/pages/components/notification';
import toggle from 'nomad-ui/tests/pages/components/toggle';
2018-07-10 18:28:52 +00:00
export default create({
visit: visitable('/clients/:id'),
breadcrumbs: collection('[data-test-breadcrumb]', {
id: attribute('data-test-breadcrumb'),
text: text(),
visit: clickable(),
}),
breadcrumbFor(id) {
return this.breadcrumbs.toArray().find(crumb => crumb.id === id);
},
title: text('[data-test-title]'),
2019-12-05 00:54:36 +00:00
clientId: text('[data-test-node-id]'),
2018-07-10 18:28:52 +00:00
statusLight: collection('[data-test-node-status]', {
id: attribute('data-test-node-status'),
text: text(),
}),
statusDefinition: text('[data-test-status-definition]'),
statusDecorationClass: attribute('class', '[data-test-status-definition] .status-text'),
addressDefinition: text('[data-test-address-definition]'),
datacenterDefinition: text('[data-test-datacenter-definition]'),
resourceCharts: collection('[data-test-primary-metric]', {
name: text('[data-test-primary-metric-title]'),
chartClass: attribute('class', '[data-test-percentage-chart] progress'),
}),
...allocations(),
2018-07-10 18:28:52 +00:00
allocationFilter: {
preemptions: clickable('[data-test-filter-preemptions]'),
all: clickable('[data-test-filter-all]'),
preemptionsCount: text('[data-test-filter-preemptions]'),
allCount: text('[data-test-filter-all]'),
},
2018-07-10 18:28:52 +00:00
attributesTable: isPresent('[data-test-attributes]'),
metaTable: isPresent('[data-test-meta]'),
emptyMetaMessage: isPresent('[data-test-empty-meta-message]'),
metaAttributes: collection('[data-test-meta] [data-test-attributes-section]', {
key: text('[data-test-key]'),
value: text('[data-test-value]'),
}),
error: {
isShown: isPresent('[data-test-error]'),
title: text('[data-test-error-title]'),
message: text('[data-test-error-message]'),
seekHelp: clickable('[data-test-error-message] a'),
},
hasEvents: isPresent('[data-test-client-events]'),
events: collection('[data-test-client-event]', {
time: text('[data-test-client-event-time]'),
subsystem: text('[data-test-client-event-subsystem]'),
message: text('[data-test-client-event-message]'),
}),
2020-02-12 03:51:09 +00:00
hasHostVolumes: isPresent('[data-test-client-host-volumes]'),
hostVolumes: collection('[data-test-client-host-volume]', {
name: text('[data-test-name]'),
path: text('[data-test-path]'),
permissions: text('[data-test-permissions]'),
}),
2018-07-10 18:28:52 +00:00
driverHeads: collection('[data-test-driver-status] [data-test-accordion-head]', {
name: text('[data-test-name]'),
detected: text('[data-test-detected]'),
lastUpdated: text('[data-test-last-updated]'),
healthIsShown: isPresent('[data-test-health]'),
health: text('[data-test-health]'),
healthClass: attribute('class', '[data-test-health] .color-swatch'),
toggle: clickable('[data-test-accordion-toggle]'),
}),
driverBodies: collection('[data-test-driver-status] [data-test-accordion-body]', {
description: text('[data-test-health-description]'),
descriptionIsShown: isPresent('[data-test-health-description]'),
attributesAreShown: isPresent('[data-test-driver-attributes]'),
}),
2019-11-22 02:39:42 +00:00
drainDetails: {
scope: '[data-test-drain-details]',
durationIsPresent: isPresent('[data-test-duration]'),
duration: text('[data-test-duration]'),
durationTooltip: attribute('aria-label', '[data-test-duration]'),
2019-12-05 00:54:36 +00:00
durationIsShown: isPresent('[data-test-duration]'),
2019-11-22 02:39:42 +00:00
deadline: text('[data-test-deadline]'),
deadlineTooltip: attribute('aria-label', '[data-test-deadline]'),
2019-12-05 00:54:36 +00:00
deadlineIsShown: isPresent('[data-test-deadline]'),
2019-11-22 02:39:42 +00:00
forceDrainText: text('[data-test-force-drain-text]'),
drainSystemJobsText: text('[data-test-drain-system-jobs-text]'),
completeCount: text('[data-test-complete-count]'),
migratingCount: text('[data-test-migrating-count]'),
remainingCount: text('[data-test-remaining-count]'),
status: text('[data-test-status]'),
force: twoStepButton('[data-test-force]'),
2018-07-10 18:28:52 +00:00
},
2019-11-22 02:39:42 +00:00
drainPopover: {
label: text('[data-test-drain-popover] [data-test-popover-trigger]'),
isOpen: isPresent('[data-test-drain-popover-form]'),
2019-11-22 02:39:42 +00:00
toggle: clickable('[data-test-drain-popover] [data-test-popover-trigger]'),
isDisabled: attribute('aria-disabled', '[data-test-popover-trigger]'),
deadlineToggle: toggle('[data-test-drain-deadline-toggle]'),
2019-11-22 02:39:42 +00:00
deadlineOptions: {
open: clickable('[data-test-drain-deadline-option-select] .ember-power-select-trigger'),
options: collection('.ember-power-select-option', {
2019-11-22 02:39:42 +00:00
label: text(),
choose: clickable(),
}),
},
setCustomDeadline: fillable('[data-test-drain-custom-deadline]'),
customDeadline: attribute('value', '[data-test-drain-custom-deadline]'),
forceDrainToggle: toggle('[data-test-force-drain-toggle]'),
systemJobsToggle: toggle('[data-test-system-jobs-toggle]'),
submit: clickable('[data-test-drain-submit]'),
cancel: clickable('[data-test-drain-cancel]'),
2019-11-22 02:39:42 +00:00
setDeadline(label) {
this.deadlineOptions.open();
this.deadlineOptions.options
.toArray()
.findBy('label', label)
.choose();
},
},
stopDrain: twoStepButton('[data-test-drain-stop]'),
stopDrainIsPresent: isPresent('[data-test-drain-stop]'),
2019-11-22 02:39:42 +00:00
eligibilityToggle: toggle('[data-test-eligibility-toggle]'),
2019-11-22 02:39:42 +00:00
eligibilityError: notification('[data-test-eligibility-error]'),
stopDrainError: notification('[data-test-stop-drain-error]'),
drainError: notification('[data-test-drain-error]'),
drainStoppedNotification: notification('[data-test-drain-stopped-notification]'),
drainUpdatedNotification: notification('[data-test-drain-updated-notification]'),
drainCompleteNotification: notification('[data-test-drain-complete-notification]'),
2018-07-10 18:28:52 +00:00
});