-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bug: scenarios in the same feature create tests using different fixtures #52
Comments
This is definitely bug, related to Background's own scope. I will investigate. |
Fixed in |
Sorry for late checking. I'll re-check tomorrow. Thank you for addressing it. |
I have tested, and got a worse situation. as you see, my ModelCompare is extended from ModelCenter (marked as modelCenter). previously, at least the step description belongs to the class(feature), it could choose the right class. but not anymore. |
Hi @wootra ! Looking on your screenshots I've noticed that I think this is the root of the issue. Could you re-check? |
@vitalets I fixed what you mentioned. But still the feature.spec.js file is not using only modelCompare even though I set background for the modelCompare and set here is the extend states of my classes: |
@wootra so the issue is that |
Tried to reproduce the behavior in https://github.com/vitalets/playwright-bdd-example/pull/4/files but works correctly. test.describe(`feature`, () => {
test.beforeEach(async ({ Given, modelCompare }) => {
await Given(`step from modelCenter`, null, { modelCompare });
});
test(`Open Build Modal in Model Center (Blank)`, async ({ And, modelCompare }) => {
await And(`step from modelBuildModal`, null, { modelCompare });
});
}); Could you have a look on this to find what extra code in your case leads to incorrect structure? |
@vitalets I did not recognize the version is increased to 5.4.0 version. Let me try with the new version tomorrow. thanks! |
with the version 5.4.0, confirmed the issue is solved. @vitalets . Thanks for taking care of it! |
Thanks for raising this! 😊 |
short description
I am using classes extending one from others to share functionalities.
But as you guys know class can hold state as member variables.
even though I use the method that is inherited from the parent class, the state can be different.
in below test, even though I used the "Given" decorator to choose the child class, the result is just chosen based on where the specific decorator is located (parent class).
When the feature file is marked with specific fixture, it should consistently use the same fixture, but in below example, you will see the fixture for each tests are dynamically chosen based on the location of the each decorator.
To fix this temporarily, I had to use a specific decorator that only belong to the fixture and it makes my BDD more verbose.
Given
playright config
feature
fixture
fixtures.ts
When
Then
It creates test using different fixtures
Expected behavior
for the same fixture, (especially when I explicitly defined
@fixture: fundCenter
), it should use the same fixture instead of using the class that holds original decorator.Isolated demo
Environment
The text was updated successfully, but these errors were encountered: