Skip to content

Commit

Permalink
Avoid messing driver state of further tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uuf6429 committed Nov 3, 2024
1 parent 626f202 commit 9447ef5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions tests/Custom/TimeoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Behat\Mink\Exception\DriverException;
use Behat\Mink\Tests\Driver\TestCase;
use Mink\WebdriverClassicDriver\Tests\WebdriverClassicConfig;
use Mink\WebdriverClassicDriver\WebdriverClassicDriver;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;

Expand Down Expand Up @@ -89,19 +90,19 @@ public function testShortPageLoadTimeoutThrowsException(): void
*/
public function testDeprecatedShortPageLoadTimeoutThrowsException(string $type): void
{
$this->markTestSkipped('Temporary; checking build failures');

$session = $this->getSession();
$driver = $session->getDriver();
\assert($driver instanceof WebdriverClassicDriver);

$driver->setTimeouts([$type => 500]);

$this->expectDeprecation('Using "' . $type . '" timeout type is deprecated, please use "page" instead');
$this->expectException(DriverException::class);
$this->expectExceptionMessage('Page failed to load: ');

$session->visit($this->pathTo('/page_load.php?sleep=2'));
$driver = WebdriverClassicConfig::getInstance()->createDriver();
$driver->start();

try {
$this->expectDeprecation('Using "' . $type . '" timeout type is deprecated, please use "page" instead');
$driver->setTimeouts([$type => 500]);

$this->expectException(DriverException::class);
$this->expectExceptionMessage('Page failed to load: ');
$driver->visit($this->pathTo('/page_load.php?sleep=2'));
} finally {
$driver->stop();
}
}

public static function deprecatedPageLoadDataProvider(): iterable
Expand Down

0 comments on commit 9447ef5

Please sign in to comment.