Skip to content

Test iframe JS behaviors - #115

Open
xurizaemon wants to merge 2 commits into
minkphp:masterfrom
xurizaemon:js_iframe_same_origin
Open

xurizaemon wants to merge 2 commits into
minkphp:masterfrom
xurizaemon:js_iframe_same_origin

Conversation

@xurizaemon

@xurizaemon xurizaemon commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Extend iframe tests to JS - ensure clicks and script context behave as expected.

  • evaluateScript() and executeScript() run in iframe window context
  • clicks in iframes produce mousedown, mouseup, click on element
  • change event fires in iframe

Extracted from dmore/chrome-mink-driver#100

Only same-origin iframes tested.

- evaluateScript() and executeScript() run in iframe window context
- clicks in iframes produce mousedown, mouseup, click on element
- change event fires once in iframe
@aik099

aik099 commented Oct 4, 2026

Copy link
Copy Markdown
Member

✅ I've tried running these new tests on https://github.com/minkphp/MinkSelenium2Driver (chrome) and all passed.

❌ I've tried running these new tests on https://github.com/minkphp/MinkSelenium2Driver (firefox) and these (2 of 4) failed:

IFrameTest::testClickInIFrameTriggersChangeEvent:

1) Behat\Mink\Tests\Driver\Js\IFrameTest::testClickInIFrameTriggersChangeEvent
WebDriver\Exception\MoveTargetOutOfBounds: Move target (128, 169) is out of bounds of viewport dimensions (300, 150)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'alex-mbp', ip: '192.168.2.5', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.7', java.version: '21.0.9'
Driver info: driver.version: unknown

.../vendor/instaclick/php-webdriver/lib/WebDriver/Exception.php:198
.../vendor/instaclick/php-webdriver/lib/WebDriver/AbstractWebDriver.php:169
.../vendor/instaclick/php-webdriver/lib/WebDriver/Session.php:306
.../src/Selenium2Driver.php:936
.../src/Selenium2Driver.php:929
.../vendor/behat/mink/src/Element/NodeElement.php:176
.../vendor/mink/driver-testsuite/tests/Js/IFrameTest.php:54
phpvfscomposer://.../vendor/phpunit/phpunit/phpunit:106

IFrameTest::testClickInIFrameTriggersMouseEvents:

2) Behat\Mink\Tests\Driver\Js\IFrameTest::testClickInIFrameTriggersMouseEvents
WebDriver\Exception\MoveTargetOutOfBounds: Move target (128, 169) is out of bounds of viewport dimensions (300, 150)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'alex-mbp', ip: '192.168.2.5', os.name: 'Mac OS X', os.arch: 'aarch64', os.version: '26.7', java.version: '21.0.9'
Driver info: driver.version: unknown

.../vendor/instaclick/php-webdriver/lib/WebDriver/Exception.php:198
.../vendor/instaclick/php-webdriver/lib/WebDriver/AbstractWebDriver.php:169
.../vendor/instaclick/php-webdriver/lib/WebDriver/Session.php:306
.../src/Selenium2Driver.php:936
.../src/Selenium2Driver.php:929
.../vendor/behat/mink/src/Element/NodeElement.php:176
.../vendor/mink/driver-testsuite/tests/Js/IFrameTest.php:78
phpvfscomposer://.../vendor/phpunit/phpunit/phpunit:106

✅ I've tried running these new tests on https://github.com/minkphp/webdriver-classic-driver (firefox) and all passed.

✅ I've tried running these new tests on https://github.com/minkphp/webdriver-classic-driver (chrome) and all passed.

@xurizaemon

xurizaemon commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, really appreciate the cross-checks!

MoveTargetOutOfBounds: Move target (128, 169) is out of bounds of viewport dimensions (300, 150)

Looks like the clicked element is not visible and the driver does not scroll it into view before clicking? 300x150 is a default iframe size in most (?) browsers. If that's the case, setting iframe dimensions in the fixture might do the job.

I will take a look (when time allows!) at the Firefox/Selenium2 setup to better understand. Since these tests have come from issues identified in dmore/chrome-mink-driver (details linked above), it's possible they are revealing edge cases in Selenium2/Firefox.

Interested in your cross-driver test rig 😁

Added width and height attributes to the iframe.

Quick test via Github web UI to see if breakage is related to target visibility (which is not the intended subject of the test).
@xurizaemon

xurizaemon commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I set non-default height/width on the iframe in 5126c30

I'm trying to locate how you ran the tests across several drivers - I didn't find docs, but when I came back to it and cheated by searching for "running" (from your comment), I found #103 which looks like the ticket. I'm trying to get that working now so I'm not depending on you running them for me again 😄

Update (2): Looks like the #103 changes don't surface failure as expected - would very much appreciate if you can point the way to running the various suites to test this! No pressure, I'll keep trying to work it out if not :D

@aik099

aik099 commented Oct 11, 2026

Copy link
Copy Markdown
Member

My setup is this:

  1. downloaded Selenium jar files for 2, 3 and 4 versions
  2. geckodriver & chromedriver corresponding to my installed browser versions
  3. os: macOS
  4. shell script to start either of selenium servers as needed
  5. all minkphp organization repos cloned side by side where vendor/mink/driver-testsuite folder instead of composer-created is a symlink to clone of that repo
  6. the phpunit.xml in each driver describing my folder setup

This way I can easily test any driver PR and see if changes to driver-testsuite would fail on any of drivers before these changes are merged.

@aik099

aik099 commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

@xurizaemon, thank you. The last change you did fixed it for me. So I think we're good to go here.

Thank you for pointing out that currently we have no tests asserting a scroll-into-view problem that Firefox doesn't automatically handle, but Chrome does. Added them in #117 PR.

The webdriver-classic-driver does scroll-into-view by itself, while MinkSelenium2Driver doesn't (there is minkphp/MinkSelenium2Driver#389 pending about this problem), and that explains why it failed with Firefox as you told yourself.

@aik099

aik099 commented Oct 13, 2026

Copy link
Copy Markdown
Member

@xurizaemon, I've also tested with minkphp/MinkSelenium2Driver#389 applied on your original PR commit (6f16aa2 - iframe without explicit dimensions), and it no longer fails.

@xurizaemon

Copy link
Copy Markdown
Contributor Author

Is there anything more I can do for this?

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