Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rossedfort committed Sep 27, 2024
1 parent 3ff544d commit 5b4d55a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
<svelte:fragment slot="content">
<div class="flex w-full flex-col gap-4">
<Select
data-testid="workflow-reset-event-id-select"
menuClass="max-h-[16rem]"
label={translate('workflows.reset-event-radio-group-description')}
bind:value={$eventId}
Expand Down
28 changes: 16 additions & 12 deletions src/lib/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
import { type google, temporal } from '@temporalio/proto';
// for CommonJS shenanigans when using Enums
import * as protos from '@temporalio/proto';
export const {
temporal: {
api: {
enums: {
v1: { ResetReapplyExcludeType, ResetReapplyType },
},
},
},
} = protos;
import type { google, temporal } from '@temporalio/proto';

// api.workflowservice

Expand Down Expand Up @@ -160,6 +149,21 @@ export type CallbackState = temporal.api.enums.v1.CallbackState;
export type PendingWorkflowTaskInfo =
temporal.api.workflow.v1.IPendingWorkflowTaskInfo;

// temporal.api.enums.v1.ResetReapplyExcludeType
export enum ResetReapplyExcludeType {
RESET_REAPPLY_EXCLUDE_TYPE_UNSPECIFIED = 0,
RESET_REAPPLY_EXCLUDE_TYPE_SIGNAL = 1,
RESET_REAPPLY_EXCLUDE_TYPE_UPDATE = 2,
}

// temporal.api.enums.v1.ResetReapplyType
export enum ResetReapplyType {
RESET_REAPPLY_TYPE_UNSPECIFIED = 0,
RESET_REAPPLY_TYPE_SIGNAL = 1,
RESET_REAPPLY_TYPE_NONE = 2,
RESET_REAPPLY_TYPE_ALL_ELIGIBLE = 3,
}

// api.workflow

export type PendingActivityInfo = temporal.api.workflow.v1.IPendingActivityInfo;
Expand Down
25 changes: 19 additions & 6 deletions tests/integration/workflow-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
await expect(page.getByTestId('workflow-reset-button')).toBeDisabled();
});

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

await page.getByTestId('workflow-reset-button').click();
await page.locator('#reset-event-5').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.locator('#reset-event-id-select')
.locator('[role="option"]')
.first()
.click();

await page
.getByTestId('reset-confirmation-modal')
.getByTestId('confirm-modal-button')
Expand All @@ -58,21 +64,28 @@ test.describe('Workflow Actions for a Completed Workflow', () => {
const body = request.postDataJSON();

expect(body.resetReapplyType).toBe(
ResetReapplyType.RESET_REAPPLY_TYPE_NONE,
ResetReapplyType.RESET_REAPPLY_TYPE_SIGNAL,
);
});

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

await page.getByTestId('workflow-reset-button').click();
await page.locator('#reset-event-5').click();
await page.getByTestId('workflow-reset-event-id-select-button').click();
await page
.getByText('Reapply Signals that happened after the Reset point')
.locator('#reset-event-id-select')
.locator('[role="option"]')
.first()
.click();

// this checkbox is defaulted to "checked", so click it to uncheck it
await page
.locator('#reset-include-signals-checkbox')
.click({ force: true });

Check warning on line 87 in tests/integration/workflow-actions.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of { force: true } option

await page
.getByTestId('reset-confirmation-modal')
.getByTestId('confirm-modal-button')
Expand Down

0 comments on commit 5b4d55a

Please sign in to comment.