Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurakwhit committed Dec 20, 2024
1 parent 53f37fb commit 2257d28
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 35 deletions.
12 changes: 6 additions & 6 deletions tests/integration/disable-write-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ test.describe('Enable write actions by default', () => {
});

test('Cancel workflow button enabled', async ({ page }) => {
const workflowActionButton = page.locator(
'#workflow-actions-primary-button',
);
const workflowActionButton = page
.locator('#workflow-actions-primary-button')
.locator('visible=true');
await expect(workflowActionButton).toBeEnabled();
});
});
Expand All @@ -29,9 +29,9 @@ test.describe('Disable write actions on workflow actions', () => {
});

test('Cancel workflow button disabled', async ({ page }) => {
const workflowActionButton = page.locator(
'#workflow-actions-primary-button',
);
const workflowActionButton = page
.locator('#workflow-actions-primary-button')
.locator('visible=true');
await expect(workflowActionButton).toBeDisabled();
});
});
Expand Down
136 changes: 107 additions & 29 deletions tests/integration/workflow-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,34 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
}) => {
await mockSettingsApi(page, { DisableWriteActions: true });

await expect(page.getByTestId('workflow-reset-button')).toBeDisabled();
await expect(
page.getByTestId('workflow-reset-button').locator('visible=true'),
).toBeDisabled();
});

test('is disabled when reset is disabled via Settings API', async ({
page,
}) => {
await mockSettingsApi(page, { WorkflowResetDisabled: true });

await expect(page.getByTestId('workflow-reset-button')).toBeDisabled();
await expect(
page.getByTestId('workflow-reset-button').locator('visible=true'),
).toBeDisabled();
});

