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,
|
2021-10-22 14:51:31 +00:00
|
|
|
value,
|
2018-07-10 18:28:52 +00:00
|
|
|
visitable,
|
|
|
|
} from 'ember-cli-page-object';
|
|
|
|
|
2018-07-24 02:06:41 +00:00
|
|
|
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';
|
2019-12-07 07:45:00 +00:00
|
|
|
import toggle from 'nomad-ui/tests/pages/components/toggle';
|
2021-12-17 21:55:40 +00:00
|
|
|
import { multiFacet } from 'nomad-ui/tests/pages/components/facet';
|
2018-07-24 02:06:41 +00:00
|
|
|
|
2018-07-10 18:28:52 +00:00
|
|
|
export default create({
|
|
|
|
visit: visitable('/clients/: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]'),
|
2021-12-28 16:08:12 +00:00
|
|
|
statusDecorationClass: attribute(
|
|
|
|
'class',
|
|
|
|
'[data-test-status-definition] .status-text'
|
|
|
|
),
|
2018-07-10 18:28:52 +00:00
|
|
|
addressDefinition: text('[data-test-address-definition]'),
|
|
|
|
datacenterDefinition: text('[data-test-datacenter-definition]'),
|
|
|
|
|
2018-09-19 23:33:51 +00:00
|
|
|
resourceCharts: collection('[data-test-primary-metric]', {
|
|
|
|
name: text('[data-test-primary-metric-title]'),
|
|
|
|
chartClass: attribute('class', '[data-test-percentage-chart] progress'),
|
|
|
|
}),
|
|
|
|
|
2018-07-24 02:06:41 +00:00
|
|
|
...allocations(),
|
2018-07-10 18:28:52 +00:00
|
|
|
|
2021-12-17 22:38:04 +00:00
|
|
|
emptyAllocations: {
|
|
|
|
scope: '[data-test-empty-allocations-list]',
|
|
|
|
headline: text('[data-test-empty-allocations-list-headline]'),
|
|
|
|
body: text('[data-test-empty-allocations-list-body]'),
|
|
|
|
},
|
|
|
|
|
2019-04-22 23:39:07 +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]'),
|
|
|
|
},
|
|
|
|
|
2021-12-17 21:55:40 +00:00
|
|
|
facets: {
|
|
|
|
namespace: multiFacet('[data-test-allocation-namespace-facet]'),
|
|
|
|
job: multiFacet('[data-test-allocation-job-facet]'),
|
|
|
|
status: multiFacet('[data-test-allocation-status-facet]'),
|
|
|
|
},
|
|
|
|
|
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]'),
|
|
|
|
|
2021-12-28 16:08:12 +00:00
|
|
|
metaAttributes: collection(
|
|
|
|
'[data-test-meta] [data-test-attributes-section]',
|
|
|
|
{
|
|
|
|
key: text('[data-test-key]'),
|
|
|
|
value: text('[data-test-value]'),
|
|
|
|
}
|
|
|
|
),
|
2018-07-10 18:28:52 +00:00
|
|
|
|
|
|
|
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]'),
|
2020-02-11 04:36:51 +00:00
|
|
|
hostVolumes: collection('[data-test-client-host-volume]', {
|
|
|
|
name: text('[data-test-name]'),
|
|
|
|
path: text('[data-test-path]'),
|
|
|
|
permissions: text('[data-test-permissions]'),
|
|
|
|
}),
|
|
|
|
|
2021-12-28 16:08:12 +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]'),
|
|
|
|
}
|
|
|
|
),
|
2018-07-10 18:28:52 +00:00
|
|
|
|
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: {
|
2019-12-07 07:45:00 +00:00
|
|
|
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]'),
|
2020-01-31 05:28:37 +00:00
|
|
|
isDisabled: attribute('aria-disabled', '[data-test-popover-trigger]'),
|
2019-12-07 07:45:00 +00:00
|
|
|
|
|
|
|
deadlineToggle: toggle('[data-test-drain-deadline-toggle]'),
|
2019-11-22 02:39:42 +00:00
|
|
|
deadlineOptions: {
|
2021-10-22 14:51:31 +00:00
|
|
|
open: clickable(
|
|
|
|
'[data-test-drain-deadline-option-select-parent] .ember-power-select-trigger'
|
|
|
|
),
|
2019-12-07 07:45:00 +00:00
|
|
|
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]'),
|
2021-10-22 14:51:31 +00:00
|
|
|
customDeadline: value('[data-test-drain-custom-deadline]'),
|
2019-12-07 07:45:00 +00:00
|
|
|
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();
|
2021-12-28 14:45:20 +00:00
|
|
|
this.deadlineOptions.options.toArray().findBy('label', label).choose();
|
2019-11-22 02:39:42 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-12-07 07:45:00 +00:00
|
|
|
stopDrain: twoStepButton('[data-test-drain-stop]'),
|
|
|
|
stopDrainIsPresent: isPresent('[data-test-drain-stop]'),
|
2019-11-22 02:39:42 +00:00
|
|
|
|
2019-12-07 07:45:00 +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]'),
|
2021-12-28 16:08:12 +00:00
|
|
|
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
|
|
|
});
|