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: request an animation frame to fix flaky clickablePoint test #7587

Merged
merged 2 commits into from Sep 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/jshandle.spec.ts
Expand Up @@ -309,7 +309,9 @@ describe('JSHandle', function () {
<div style="cursor: pointer; width: 120px; height: 60px; margin: 30px; padding: 15px;"></div>
`;
});

await page.evaluate(async () => {
jschfflr marked this conversation as resolved.
Show resolved Hide resolved
return new Promise((resolve) => window.requestAnimationFrame(resolve));
});
const divHandle = await page.$('div');
expect(await divHandle.clickablePoint()).toEqual({
x: 45 + 60, // margin + middle point offset
Expand All @@ -335,6 +337,9 @@ describe('JSHandle', function () {
<iframe style="border: none; margin: 0; padding: 0;" seamless sandbox srcdoc="<style>* { margin: 0; padding: 0;}</style><div style='cursor: pointer; width: 120px; height: 60px; margin: 30px; padding: 15px;' />"></iframe>
`;
});
await page.evaluate(async () => {
return new Promise((resolve) => window.requestAnimationFrame(resolve));
});
const frame = page.frames()[1];
const divHandle = await frame.$('div');
expect(await divHandle.clickablePoint()).toEqual({
Expand Down