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

25 lines
1.5 KiB
JavaScript

const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await go('/workflows/implement');
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 more=page.getByRole('button',{name:'More',exact:true}).filter({hasText:'More'});
if (await more.getAttribute('aria-expanded')==='false') await more.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:'History',exact:true}).click();
assert.match(await page.getByLabel('Workflow YAML',{exact:true}).inputValue(), /backoff: 30s/);
await shot('validated');
};