github.com/anuvu/nomad@v0.8.7-atom1/ui/tests/integration/job-page/helpers.js (about) 1 import { click, find } from 'ember-native-dom-helpers'; 2 import wait from 'ember-test-helpers/wait'; 3 4 export function jobURL(job, path = '') { 5 const id = job.get('plainId'); 6 const namespace = job.get('namespace.name') || 'default'; 7 let expectedURL = `/v1/job/${id}${path}`; 8 if (namespace !== 'default') { 9 expectedURL += `?namespace=${namespace}`; 10 } 11 return expectedURL; 12 } 13 14 export function stopJob() { 15 click('[data-test-stop] [data-test-idle-button]'); 16 return wait().then(() => { 17 click('[data-test-stop] [data-test-confirm-button]'); 18 return wait(); 19 }); 20 } 21 22 export function expectStopError(assert) { 23 return () => { 24 assert.equal( 25 find('[data-test-job-error-title]').textContent, 26 'Could Not Stop Job', 27 'Appropriate error is shown' 28 ); 29 assert.ok( 30 find('[data-test-job-error-body]').textContent.includes('ACL'), 31 'The error message mentions ACLs' 32 ); 33 34 click('[data-test-job-error-close]'); 35 assert.notOk(find('[data-test-job-error-title]'), 'Error message is dismissable'); 36 return wait(); 37 }; 38 } 39 40 export function expectDeleteRequest(assert, server, job) { 41 const expectedURL = jobURL(job); 42 43 assert.ok( 44 server.pretender.handledRequests 45 .filterBy('method', 'DELETE') 46 .find(req => req.url === expectedURL), 47 'DELETE URL was made correctly' 48 ); 49 50 return wait(); 51 }