-
Notifications
You must be signed in to change notification settings - Fork 29
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
testWindowMaximize is prone to failure #66
Comments
Does it work with a different Selenium version/Web Browser?
I like that. Could you please change that test to use that API instead? Also please check if it works fine with Google Chrome. |
I did find what the main problem was - the infobar thing in chrome is what was causing the height change. Firefox tests were in fact not failing. I'll implement the change, no worries. |
Hmm, sadly that API is only available to web-extensions. I would consider changing to the following code though: $unusedWidth = $session->evaluateScript('screen.availWidth - window.outerWidth');
$unusedHeight = $session->evaluateScript('screen.availHeight - window.outerHeight');
$this->assertLessThanOrEqual(0, $unusedWidth);
$this->assertLessThanOrEqual(0, $unusedHeight); Presumably it shouldn't care about negative values. Wdyt? |
I like this. Adding a window width check was a wise move. Whatever the 100 number meant it is no longer relevant, because currently |
@uuf6429 can you send a PR ? |
Unfortunately, that's not the case. It seems that it depends on the browser and platform. Even worse, these variations haven't been reported as bugs and are undocumentation (fox example mdn/caniuse report full support) A quick check on Win11+Chrome yields the following:
I'll send one soon, however I still feel this test is more trouble than it's worth. 😞 |
@uuf6429 , then the only way to proceed is to:
? Then window maximization test (as before) would be testing the window state close to maximized :( , but be cross-browser compatible. |
@aik099 I see two other possibilities:
|
The 2nd option sounds useful. Since we can't exactly tell if the window has been maximized we at least can tell it has been resized. |
Done: #75 |
First of all, the code is not very clear - it took me a few moments to realise what it was doing, all the while I was thinking "but where is the screen height defined and is 100 a sane maximised window height?"
driver-testsuite/tests/Js/WindowTest.php
Line 95 in 9f2fb57
It turns out that the test assumes that when a window is maximized, it will be the height of the screen minus some height for desktop widgets such as a taskbar. This extra height is defined as a buffer of up to 100px.
(it could be helpful to assign values to aptly named variables)
Anyway, while testing with Firefox on Selenium (standalone v2.53.1), it seems that the OS needs 102px - causing the test to fail.
A cursory search resulted in this fairly available API that could be used instead of manually checking the window size:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/WindowState#browser_compatibility
The text was updated successfully, but these errors were encountered: