Open RichardCariven opened 5 days ago
Hi @RichardCariven
Could you try to make fresh install of packages?
And if it does not help, could you show how you create Given / When / Then
? ideally to reproduce on https://github.com/vitalets/playwright-bdd-example
tried a fresh install issue still present, one of the devs also tried and is also seeing the linting errors
Have followed the instructions and pushed a fork to bdd-example, https://github.com/RichardCariven/playwright-bdd-example. Don't have the same linting rules on this branch so you are not going to see that, but it shows you the architecture of how the E2E framework is laid out.
Full list of linting errors so you can compare with the code I have pasted (should be like for like path)
tests/step-definitions/assertions/verify-dropdown-value.ts
Error: 19:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 21:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 33:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 35:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 48:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 50:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/assertions/verify-element-active.ts
Error: 14:38 error Unsafe argument of type any
assigned to a parameter of type string
@typescript-eslint/no-unsafe-argument
Error: 14:44 error Unsafe member access .title on an any
value @typescript-eslint/no-unsafe-member-access
Error: 16:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 18:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/assertions/verify-element-checked.ts
Error: 14:38 error Unsafe argument of type any
assigned to a parameter of type string
@typescript-eslint/no-unsafe-argument
Error: 14:44 error Unsafe member access .title on an any
value @typescript-eslint/no-unsafe-member-access
Error: 16:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 18:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/assertions/verify-element-value.ts
Error: 19:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 21:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 36:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 38:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/assertions/verify-element-visibility.ts
Error: 14:38 error Unsafe argument of type any
assigned to a parameter of type string
@typescript-eslint/no-unsafe-argument
Error: 14:44 error Unsafe member access .title on an any
value @typescript-eslint/no-unsafe-member-access
Error: 16:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 18:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 32:38 error Unsafe argument of type any
assigned to a parameter of type string
@typescript-eslint/no-unsafe-argument
Error: 32:44 error Unsafe member access .title on an any
value @typescript-eslint/no-unsafe-member-access
Error: 34:20 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 34:25 error Unsafe member access .getByText on an any
value @typescript-eslint/no-unsafe-member-access
Error: 36:20 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 36:25 error Unsafe member access .getByText on an any
value @typescript-eslint/no-unsafe-member-access
Error: 44:29 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 44:35 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 53:22 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 53:27 error Unsafe member access .getByText on an any
value @typescript-eslint/no-unsafe-member-access
tests/step-definitions/assertions/verify-new-page.ts
Error: 14:56 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 16:11 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 16:27 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 16:32 error Unsafe member access .waitForEvent on an any
value @typescript-eslint/no-unsafe-member-access
Error: 17:11 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 18:11 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 18:18 error Unsafe member access .waitForLoadState on an any
value @typescript-eslint/no-unsafe-member-access
tests/step-definitions/assertions/verify-page-language.ts
Error: 12:11 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 12:24 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 12:24 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 12:29 error Unsafe member access .locator on an any
value @typescript-eslint/no-unsafe-member-access
Error: 12:45 error Unsafe member access .getAttribute on an any
value @typescript-eslint/no-unsafe-member-access
tests/step-definitions/check.ts
Error: 14:35 error Unsafe argument of type any
assigned to a parameter of type string
@typescript-eslint/no-unsafe-argument
Error: 14:41 error Unsafe member access .title on an any
value @typescript-eslint/no-unsafe-member-access
Error: 16:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 18:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/click.ts
Error: 15:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 17:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/dropdown-select.ts
Error: 19:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 21:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 37:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 39:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/form-steps.ts
Error: 19:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 21:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 38:7 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 40:7 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
tests/step-definitions/navigation.ts
Error: 17:26 error Unsafe argument of type any
assigned to a parameter of type Page
@typescript-eslint/no-unsafe-argument
Error: 17:40 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
ERROR run failed: command exited (1)
Error: 19:56 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 25:21 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 25:26 error Unsafe member access .url on an any
value @typescript-eslint/no-unsafe-member-access
Error: 34:56 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 39:21 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 39:26 error Unsafe member access .url on an any
value @typescript-eslint/no-unsafe-member-access
Error: 48:28 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 48:34 error Unsafe assignment of an any
value @typescript-eslint/no-unsafe-assignment
Error: 55:11 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 55:16 error Unsafe member access .reload on an any
value @typescript-eslint/no-unsafe-member-access
Error: 57:56 error Unsafe argument of type any
assigned to a parameter of type GlobalConfig
@typescript-eslint/no-unsafe-argument
Error: 62:21 error Unsafe call of an any
typed value @typescript-eslint/no-unsafe-call
Error: 62:26 error Unsafe member access .url on an any
value @typescript-eslint/no-unsafe-member-access
Thank you, will check. Could you also share your actual tsconfig.json?
Added, overwrote the ts.config that was present.
This is part of a monorepo, let me know if you need me to share any of the files that sit outside of the test directory.
@rayo/typescript-config/base.json
is missing in the repo, but referenced in tsconfig.json: https://github.com/RichardCariven/playwright-bdd-example/blob/main/tsconfig.json#L3
Also it would be helpful to add @typescript-eslint
configuration, because without it it's difficult to reproduce linting errors.
Pushed the Tooling Directory, you may have to tweak a couple of teh paths as it is lifted from a larger project.
The ES.lint rules are in the next.js file under tooling/eslint-config
Hi @RichardCariven
I've checked the updated repo, installed two missing dependencies (axe-playwright and faker-js).
npx tsc --noEmit
runs successfully without any errors.
One suggestion is to add "module": "NodeNext"
to tooling/typescript-config/base.json
.
Anyway, could you try to reproduce at least one of these lint errors on the demo code?
You can ping me on discord (vitalets) to continue discussion directly.
Given team was running Playwright BDD V6.6.0 we have updated to V7.2.2 (with the aim of moving to 7.4) but are seeing a number of Type issues that mean we are unable to make this migration. The main issue seems to be that many types have become 'any'
When Upgraded to version 7.2.2
Then Linting errors appeared all the way through our Playwright code
But I expect To not have Linting errors
Isolated demo
Environment Playwright-bdd environment info:
platform: darwin node: v18.17.0 playwright-bdd: v7.2.2 @playwright/test: v1.47.2 @cucumber/cucumber: v10.8.0 Playwright config file: playwright.config.ts