Skip to content

Commit

Permalink
Added test for frame switching by an ID
Browse files Browse the repository at this point in the history
  • Loading branch information
aik099 committed Feb 22, 2024
1 parent baa9e54 commit 7055197
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 6 additions & 5 deletions tests/Basic/IFrameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class IFrameTest extends TestCase
*
* @dataProvider iFrameDataProvider
*/
public function testIFrame($iframeIdentifier): void
public function testIFrame($iframeIdentifier, $elementSelector, $elementContent): void

Check failure on line 14 in tests/Basic/IFrameTest.php

View workflow job for this annotation

GitHub Actions / Static analysis

Method Behat\Mink\Tests\Driver\Basic\IFrameTest::testIFrame() has parameter $elementContent with no type specified.

Check failure on line 14 in tests/Basic/IFrameTest.php

View workflow job for this annotation

GitHub Actions / Static analysis

Method Behat\Mink\Tests\Driver\Basic\IFrameTest::testIFrame() has parameter $elementSelector with no type specified.
{
$this->getSession()->visit($this->pathTo('/iframe.html'));
$webAssert = $this->getAssertSession();
Expand All @@ -21,8 +21,8 @@ public function testIFrame($iframeIdentifier): void

$this->getSession()->switchToIFrame($iframeIdentifier);

Check failure on line 22 in tests/Basic/IFrameTest.php

View workflow job for this annotation

GitHub Actions / Static analysis

Parameter #1 $name of method Behat\Mink\Session::switchToIFrame() expects string|null, int|string given.

$el = $webAssert->elementExists('css', '#text');
$this->assertSame('iFrame div text', $el->getText());
$el = $webAssert->elementExists('css', $elementSelector);
$this->assertSame($elementContent, $el->getText());

$this->getSession()->switchToIFrame();

Expand All @@ -36,8 +36,9 @@ public function testIFrame($iframeIdentifier): void
public function iFrameDataProvider()
{
return array(
'by name' => array('subframe'),
'by index' => array(1),
'by name' => array('subframe_by_name', '#text', 'iFrame div text'),
'by id' => array('subframe_by_id', '#foobar', 'Some accentués characters'),
'by index' => array(1, '#text', 'iFrame div text'),
);
}
}
4 changes: 3 additions & 1 deletion web-fixtures/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

<iframe src="empty_textarea.html"></iframe>

<iframe src="iframe_inner.html" name="subframe"></iframe>
<iframe src="iframe_inner.html" name="subframe_by_name"></iframe>

<iframe src="issue131.html" name="subframe_by_id"></iframe>

<div id="text">
Main window div text
Expand Down

0 comments on commit 7055197

Please sign in to comment.