github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/wats/test/build.js (about) 1 import test from 'ava'; 2 3 const Suite = require('../helpers/suite'); 4 5 const color = require('color'); 6 const palette = require('../helpers/palette'); 7 8 test.beforeEach(async t => { 9 t.context = new Suite(); 10 await t.context.init(t); 11 }); 12 13 test.afterEach(async t => { 14 t.context.passed(t); 15 }); 16 17 test.afterEach.always(async t => { 18 await t.context.finish(t); 19 }); 20 21 test('shows abort hooks', async t => { 22 await t.context.fly.run('set-pipeline -n -p some-pipeline -c fixtures/hooks-pipeline.yml'); 23 await t.context.fly.run('unpause-pipeline -p some-pipeline'); 24 25 await t.context.fly.run('trigger-job -j some-pipeline/on_abort'); 26 27 await t.context.web.page.goto(t.context.web.route(`/teams/${t.context.teamName}/pipelines/some-pipeline/jobs/on_abort/builds/1`)); 28 await t.context.web.page.setViewport({width: 1200, height: 900}); 29 30 await t.context.web.waitForText("say-bye-from-step"); 31 await t.context.web.waitForText("say-bye-from-job"); 32 // await t.context.web.waitForText("looping"); 33 34 await t.context.web.page.waitFor('button[title="Abort Build"]'); 35 await t.context.web.page.click('button[title="Abort Build"]'); 36 37 await t.context.web.waitForBackgroundColor('.build-header', palette.brown, { 38 timeout: 60000, 39 }); 40 await t.context.web.page.waitFor('[data-step-name="say-bye-from-step"] [data-step-state="succeeded"]'); 41 await t.context.web.page.waitFor('[data-step-name="say-bye-from-job"] [data-step-state="succeeded"]'); 42 43 await t.context.web.clickAndWait('[data-step-name="say-bye-from-step"] .header', '[data-step-name="say-bye-from-step"] .step-body:not(.step-collapsed)'); 44 t.regex(await t.context.web.text(), /bye from step/); 45 46 await t.context.web.clickAndWait('[data-step-name="say-bye-from-job"] .header', '[data-step-name="say-bye-from-job"] .step-body:not(.step-collapsed)'); 47 t.regex(await t.context.web.text(), /bye from job/); 48 }); 49 50 test('can be switched between', async t => { 51 await t.context.fly.run('set-pipeline -n -p some-pipeline -c fixtures/states-pipeline.yml'); 52 await t.context.fly.run('unpause-pipeline -p some-pipeline'); 53 54 await t.context.fly.run('trigger-job -w -j some-pipeline/passing'); 55 await t.context.fly.run('trigger-job -w -j some-pipeline/passing'); 56 57 await t.context.web.page.goto(t.context.web.route(`/teams/${t.context.teamName}/pipelines/some-pipeline/jobs/passing/builds/1`)); 58 59 await t.context.web.clickAndWait('#builds li:nth-child(1) a', '[data-build-name="2"]'); 60 t.regex(await t.context.web.text(), /passing #2/); 61 62 await t.context.web.clickAndWait('#builds li:nth-child(2) a', '[data-build-name="1"]'); 63 t.regex(await t.context.web.text(), /passing #1/); 64 });