Skip to content

Commit cfe0d80

Browse files
committed
Fixed arguments form not updated for tasks without schema
1 parent 7b020ea commit cfe0d80

File tree

3 files changed

+93
-12
lines changed

3 files changed

+93
-12
lines changed

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default defineConfig({
8080

8181
webServer: [
8282
{
83-
command: './tests/start-test-server.sh --branch 2496-task-updating-should-inherit-history-status-from-old-task',
83+
command: './tests/start-test-server.sh --branch main',
8484
port: 8000,
8585
waitForPort: true,
8686
stdout: 'pipe',

src/routes/v2/projects/[projectId]/workflows/[workflowId]/+page.svelte

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,21 +1051,23 @@
10511051
{#if selectedWorkflowTask}
10521052
{#key selectedWorkflowTask}
10531053
{#if selectedHistoryRun}
1054-
<ArgumentsSchema
1055-
workflowTask={selectedWorkflowTask}
1056-
{onWorkflowTaskUpdated}
1057-
editable={false}
1058-
bind:this={argsSchemaForm}
1059-
argsSchemaNonParallel={selectedHistoryRun.args_schema_non_parallel}
1060-
argsSchemaParallel={selectedHistoryRun.args_schema_parallel}
1061-
argsNonParallel={selectedHistoryRun.workflowtask_dump.args_non_parallel}
1062-
argsParallel={selectedHistoryRun.workflowtask_dump.args_parallel}
1063-
/>
1054+
{#key selectedHistoryRun}
1055+
<ArgumentsSchema
1056+
workflowTask={selectedWorkflowTask}
1057+
{onWorkflowTaskUpdated}
1058+
editable={false}
1059+
bind:this={argsSchemaForm}
1060+
argsSchemaNonParallel={selectedHistoryRun.args_schema_non_parallel}
1061+
argsSchemaParallel={selectedHistoryRun.args_schema_parallel}
1062+
argsNonParallel={selectedHistoryRun.workflowtask_dump.args_non_parallel}
1063+
argsParallel={selectedHistoryRun.workflowtask_dump.args_parallel}
1064+
/>
1065+
{/key}
10641066
{:else}
10651067
<ArgumentsSchema
10661068
workflowTask={selectedWorkflowTask}
10671069
{onWorkflowTaskUpdated}
1068-
editable={!selectedHistoryRun}
1070+
editable={true}
10691071
bind:this={argsSchemaForm}
10701072
argsSchemaNonParallel={selectedWorkflowTask.task.args_schema_non_parallel}
10711073
argsSchemaParallel={selectedWorkflowTask.task.args_schema_parallel}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { expect, test } from './workflow_fixture.js';
2+
import { waitModalClosed, waitPageLoading } from '../utils.js';
3+
import { createDataset } from './dataset_utils.js';
4+
import { waitTasksSuccess } from './workflow_task_utils.js';
5+
import { createFakeTask, deleteTask } from './task_utils.js';
6+
7+
test('Workflow task runs on task without arguments', async ({ page, workflow }) => {
8+
await page.waitForURL(workflow.url);
9+
await waitPageLoading(page);
10+
11+
test.slow();
12+
13+
const modal = page.locator('.modal.show');
14+
15+
await test.step('Create test dataset', async () => {
16+
await createDataset(page, workflow.projectId);
17+
});
18+
19+
/** @type {string} */
20+
let taskName;
21+
22+
await test.step('Create test tasks', async () => {
23+
taskName = await createFakeTask(page, {
24+
type: 'non_parallel',
25+
version: '0.0.1',
26+
command_non_parallel: 'echo'
27+
});
28+
});
29+
30+
await test.step('Prepare workflow', async () => {
31+
await page.goto(workflow.url);
32+
await waitPageLoading(page);
33+
await workflow.addTask(taskName);
34+
await workflow.selectTask(taskName);
35+
await page.getByRole('button', { name: 'Add property' }).click();
36+
await page.getByRole('textbox', { name: 'Argument name' }).fill('key');
37+
await page.getByRole('textbox', { name: 'Argument value' }).fill('foo');
38+
await page.getByRole('button', { name: 'Save changes' }).click();
39+
await expect(page.getByText('Arguments changes saved successfully')).toBeVisible();
40+
});
41+
42+
await test.step('Run workflow', async () => {
43+
await page.getByRole('button', { name: 'Run workflow' }).click();
44+
await modal.waitFor();
45+
await modal.getByRole('button', { name: 'Run' }).click();
46+
await modal.getByRole('button', { name: 'Confirm' }).click();
47+
await waitModalClosed(page);
48+
await waitTasksSuccess(page);
49+
});
50+
51+
await test.step('Update arguments', async () => {
52+
await page.getByRole('textbox', { name: 'Argument value' }).fill('bar');
53+
await page.getByRole('button', { name: 'Save changes' }).click();
54+
await expect(page.getByText('Arguments changes saved successfully')).toBeVisible();
55+
});
56+
57+
await test.step('Run workflow again', async () => {
58+
await page.getByRole('button', { name: 'Continue workflow' }).click();
59+
await modal.waitFor();
60+
await modal.getByRole('combobox', { name: 'Start workflow at' }).selectOption(taskName);
61+
await modal.getByRole('button', { name: 'Run', exact: true }).click();
62+
await modal.getByRole('button', { name: 'Confirm' }).click();
63+
await waitModalClosed(page);
64+
await waitTasksSuccess(page);
65+
});
66+
67+
await test.step('Check run arguments', async () => {
68+
await page.getByLabel('Show runs').click();
69+
await page.getByRole('button', { name: 'Run 1' }).click();
70+
await expect(page.getByRole('textbox', { name: 'Argument value' })).toHaveValue('foo');
71+
await page.getByRole('button', { name: 'Run 2' }).click();
72+
await expect(page.getByRole('textbox', { name: 'Argument value' })).toHaveValue('bar');
73+
});
74+
75+
await test.step('Cleanup', async () => {
76+
await workflow.removeCurrentTask();
77+
await deleteTask(page, taskName);
78+
});
79+
});

0 commit comments

Comments
 (0)