-
Notifications
You must be signed in to change notification settings - Fork 29
/
JavascriptTest.php
55 lines (42 loc) · 2.01 KB
/
JavascriptTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace Behat\Mink\Tests\Driver\Js;
use Behat\Mink\Tests\Driver\TestCase;
final class JavascriptTest extends TestCase
{
public function testAriaRoles():void
{
$this->getSession()->visit($this->pathTo('/aria_roles.html'));
$this->getSession()->wait(5000, '$("#hidden-element").is(":visible") === false');
$this->getSession()->getPage()->pressButton('Toggle');
$this->getSession()->wait(5000, '$("#hidden-element").is(":visible") === true');
$this->getSession()->getPage()->clickLink('Go to Index');
$this->assertEquals($this->pathTo('/index.html'), $this->getSession()->getCurrentUrl());
}
public function testDragDrop():void
{
$this->getSession()->visit($this->pathTo('/js_test.html'));
$webAssert = $this->getAssertSession();
$draggable = $webAssert->elementExists('css', '#draggable');
$droppable = $webAssert->elementExists('css', '#droppable');
$draggable->dragTo($droppable);
$this->assertSame('Dropped left!', $webAssert->elementExists('css', 'p', $droppable)->getText());
}
// https://github.com/minkphp/MinkSelenium2Driver/pull/359
public function testDragDropOntoHiddenItself():void
{
$this->getSession()->visit($this->pathTo('/js_test.html'));
$webAssert = $this->getAssertSession();
$draggable = $webAssert->elementExists('css', '#draggable2');
$droppable = $webAssert->elementExists('css', '#draggable2');
$draggable->dragTo($droppable);
$this->assertSame('Dropped small!', $webAssert->elementExists('css', '#droppable p')->getText());
}
// test accentuated char in button
public function testIssue225():void
{
$this->getSession()->visit($this->pathTo('/issue225.html'));
$this->getSession()->getPage()->pressButton('Créer un compte');
$this->getSession()->wait(5000, '$("#panel").text() !== ""');
$this->assertStringContainsString('OH AIH!', $this->getSession()->getPage()->getText());
}
}