playwright
playwright copied to clipboard
[Feature] Allow dependent Projects to Run even if the First Project Fails.
I have a playwright.config.ts in which I define 3 projects. Below is my project structure. projects: [ { name: 'Need Authentication For Usage tests', testDir: './tests/Billing/',Need Authentication For Usage tests }, { name: 'Need Authentication', testDir: './tests/Authentication/', dependencies: ['Need Authentication For Usage tests'],
}, { name: 'Non-Authentication State', testDir: './tests/Non-Authentication/', dependencies: ['Need Authentication For Usage tests'], }, ],
Basically i want to run the test scripts in ./tests/Billing/ directory separately and once it gets executed (be the test status be PASS/FAIL). then i want to run my other projects. Once the Project : Need Authentication For Usage tests is completed , only then i would want my other projects to be picked up. I am facing this issues as i am running my tests parallely using 6 workers. And i would like to run my Tests parallely. Or is there any way through which i can achieve this?
I have the same need.
I am using a setup
project to authenticate and authorize various users so that I can store and reuse the obtained authorization tokens. If I have three users and one fails to authenticate during the setup, I would still want to execute the dependent projects. If a test in them requires a missing token it can fail on its own. However, I would still retain the ability to execute tests for those users with tokens. Not being able to configure a dependency and flag it as dependencies: [["setup", { fail: "allowed" }]]
is making me consider using once more the global-setup outside the projects array. Even if that requires extra steps to handle errors and permit projects to run and fail on their own.
One of my projects could be described as follows:
projects: [
{
name: "setup",
testMatch: "auth.setup.ts"
},
{
name: "project1",
dependencies: ["setup"],
use: { ... }
},
{
name: "project2",
dependencies: ["setup"],
use: { ... }
}
...
]
The type for the fail property could be fail: "allowed" | "forbidden"
.
There could even be a similar flag for skipped executions. Or they could be combined with creative names.
Hope it helps!
Thanks!
Upvote, same needs here, my test is testing e2e workflow of 3 applications: app A, app B and app C. I want to run all tests related to app A and app B, then run tests on app C (it takes a while to app C to process submissions from app A and B). If one test of app A or app B fail, I'll add logic to skip that test for app C.
Now, if set app C into one project dependent on project of app A and B, if one test of app A or app B fail, all tests on app C won't run
I would also like to request this feature. It would be very helpful for me.
For now, I've found a crude workaround. If you go into the node_modules folder for Playwright, you can find the 'tasks.js' file.
Go to the createRunTestsTask() function, and change the "if (!hasFailedDeps) phaseTestGroups.push(...testGroups);" line to read just "phaseTestGroups.push(...testGroups);"
Now, the test runner will not skip any projects that have failed dependencies. This is not a perfect solution, but maybe it will help for now.
+1 This feature along with https://github.com/microsoft/playwright/issues/18112 can allow users to decide how test can be run. Think about this like high level soft assertions.
waiting for this feature also , i have the same problem as jmflaherty