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

feat(expect): introduce expect(locator).toIntersectViewport() #19901

Merged
merged 1 commit into from
Jan 7, 2023

Conversation

aslushnikov
Copy link
Collaborator

This is a new web-first assertion that should be used like this:

test('should work', async ({ page }) => {
  const locator = page.locator('body');
  // New web-first assertion.
  await expect(locator).toIntersectViewport();
  // The same functionality.
  await expect.poll(() => locator.viewportRatio()).toBeGreaterThan(0);
});

Fixes #8740

@aslushnikov aslushnikov force-pushed the to-intersect-viewport branch from 0c321e7 to 61627de Compare January 5, 2023 23:34
This is a new web-first assertion that should be used like this:

```ts
test('should work', async ({ page }) => {
  const locator = page.locator('body');
  // New web-first assertion.
  await expect(locator).toIntersectViewport();
  // The same functionality.
  await expect.poll(() => locator.viewportRatio()).toBeGreaterThan(0);
});
```

Fixes microsoft#8740
@aslushnikov aslushnikov force-pushed the to-intersect-viewport branch from 61627de to 7998a62 Compare January 7, 2023 00:54
@aslushnikov aslushnikov merged commit 2a49c5e into microsoft:main Jan 7, 2023
@aslushnikov aslushnikov deleted the to-intersect-viewport branch January 7, 2023 00:56
dgozman added a commit that referenced this pull request Jan 19, 2023
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.

[Feature] add expect(locator).isInViewport() / isIntersectingViewport
2 participants