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

fix: consider existing frames when waiting for a frame #8200

Merged
merged 1 commit into from Apr 7, 2022
Merged

Conversation

OrKoN
Copy link
Collaborator

@OrKoN OrKoN commented Apr 6, 2022

No description provided.

@OrKoN OrKoN requested a review from ergunsh April 6, 2022 12:55
Copy link
Collaborator

@ergunsh ergunsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where the test for this specific functionality can belong. However, I think we're able to test this change via using utils.attachFrame which attaches a frame and resolves after it is attached in the page.

For example, I added a test in oopif.spec.ts and it correctly tests this change:

it('should waitForFrame resolve immediately if the waited frame already exists in the page', async () => {
    const { server } = getTestState();

    await page.goto(server.EMPTY_PAGE);
    await utils.attachFrame(
      page,
      'frame2',
      server.CROSS_PROCESS_PREFIX + '/empty.html'
    );

    await page.waitForFrame((frame) =>
      frame.url().endsWith('/empty.html')
    );
  });

Though I'm not sure if the test should belong there 😅

src/common/Page.ts Show resolved Hide resolved
@OrKoN
Copy link
Collaborator Author

OrKoN commented Apr 7, 2022

Thanks for taking a look! The idea of using utils.attachFrame for testing this looks good to me. Updating the PR.

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

Successfully merging this pull request may close these issues.

None yet

2 participants