Closed jithinjosejacob closed 2 years ago
TypeError: Cannot read properties of undefined (reading 'waitForEvent')
It looks like the context that you pass into AfterpayLoginPage is undefined or it gets reset to undefined before calling this.context.waitForEvent
. Is afterpayLoginPage
a test fixture? Can you share its code?
@yury-s - i have updated the initial message with the whole script
The code looks correct, it appears that AfterpayLoginPage.context
gets cleared at some point after the object is constructed but it's hard to tell for sure without seeing full code and the error. Can you please provide a repro?
Is there a reason you redefine page
and context
fields in AfterpayLoginPage
when they already exist in the superclass?
i have removed the redinition of page and context and defined context for every fixture. Now i am able to access the context properly in the tests. Only problem i am seeing right now is when i open a new tab ,it opens up a new window instead of a new tab in existing browser (but tab2 opened has the same cache and cookies as that of tab1). i will raise this a seperate question for this with a repro
I am using Page Object Model for my tests using Playwright Test Runner and TypeScript
I have a scenario where i need to handle multitab
I am trying to access context inside one of the pages, so that i can work with new tab
But i am getting following error
TypeError: Cannot read properties of undefined (reading 'waitForEvent')
Is the below approach correct or is there any other way to handle this.
Base Page
Master Page
AfterpayLoginPage