6b87354d0ebecf5ccbe5705ba3287862c017f131
[yaffs-website] / vendor / jcalderonzumba / gastonjs / tests / unit / BrowserNavigateTest.php
1 <?php
2
3 namespace Zumba\GastonJS\Tests;
4
5 /**
6  * Class BrowserNavigateTest
7  * @package Zumba\GastonJS\Tests
8  */
9 class BrowserNavigateTest extends BrowserCommandsTestCase {
10
11   public function testBrowserVisit() {
12     $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
13   }
14
15   public function testBrowserCurrentUrl() {
16     $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
17     $currentUrl = $this->browser->currentUrl();
18     $this->assertEquals($this->getTestPageBaseUrl() . "/static/basic.html", $currentUrl);
19   }
20
21   public function testBrowserReload() {
22     $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
23     $this->assertTrue($this->browser->reload());
24     $currentUrl = $this->browser->currentUrl();
25     $this->assertEquals($this->getTestPageBaseUrl() . "/static/basic.html", $currentUrl);
26   }
27
28   public function testGoBack() {
29     //We have a clean slate so the first try should say no
30     $this->assertFalse($this->browser->goBack());
31     $this->testBrowserVisit();
32     //First visit still needs to be false
33     $this->assertFalse($this->browser->goBack());
34     $this->visitUrl($this->getTestPageBaseUrl() . "/static/auth_ok.html");
35     $this->assertTrue($this->browser->goBack());
36     $this->assertEquals($this->getTestPageBaseUrl() . "/static/basic.html", $this->browser->currentUrl());
37   }
38
39   public function testGoForward() {
40     //We have a clean slate so the first try should say no
41     $this->assertFalse($this->browser->goForward());
42     $this->testBrowserVisit();
43     //Still can not go forward
44     $this->assertFalse($this->browser->goForward());
45     $this->visitUrl($this->getTestPageBaseUrl() . "/static/auth_ok.html");
46     //Now we can go back and forward
47     $this->assertTrue($this->browser->goBack());
48     $this->assertTrue($this->browser->goForward());
49     $this->assertEquals($this->getTestPageBaseUrl() . "/static/auth_ok.html", $this->browser->currentUrl());
50   }
51 }