Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
155
vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php
vendored
Normal file
155
vendor/behat/mink/driver-testsuite/tests/Js/ChangeEventTest.php
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Js;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
*/
|
||||
class ChangeEventTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* 'change' event should be fired after selecting an <option> in a <select>.
|
||||
*
|
||||
* TODO check whether this test is redundant with other change event tests.
|
||||
*/
|
||||
public function testIssue255()
|
||||
{
|
||||
$session = $this->getSession();
|
||||
$session->visit($this->pathTo('/issue255.html'));
|
||||
|
||||
$session->getPage()->selectFieldOption('foo_select', 'Option 3');
|
||||
|
||||
$session->wait(2000, '$("#output_foo_select").text() != ""');
|
||||
$this->assertEquals('onChangeSelect', $this->getAssertSession()->elementExists('css', '#output_foo_select')->getText());
|
||||
}
|
||||
|
||||
public function testIssue178()
|
||||
{
|
||||
$session = $this->getSession();
|
||||
$session->visit($this->pathTo('/issue178.html'));
|
||||
|
||||
$this->findById('source')->setValue('foo');
|
||||
$this->assertEquals('foo', $this->findById('target')->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider setValueChangeEventDataProvider
|
||||
* @group change-event-detector
|
||||
*/
|
||||
public function testSetValueChangeEvent($elementId, $valueForEmpty, $valueForFilled = '')
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/element_change_detector.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$input = $this->findById($elementId);
|
||||
$this->assertNull($page->findById($elementId.'-result'));
|
||||
|
||||
// Verify setting value, when control is initially empty.
|
||||
$input->setValue($valueForEmpty);
|
||||
$this->assertElementChangeCount($elementId, 'initial value setting triggers change event');
|
||||
|
||||
if ($valueForFilled) {
|
||||
// Verify setting value, when control already has a value.
|
||||
$this->findById('results')->click();
|
||||
$input->setValue($valueForFilled);
|
||||
$this->assertElementChangeCount($elementId, 'value change triggers change event');
|
||||
}
|
||||
}
|
||||
|
||||
public function setValueChangeEventDataProvider()
|
||||
{
|
||||
return array(
|
||||
'input default' => array('the-input-default', 'from empty', 'from existing'),
|
||||
'input text' => array('the-input-text', 'from empty', 'from existing'),
|
||||
'input email' => array('the-email', 'from empty', 'from existing'),
|
||||
'textarea' => array('the-textarea', 'from empty', 'from existing'),
|
||||
'file' => array('the-file', 'from empty', 'from existing'),
|
||||
'select' => array('the-select', '30'),
|
||||
'radio' => array('the-radio-m', 'm'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider selectOptionChangeEventDataProvider
|
||||
* @group change-event-detector
|
||||
*/
|
||||
public function testSelectOptionChangeEvent($elementId, $elementValue)
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/element_change_detector.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$input = $this->findById($elementId);
|
||||
$this->assertNull($page->findById($elementId.'-result'));
|
||||
|
||||
$input->selectOption($elementValue);
|
||||
$this->assertElementChangeCount($elementId);
|
||||
}
|
||||
|
||||
public function selectOptionChangeEventDataProvider()
|
||||
{
|
||||
return array(
|
||||
'select' => array('the-select', '30'),
|
||||
'radio' => array('the-radio-m', 'm'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider checkboxTestWayDataProvider
|
||||
* @group change-event-detector
|
||||
*/
|
||||
public function testCheckChangeEvent($useSetValue)
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/element_change_detector.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$checkbox = $this->findById('the-unchecked-checkbox');
|
||||
$this->assertNull($page->findById('the-unchecked-checkbox-result'));
|
||||
|
||||
if ($useSetValue) {
|
||||
$checkbox->setValue(true);
|
||||
} else {
|
||||
$checkbox->check();
|
||||
}
|
||||
|
||||
$this->assertElementChangeCount('the-unchecked-checkbox');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider checkboxTestWayDataProvider
|
||||
* @group change-event-detector
|
||||
*/
|
||||
public function testUncheckChangeEvent($useSetValue)
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/element_change_detector.html'));
|
||||
$page = $this->getSession()->getPage();
|
||||
|
||||
$checkbox = $this->findById('the-checked-checkbox');
|
||||
$this->assertNull($page->findById('the-checked-checkbox-result'));
|
||||
|
||||
if ($useSetValue) {
|
||||
$checkbox->setValue(false);
|
||||
} else {
|
||||
$checkbox->uncheck();
|
||||
}
|
||||
|
||||
$this->assertElementChangeCount('the-checked-checkbox');
|
||||
}
|
||||
|
||||
public function checkboxTestWayDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(true),
|
||||
array(false),
|
||||
);
|
||||
}
|
||||
|
||||
private function assertElementChangeCount($elementId, $message = '')
|
||||
{
|
||||
$counterElement = $this->getSession()->getPage()->findById($elementId.'-result');
|
||||
$actualCount = null === $counterElement ? 0 : $counterElement->getText();
|
||||
|
||||
$this->assertEquals('1', $actualCount, $message);
|
||||
}
|
||||
}
|
122
vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php
vendored
Normal file
122
vendor/behat/mink/driver-testsuite/tests/Js/EventsTest.php
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Js;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class EventsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @group mouse-events
|
||||
*/
|
||||
public function testClick()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$clicker = $this->getAssertSession()->elementExists('css', '.elements div#clicker');
|
||||
$this->assertEquals('not clicked', $clicker->getText());
|
||||
|
||||
$clicker->click();
|
||||
$this->assertEquals('single clicked', $clicker->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group mouse-events
|
||||
*/
|
||||
public function testDoubleClick()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$clicker = $this->getAssertSession()->elementExists('css', '.elements div#clicker');
|
||||
$this->assertEquals('not clicked', $clicker->getText());
|
||||
|
||||
$clicker->doubleClick();
|
||||
$this->assertEquals('double clicked', $clicker->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group mouse-events
|
||||
*/
|
||||
public function testRightClick()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$clicker = $this->getAssertSession()->elementExists('css', '.elements div#clicker');
|
||||
$this->assertEquals('not clicked', $clicker->getText());
|
||||
|
||||
$clicker->rightClick();
|
||||
$this->assertEquals('right clicked', $clicker->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group mouse-events
|
||||
*/
|
||||
public function testFocus()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$focusBlurDetector = $this->getAssertSession()->elementExists('css', '.elements input#focus-blur-detector');
|
||||
$this->assertEquals('no action detected', $focusBlurDetector->getValue());
|
||||
|
||||
$focusBlurDetector->focus();
|
||||
$this->assertEquals('focused', $focusBlurDetector->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group mouse-events
|
||||
* @depends testFocus
|
||||
*/
|
||||
public function testBlur()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$focusBlurDetector = $this->getAssertSession()->elementExists('css', '.elements input#focus-blur-detector');
|
||||
$this->assertEquals('no action detected', $focusBlurDetector->getValue());
|
||||
|
||||
$focusBlurDetector->blur();
|
||||
$this->assertEquals('blured', $focusBlurDetector->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group mouse-events
|
||||
*/
|
||||
public function testMouseOver()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$mouseOverDetector = $this->getAssertSession()->elementExists('css', '.elements div#mouseover-detector');
|
||||
$this->assertEquals('no mouse action detected', $mouseOverDetector->getText());
|
||||
|
||||
$mouseOverDetector->mouseOver();
|
||||
$this->assertEquals('mouse overed', $mouseOverDetector->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideKeyboardEventsModifiers
|
||||
*/
|
||||
public function testKeyboardEvents($modifier, $eventProperties)
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
$webAssert = $this->getAssertSession();
|
||||
|
||||
$input1 = $webAssert->elementExists('css', '.elements input.input.first');
|
||||
$input2 = $webAssert->elementExists('css', '.elements input.input.second');
|
||||
$input3 = $webAssert->elementExists('css', '.elements input.input.third');
|
||||
$event = $webAssert->elementExists('css', '.elements .text-event');
|
||||
|
||||
$input1->keyDown('u', $modifier);
|
||||
$this->assertEquals('key downed:'.$eventProperties, $event->getText());
|
||||
|
||||
$input2->keyPress('r', $modifier);
|
||||
$this->assertEquals('key pressed:114 / '.$eventProperties, $event->getText());
|
||||
|
||||
$input3->keyUp(78, $modifier);
|
||||
$this->assertEquals('key upped:78 / '.$eventProperties, $event->getText());
|
||||
}
|
||||
|
||||
public function provideKeyboardEventsModifiers()
|
||||
{
|
||||
return array(
|
||||
'none' => array(null, '0 / 0 / 0 / 0'),
|
||||
'alt' => array('alt', '1 / 0 / 0 / 0'),
|
||||
// jQuery considers ctrl as being a metaKey in the normalized event
|
||||
'ctrl' => array('ctrl', '0 / 1 / 0 / 1'),
|
||||
'shift' => array('shift', '0 / 0 / 1 / 0'),
|
||||
'meta' => array('meta', '0 / 0 / 0 / 1'),
|
||||
);
|
||||
}
|
||||
}
|
85
vendor/behat/mink/driver-testsuite/tests/Js/JavascriptEvaluationTest.php
vendored
Normal file
85
vendor/behat/mink/driver-testsuite/tests/Js/JavascriptEvaluationTest.php
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Js;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class JavascriptEvaluationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Tests, that `wait` method returns check result after exit.
|
||||
*/
|
||||
public function testWaitReturnValue()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
|
||||
$found = $this->getSession()->wait(5000, '$("#draggable").length == 1');
|
||||
$this->assertTrue($found);
|
||||
}
|
||||
|
||||
public function testWait()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/js_test.html'));
|
||||
|
||||
$waitable = $this->findById('waitable');
|
||||
|
||||
$waitable->click();
|
||||
$this->getSession()->wait(3000, '$("#waitable").has("div").length > 0');
|
||||
$this->assertEquals('arrived', $this->getAssertSession()->elementExists('css', '#waitable > div')->getText());
|
||||
|
||||
$waitable->click();
|
||||
$this->getSession()->wait(3000, 'false');
|
||||
$this->assertEquals('timeout', $this->getAssertSession()->elementExists('css', '#waitable > div')->getText());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideExecutedScript
|
||||
*/
|
||||
public function testExecuteScript($script)
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->getSession()->executeScript($script);
|
||||
|
||||
sleep(1);
|
||||
|
||||
$heading = $this->getAssertSession()->elementExists('css', 'h1');
|
||||
$this->assertEquals('Hello world', $heading->getText());
|
||||
}
|
||||
|
||||
public function provideExecutedScript()
|
||||
{
|
||||
return array(
|
||||
array('document.querySelector("h1").textContent = "Hello world"'),
|
||||
array('document.querySelector("h1").textContent = "Hello world";'),
|
||||
array('function () {document.querySelector("h1").textContent = "Hello world";}()'),
|
||||
array('function () {document.querySelector("h1").textContent = "Hello world";}();'),
|
||||
array('(function () {document.querySelector("h1").textContent = "Hello world";})()'),
|
||||
array('(function () {document.querySelector("h1").textContent = "Hello world";})();'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideEvaluatedScript
|
||||
*/
|
||||
public function testEvaluateJavascript($script)
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
|
||||
$this->assertSame(2, $this->getSession()->evaluateScript($script));
|
||||
}
|
||||
|
||||
public function provideEvaluatedScript()
|
||||
{
|
||||
return array(
|
||||
array('1 + 1'),
|
||||
array('1 + 1;'),
|
||||
array('return 1 + 1'),
|
||||
array('return 1 + 1;'),
|
||||
array('function () {return 1+1;}()'),
|
||||
array('(function () {return 1+1;})()'),
|
||||
array('return function () { return 1+1;}()'),
|
||||
array('return (function () {return 1+1;})()'),
|
||||
);
|
||||
}
|
||||
}
|
42
vendor/behat/mink/driver-testsuite/tests/Js/JavascriptTest.php
vendored
Normal file
42
vendor/behat/mink/driver-testsuite/tests/Js/JavascriptTest.php
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Js;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class JavascriptTest extends TestCase
|
||||
{
|
||||
public function testAriaRoles()
|
||||
{
|
||||
$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()
|
||||
{
|
||||
$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->assertEquals('Dropped!', $this->getAssertSession()->elementExists('css', 'p', $droppable)->getText());
|
||||
}
|
||||
|
||||
// test accentuated char in button
|
||||
public function testIssue225()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/issue225.html'));
|
||||
$this->getSession()->getPage()->pressButton('Créer un compte');
|
||||
$this->getSession()->wait(5000, '$("#panel").text() != ""');
|
||||
|
||||
$this->assertContains('OH AIH!', $this->getSession()->getPage()->getText());
|
||||
}
|
||||
}
|
83
vendor/behat/mink/driver-testsuite/tests/Js/WindowTest.php
vendored
Normal file
83
vendor/behat/mink/driver-testsuite/tests/Js/WindowTest.php
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace Behat\Mink\Tests\Driver\Js;
|
||||
|
||||
use Behat\Mink\Tests\Driver\TestCase;
|
||||
|
||||
class WindowTest extends TestCase
|
||||
{
|
||||
public function testWindow()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/window.html'));
|
||||
$session = $this->getSession();
|
||||
$page = $session->getPage();
|
||||
$webAssert = $this->getAssertSession();
|
||||
|
||||
$page->clickLink('Popup #1');
|
||||
$session->switchToWindow(null);
|
||||
|
||||
$page->clickLink('Popup #2');
|
||||
$session->switchToWindow(null);
|
||||
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('Main window div text', $el->getText());
|
||||
|
||||
$session->switchToWindow('popup_1');
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('Popup#1 div text', $el->getText());
|
||||
|
||||
$session->switchToWindow('popup_2');
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('Popup#2 div text', $el->getText());
|
||||
|
||||
$session->switchToWindow(null);
|
||||
$el = $webAssert->elementExists('css', '#text');
|
||||
$this->assertSame('Main window div text', $el->getText());
|
||||
}
|
||||
|
||||
public function testGetWindowNames()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/window.html'));
|
||||
$session = $this->getSession();
|
||||
$page = $session->getPage();
|
||||
|
||||
$windowName = $this->getSession()->getWindowName();
|
||||
|
||||
$this->assertNotNull($windowName);
|
||||
|
||||
$page->clickLink('Popup #1');
|
||||
$page->clickLink('Popup #2');
|
||||
|
||||
$windowNames = $this->getSession()->getWindowNames();
|
||||
|
||||
$this->assertNotNull($windowNames[0]);
|
||||
$this->assertNotNull($windowNames[1]);
|
||||
$this->assertNotNull($windowNames[2]);
|
||||
}
|
||||
|
||||
public function testResizeWindow()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->resizeWindow(400, 300);
|
||||
$session->wait(1000, 'false');
|
||||
|
||||
$script = 'return Math.abs(window.outerHeight - 300) <= 100 && Math.abs(window.outerWidth - 400) <= 100;';
|
||||
|
||||
$this->assertTrue($session->evaluateScript($script));
|
||||
}
|
||||
|
||||
public function testWindowMaximize()
|
||||
{
|
||||
$this->getSession()->visit($this->pathTo('/index.html'));
|
||||
$session = $this->getSession();
|
||||
|
||||
$session->maximizeWindow();
|
||||
$session->wait(1000, 'false');
|
||||
|
||||
$script = 'return Math.abs(screen.availHeight - window.outerHeight) <= 100;';
|
||||
|
||||
$this->assertTrue($session->evaluateScript($script));
|
||||
}
|
||||
}
|
Reference in a new issue