From 5e3fa6723b144c7962eebfd2e34b2cf917c18b4a Mon Sep 17 00:00:00 2001 From: Christian Sciberras Date: Sun, 5 Jan 2025 21:49:54 +0100 Subject: [PATCH] Test switching to missing window --- tests/Js/WindowTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Js/WindowTest.php b/tests/Js/WindowTest.php index 2a526ba..fc6b697 100644 --- a/tests/Js/WindowTest.php +++ b/tests/Js/WindowTest.php @@ -2,6 +2,7 @@ namespace Behat\Mink\Tests\Driver\Js; +use Behat\Mink\Exception\DriverException; use Behat\Mink\Tests\Driver\TestCase; final class WindowTest extends TestCase @@ -108,4 +109,14 @@ public function testWindowMaximize(): void $this->assertLessThanOrEqual(100, $session->evaluateScript($script)); } + + public function testSwitchingToMissingWindow(): void + { + $this->getSession()->visit($this->pathTo('/window.html')); + $session = $this->getSession(); + + $this->expectException(DriverException::class); + + $session->switchToWindow('inexistent_window'); + } }