This thread is trying to answer question "How to model a page with different tabs, each containing fields of information to be filled in?"
In our case, there is a page object model and then the tabs are like components that you intialize in that page object. Something like this:
export class SomePage {
readonly firstTab = new OneTab(this.page)
readonly secondTab = new SecondTab(this.page)
...locators that are in page but not in tabs
constructor(private readonly page: Page) {}
}
export class FirstTab {
...locators
constructor(private readonly page: Page) {}
}
@tphillips8117 thanks for your input. but you know the challenge that I'm facing is that each tab contains a lot of information and at some point it will become chaotic, modelling the entire page's locators in only one POM.
@skorp32 thanks for your input. I've been thinking to the same approach. If I'm not mistaken about your explanation. I should have all tabs' POM already implemented aside?
But how are you going to passe this.page to your tabs readonly firstTab =new OneTab(this.page) in typescript
whereas they are not inside of your constructor() function yet?
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].