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

Test resize and maximize window also prior to page visit #10

Closed
wants to merge 2 commits into from

Conversation

peterrehm
Copy link

{
$session = $this->getSession();
$session->resizeWindow(400, 300);
$session->wait(1000, 'false');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the session to wait without a meaningful JS condition (i.e. one subject to change) is useless. Just use sleep.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@stof
Copy link
Member

stof commented Feb 7, 2017

have you tried it for existing drivers ?

@peterrehm
Copy link
Author

I am fast, but not that fast :) It wont be too easy, as I also need the not merged patch with the auto start from Mink.

@peterrehm
Copy link
Author

Actually do you have a hint what would be the easiest way to test that?

@stof
Copy link
Member

stof commented Feb 7, 2017

no you don't need it, if you use the stable version of Mink (as it does not yet auto-start sessions at all, and so $this->getSession() would return a started session when using a stable release (as the Mink class forces the start).
And otherwise, you can just add a call to start in your test temporarily.

The easiest way to test your change is probably to run composer update in your clone of the driver repo, and then patching the WindowTest file inside your vendor/mink/driver-testsuite folder to run your modified version.
You could also change the composer.json of the driver to use your fork of the testsuite, but this is not worth it for one-time local testing.

@peterrehm
Copy link
Author

Mhm I tested it by submitting a PR to teh driver with the modified composer.json.

https://travis-ci.org/minkphp/MinkSelenium2Driver/builds/199169919

Looks like there is an issue with the WindowMaximize but Resize works find.

But the testWindowMaximize is skipped as it does not work in xvfb, I assume this
is related.

11) Behat\Mink\Tests\Driver\Js\WindowTest::testWindowMaximize
Maximizing the window does not work when running the browser in Xvfb.

Do you have any clue how to fix that?

Otherwise we could only allow resize and revert the autostart for the maximize function as it might not make any sense?

/cc @aik099

@stof
Copy link
Member

stof commented Feb 7, 2017

@peterrehm the fact that maximize does not work in Selenium when using xvfb is unrelated to this topic (and is why we skip the existing maximize test in the Selenium2Driver testsuite on Travis).
You can try running the testsuite locally, where it won't be using xvfb

@peterrehm
Copy link
Author

So much for the idea of quickly provide a PR for Mink :)

I am struggling with Selenium etc. on my local instance. I have a lot of failing tests

phpunit-5.7.phar --filter=WindowTest --verbose --debug
PHPUnit 5.7.11 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.0
Configuration: /www/MinkSelenium2Driver/phpunit.xml.dist

Starting test 'Behat\Mink\Tests\Driver\Js\WindowTest::testWindow'.
E
Starting test 'Behat\Mink\Tests\Driver\Js\WindowTest::testGetWindowNames'.
E
Starting test 'Behat\Mink\Tests\Driver\Js\WindowTest::testResizeWindow'.
.
Starting test 'Behat\Mink\Tests\Driver\Js\WindowTest::testResizeWindowBeforePageVisit'.
.
Starting test 'Behat\Mink\Tests\Driver\Js\WindowTest::testWindowMaximize'.
.
Starting test 'Behat\Mink\Tests\Driver\Js\WindowTest::testWindowMaximizeBeforePageVisit'.
.

So in conclusion the BeforePageVisit Tests are okay, we must skip testWindowMaximizeBeforePageVisit however. Where do I need to adjust this?

Any clue about the failing tests? I am using now Selenium 3 with Firefox 51.0.1 and latest geckodriver.

@stof
Copy link
Member

stof commented Feb 7, 2017

So in conclusion the BeforePageVisit Tests are okay, we must skip testWindowMaximizeBeforePageVisit however. Where do I need to adjust this?

Skipping tests is handled by the Config class living in the testsuite of each driver (the exact class name depends on the driver). The driver testsuite calls skipMessage for each test being run. If the method returns a string, the test is skipped using the string as message. Otherwise it runs.

Any clue about the failing tests? I am using now Selenium 3 with Firefox 51.0.1 and latest geckodriver.

GeckoDriver does not passes all tests yet. some of them are because GeckoDriver is not yet fully implemented (some APIs are missing) while some others are because we are too strict on our assertions (window name tests are in this category).
Plus, we currently have 1 or 2 tests failing on all versions of Selenium (2 and 3) and all browsers we tested. We need to figure them out (deciding whether they are a bug in our Selenium2Driver or in the driver-testsuite itself)

@peterrehm
Copy link
Author

@stof minkphp/MinkSelenium2Driver#265 Provided the adusted skip configuration.

Anything else needs to be done in this case? :)

@peterrehm
Copy link
Author

Okay, indeed, looks much better on Chrome. Can we get the several PRs of today now merged or is there anything else? /cc @aik099

@aik099
Copy link
Member

aik099 commented Feb 7, 2017

Looks good. But we need to be careful about merge order to avoid failing builds. @peterrehm maybe you can, in main task, specify order in which PR should be merged?

@peterrehm
Copy link
Author

I would merge it like this:

  • MinkSelenium2Driver (as it has no immediate impact)
  • Mink both PRs
  • DriverTestSuite

@peterrehm
Copy link
Author

@aik099 Anything else you need?

@aik099
Copy link
Member

aik099 commented Feb 9, 2017

Nothing else. Just waiting to @stof to catch up and merge all these PRs.

@peterrehm
Copy link
Author

Okay, perfect!

@peterrehm
Copy link
Author

@stof Anything else you need? It would be great to get this merged so I have it off my desk.

@peterrehm
Copy link
Author

@stof Any chance to get this merged? If this is not wanted any more let me know and I can close the PRs.

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.

3 participants