Comments (4)
In homeCardPage, which is the first page, where the app display the cards, for the user to select them.
from playwright-bdd.
This is kind of "expected", but lets discuss the use case.
Looking at the scenario itself, I've marked POM for each step:
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:
TodoPage
AdminTodoPage extends TodoPage
OtherTodoPage extends TodoPage
Technically we can instantiate two POMs (AdminTodoPage
and OtherTodoPage
) and call common step (And I filter todos as "Completed"
) on one of them. But imagine if these POMs have some state created by previous steps? In that case calling common step on one of them can lead to unexpected behavior.
One of the ideas is to introduce config option statelessPoms: true
and allow such situations. But I suggest to investigate more do we really need this. Maybe we can solve it with linear inheritance model.
Could you share your real use-case for such inheritance?
from playwright-bdd.
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.
When I select cards (homeCardPage)
Then I check cards selected in userPage (userCardPage)
And I send cards selected by email (emailCardPage)
I know that one way to cover this, would be to have two scenarios, one for checking the userCardPage and the other for emailCardPage.
But In the case of an e2e scenario I should be able to assert the same element in different components (pages).
So, making emailCardPage extends userCardPage, to cover the linear inheritance, could be a workaround, but I don't feel its the best solution, because I'm forcing emailCardPage inherit elements that are not needed.
from playwright-bdd.
Fair enough! So in your example, on what fixture should we call the first step I select cards
?
I see 3 options:
- on
homeCardPage
- on
userCardPage
- on
emailCardPage
from playwright-bdd.
Related Issues (20)
- Bug: SyntaxError when generating tests HOT 2
- Steps are not being found (probably something simple I have missed) HOT 2
- Open Playwright trace from HTML report without downloading HOT 5
- Error: Pickle step not found for step: I am login in my app (Since v6.0.1 ) HOT 14
- Question around best practice for Fixtures and BDD World. HOT 7
- May be a bug, unsure. Cant call init on BddWorld HOT 3
- Question: Generating cucumber reports with hooks HOT 9
- Getting Typescript error on Cucumber Reporter HOT 2
- Question: How do you organize steps in multiple TypeScript files (Playwright-style)? HOT 2
- Feature: call step from step HOT 9
- Feature: Add keyword in feature file HOT 1
- Feature: support defineParameterType for decorator playwright mode? HOT 1
- Can someone give an example of using Tags to set Locale via Fixtures? HOT 3
- Bug: Error: Requiring @playwright/test second time HOT 16
- Bug: Screenshots generated for visual testing are not correct , getting incomplete screenshots HOT 1
- Bug: Not able to execute tests with latest version of playwright HOT 7
- Question:Do steps have to be Async? HOT 2
- Feature: support new Playwright tags HOT 2
- Question: Why route not used when using routeFromHar with update: false ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from playwright-bdd.