-
-
Notifications
You must be signed in to change notification settings - Fork 19
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: Inheritance Issue when more than one child is issue in the same scenario #102
Comments
This is kind of "expected", but lets discuss the use case. Scenario: Complete todos
When I add todo "foo" # AdminTodoPage
And I add todo "bar" # AdminTodoPage
And I complete todo "bar" # OtherTodoPage
And I filter todos as "Completed" # TodoPage
Then visible todos count is 1 # TodoPage So scenario uses 3 POMs that are in non-linear relationship:
Technically we can instantiate two POMs ( One of the ideas is to introduce config option |
I got an e2e scenario where I need to select some cards, lets call it homeCardsPage (parent). Then I need to check (assert) those cards selected in two different pages: userCardsPage (child1) and emailCardPage(child2). These last two pages share the same list of cards, but they are different pages with different elements, that's why we could say they are siblings. They all share a global variable (fixture) cardList, with the card selected by the user.
I know that one way to cover this, would be to have two scenarios, one for checking the userCardPage and the other for emailCardPage. |
Fair enough! So in your example, on what fixture should we call the first step
|
In homeCardPage, which is the first page, where the app display the cards, for the user to select them. |
@jzaratei Taking the example above: When I select cards (homeCardPage)
Then I check cards selected in userPage (userCardPage)
And I send cards selected by email (emailCardPage) The generated test should be: test("my test", async ({ When, Then, And, homeCardPage, userCardPage, emailCardPage }) => {
await When("I select cards", null, { homeCardPage });
await Then("I check cards selected in userPage", null, { userCardPage });
await And("I send cards selected by email", null, { emailCardPage });
}); If it is still relevant for your project, could you re-check on your side? Note: to return to previous behavior there is a new config option statefulPoms: true. |
Yeah, I am refactoring my page objects and now it seems to work as expected. Thank for this upgrade! |
Given
Scenario: Add todos
When I add todo "foo"
And I add todo "bar"
Then visible todos count is 2
When
I create multiple child classes for todo page: AdminTodoPage, OtherTodoPage
Then
I run npx bddgen and I get
Error: Can't guess fixture for decorator step "I filter todos as "Completed"" in file: features\todopage.feature. Please refactor your Page Object classes or set one of the following tags: @fixture:adminTodoPage, @fixture:otherTodoPage
Adding @fixture:otherTodoPage or @fixture:adminTodoPage tag does not work
But I expect
test cases to be generated successfully. The step "I filter todos as "Completed" should use parent fixture 'todoPage'
Isolated demo
https://github.com/jzaratei/playwright-bdd-example/tree/inheritance-issue
Environment
The text was updated successfully, but these errors were encountered: