github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/pages/components/clients.js (about) 1 import { attribute, collection, clickable, text } from 'ember-cli-page-object'; 2 import { singularize } from 'ember-inflector'; 3 4 export default function (selector = '[data-test-client]', propKey = 'clients') { 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 name: text('[data-test-name]'), 14 status: text('[data-test-job-status]'), 15 16 createTime: { 17 scope: '[data-test-create-time]', 18 tooltip: { 19 scope: '.tooltip', 20 text: attribute('aria-label'), 21 }, 22 }, 23 24 modifyTime: { 25 scope: '[data-test-modify-time]', 26 tooltip: { 27 scope: '.tooltip', 28 text: attribute('aria-label'), 29 }, 30 }, 31 32 visit: clickable('[data-test-short-id] a'), 33 visitRow: clickable(), 34 }), 35 36 [lookupKey]: function (id) { 37 return this[propKey].toArray().find((client) => client.id === id); 38 }, 39 }; 40 }