I am used to using Playwright in c# and now thinking about porting what we have into TS but being not overlay familiar with type script i thought i would experiment a bit. i found an issue that is confusing me. In C# i can create a page manager class that lists all my pages and with the pages i have component modals. this allows me to write a class for a component and it can be used in other pages objects. An Example of the structure might be Manager -> HomePage -> NavBar -> search input so in my test i would write await manager.Homepage.Navbar.searchinput.FillAsync("Test");
This work but experimenting with the same thing in TS seems to cause issues
I have this repo https://github.com/infinitejest69/PlaywrightTS/blob/Master/tests/POM.spec.ts (don't judge just experimenting with TS) With a test 'should show search' When i run it it seems to do the fill twice and i can't see why. i suspect my approach is just flawed for TS but the test still runs and does the fill
**EDIT To add i tried making the searchDocs a method outside of the constructor and still does the same thing
This thread is trying to answer question "Why does the 'fill' function run twice when creating a nested component in page objects in TypeScript?"
Thanks, so the fill is the issue pressSequentially with the break point seems to work with the breakpoint at the same place. how strange. I thought it was something racy in the approach of nesting classes.
Going to play around with a page object manager hopefully dont come across these issues again. thanks for your help
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].