I’m opening a window (w1) using beforeEach, from that I’m opening another window (w2). Now, I want to perform some actions on (w2) and switch to (w1). And then, close a (w2) window.
test.beforeEach(async ({ page }) => {
await page.goto(BASE_URL + "/w1");
});
test("switch between tabs", async ({ context }) => {
const page = await context.newPage();
const [newtab] = await Promise.all([
context.waitForEvent('page'),
await page.goto(BASE_URL + "/w2"),
await page.getByTestId('id_here').click(),
await page.getByTestId('id1_here').fill('test')
])
//come back to window (w1)
//perform actions on window (w1)
//close window (w2)
});