github.com/hernad/nomad@v1.6.112/ui/tests/pages/jobs/detail.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { 7 attribute, 8 create, 9 collection, 10 clickable, 11 hasClass, 12 isPresent, 13 property, 14 text, 15 visitable, 16 } from 'ember-cli-page-object'; 17 18 import allocations from 'nomad-ui/tests/pages/components/allocations'; 19 import taskGroups from 'nomad-ui/tests/pages/components/task-groups'; 20 import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button'; 21 import recommendationAccordion from 'nomad-ui/tests/pages/components/recommendation-accordion'; 22 import jobClientStatusBar from 'nomad-ui/tests/pages/components/job-client-status-bar'; 23 24 export default create({ 25 visit: visitable('/jobs/:id'), 26 27 jobName: text('[data-test-job-name]'), 28 29 tabs: collection('[data-test-tab]', { 30 id: attribute('data-test-tab'), 31 visit: clickable('a'), 32 }), 33 34 tabFor(id) { 35 return this.tabs.toArray().findBy('id', id); 36 }, 37 38 recommendations: collection( 39 '[data-test-recommendation-accordion]', 40 recommendationAccordion 41 ), 42 43 stop: twoStepButton('[data-test-stop]'), 44 start: twoStepButton('[data-test-start]'), 45 purge: twoStepButton('[data-test-purge]'), 46 47 packTag: isPresent('[data-test-pack-tag]'), 48 metaTable: isPresent('[data-test-meta]'), 49 50 execButton: { 51 scope: '[data-test-exec-button]', 52 isDisabled: property('disabled'), 53 hasTooltip: hasClass('tooltip'), 54 tooltipText: attribute('aria-label'), 55 }, 56 57 incrementButton: { 58 scope: '[data-test-scale-controls-increment]', 59 isDisabled: property('disabled'), 60 }, 61 62 dispatchButton: { 63 scope: '[data-test-dispatch-button]', 64 isDisabled: property('disabled'), 65 }, 66 67 stats: collection('[data-test-job-stat]', { 68 id: attribute('data-test-job-stat'), 69 text: text(), 70 }), 71 72 statFor(id) { 73 return this.stats.toArray().findBy('id', id); 74 }, 75 76 packStats: collection('[data-test-pack-stat]', { 77 id: attribute('data-test-pack-stat'), 78 text: text(), 79 }), 80 81 packStatFor(id) { 82 return this.packStats.toArray().findBy('id', id); 83 }, 84 85 statusModes: { 86 current: { 87 scope: '[data-test-status-mode-current]', 88 click: clickable(), 89 }, 90 historical: { 91 scope: '[data-test-status-mode-historical]', 92 click: clickable(), 93 }, 94 }, 95 96 childrenSummary: jobClientStatusBar( 97 '[data-test-children-status-bar]:not(.is-narrow)' 98 ), 99 allocationsSummary: jobClientStatusBar( 100 '[data-test-allocation-status-bar]:not(.is-narrow)' 101 ), 102 ...taskGroups(), 103 ...allocations(), 104 105 viewAllAllocations: text('[data-test-view-all-allocations]'), 106 107 jobsHeader: { 108 scope: '[data-test-jobs-header]', 109 hasSubmitTime: isPresent('[data-test-jobs-submit-time-header]'), 110 hasNamespace: isPresent('[data-test-jobs-namespace-header]'), 111 hasNodePool: isPresent('[data-test-jobs-node-pool-header]'), 112 hasType: isPresent('[data-test-jobs-type-header]'), 113 hasPriority: isPresent('[data-test-jobs-priority-header]'), 114 }, 115 116 jobs: collection('[data-test-job-row]', { 117 id: attribute('data-test-job-row'), 118 name: text('[data-test-job-name]'), 119 link: attribute('href', '[data-test-job-name] a'), 120 namespace: text('[data-test-job-namespace]'), 121 nodePool: text('[data-test-job-node-pool]'), 122 submitTime: text('[data-test-job-submit-time]'), 123 status: text('[data-test-job-status]'), 124 type: text('[data-test-job-type]'), 125 priority: text('[data-test-job-priority]'), 126 taskGroups: text('[data-test-job-task-groups]'), 127 128 clickRow: clickable(), 129 clickName: clickable('[data-test-job-name] a'), 130 }), 131 132 error: { 133 isPresent: isPresent('[data-test-error]'), 134 title: text('[data-test-error-title]'), 135 message: text('[data-test-error-message]'), 136 seekHelp: clickable('[data-test-error-message] a'), 137 }, 138 139 recentAllocationsEmptyState: { 140 headline: text('[data-test-empty-recent-allocations-headline]'), 141 }, 142 });