3 namespace Zumba\GastonJS\Tests;
6 * Class BrowserWindowTest
7 * @package Zumba\GastonJS\Tests
9 class BrowserWindowTest extends BrowserCommandsTestCase {
11 public function testWindowHandleNoPage() {
12 $this->assertEquals(0, $this->browser->windowHandle());
15 public function testWindowHandlePage() {
16 $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
17 $this->assertEquals(0, $this->browser->windowHandle());
20 public function testWindowNameNoPage() {
21 $this->assertEmpty($this->browser->windowName());
24 public function testWindowNamePage() {
25 $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
26 $this->assertEquals("BASIC_WINDOW", $this->browser->windowName());
29 public function testCloseWindow() {
30 $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
31 $this->assertEquals(0, $this->browser->windowHandle());
32 $this->browser->closeWindow("0");
33 $this->assertNull($this->browser->windowHandle());
36 public function testWindowHandlesNoPage() {
37 $handles = $this->browser->windowHandles();
38 $this->assertCount(1, $handles);
39 $this->assertEquals($handles[0], "0");
42 public function testOpenNewWindow() {
43 $this->assertTrue($this->browser->openNewWindow());
44 $this->assertEquals("about:blank", $this->browser->currentUrl());
47 public function testWindowHandlesPage() {
48 $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
49 $this->browser->openNewWindow();
50 $this->visitUrl($this->getTestPageBaseUrl() . "/static/auth_ok.html");
51 $this->assertCount(2, $this->browser->windowHandles());
54 public function testSwitchToWindow() {
55 $this->testWindowHandlesPage();
56 $this->assertEquals(0, $this->browser->windowHandle());
57 $this->assertTrue($this->browser->switchToWindow("1"));
58 $this->assertEquals(1, $this->browser->windowHandle());