예제 #1
0
    public function testDelayedWriteWithElementTest()
    {
        $time = time();
        $this->write(<<<HTML
<html>
<body>
<script type="text/javascript">
var nextUrl;
setTimeout(function(){
    window.location.href = nextUrl;
}, 4000);
</script>
<div id="testElement">Test</div>
</body>
</html>
HTML
);
        $this->unlink();
        $this->write(<<<HTML
<html>
<body>
<div id="footer">Test</div>
</body>
</html>
HTML
, false);
        $testElement = $this->byId('testElement');
        $filename = str_replace('\\', '\\\\', $this->filename);
        $this->webdriver->executeScript(<<<SCRIPT
window.nextUrl = "file://{$filename}";
SCRIPT
);
        $action = new WaitForPageLoaded($this->webdriver, $this->getThemeMock());
        $action->execute($testElement);
        $this->unlink();
        self::assertGreaterThan($time + 2, time());
        // Asserting that the test took longer than 3 seconds
    }
 public function __construct(WebDriver $webDriver, ThemeConfiguration $themeConfiguration)
 {
     parent::__construct($webDriver, $themeConfiguration);
 }