open-nomad/ui/tests/pages/components/topo-viz/node.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.4 KiB
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2020-10-30 21:23:59 +00:00
import {
attribute,
collection,
clickable,
hasClass,
isPresent,
text,
triggerable,
} from 'ember-cli-page-object';
2020-10-12 05:58:44 +00:00
const allocationRect = {
select: clickable(),
2020-10-30 21:23:59 +00:00
hover: triggerable('mouseenter'),
mouseleave: triggerable('mouseleave'),
2020-10-12 05:58:44 +00:00
width: attribute('width', '> rect'),
height: attribute('height', '> rect'),
isActive: hasClass('is-active'),
isSelected: hasClass('is-selected'),
running: hasClass('running'),
failed: hasClass('failed'),
pending: hasClass('pending'),
};
2021-12-28 14:45:20 +00:00
export default (scope) => ({
2020-10-12 05:58:44 +00:00
scope,
label: text('[data-test-label]'),
2020-10-14 07:54:39 +00:00
labelIsPresent: isPresent('[data-test-label]'),
2020-10-12 05:58:44 +00:00
statusIcon: attribute('class', '[data-test-status-icon] .icon'),
statusIconLabel: attribute('aria-label', '[data-test-status-icon]'),
selectNode: clickable('[data-test-node-background]'),
nodeIsInteractive: hasClass('is-interactive', '[data-test-node-background]'),
nodeIsSelected: hasClass('is-selected', '[data-test-node-background]'),
memoryRects: collection('[data-test-memory-rect]', {
...allocationRect,
id: attribute('data-test-memory-rect'),
}),
cpuRects: collection('[data-test-cpu-rect]', {
...allocationRect,
id: attribute('data-test-cpu-rect'),
}),
2020-10-30 21:23:59 +00:00
mouseout: triggerable('mouseout', '[data-test-topo-node-svg]'),
2020-10-12 05:58:44 +00:00
emptyMessage: text('[data-test-empty-message]'),
isEmpty: hasClass('is-empty'),
2020-10-12 05:58:44 +00:00
});