Giter VIP home page Giter VIP logo

Comments (4)

jzaratei avatar jzaratei commented on June 2, 2024 1

In homeCardPage, which is the first page, where the app display the cards, for the user to select them.

from playwright-bdd.

vitalets avatar vitalets commented on June 2, 2024

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.

jzaratei avatar jzaratei commented on June 2, 2024

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.

vitalets avatar vitalets commented on June 2, 2024

Fair enough! So in your example, on what fixture should we call the first step I select cards?
I see 3 options:

  1. on homeCardPage
  2. on userCardPage
  3. on emailCardPage

from playwright-bdd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.