-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wdspec] Assert for expected screenshot dimensions.
Depends on D10627 Differential Revision: https://phabricator.services.mozilla.com/D10628 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1503804 gecko-commit: 076d32d1343fa0203bbf58209a45c73f2c878d97 gecko-integration-branch: autoland gecko-reviewers: ato
- Loading branch information
1 parent
ba41afb
commit 1d98d96
Showing
11 changed files
with
72 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1 @@ | ||
def retrieve_element_rect(session, element): | ||
return session.execute_script(""" | ||
let rect = arguments[0].getBoundingClientRect(); | ||
return { | ||
x: rect.left + window.pageXOffset, | ||
y: rect.top + window.pageYOffset, | ||
width: rect.width, | ||
height: rect.height, | ||
}; | ||
""", args=(element,)) | ||
|
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 |
---|---|---|
|
@@ -231,4 +231,3 @@ def closed_window(session, create_window): | |
yield new_handle | ||
|
||
session.window_handle = original_handle | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import base64 | ||
import math | ||
import struct | ||
|
||
from tests.support.asserts import assert_png | ||
|
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,12 @@ | ||
def element_rect(session, element): | ||
return session.execute_script(""" | ||
let {devicePixelRatio} = window; | ||
let rect = arguments[0].getBoundingClientRect(); | ||
return { | ||
x: Math.floor((rect.left + window.pageXOffset) * devicePixelRatio), | ||
y: Math.floor((rect.top + window.pageYOffset) * devicePixelRatio), | ||
width: Math.floor(rect.width * devicePixelRatio), | ||
height: Math.floor(rect.height * devicePixelRatio), | ||
}; | ||
""", args=(element,)) |
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,6 @@ | ||
def document_dimensions(session): | ||
return tuple(session.execute_script(""" | ||
let {devicePixelRatio} = window; | ||
let {width, height} = document.documentElement.getBoundingClientRect(); | ||
return [Math.floor(width * devicePixelRatio), Math.floor(height * devicePixelRatio)]; | ||
""")) |
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