Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is msw also usable within a new page? #102

Open
daniel-hyun-chae opened this issue Sep 6, 2024 · 0 comments
Open

Is msw also usable within a new page? #102

daniel-hyun-chae opened this issue Sep 6, 2024 · 0 comments

Comments

@daniel-hyun-chae
Copy link

I have a test where it waits for a new window to popup and interact with the page in this new window.
It seems that the mock service worker made available with the extended test is not available in the new window.
It's a new page but still within the scope of the same test, I'd expect that the same service worker is available in the new window.
Is this intended behavior?

test("create new entry submits a correct data", async ({ page }) => {
....
await page.getByLabel("LP.general.input.password").click();
await page.getByLabel("LP.general.input.password").fill(userDataToSubmit.passwordDataForCreation.value);
await page.getByLabel("LP.general.input.confirmPassword").click();
await page.getByLabel("LP.general.input.confirmPassword").fill(userDataToSubmit.passwordDataForCreation.value);
await page.getByLabel("LP.views.UsersManagementView.users.passwordIsTemporary").check();

**const page2Promise = page.waitForEvent("popup");
await page.getByRole("button", { name: "LP.general.actions.submit" }).click();
const page2 = await page2Promise;
await page2.getByLabel("LP.general.input.user").click();
await page2.getByLabel("LP.general.input.user").fill("user1");**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant