github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/tests/pages/components/allocations.js (about) 1 import { attribute, collection, clickable, isPresent, text } from 'ember-cli-page-object'; 2 import { singularize } from 'ember-inflector'; 3 4 export default function(selector = '[data-test-allocation]', propKey = 'allocations') { 5 const lookupKey = `${singularize(propKey)}For`; 6 // Remove the bracket notation 7 const attr = selector.substring(1, selector.length - 1); 8 9 return { 10 [propKey]: collection(selector, { 11 id: attribute(attr), 12 shortId: text('[data-test-short-id]'), 13 createTime: text('[data-test-create-time]'), 14 createTooltip: attribute('aria-label', '[data-test-create-time] .tooltip'), 15 modifyTime: text('[data-test-modify-time]'), 16 health: text('[data-test-health]'), 17 status: text('[data-test-client-status]'), 18 job: text('[data-test-job]'), 19 taskGroup: text('[data-test-task-group]'), 20 client: text('[data-test-client]'), 21 jobVersion: text('[data-test-job-version]'), 22 volume: text('[data-test-volume]'), 23 cpu: text('[data-test-cpu]'), 24 cpuTooltip: attribute('aria-label', '[data-test-cpu] .tooltip'), 25 mem: text('[data-test-mem]'), 26 memTooltip: attribute('aria-label', '[data-test-mem] .tooltip'), 27 rescheduled: isPresent('[data-test-indicators] [data-test-icon="reschedule"]'), 28 29 visit: clickable('[data-test-short-id] a'), 30 visitRow: clickable(), 31 visitJob: clickable('[data-test-job]'), 32 visitClient: clickable('[data-test-client] a'), 33 }), 34 35 [lookupKey]: function(id) { 36 return this[propKey].toArray().find(allocation => allocation.id === id); 37 }, 38 }; 39 }