Files
archie/e2e/checks/workflow-validation.cjs
T

24 lines
1.4 KiB
JavaScript

const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await go('/workflows');
await page.getByRole('button', {name:/^implement/}).click();
const runPicker = page.getByRole('combobox', { name: 'Run shown on the canvas' });
if (await runPicker.count()) { await runPicker.click(); await page.getByRole('option', { name: 'Definition', exact: true }).click(); }
await page.locator('.vue-flow__node').filter({hasText:'Prepare worktree'}).first().click();
const condition=page.getByLabel('Run only when', {exact:true});
await condition.fill('what');
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor();
await condition.fill('task.title');
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor({state:'hidden'});
const backoff=page.getByLabel('Retry backoff',{exact:true});
await backoff.fill('yes');
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor();
await backoff.fill('0.5');
await page.getByLabel('Run only when',{exact:true}).focus();
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor({state:'hidden'});
await page.getByRole('combobox',{name:'Unit',exact:true}).selectOption('m');
await page.getByRole('tab',{name:'YAML',exact:true}).click();
assert.match(await page.getByLabel('Workflow YAML',{exact:true}).inputValue(), /backoff: 30s/);
await shot('validated');
};