forked from minkphp/driver-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIFrameTest.php
39 lines (30 loc) · 1.2 KB
/
IFrameTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace Behat\Mink\Tests\Driver\Basic;
use Behat\Mink\Tests\Driver\TestCase;
final class IFrameTest extends TestCase
{
/**
* @dataProvider iFrameDataProvider
*/
public function testIFrame(string $iframeIdentifier, string $elementSelector, string $elementContent): void
{
$this->getSession()->visit($this->pathTo('/iframe.html'));
$webAssert = $this->getAssertSession();
$el = $webAssert->elementExists('css', '#text');
$this->assertSame('Main window div text', $el->getText());
$this->getSession()->switchToIFrame($iframeIdentifier);
$el = $webAssert->elementExists('css', $elementSelector);
$this->assertSame($elementContent, $el->getText());
$this->getSession()->switchToIFrame();
$el = $webAssert->elementExists('css', '#text');
$this->assertSame('Main window div text', $el->getText());
}
/**
* @return iterable<string, array{string, string, string}>
*/
public static function iFrameDataProvider(): iterable
{
yield 'by name' => ['subframe_by_name', '#text', 'iFrame div text'];
yield 'by id' => ['subframe_by_id', '#foobar', 'Some accentués characters'];
}
}