-
Notifications
You must be signed in to change notification settings - Fork 0
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: Support resize window #10
Conversation
currentHeight: number, | ||
) { | ||
if (width > maxWindowSize || height > maxWindowSize) { | ||
throw new WindowSizeRangeError(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestCafe has checked the input before. Only positive integer is allowed. However, there is no limit for max size. So here added one.
Meanwhile, TestCafe official provider is using MAX_SAFE_INTEGER as the maxWindowSize to validate the input. However, the error message is mismatched with the actual value, which is 2^53-1.
Considering real-world scenarios, setting it to 2^31-1 is good enough.
export const maxWindowSize = 2 ** 31 - 1;
Description
Job example: https://app.saucelabs.com/tests/85b6389899714d53b8514a1a88cb3563#2
Notes: when getting and setting window size, TestCafe official provider is checking if the browser is jwp type and using
_getWindowSize
and_setWindowSize
. These two methods are both deprecated and commented asThis command is deprecated and likely not supported by any browser.
. They have been removed recently as well. Therefore, in this PR, only usebrowser.getWindowRect
andbrowser.setWindowRect
which are for W3C browser.