test('allows reapplying signals after the reset point', async ({
page,
}) => {
const requestPromise = page.waitForRequest(WORKFLOW_RESET_API);

Check failure on line 56 in tests/integration/workflow-actions.spec.ts

View workflow job for this annotation

GitHub Actions / integration-tests

[chromium desktop] › integration/workflow-actions.spec.ts:53:5 › Workflow Actions for a Completed Workflow › Workflow Reset for server version <1.24 › allows reapplying signals after the reset point

1) [chromium desktop] › integration/workflow-actions.spec.ts:53:5 › Workflow Actions for a Completed Workflow › Workflow Reset for server version <1.24 › allows reapplying signals after the reset point Error: page.waitForRequest: Test timeout of 10000ms exceeded. =========================== logs =========================== waiting for request "**/api/v1/namespaces/*/workflows/*/reset*" ============================================================ 54 | page, 55 | }) => { > 56 | const requestPromise = page.waitForRequest(WORKFLOW_RESET_API); | ^ 57 | 58 | await page 59 | .getByTestId('workflow-reset-button') at /home/runner/work/ui/ui/tests/integration/workflow-actions.spec.ts:56:35

Check failure on line 56 in tests/integration/workflow-actions.spec.ts

View workflow job for this annotation

GitHub Actions / integration-tests

[chromium desktop] › integration/workflow-actions.spec.ts:53:5 › Workflow Actions for a Completed Workflow › Workflow Reset for server version <1.24 › allows reapplying signals after the reset point

1) [chromium desktop] › integration/workflow-actions.spec.ts:53:5 › Workflow Actions for a Completed Workflow › Workflow Reset for server version <1.24 › allows reapplying signals after the reset point Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: page.waitForRequest: Test timeout of 10000ms exceeded. =========================== logs =========================== waiting for request "**/api/v1/namespaces/*/workflows/*/reset*" ============================================================ 54 | page, 55 | }) => { > 56 | const requestPromise = page.waitForRequest(WORKFLOW_RESET_API); | ^ 57 | 58 | await page 59 | .getByTestId('workflow-reset-button') at /home/runner/work/ui/ui/tests/integration/workflow-actions.spec.ts:56:35

Check failure on line 56 in tests/integration/workflow-actions.spec.ts

View workflow job for this annotation

GitHub Actions / integration-tests

[chromium desktop] › integration/workflow-actions.spec.ts:53:5 › Workflow Actions for a Completed Workflow › Workflow Reset for server version <1.24 › allows reapplying signals after the reset point

1) [chromium desktop] › integration/workflow-actions.spec.ts:53:5 › Workflow Actions for a Completed Workflow › Workflow Reset for server version <1.24 › allows reapplying signals after the reset point Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: page.waitForRequest: Test timeout of 10000ms exceeded. =========================== logs =========================== waiting for request "**/api/v1/namespaces/*/workflows/*/reset*" ============================================================ 54 | page, 55 | }) => { > 56 | const requestPromise = page.waitForRequest(WORKFLOW_RESET_API); | ^ 57 | 58 | await page 59 | .getByTestId('workflow-reset-button') at /home/runner/work/ui/ui/tests/integration/workflow-actions.spec.ts:56:35

await page.getByTestId('workflow-reset-button').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.getByTestId('workflow-reset-button')
.locator('visible=true')
.click();
await page
.getByTestId('workflow-reset-event-id-select-button')
.locator('visible=true')
.click();
await page
.locator('#reset-event-id-select')
.locator('[role="option"]')
Expand All @@ -77,8 +87,14 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
}) => {
const requestPromise = page.waitForRequest(WORKFLOW_RESET_API);

await page.getByTestId('workflow-reset-button').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.getByTestId('workflow-reset-button')
.locator('visible=true')
.click();
await page
.getByTestId('workflow-reset-event-id-select-button')
.locator('visible=true')
.click();
await page
.locator('#reset-event-id-select')
.locator('[role="option"]')
Expand Down Expand Up @@ -115,8 +131,14 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
}) => {
const requestPromise = page.waitForRequest(WORKFLOW_RESET_API);

await page.getByTestId('workflow-reset-button').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.getByTestId('workflow-reset-button')
.locator('visible=true')
.click();
await page
.getByTestId('workflow-reset-event-id-select-button')
.locator('visible=true')
.click();
await page
.locator('#reset-event-id-select')
.locator('[role="option"]')
Expand All @@ -141,8 +163,14 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
test('Allows excluding Signals after the reset point', async ({ page }) => {
const requestPromise = page.waitForRequest(WORKFLOW_RESET_API);

await page.getByTestId('workflow-reset-button').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.getByTestId('workflow-reset-button')
.locator('visible=true')
.click();
await page
.getByTestId('workflow-reset-event-id-select-button')
.locator('visible=true')
.click();
await page
.locator('#reset-event-id-select')
.locator('[role="option"]')
Expand All @@ -169,8 +197,14 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
test('Allows excluding Updates after the reset point', async ({ page }) => {
const requestPromise = page.waitForRequest(WORKFLOW_RESET_API);

await page.getByTestId('workflow-reset-button').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.getByTestId('workflow-reset-button')
.locator('visible=true')
.click();
await page
.getByTestId('workflow-reset-event-id-select-button')
.locator('visible=true')
.click();
await page
.locator('#reset-event-id-select')
.locator('[role="option"]')
Expand Down Expand Up @@ -216,10 +250,12 @@ test.describe('Workflow actions for a Running Workflow', () => {
}) => {
await mockSettingsApi(page, { DisableWriteActions: true });

await expect(page.locator('#workflow-actions-menu-button')).toBeDisabled();
await expect(
page.locator('#workflow-actions-menu-button').locator('visible=true'),
).toBeDisabled();

await expect(
page.locator('#workflow-actions-primary-button'),
page.locator('#workflow-actions-primary-button').locator('visible=true'),
).toBeDisabled();
});

Expand All @@ -230,21 +266,35 @@ test.describe('Workflow actions for a Running Workflow', () => {
await mockSettingsApi(page, { WorkflowCancelDisabled: true });

await expect(
page.locator('#workflow-actions-primary-button'),
page
.locator('#workflow-actions-primary-button')
.locator('visible=true'),
).toBeDisabled();

await page.locator('#workflow-actions-menu-button').click();
await page
.locator('#workflow-actions-menu-button')
.locator('visible=true')
.click();

await expect(
page.locator('#workflow-actions-menu').getByText('Send a Signal'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Send a Signal'),
).toBeEnabled();

await expect(
page.locator('#workflow-actions-menu').getByText('Terminate'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Terminate'),
).toBeEnabled();

await expect(
page.locator('#workflow-actions-menu').getByText('Reset'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Reset'),
).toBeEnabled();
});
});
Expand All @@ -256,21 +306,35 @@ test.describe('Workflow actions for a Running Workflow', () => {
await mockSettingsApi(page, { WorkflowTerminateDisabled: true });

await expect(
page.locator('#workflow-actions-primary-button'),
page
.locator('#workflow-actions-primary-button')
.locator('visible=true'),
).toBeEnabled();

await page.locator('#workflow-actions-menu-button').click();
await page
.locator('#workflow-actions-menu-button')
.locator('visible=true')
.click();

await expect(
page.locator('#workflow-actions-menu').getByText('Send a Signal'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Send a Signal'),
).toBeEnabled();

await expect(
page.locator('#workflow-actions-menu').getByText('Terminate'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Terminate'),
).toBeDisabled();

await expect(
page.locator('#workflow-actions-menu').getByText('Reset'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Reset'),
).toBeEnabled();
});
});
Expand All @@ -282,21 +346,35 @@ test.describe('Workflow actions for a Running Workflow', () => {
await mockSettingsApi(page, { WorkflowSignalDisabled: true });

await expect(
page.locator('#workflow-actions-primary-button'),
page
.locator('#workflow-actions-primary-button')
.locator('visible=true'),
).toBeEnabled();

await page.locator('#workflow-actions-menu-button').click();
await page
.locator('#workflow-actions-menu-button')
.locator('visible=true')
.click();

await expect(
page.locator('#workflow-actions-menu').getByText('Send a Signal'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Send a Signal'),
).toBeDisabled();

await expect(
page.locator('#workflow-actions-menu').getByText('Terminate'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Terminate'),
).toBeEnabled();

await expect(
page.locator('#workflow-actions-menu').getByText('Reset'),
page
.locator('#workflow-actions-menu')
.locator('visible=true')
.getByText('Reset'),
).toBeEnabled();
});
});
Expand Down

0 comments on commit 2257d28

Please sign in to comment.