TimeTrex Community Edition v16.2.0
This commit is contained in:
19
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/BaseTestCase.php
vendored
Normal file
19
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/BaseTestCase.php
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
|
||||
class BaseTestCase extends Selenium2TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setHost(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_HOST);
|
||||
$this->setPort((int)PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_PORT);
|
||||
$this->setBrowser(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM2_BROWSER);
|
||||
if (!defined('PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL')) {
|
||||
$this->markTestSkipped("You must serve the selenium-1-tests folder from an HTTP server and configure the PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL constant accordingly.");
|
||||
}
|
||||
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL);
|
||||
}
|
||||
}
|
50
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/CookieTest.php
vendored
Normal file
50
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/CookieTest.php
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase\Coverage;
|
||||
|
||||
use PHPUnit\Framework\TestResult;
|
||||
use Tests\Selenium2TestCase\BaseTestCase;
|
||||
|
||||
class CookieTest extends BaseTestCase
|
||||
{
|
||||
// this is a dummy URL (returns down coverage data in HTML), but Firefox still sets domain cookie, which is what's needed
|
||||
protected $coverageScriptUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL .'/coverage/dummy.html';
|
||||
|
||||
public function run(TestResult $result = NULL): TestResult
|
||||
{
|
||||
// make sure code coverage collection is enabled
|
||||
if ($result === NULL) {
|
||||
$result = $this->createResult();
|
||||
}
|
||||
if (!$result->getCollectCodeCoverageInformation()) {
|
||||
$result->setCodeCoverage(new \SebastianBergmann\CodeCoverage\CodeCoverage());
|
||||
}
|
||||
|
||||
parent::run($result);
|
||||
|
||||
$result->getCodeCoverage()->clear();
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getTestIdCookie()
|
||||
{
|
||||
return $this->prepareSession()->cookie()->get('PHPUNIT_SELENIUM_TEST_ID');
|
||||
}
|
||||
|
||||
public function testTestIdCookieIsSet()
|
||||
{
|
||||
$this->url('/');
|
||||
$testIdCookie = $this->getTestIdCookie();
|
||||
$this->assertNotEmpty($testIdCookie);
|
||||
return $testIdCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testTestIdCookieIsSet
|
||||
*/
|
||||
public function testTestsHaveUniqueTestIdCookies($previousTestIdCookie)
|
||||
{
|
||||
$this->url('/');
|
||||
$this->assertNotEquals($this->getTestIdCookie(), $previousTestIdCookie);
|
||||
}
|
||||
}
|
13
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/DummyClass.php
vendored
Normal file
13
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/DummyClass.php
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
class DummyClass
|
||||
{
|
||||
public function coveredMethod()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function uncoveredMethod()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
40
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/RemoteCoverageTest.php
vendored
Normal file
40
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/RemoteCoverageTest.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase\Coverage;
|
||||
|
||||
use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RemoteCoverageTest extends TestCase
|
||||
{
|
||||
public function testObtainsCodeCoverageInformationFromAPossiblyRemoteHttpServer()
|
||||
{
|
||||
$coverageScriptUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL . '/coverage/dummy.txt';
|
||||
$coverage = new RemoteCoverage(
|
||||
$coverageScriptUrl,
|
||||
'dummyTestId'
|
||||
);
|
||||
$content = $coverage->get();
|
||||
$dummyClassSourceFile = $this->classSourceFile('DummyClass', $content);
|
||||
$expectedCoverage = array(
|
||||
3 => 1,
|
||||
6 => 1,
|
||||
7 => -2,
|
||||
11 => -1,
|
||||
12 => -2,
|
||||
14 => 1
|
||||
);
|
||||
$this->assertTrue(isset($content[$dummyClassSourceFile]), "Coverage: " . var_export($content, true));
|
||||
$this->assertEquals($expectedCoverage, $content[$dummyClassSourceFile]);
|
||||
}
|
||||
|
||||
private function classSourceFile($className, array $content)
|
||||
{
|
||||
foreach ($content as $file => $coverage) {
|
||||
if (strstr($file, $className)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
$this->fail("Class $className not found in coverage: " . var_export($content, true));
|
||||
}
|
||||
}
|
63
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/SingleFileTest.php
vendored
Normal file
63
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/SingleFileTest.php
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase\Coverage;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SingleFileTest extends TestCase
|
||||
{
|
||||
private $dummyTestId = 'ns_dummyTestId';
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!extension_loaded('xdebug')) {
|
||||
$this->markTestSkipped('Needs xdebug to run');
|
||||
}
|
||||
$this->coverageFilePattern = __DIR__ . '/*.' . $this->dummyTestId;
|
||||
$this->dummyClassSourceFile = __DIR__ . '/DummyClass.php';
|
||||
}
|
||||
|
||||
public function testExecutingAFileWithThePrependedAndAppendedCoverageScriptsProducesACoverageData()
|
||||
{
|
||||
$this->clearCoverageFiles();
|
||||
|
||||
exec('php ' . __DIR__ . '/singleFile.php');
|
||||
$coverageFiles = glob($this->coverageFilePattern);
|
||||
$this->assertEquals(1, count($coverageFiles));
|
||||
|
||||
$content = unserialize(file_get_contents($coverageFiles[0]));
|
||||
$dummyClassCoverage = $content[$this->dummyClassSourceFile];
|
||||
$this->assertCovered(6, $dummyClassCoverage);
|
||||
$this->assertNotCovered(11, $dummyClassCoverage);
|
||||
|
||||
return $dummyClassCoverage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testExecutingAFileWithThePrependedAndAppendedCoverageScriptsProducesACoverageData
|
||||
*/
|
||||
public function testTheCoverageScriptReturnsTheContentOfASpecificCoverageFile($expectedDummyClassCoverage)
|
||||
{
|
||||
$coverage = unserialize(exec('php ' . __DIR__ . '/singleFileCoverage.php ' . $this->dummyTestId));
|
||||
$dummyClassCoverage = $coverage[$this->dummyClassSourceFile];
|
||||
$this->assertEquals($expectedDummyClassCoverage, $dummyClassCoverage['coverage']);
|
||||
}
|
||||
|
||||
private function clearCoverageFiles()
|
||||
{
|
||||
$coverageFiles = glob($this->coverageFilePattern);
|
||||
foreach ($coverageFiles as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
private function assertCovered($line, array $fileCoverage)
|
||||
{
|
||||
$this->assertEquals(1, $fileCoverage[$line]);
|
||||
}
|
||||
|
||||
private function assertNotCovered($line, array $fileCoverage)
|
||||
{
|
||||
$this->assertEquals(-1, $fileCoverage[$line]);
|
||||
}
|
||||
}
|
9
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/singleFile.php
vendored
Normal file
9
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/singleFile.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$_COOKIE['PHPUNIT_SELENIUM_TEST_ID'] = 'ns\\dummyTestId';
|
||||
require __DIR__ . '/../../../PHPUnit/Extensions/SeleniumCommon/prepend.php';
|
||||
|
||||
require_once 'DummyClass.php';
|
||||
$object = new DummyClass();
|
||||
$object->coveredMethod();
|
||||
|
||||
require __DIR__ . '/../../../PHPUnit/Extensions/SeleniumCommon/append.php';
|
3
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/singleFileCoverage.php
vendored
Normal file
3
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/Coverage/singleFileCoverage.php
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$_GET['PHPUNIT_SELENIUM_TEST_ID'] = $argv[1];
|
||||
require __DIR__ . '/../../../PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php';
|
29
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/CustomDesiredCapabilitiesTest.php
vendored
Normal file
29
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/CustomDesiredCapabilitiesTest.php
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* Tests for PHPUnit_Extensions_SeleniumTestCase.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class CustomDesiredCapabilitiesTest extends BaseTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->setDesiredCapabilities(array(
|
||||
'platform' => 'ANY'
|
||||
));
|
||||
}
|
||||
|
||||
public function testOpen()
|
||||
{
|
||||
$this->url('html/test_open.html');
|
||||
$this->assertStringEndsWith('html/test_open.html', $this->url());
|
||||
}
|
||||
}
|
102
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/FailuresTest.php
vendored
Normal file
102
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/FailuresTest.php
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
use BadMethodCallException;
|
||||
use DomainException;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for PHPUnit_Extensions_SeleniumTestCase.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class Selenium2TestCaseFailuresTest extends BaseTestCase
|
||||
{
|
||||
public function testInexistentCommandCausesTheTestToFail()
|
||||
{
|
||||
$this->expectException(BadMethodCallException::class);
|
||||
$this->inexistentSessionCommand();
|
||||
}
|
||||
|
||||
public function testExceptionsAreReThrownOnNotSuccessfulTests()
|
||||
{
|
||||
$this->expectException(DomainException::class);
|
||||
$this->onNotSuccessfulTest(new DomainException);
|
||||
}
|
||||
|
||||
public function testInexistentElementCausesTheTestToFail()
|
||||
{
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->url('html/test_open.html');
|
||||
$this->byId('notExistent');
|
||||
}
|
||||
|
||||
public function testStaleElementsCannotBeAccessed()
|
||||
{
|
||||
$this->url('html/test_element_selection.html');
|
||||
$div = $this->byId('theDivId');
|
||||
$this->url('html/test_element_selection.html');
|
||||
try {
|
||||
$div->text();
|
||||
$this->fail('The element shouldn\'t be accessible.');
|
||||
} catch (RuntimeException $e) {
|
||||
$this->assertStringContainsString('http://seleniumhq.org/exceptions/stale_element_reference.html', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function testSelectObjectsCanOnlyBeCreatedOverSelectTags()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->url('html/test_element_selection.html');
|
||||
$div = $this->byId('theDivId');
|
||||
$select = $this->select($div);
|
||||
}
|
||||
}
|
128
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/LogTest.php
vendored
Normal file
128
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/LogTest.php
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Andrew Krasichkov <krasichkovandrew@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for session::log() and session::logTypes() commands.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Andrew Krasichkov <krasichkovandrew@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class LogTest extends BaseTestCase
|
||||
{
|
||||
private static $expectedLogTypes = array(
|
||||
'default' => array(
|
||||
'browser'
|
||||
),
|
||||
'firefox' => array(
|
||||
'browser',
|
||||
'driver',
|
||||
'client',
|
||||
'server'
|
||||
),
|
||||
'chrome' => array(
|
||||
'browser',
|
||||
'client',
|
||||
'server'
|
||||
)
|
||||
);
|
||||
|
||||
private static $jsInlineErrors = array(
|
||||
'default' => '',
|
||||
'chrome' => 'html/test_log.html 4 Uncaught TypeError: Cannot read property \'inlineError\' of null',
|
||||
'firefox' => 'TypeError: null has no properties'
|
||||
);
|
||||
|
||||
public function testLogType()
|
||||
{
|
||||
$this->markTestSkipped('Unsupported command');
|
||||
|
||||
$actual = $this->logTypes();
|
||||
$expected = $this->getDataArray(self::$expectedLogTypes, $this->getBrowser());
|
||||
$diff = array_diff($expected, $actual);
|
||||
$this->assertEmpty($diff, 'Some log types not presented by browser: ' . var_export($diff, TRUE));
|
||||
}
|
||||
|
||||
public function testLog()
|
||||
{
|
||||
$this->markTestSkipped('Unsupported command');
|
||||
|
||||
$this->url('html/test_log.html');
|
||||
$actual = $this->log('browser');
|
||||
$actual = $this->getLogsMessages($actual);
|
||||
if($this->getBrowser() == 'chrome') {
|
||||
$expected = $this->getBrowserUrl();
|
||||
|
||||
} else {
|
||||
$expected = '';
|
||||
}
|
||||
$expected .= $this->getDataArray(self::$jsInlineErrors, $this->getBrowser());
|
||||
$this->assertContains($expected, $actual);
|
||||
}
|
||||
|
||||
private function getDataArray(array $array, $key)
|
||||
{
|
||||
if(isset($array[$key])) {
|
||||
return $array[$key];
|
||||
}
|
||||
else {
|
||||
return $array['default'];
|
||||
}
|
||||
}
|
||||
|
||||
private function getLogsMessages($logs, $level = 'SEVERE')
|
||||
{
|
||||
$result = array();
|
||||
foreach($logs as $log) {
|
||||
if(isset($log['message']) && isset($log['level']) && $log['level'] == $level) {
|
||||
$result[] = $log['message'];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
182
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/MobileFeaturesTest.php
vendored
Normal file
182
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/MobileFeaturesTest.php
vendored
Normal file
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Jonathan Lipps <jlipps@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
* @since File available since Release 1.2.0
|
||||
*/
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* Gets or posts an attribute from/to the session (title, alert text, etc.)
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Jonathan Lipps <jlipps@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @version Release: @package_version@
|
||||
* @link http://www.phpunit.de/
|
||||
* @since Class available since Release 1.2.9
|
||||
*/
|
||||
|
||||
if (defined('SAUCE_USERNAME') && defined('SAUCE_ACCESS_KEY')) {
|
||||
define('SAUCE_HOST', constant('SAUCE_USERNAME') . ':' . constant('SAUCE_ACCESS_KEY') . '@ondemand.saucelabs.com');
|
||||
} else {
|
||||
define('SAUCE_HOST', '');
|
||||
}
|
||||
|
||||
class MobileFeaturesTest extends Selenium2TestCase
|
||||
{
|
||||
public static $browsers = array(
|
||||
array(
|
||||
'host' => SAUCE_HOST,
|
||||
'port' => 80,
|
||||
'sessionStrategy' => 'isolated',
|
||||
'browserName' => 'Android',
|
||||
'desiredCapabilities' => array(
|
||||
'version' => '4',
|
||||
'platform' => 'Linux'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'host' => SAUCE_HOST,
|
||||
'port' => 80,
|
||||
'sessionStrategy' => 'isolated',
|
||||
'browserName' => 'iPhone',
|
||||
'desiredCapabilities' => array(
|
||||
'version' => '5',
|
||||
'platform' => 'Mac 10.6'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!defined('SAUCE_ACCESS_KEY') || !defined('SAUCE_USERNAME')) {
|
||||
$this->markTestSkipped("SAUCE_USERNAME and SAUCE_ACCESS_KEY must be set to run tests on Sauce");
|
||||
} elseif ($this->getBrowser() == 'iPhone') {
|
||||
$this->markTestSkipped('iPhone does not yet support touch interactions');
|
||||
} elseif ($this->getName() == "testLocation") {
|
||||
$this->markTestSkipped('Mobile drivers don\'t yet reliably support location');
|
||||
} else {
|
||||
$caps = $this->getDesiredCapabilities();
|
||||
$caps['name'] = get_called_class() . '::' . $this->getName();
|
||||
$this->setDesiredCapabilities($caps);
|
||||
$this->setBrowserUrl('http://saucelabs.com/test/guinea-pig');
|
||||
}
|
||||
}
|
||||
|
||||
public function testMove()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->touchMove(array('x' => 100, 'y' => 100));
|
||||
}
|
||||
|
||||
public function testGeneralScroll()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->touchScroll(array('xoffset' => 0, 'yoffset' => 100));
|
||||
}
|
||||
|
||||
public function testTouchDownUp()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->touchDown(array('x' => 100, 'y' => 100));
|
||||
$this->touchUp(array('x' => 100, 'y' => 100));
|
||||
}
|
||||
|
||||
public function testGeneralFlick()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->flick(array('ySpeed' => -20));
|
||||
}
|
||||
|
||||
public function testTap()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->byId('i am a link')->tap();
|
||||
$this->assertContains("I am another page title", $this->title());
|
||||
}
|
||||
|
||||
public function testElementScroll()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->byId('i_am_a_textbox')->scroll(array('yoffset' => 50, 'xoffset' => 0));
|
||||
}
|
||||
|
||||
public function testElementFlick()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->byId('i_am_a_textbox')->flick(array('yoffset' => 50, 'speed' => 10, 'xoffset' => 0));
|
||||
}
|
||||
|
||||
public function testDoubleTap()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->byId('i_am_an_id')->doubletap();
|
||||
}
|
||||
|
||||
public function testLongTap()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->byId('i am a link')->longtap();
|
||||
}
|
||||
|
||||
public function testLocation()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->location(array('latitude' => 35.5, 'longitude' => 17.6, 'altitude' => 50));
|
||||
$location = $this->location();
|
||||
$this->assertEquals($location['latitude'], 35.5);
|
||||
}
|
||||
|
||||
public function testOrientation()
|
||||
{
|
||||
$this->url('/');
|
||||
$this->landscape();
|
||||
$this->assertEquals($this->orientation(), 'LANDSCAPE');
|
||||
$this->portrait();
|
||||
$this->assertEquals($this->orientation(), 'PORTRAIT');
|
||||
}
|
||||
}
|
||||
|
107
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/MultipleBrowsersMethodTest.php
vendored
Normal file
107
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/MultipleBrowsersMethodTest.php
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
use Exception;
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class MultipleBrowsersMethodTest extends Selenium2TestCase
|
||||
{
|
||||
private $browserWeSetUp = '';
|
||||
private static $testsRun = 0;
|
||||
|
||||
public static function browsers()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'browserName' => 'firefox',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444,
|
||||
'sessionStrategy' => 'shared'
|
||||
),
|
||||
array(
|
||||
'browserName' => 'firefox',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444,
|
||||
'sessionStrategy' => 'isolated'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!defined('PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL')) {
|
||||
$this->markTestSkipped("You must serve the selenium-1-tests folder from an HTTP server and configure the PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL constant accordingly.");
|
||||
}
|
||||
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL);
|
||||
}
|
||||
|
||||
public function tearDown(): void
|
||||
{
|
||||
self::$testsRun++;
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass(): void
|
||||
{
|
||||
$expected = count(self::browsers());
|
||||
$actual = self::$testsRun;
|
||||
if ($expected != $actual) {
|
||||
throw new Exception("There were $expected browsers to run but $actual were run.");
|
||||
}
|
||||
}
|
||||
|
||||
public function testSessionIsLaunchedCorrectly()
|
||||
{
|
||||
$this->url('html/test_open.html');
|
||||
$this->assertStringEndsWith('html/test_open.html', $this->url());
|
||||
}
|
||||
}
|
134
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/MultipleBrowsersPropertyTest.php
vendored
Normal file
134
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/MultipleBrowsersPropertyTest.php
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* Tests for Selenium2TestCase.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Jonathan Lipps <jlipps@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class MultipleBrowsersPropertyTest extends Selenium2TestCase
|
||||
{
|
||||
public static $browsers = array(
|
||||
array(
|
||||
'browserName' => 'firefox',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444,
|
||||
'sessionStrategy' => 'shared'
|
||||
),
|
||||
array(
|
||||
'browserName' => 'firefox',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444,
|
||||
'sessionStrategy' => 'isolated'
|
||||
),
|
||||
array(
|
||||
'browserName' => 'safari',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444
|
||||
)
|
||||
);
|
||||
|
||||
private $_browserWeSetUp = '';
|
||||
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
if (!defined('PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL')) {
|
||||
$this->markTestSkipped("You must serve the selenium-1-tests folder from an HTTP server and configure the PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL constant accordingly.");
|
||||
}
|
||||
if ($this->getBrowser() == 'safari') {
|
||||
$this->markTestSkipped("Skipping safari since it might not be present");
|
||||
}
|
||||
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL);
|
||||
}
|
||||
|
||||
public function setupSpecificBrowser($params)
|
||||
{
|
||||
$this->_browserWeSetUp = $params['browserName'];
|
||||
parent::setupSpecificBrowser($params);
|
||||
}
|
||||
|
||||
public function testOpen()
|
||||
{
|
||||
$this->url(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL);
|
||||
$this->assertEquals($this->_browserWeSetUp, $this->getBrowser());
|
||||
}
|
||||
|
||||
public function testSessionIsLaunchedCorrectly()
|
||||
{
|
||||
$this->url('html/test_open.html');
|
||||
$this->assertStringEndsWith('html/test_open.html', $this->url());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider urls
|
||||
*/
|
||||
public function testDataProvidersAreRecognized($url)
|
||||
{
|
||||
$this->url($url);
|
||||
$this->assertStringEndsWith($url, $this->url());
|
||||
$body = $this->byCssSelector('body');
|
||||
$this->assertEquals('This is a test of the open command.', $body->text());
|
||||
}
|
||||
|
||||
public static function urls()
|
||||
{
|
||||
return array(
|
||||
array('html/test_open.html')
|
||||
);
|
||||
}
|
||||
|
||||
public function testTheBrowserNameIsAccessible()
|
||||
{
|
||||
$this->assertEquals($this->_browserWeSetUp, $this->getBrowser());
|
||||
}
|
||||
}
|
58
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/PageObjectTest.php
vendored
Normal file
58
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/PageObjectTest.php
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
class PageObjectTest extends BaseTestCase
|
||||
{
|
||||
public function testAPageInteractsWithElementsExposingAnHigherLevelApi()
|
||||
{
|
||||
$this->url('html/test_type_page1.html');
|
||||
$page = new AuthenticationPage($this);
|
||||
$welcomePage = $page->username('TestUser')
|
||||
->password('TestPassword')
|
||||
->submit();
|
||||
$welcomePage->assertWelcomeIs('Welcome, TestUser!');
|
||||
}
|
||||
}
|
||||
|
||||
class AuthenticationPage
|
||||
{
|
||||
public function __construct($test)
|
||||
{
|
||||
$this->usernameInput = $test->byName('username');
|
||||
$this->passwordInput = $test->byName('password');
|
||||
$this->test = $test;
|
||||
}
|
||||
|
||||
public function username($value)
|
||||
{
|
||||
$this->usernameInput->value($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function password($value)
|
||||
{
|
||||
$this->passwordInput->value($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
$this->test->clickOnElement('submitButton');
|
||||
return new WelcomePage($this->test);
|
||||
}
|
||||
}
|
||||
|
||||
class WelcomePage
|
||||
{
|
||||
public function __construct($test)
|
||||
{
|
||||
$this->header = $test->byCssSelector('h2');
|
||||
$this->test = $test;
|
||||
}
|
||||
|
||||
public function assertWelcomeIs($text)
|
||||
{
|
||||
$this->test->assertMatchesRegularExpression("/$text/", $this->header->text());
|
||||
}
|
||||
}
|
81
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/RegressionsTest.php
vendored
Normal file
81
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/RegressionsTest.php
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests for PHPUnit_Extensions_SeleniumTestCase.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class RegressionsTest extends BaseTestCase
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function testDependency()
|
||||
{
|
||||
$this->url("html/test_open.html");
|
||||
$title = $this->title();
|
||||
$this->assertEquals('Test open', $title);
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testDependency
|
||||
* Checks #82 for Selenium2TestCase.
|
||||
*
|
||||
* @param $expectedTitle
|
||||
*/
|
||||
public function testDependent($expectedTitle)
|
||||
{
|
||||
$this->url("html/test_open.html");
|
||||
$actualTitle = $this->title();
|
||||
$this->assertSame($expectedTitle, $actualTitle);
|
||||
}
|
||||
}
|
72
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/ScreenshotListenerTest.php
vendored
Normal file
72
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/ScreenshotListenerTest.php
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
use Exception;
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
use PHPUnit\Extensions\Selenium2TestCase\ScreenshotListener;
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
use RuntimeException;
|
||||
|
||||
class ScreenshotListenerTest extends BaseTestCase
|
||||
{
|
||||
/** @var ScreenshotListener */
|
||||
private $listener;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->directory = sys_get_temp_dir();
|
||||
$existing = glob("$this->directory/Tests_Selenium2TestCase_ScreenshotListenerTest__*.png");
|
||||
foreach ($existing as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
$this->listener = new ScreenshotListener(
|
||||
$this->directory
|
||||
);
|
||||
}
|
||||
|
||||
public function testStoresAScreenshotInCaseOfError()
|
||||
{
|
||||
$this->url('html/test_open.html');
|
||||
|
||||
$this->listener->addError($this, new Exception(), microtime(true));
|
||||
|
||||
$this->assertThereIsAScreenshotNamed('Tests_Selenium2TestCase_ScreenshotListenerTest__testStoresAScreenshotInCaseOfError__*.png');
|
||||
}
|
||||
|
||||
public function testStoresAScreenshotInCaseOfFailure()
|
||||
{
|
||||
$this->url('html/test_open.html');
|
||||
|
||||
$exception = new AssertionFailedError();
|
||||
$this->listener->addFailure($this, $exception, microtime(true));
|
||||
|
||||
$this->assertThereIsAScreenshotNamed('Tests_Selenium2TestCase_ScreenshotListenerTest__testStoresAScreenshotInCaseOfFailure*.png');
|
||||
}
|
||||
|
||||
public function testScreenshotGenerationMayFailWithoutJeopardizingTheRestOfTheSuite()
|
||||
{
|
||||
$test = new Tests_Selenium2TestCase_NotCapableOfTakingScreenshotsTest();
|
||||
|
||||
$this->listener->addError($test, new RuntimeException(), microtime(true));
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
private function assertThereIsAScreenshotNamed($filename)
|
||||
{
|
||||
$images = glob("$this->directory/$filename");
|
||||
$this->assertEquals(1, count($images), 'No screenshot were saved.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This Mock cannot be generated by PHPUnit because currentScreenshot()
|
||||
* is a method exposed via __call().
|
||||
*/
|
||||
class Tests_Selenium2TestCase_NotCapableOfTakingScreenshotsTest extends Selenium2TestCase
|
||||
{
|
||||
public function __construct() {}
|
||||
|
||||
public function currentScreenshot() { throw new RuntimeException(); }
|
||||
}
|
27
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SessionCommand/FileTest.php
vendored
Normal file
27
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SessionCommand/FileTest.php
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase\SessionCommand;
|
||||
|
||||
use Tests\Selenium2TestCase\BaseTestCase;
|
||||
|
||||
class FileTest extends BaseTestCase
|
||||
{
|
||||
public function testUploadFile()
|
||||
{
|
||||
$this->markTestIncomplete("Cannot get this to run <del>reliably</del><em>at all</em> on Travis CI.");
|
||||
$this->url('php/file_upload.php');
|
||||
|
||||
$remote_file = $this->file('selenium-1-tests/html/banner.gif');
|
||||
|
||||
$this->byName('upload_here')
|
||||
->value($remote_file);
|
||||
|
||||
$this->byId('submit')
|
||||
->click();
|
||||
|
||||
$msg_displayed = $this->byId('uploaded')
|
||||
->displayed();
|
||||
|
||||
$this->assertNotEmpty($msg_displayed);
|
||||
}
|
||||
}
|
23
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SessionInSetupTest.php
vendored
Normal file
23
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SessionInSetupTest.php
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
|
||||
class SessionInSetupTest extends Selenium2TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->setHost(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_HOST);
|
||||
$this->setPort((int)PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_PORT);
|
||||
$this->setBrowser(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM2_BROWSER);
|
||||
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL);
|
||||
$this->prepareSession();
|
||||
$this->url('html/test_open.html');
|
||||
}
|
||||
|
||||
public function testTheSessionStartedInSetupAndCanBeUsedNow()
|
||||
{
|
||||
$this->assertStringEndsWith('html/test_open.html', $this->url());
|
||||
}
|
||||
}
|
64
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SetUpPageTest.php
vendored
Normal file
64
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SetUpPageTest.php
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Julian Seeger <seeger.julian@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
/**
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Julian Seeger <seeger.julian@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class SetUpPageTest extends BaseTestCase {
|
||||
public function setUpPage()
|
||||
{
|
||||
$this->url('html/test_type_page1.html');
|
||||
}
|
||||
|
||||
public function testSetUpPageIsExecuted()
|
||||
{
|
||||
$this->assertMatchesRegularExpression('/html\/test_type_page1\.html$/', $this->url());
|
||||
}
|
||||
}
|
80
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SuiteBuildingTest.php
vendored
Normal file
80
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/SuiteBuildingTest.php
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use Tests\Selenium2TestCase\fixtures\MultipleBrowsersTestCaseSample;
|
||||
use Tests\Selenium2TestCase\fixtures\TestCaseSample;
|
||||
|
||||
require_once 'PHPUnit/Extensions/Selenium2TestCase.php';
|
||||
|
||||
/**
|
||||
* Tests for Selenium2TestCase::suite().
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Jonathan Lipps <jlipps@gmail.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class SuiteBuildingTest extends TestCase
|
||||
{
|
||||
public function testSampleTestCaseBuildsAFullSuiteContainingAllItsTests()
|
||||
{
|
||||
require_once __DIR__ . '/fixtures/SuiteBuildingSuites.php';
|
||||
$suite = TestCaseSample::suite(TestCaseSample::class);
|
||||
$this->assertInstanceOf(TestSuite::class, $suite);
|
||||
$this->assertEquals(2, count($suite->tests()));
|
||||
}
|
||||
|
||||
public function testAMultipleBrowsersTestCaseBuildsACopyOfEachTestForEachBrowser()
|
||||
{
|
||||
require_once __DIR__ . '/fixtures/SuiteBuildingSuites.php';
|
||||
$suite = MultipleBrowsersTestCaseSample::suite(MultipleBrowsersTestCaseSample::class);
|
||||
$this->assertInstanceOf(TestSuite::class, $suite);
|
||||
$this->assertEquals(2, count($suite->tests()));
|
||||
}
|
||||
}
|
31
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/TimeoutTest.php
vendored
Normal file
31
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/TimeoutTest.php
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
class TimeoutTest extends BaseTestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->setSeleniumServerRequestsTimeout(60);
|
||||
}
|
||||
|
||||
public function testOpen()
|
||||
{
|
||||
$this->url('html/test_open.html');
|
||||
$this->assertStringEndsWith('html/test_open.html', $this->url());
|
||||
}
|
||||
|
||||
public function testAnImplicitWaitValueToRespectOnTheServerMustBeSmallerThanTheSeleniumServerCallsTimeout()
|
||||
{
|
||||
$this->expectException(\PHPUnit\Extensions\Selenium2TestCase\Exception::class);
|
||||
$this->timeouts()->implicitWait(120000);
|
||||
}
|
||||
|
||||
public function testGetLastImplicitWaitValue()
|
||||
{
|
||||
$this->assertEquals(0, $this->timeouts()->getLastImplicitWaitValue());
|
||||
$this->timeouts()->implicitWait(42);
|
||||
$this->assertEquals(42, $this->timeouts()->getLastImplicitWaitValue());
|
||||
}
|
||||
}
|
109
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/URLTest.php
vendored
Normal file
109
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/URLTest.php
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2013, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase\URL;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Giorgio Sironi <info@giorgiosironi.com>
|
||||
* @copyright 2010-2013 Sebastian Bergmann <sebastian@phpunit.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class URLTest extends TestCase
|
||||
{
|
||||
public function testDescendsAnURLWithAnAdditionalFolder()
|
||||
{
|
||||
$this->assertURLEquals($this->url('/posts/1'),
|
||||
$this->url('/posts')->descend('1'));
|
||||
}
|
||||
|
||||
public function testAscendsAnURByEliminatingAnAdditionalFolder()
|
||||
{
|
||||
$this->assertURLEquals($this->url('/posts'),
|
||||
$this->url('/posts/1')->ascend());
|
||||
}
|
||||
|
||||
public function testTransformsCamelCaseIntoWhileAddingACommandToAnURL()
|
||||
{
|
||||
$this->assertURLEquals($this->url('/posts/alert_text'),
|
||||
$this->url('/posts')->addCommand('alertText'));
|
||||
}
|
||||
|
||||
public function testCompletesARelativeUrl()
|
||||
{
|
||||
$exampleFolder = 'example/';
|
||||
$this->assertURLEquals($this->url('http://localhost/example/'),
|
||||
$this->url('http://localhost')->jump($exampleFolder));
|
||||
}
|
||||
|
||||
public function testJumpsToAnAbsoluteUrl()
|
||||
{
|
||||
$exampleDotCom = 'http://www.example.com';
|
||||
$this->assertURLEquals($this->url($exampleDotCom),
|
||||
$this->url('http://localhost')->jump($exampleDotCom));
|
||||
}
|
||||
|
||||
public function testJumpsToASecureAbsoluteUrl()
|
||||
{
|
||||
$exampleDotCom = 'https://www.example.com';
|
||||
$this->assertURLEquals($this->url($exampleDotCom),
|
||||
$this->url('http://localhost')->jump($exampleDotCom));
|
||||
}
|
||||
|
||||
private function assertURLEquals($expected, $actual)
|
||||
{
|
||||
$this->assertInstanceOf(URL::class, $expected);
|
||||
$this->assertInstanceOf(URL::class, $actual);
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
private function url($value)
|
||||
{
|
||||
return new URL($value);
|
||||
}
|
||||
}
|
137
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/WaitUntilTest.php
vendored
Normal file
137
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/WaitUntilTest.php
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase;
|
||||
|
||||
/**
|
||||
* PHPUnit
|
||||
*
|
||||
* Copyright (c) 2010-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* * Neither the name of Sebastian Bergmann nor the names of his
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Ivan Kurnosov <zerkms@zerkms.com>
|
||||
* @copyright 2010-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase\WebDriverException;
|
||||
|
||||
/**
|
||||
* Tests for session::waitUntil() command.
|
||||
*
|
||||
* @package PHPUnit_Selenium
|
||||
* @author Ivan Kurnosov <zerkms@zerkms.com>
|
||||
* @copyright 2010-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
|
||||
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
|
||||
* @link http://www.phpunit.de/
|
||||
*/
|
||||
class WaitUntilTest extends BaseTestCase
|
||||
{
|
||||
public function testWaitSuccessfully()
|
||||
{
|
||||
$this->url('html/test_wait.html');
|
||||
|
||||
$this->waitUntil(function($testCase) {
|
||||
try {
|
||||
$testCase->byXPath('//div[@id="parent"][contains(text(), "default text")]');
|
||||
} catch (WebDriverException $e) {
|
||||
return TRUE;
|
||||
}
|
||||
}, 8000);
|
||||
|
||||
$this->addToAssertionCount(1);
|
||||
}
|
||||
|
||||
public function testWaitUnsuccessfully()
|
||||
{
|
||||
$this->expectException(WebDriverException::class);
|
||||
$this->url('html/test_wait.html');
|
||||
|
||||
$this->waitUntil(function($testCase) {
|
||||
try {
|
||||
$testCase->byXPath('//div[@id="parent"][contains(text(), "default text")]');
|
||||
} catch (WebDriverException $e) {
|
||||
return TRUE;
|
||||
}
|
||||
}, 42);
|
||||
}
|
||||
|
||||
public function testInvalidCallback()
|
||||
{
|
||||
$this->expectException(\PHPUnit\Extensions\Selenium2TestCase\Exception::class);
|
||||
$this->expectExceptionMessage('The valid callback is expected');
|
||||
$this->waitUntil('not a callback');
|
||||
}
|
||||
|
||||
public function testImplicitWaitIsRestoredAfterFailure()
|
||||
{
|
||||
$this->url('html/test_wait.html');
|
||||
$this->timeouts()->implicitWait(7000);
|
||||
|
||||
try {
|
||||
$this->waitUntil(function($testCase) {
|
||||
$testCase->byId('testBox');
|
||||
return TRUE;
|
||||
});
|
||||
$this->fail('Should fail because of the element not exists there yet');
|
||||
} catch (WebDriverException $e) {}
|
||||
|
||||
// in this case - element should be found, because of the implicitWait
|
||||
$element = $this->byId('testBox');
|
||||
$this->assertEquals('testBox', $element->attribute('id'));
|
||||
}
|
||||
|
||||
public function testImplicitWaitIsRestoredAfterSuccess()
|
||||
{
|
||||
$this->url('html/test_wait.html');
|
||||
$this->timeouts()->implicitWait(8000);
|
||||
|
||||
$this->waitUntil(function($testCase) {
|
||||
$testCase->byId('parent');
|
||||
return TRUE;
|
||||
});
|
||||
|
||||
// in this case - element should be found, because we set a 8000ms implicitWait before the waitUntil.
|
||||
$element = $this->byId('testBox');
|
||||
$this->assertEquals('testBox', $element->attribute('id'));
|
||||
}
|
||||
|
||||
public function testReturnValue()
|
||||
{
|
||||
$result = $this->waitUntil(function() {
|
||||
return 'return value';
|
||||
});
|
||||
|
||||
$this->assertEquals('return value', $result);
|
||||
}
|
||||
}
|
29
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/fixtures/SuiteBuildingSuites.php
vendored
Normal file
29
vendor/phpunit/phpunit-selenium/Tests/Selenium2TestCase/fixtures/SuiteBuildingSuites.php
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Selenium2TestCase\fixtures;
|
||||
|
||||
use PHPUnit\Extensions\Selenium2TestCase;
|
||||
|
||||
class TestCaseSample extends Selenium2TestCase
|
||||
{
|
||||
public function testFirst() {}
|
||||
public function testSecond() {}
|
||||
}
|
||||
|
||||
class MultipleBrowsersTestCaseSample extends Selenium2TestCase
|
||||
{
|
||||
public static $browsers = array(
|
||||
array(
|
||||
'browserName' => 'firefox',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444,
|
||||
),
|
||||
array(
|
||||
'browserName' => 'safari',
|
||||
'host' => 'localhost',
|
||||
'port' => 4444,
|
||||
),
|
||||
);
|
||||
|
||||
public function testSingle() {}
|
||||
}
|
Reference in New Issue
Block a user