Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I define the --config flag? #6

Closed
zakhenry opened this issue May 2, 2022 · 5 comments
Closed

How can I define the --config flag? #6

zakhenry opened this issue May 2, 2022 · 5 comments

Comments

@zakhenry
Copy link

zakhenry commented May 2, 2022

I use NX and so my tests are fairly nested within a folder. The npm script I run to get headed tests is

yarn playwright test --config ./apps/my-app-e2e/playwright.config.ts --headed

I don't have anything special in the config file, but I suspect the testDir: './src/tests', field is what is causing this plugin to fail to find my tests?

Out of the box if I try to run a test from the gutter I get

Screenshot 2022-05-03 at 04 15 30

the console shows

/Users/zak/.nvm/versions/node/v14.17.1/bin/node /Users/zak/.nvm/versions/node/v14.17.1/lib/node_modules/yarn/bin/yarn.js run playwright test --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter11570315857909753255.js optimize.spec.ts -g "^optimize.spec.ts.Optimize.should have the form initialised$"
yarn run v1.22.15
$ playwright test --reporter /var/folders/j8/hkdrcxfn7819nyspt0mqq0tm0000gn/T/intellij-playwright-reporter11570315857909753255.js optimize.spec.ts -g '^optimize.spec.ts.Optimize.should have the form initialised$'

nothing in that command has the relative path to the spec file so I think the config needs to be passed for discovery (or maybe the plugin can pass the full path directly?)

@mbolotov
Copy link
Owner

mbolotov commented May 2, 2022

Hi Zak,
You can define any additional parameters in this field of a run configuration:
image

@zakhenry
Copy link
Author

zakhenry commented May 2, 2022

Wouldn't I need to do this on every test though? As in the workflow would be run test in margin, let it fail, go edit run configuration then rerun. for each test?

@mbolotov
Copy link
Owner

mbolotov commented May 2, 2022

you can use run configuration templates to define default parameters to be used for a newly created configuration:
image

@zakhenry
Copy link
Author

zakhenry commented May 2, 2022

Oh fantastic, that works well thanks!

@zakhenry zakhenry closed this as completed May 2, 2022
@rickirunge
Copy link

Also works if you manual change "Project Base" to the root of your project.

Don't know why this is set to the folder of the test being run - don't know when that would be needed?
IMO it should (almost) always be the project root - the same ways as when you run playwright using "npm run"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants