minkphp / driver-testsuite

Functional testsuite for Mink drivers
MIT License
8 stars 29 forks source link

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

Closed peterrehm closed 6 years ago

peterrehm commented 7 years ago

As discussed minkphp/Mink#732 and minkphp/Mink#733

stof commented 7 years ago

have you tried it for existing drivers ?

peterrehm commented 7 years ago

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 commented 7 years ago

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

stof commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@stof https://github.com/minkphp/MinkSelenium2Driver/pull/265 Provided the adusted skip configuration.

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

peterrehm commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

I would merge it like this:

peterrehm commented 7 years ago

@aik099 Anything else you need?

aik099 commented 7 years ago

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

peterrehm commented 7 years ago

Okay, perfect!

peterrehm commented 7 years ago

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

peterrehm commented 7 years ago

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