Skip to content

Commit

Permalink
fix ts for earlier pw versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Oct 15, 2024
1 parent 9db2978 commit 064e97b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/playwright/runStepWithLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ interface TestStepInternal {
location?: Location;
}

type StepOptions = Parameters<TestTypeCommon['step']>[2];

// eslint-disable-next-line max-params
export async function runStepWithLocation(
test: TestTypeCommon,
Expand All @@ -26,8 +24,8 @@ export async function runStepWithLocation(
) {
// PW 1.48 introduced official way to run step with location.
if (playwrightVersion >= '1.48.0') {
// use type assertion to avoid TS error in earlier PW versions
return test.step(stepText, body, { location } as StepOptions);
// @ts-expect-error earlier PW versions do not support 3rd argument in test.step

Check failure on line 27 in src/playwright/runStepWithLocation.ts

View workflow job for this annotation

GitHub Actions / test-win (latest)

Unused '@ts-expect-error' directive.

Check failure on line 27 in src/playwright/runStepWithLocation.ts

View workflow job for this annotation

GitHub Actions / test-win (beta)

Unused '@ts-expect-error' directive.

Check failure on line 27 in src/playwright/runStepWithLocation.ts

View workflow job for this annotation

GitHub Actions / test (1.48)

Unused '@ts-expect-error' directive.

Check failure on line 27 in src/playwright/runStepWithLocation.ts

View workflow job for this annotation

GitHub Actions / test (beta)

Unused '@ts-expect-error' directive.
return test.step(stepText, body, { location });
}

// Since PW 1.43 testInfo._runAsStep was replaced with a more complex logic.
Expand Down

0 comments on commit 064e97b

Please sign in to comment.