Open markov1983 opened 3 weeks ago
Hey @vitalets I made some progress with the test execution, I was able to run the tests with @nx/playwright:playwright executor just by using the "config" option but I can not use any options like devServerTarget as I am getting that error: unknown option. Why is that happening? If possible I would like to use other options so that I can build app prior to text execution, etc.
Hi @markov1983
I've updated playwright-bdd-example nx
branch, please check-out does it work for you.
Looking at provided files, I think the possible issue is here:
"options": {
"config": "playwright.config.ts"
}
Each project searches for playwright.config.ts
in workspace root, but should use Playwright config from project root.
Try the following setup:
"targets": {
"bddgen": {
"command": "bddgen",
"options": {
"cwd": "{projectRoot}"
}
},
"e2e": {
"executor": "@nx/playwright:playwright",
"dependsOn": ["bddgen"],
"options": {
"config": "{projectRoot}"
}
}
Thx, a lot @vitalets and I apologize for the late reply, I was on vacation. I have managed to sort it out. It was my bad setup/config. Thank you for the answer.
Hi, I am working on one project using NX and playwright and am having trouble implementing the playwright BDD.
One of those 5 apps is subject to implementation with playwright BDD I have followed the guidelines on your website and example repo to try to make it work, but I can't do that.
a) When I run: npx nx run my app-bdd:e2e (all other apps are executed like that) the .feature-gen dir is generated with test inside but I am getting an error that no tests are found
Also, as you can see the command that is executed contains the SRC part which is I guess forced somehow through NX which is then trying to search the tests in that folder. If I try to run manually the command without src part through CLI the tests starts with execution.
As for the project.json, this is how it looks like: As you can see I did try to force the output so that it generates the tests inside src folder but that doesn't work
Unfortunately, I am not able to share other parts of the repo/code
b) when I try to run: the npm run test I get an error (Can't find Playwright config file ) and the targeted folder is always the workspace root and not the desired app root (even dough I do try to pass the --config flag "npx bddgen --tags '@todo' && npx playwright test --config apps/myapp/playwright.config.ts" inside test script
c) If I try to use "executor": "@nx/playwright:playwright", then I am getting an error that no options are found:
If you can help maybe with some advice or tips on how to make it work that would be great, thank you for great work and BDD implementation :)
Some of the libs used: