Hi @qaengineer,
Sorry for my late reply. I was out of the office.
The problem is the test script creates concurrent browser contexts, which is not allowed:
export async function firstTest() {
const page = browser.newPage();
// ...
}
export async function secondTest(context) {
const page = context.newPage();
// ...
}
See the migration guide and documentation for more details:
So, the solution is to close the browser context when a test finishes:
export async function firstTest() {
const page = browser.newPage();
try {
// ... same
} finally {
page.close();
browser.context().close(); // <--
}
}
export async function secondTest() {
const page = browser.newPage();
try {
// ... same
} finally {
page.close();
browser.context().close(); // <--
}
}
browser.newPage
creates a new page in a new context. That’s why we should close the other context before calling newPage
. The first test will create a new page in a new context and then close the context when it’s done. Then the second test will run and do the same.
Hope this helps.