github.com/hernad/nomad@v1.6.112/ui/tests/pages/components/clients.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { attribute, collection, clickable, text } from 'ember-cli-page-object'; 7 import { singularize } from 'ember-inflector'; 8 9 export default function (selector = '[data-test-client]', propKey = 'clients') { 10 const lookupKey = `${singularize(propKey)}For`; 11 // Remove the bracket notation 12 const attr = selector.substring(1, selector.length - 1); 13 14 return { 15 [propKey]: collection(selector, { 16 id: attribute(attr), 17 shortId: text('[data-test-short-id]'), 18 name: text('[data-test-name]'), 19 status: text('[data-test-job-status]'), 20 21 createTime: { 22 scope: '[data-test-create-time]', 23 tooltip: { 24 scope: '.tooltip', 25 text: attribute('aria-label'), 26 }, 27 }, 28 29 modifyTime: { 30 scope: '[data-test-modify-time]', 31 tooltip: { 32 scope: '.tooltip', 33 text: attribute('aria-label'), 34 }, 35 }, 36 37 visit: clickable('[data-test-short-id] a'), 38 visitRow: clickable(), 39 }), 40 41 [lookupKey]: function (id) { 42 return this[propKey].toArray().find((client) => client.id === id); 43 }, 44 }; 45 }