-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(browser): playwright provider doesn't allow resizing the browser…
… viewport (#5984) Co-authored-by: Vladimir Sheremet <[email protected]>
- Loading branch information
1 parent
b1a27d4
commit ff978e5
Showing
4 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { page, server } from '@vitest/browser/context' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
describe.skipIf(server.provider === 'preview')('viewport window has been properly initialized', () => { | ||
it.skipIf(!page.config.browser.headless)('viewport has proper size', () => { | ||
const { width, height } = page.config.browser.viewport | ||
const { width: actualWidth, height: actualHeight } = window.document.documentElement.getBoundingClientRect() | ||
|
||
expect(actualWidth).toBe(width) | ||
expect(actualHeight).toBe(height) | ||
}) | ||
|
||
it.skipIf(page.config.browser.headless)('window has been maximized', () => { | ||
let topWindow = window | ||
while (topWindow.parent && topWindow !== topWindow.parent) { | ||
topWindow = topWindow.parent as unknown as any | ||
} | ||
|
||
// edge will show the Hub Apps right panel | ||
if (server.browser === 'edge') { | ||
expect(topWindow.visualViewport.width - topWindow.innerWidth === 0).toBe(true) | ||
} | ||
else { | ||
expect(screen.availWidth - topWindow.innerWidth === 0).toBe(true) | ||
} | ||
}) | ||
}) |