Im trying to perform a end to end test on a e-commerce website using playwright with TS (POM ,Fixture) while performing the test im using POM and fixture concept . The problem is that im while performing the test the product description page open on the new tab and i have to pass the instance of the new tab in fixture
// This is the function that clicks the target blank
// homepage class
async newtab(context){
const [tab] = await Promise.all([
context.waitForEvent('page'),
this.clickProduct(),
])
await tab.waitForLoadState();
return tab ;
}
// fixturepage
PDP: ({ homepage , context}, use) => {
use(new PDP(homepage.newtab(context));
},
I need to pass the instance of newtab as the argument of the PDP constructor
Hope yall got my problem and my question ! Thank You !