package.xml 0000664 0000764 0000764 00000027051 11735520166 011012 0 ustar sb sb
PHPUnit_Selenium
pear.phpunit.de
Selenium Server integration for PHPUnit
Selenium Server integration for PHPUnit
Sebastian Bergmann
sb
sb@sebastian-bergmann.de
yes
2012-03-31
06:13:10
1.2.6
1.2.1
stable
stable
BSD License
http://github.com/sebastianbergmann/phpunit-selenium/blob/master/README.markdown
5.2.7
1.9.4
PHPUnit
pear.phpunit.de
3.6.0
curl
dom
reflection
spl
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Element/Select.php 0000664 0000764 0000764 00000010365 11735520166 024735 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.2
*/
/**
* Object representing a element.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.2
*/
class PHPUnit_Extensions_Selenium2TestCase_Element_Select
extends PHPUnit_Extensions_Selenium2TestCase_Element
{
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Element_Select
*/
public static function fromElement(PHPUnit_Extensions_Selenium2TestCase_Element $element)
{
return new self($element->driver, $element->url);
}
/**
* @return string
*/
public function selectedLabel()
{
return $this->selectedOption()->text();
}
/**
* @return string
*/
public function selectedValue()
{
return $this->selectedOption()->value();
}
/**
* @param string $label the text appearing in the option
* @return void
*/
public function selectOptionByLabel($label)
{
$toSelect = $this->criteria('xpath')->value("//option[.='$label']");
$this->selectOptionByCriteria($toSelect);
}
/**
* @param string $value the value attribute of the option
* @return void
*/
public function selectOptionByValue($value)
{
$toSelect = $this->criteria('xpath')->value("//option[@value='$value']");
$this->selectOptionByCriteria($toSelect);
}
/**
* @param PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $localCriteria condiotions for selecting an option
* @return void
*/
public function selectOptionByCriteria(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $localCriteria)
{
$option = $this->element($localCriteria);
$option->click();
}
private function selectedOption()
{
foreach ($this->options() as $option) {
if ($option->selected()) {
return $option;
}
}
}
private function options()
{
$onlyTheOptions = $this->criteria('css selector')->value('option');
return $this->elements($onlyTheOptions);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Attribute.php 0000664 0000764 0000764 00000005550 11735520166 026760 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Retrieves an attribute of a DOM element.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Attribute
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
/**
* @param array $parameter
*/
public function __construct($parameter,
PHPUnit_Extensions_Selenium2TestCase_URL $attributeResourceBaseUrl)
{
$this->jsonParameters = array();
$this->url = $attributeResourceBaseUrl->descend($parameter);
}
public function httpMethod()
{
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Click.php 0000664 0000764 0000764 00000005037 11735520166 026042 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Clicks ok on an alert popup.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Click
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
return 'POST';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Css.php 0000664 0000764 0000764 00000005535 11735520166 025550 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Retrieves the value of a CSS property.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Css
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
/**
* @param array $propertyName
*/
public function __construct($propertyName,
PHPUnit_Extensions_Selenium2TestCase_URL $cssResourceBaseUrl)
{
$this->jsonParameters = array();
$this->url = $cssResourceBaseUrl->descend($propertyName);
}
public function httpMethod()
{
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Equals.php 0000664 0000764 0000764 00000006124 11735520166 026245 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Checks equality (same element on the page) with another DOM element.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Equals
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
/**
* @param array $parameter
*/
public function __construct($parameter,
PHPUnit_Extensions_Selenium2TestCase_URL $equalsResourceBaseUrl)
{
$this->jsonParameters = array();
if (!($parameter instanceof PHPUnit_Extensions_Selenium2TestCase_Element)) {
throw new InvalidArgumentException("Elements can only test equality with other Element instances.");
}
$this->url = $equalsResourceBaseUrl->descend($parameter->getId());
}
public function httpMethod()
{
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/GenericAccessor.php 0000664 0000764 0000764 00000005135 11735520166 030053 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Class for implementing commands that just return a value
* (obtained with GET).
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/GenericPost.php 0000664 0000764 0000764 00000005113 11735520166 027232 0 ustar sb sb .
* 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
* @copyright 2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Class for implementing commands that just accomplishes an action (via POST).
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
return 'POST';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Value.php 0000664 0000764 0000764 00000006532 11735520166 026072 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Get and set the element's value attribute.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Value
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function __construct($jsonParameters,
PHPUnit_Extensions_Selenium2TestCase_URL $url)
{
if (is_string($jsonParameters)) {
$jsonParameters = $this->charactersToType($jsonParameters);
}
parent::__construct($jsonParameters, $url);
}
public function httpMethod()
{
if ($this->jsonParameters) {
return 'POST';
} else {
return 'GET';
}
}
/**
* @param string $string
* @return array array of characters to type
*/
private function charactersToType($string)
{
$characters = array();
for ($i = 0, $length = strlen($string); $i < $length; $i++) {
$characters[] = mb_substr($string, $i, 1, 'UTF-8');
}
return array(
'value' => $characters
);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Session/Cookie/Builder.php 0000664 0000764 0000764 00000010004 11735520166 026335 0 ustar sb sb .
* 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
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Adds a cookie.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_Selenium2TestCase_Session_Cookie_Builder
{
private $name;
private $value;
private $path;
private $domain;
private $secure = FALSE;
private $expiry;
public function __construct($cookieFacade, $name, $value)
{
$this->cookieFacade = $cookieFacade;
$this->name = $name;
$this->value = $value;
}
/**
* @param string
* @return PHPUnit_Extensions_Selenium2TestCase_Session_Cookie_Builder
*/
public function path($path)
{
$this->path = $path;
return $this;
}
/**
* @param string
* @return PHPUnit_Extensions_Selenium2TestCase_Session_Cookie_Builder
*/
public function domain($domain)
{
$this->domain = $domain;
return $this;
}
/**
* @param boolean
* @return PHPUnit_Extensions_Selenium2TestCase_Session_Cookie_Builder
*/
public function secure($secure)
{
$this->secure = $secure;
return $this;
}
/**
* @param integer
* @return PHPUnit_Extensions_Selenium2TestCase_Session_Cookie_Builder
*/
public function expiry($expiry)
{
$this->expiry = $expiry;
return $this;
}
/**
* @return void
*/
public function set()
{
$cookieData = array(
'name' => $this->name,
'value' => $this->value,
'secure' => $this->secure,
);
foreach (array('path', 'domain', 'expiry') as $parameter) {
if ($this->$parameter !== NULL) {
$cookieData[$parameter] = $this->$parameter;
}
}
$this->cookieFacade->postCookie($cookieData);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Session/Cookie.php 0000664 0000764 0000764 00000007761 11735520166 024767 0 ustar sb sb .
* 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
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Adds and remove cookies.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_Selenium2TestCase_Session_Cookie
{
private $driver;
private $url;
public function __construct(PHPUnit_Extensions_Selenium2TestCase_Driver $driver,
PHPUnit_Extensions_Selenium2TestCase_URL $url)
{
$this->driver = $driver;
$this->url = $url;
}
/**
* @param string $name
* @param string $value
* @return void
*/
public function add($name, $value)
{
return new PHPUnit_Extensions_Selenium2TestCase_Session_Cookie_Builder($this, $name, $value);
}
/**
* @param string $name
* @return string
*/
public function get($name)
{
$cookies = $this->driver->curl('GET', $this->url)->getValue();
foreach ($cookies as $cookie) {
if ($cookie['name'] == $name) {
return $cookie['value'];
}
}
throw new PHPUnit_Extensions_Selenium2TestCase_Exception("There is no '$name' cookie available on this page.");
}
/**
* @param string $name
* @return void
*/
public function remove($name)
{
$url = $this->url->descend($name);
$this->driver->curl('DELETE', $url);
}
/**
* @return void
*/
public function clear()
{
$this->driver->curl('DELETE', $this->url);
}
/**
* @internal
* @param array $data
* @return void
*/
public function postCookie(array $data)
{
$this->driver->curl('POST',
$this->url,
array(
'cookie' => $data
));
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Session/Storage.php 0000664 0000764 0000764 00000006054 11735520166 025154 0 ustar sb sb .
* 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
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Manage the local storage HTML 5 database.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_Selenium2TestCase_Session_Storage
{
private $driver;
private $url;
public function __construct(PHPUnit_Extensions_Selenium2TestCase_Driver $driver,
PHPUnit_Extensions_Selenium2TestCase_URL $url)
{
$this->driver = $driver;
$this->url = $url;
}
public function __set($name, $value)
{
$this->driver->curl('POST', $this->url, array(
'key' => $name,
'value' => (string)$value
));
}
public function __get($name)
{
return $this->driver->curl(
'GET',
$this->url->descend('key')->descend($name)
)->getValue();
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Session/Timeouts.php 0000664 0000764 0000764 00000006130 11735520166 025354 0 ustar sb sb .
* 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
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Manages timeouts for the current browser session.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_Session_Timeouts
extends PHPUnit_Extensions_Selenium2TestCase_CommandsHolder
{
protected function initCommands()
{
return array(
'implicitWait' => function ($parameter, $commandUrl) {
$jsonParameters = array('ms' => $parameter);
return new PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost($jsonParameters, $commandUrl);
},
'asyncScript' => function ($parameter, $commandUrl) {
$jsonParameters = array('ms' => $parameter);
return new PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost($jsonParameters, $commandUrl);
},
);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/AcceptAlert.php 0000664 0000764 0000764 00000005045 11735520166 027235 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Clicks Ok on an alert popup.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_AcceptAlert
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
return 'POST';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/AlertText.php 0000664 0000764 0000764 00000006067 11735520166 026767 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Obtains the text of an alert, or types into a prompt.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_AlertText
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function __construct($argument, PHPUnit_Extensions_Selenium2TestCase_URL $url)
{
if (is_string($argument)) {
$jsonParameters =array('text' => $argument);
} else if ($argument == NULL) {
$jsonParameters = NULL;
} else {
throw new BadMethodCallException('Wrong parameters for alertText().');
}
parent::__construct($jsonParameters, $url);
}
public function httpMethod()
{
if ($this->jsonParameters) {
return 'POST';
}
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/DismissAlert.php 0000664 0000764 0000764 00000005052 11735520166 027447 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Clicks Cancel on an alert popup.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_DismissAlert
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
return 'POST';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Frame.php 0000664 0000764 0000764 00000005310 11735520166 026073 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Changes the focus to a frame.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Frame
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function __construct($id, $commandUrl)
{
$jsonParameters = array('id' => $id);
parent::__construct($jsonParameters, $commandUrl);
}
public function httpMethod()
{
return 'POST';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/GenericAccessor.php 0000664 0000764 0000764 00000005110 11735520166 030076 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Gets an attribute from the session (title, alert text, etc.)
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_GenericAccessor
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Url.php 0000664 0000764 0000764 00000006002 11735520166 025602 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Gets or sets the current URL of the window.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Url
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function __construct($url, $commandUrl, PHPUnit_Extensions_Selenium2TestCase_URL $baseUrl)
{
if ($url !== NULL) {
$absoluteLocation = $baseUrl->jump($url)->getValue();
$jsonParameters = array('url' => $absoluteLocation);
} else {
$jsonParameters = NULL;
}
parent::__construct($jsonParameters, $commandUrl);
}
public function httpMethod()
{
if ($this->jsonParameters) {
return 'POST';
}
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionCommand/Window.php 0000664 0000764 0000764 00000005320 11735520166 026311 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Changes the focus to a window.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Window
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function __construct($name, $commandUrl)
{
$jsonParameters = array('name' => $name);
parent::__construct($jsonParameters, $commandUrl);
}
public function httpMethod()
{
return 'POST';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Isolated.php 0000664 0000764 0000764 00000006074 11735520166 027041 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Produces a new Session object shared for each test.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Isolated
implements PHPUnit_Extensions_Selenium2TestCase_SessionStrategy
{
public function session(array $parameters)
{
$seleniumServerUrl = PHPUnit_Extensions_Selenium2TestCase_URL::fromHostAndPort($parameters['host'], $parameters['port']);
$driver = new PHPUnit_Extensions_Selenium2TestCase_Driver($seleniumServerUrl);
$session = $driver->startSession($parameters['browser'], $parameters['browserUrl']);
return $session;
}
public function notSuccessfulTest()
{
}
public function endOfTest(PHPUnit_Extensions_Selenium2TestCase_Session $session)
{
$session->stop();
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy/Shared.php 0000664 0000764 0000764 00000006377 11735520166 026511 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Keeps a Session object shared between test runs to save time.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Shared
implements PHPUnit_Extensions_Selenium2TestCase_SessionStrategy
{
private $original;
private $session;
private $mainWindow;
public function __construct(PHPUnit_Extensions_Selenium2TestCase_SessionStrategy $originalStrategy)
{
$this->original = $originalStrategy;
}
public function session(array $parameters)
{
if ($this->session === NULL) {
$this->session = $this->original->session($parameters);
$this->mainWindow = $this->session->windowHandle();
} else {
$this->session->window($this->mainWindow);
}
return $this->session;
}
public function notSuccessfulTest()
{
$this->session = NULL;
}
public function endOfTest(PHPUnit_Extensions_Selenium2TestCase_Session $session)
{
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Command.php 0000664 0000764 0000764 00000006500 11735520166 023477 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Base class for implementing commands with special semantics.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
abstract class PHPUnit_Extensions_Selenium2TestCase_Command
{
protected $jsonParameters;
private $commandName;
/**
* @param array $jsonParameters null in case of no parameters
*/
public function __construct($jsonParameters,
PHPUnit_Extensions_Selenium2TestCase_URL $url)
{
if (!is_array($jsonParameters) && $jsonParameters !== NULL) {
throw new InvalidArgumentException("The JSON parameters must be an array, or a NULL value in case they are not required.");
}
$this->jsonParameters = $jsonParameters;
$this->url = $url;
}
public function url()
{
return $this->url;
}
/**
* @return string
*/
abstract public function httpMethod();
/**
* @param array $jsonParameters null in case of no parameters
*/
public function jsonParameters()
{
return $this->jsonParameters;
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php 0000664 0000764 0000764 00000012715 11735520166 025025 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.4
*/
/**
* Object representing elements, or everything that may have subcommands.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.4
*/
abstract class PHPUnit_Extensions_Selenium2TestCase_CommandsHolder
{
/**
* @var PHPUnit_Extensions_Selenium2TestCase_Driver
*/
protected $driver;
/**
* @var string the API URL for this element,
*/
protected $url;
/**
* @var array instances of
* PHPUnit_Extensions_Selenium2TestCase_ElementCommand
*/
protected $commands;
public function __construct($driver,
PHPUnit_Extensions_Selenium2TestCase_URL $url)
{
$this->driver = $driver;
$this->url = $url;
$this->commands = array();
foreach ($this->initCommands() as $commandName => $handler) {
if (is_string($handler)) {
$this->commands[$commandName] = $this->factoryMethod($handler);
} else if (is_callable($handler)) {
$this->commands[$commandName] = $handler;
} else {
throw new InvalidArgumentException("Command $commandName is not configured correctly.");
}
}
}
/**
* @return array class names, or
* callables of the form function($parameter, $commandUrl)
*/
protected abstract function initCommands();
public function __call($commandName, $arguments)
{
$jsonParameters = $this->extractJsonParameters($arguments);
$response = $this->driver->execute($this->newCommand($commandName, $jsonParameters));
return $response->getValue();
}
protected function postCommand($name, PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$response = $this->driver->curl('POST',
$this->url->addCommand($name),
$criteria->getArrayCopy());
return $response->getValue();
}
/**
* @params string $commandClass a class name, descending from
PHPUnit_Extensions_Selenium2TestCase_Command
* @return callable
*/
private function factoryMethod($commandClass)
{
return function($jsonParameters, $url) use ($commandClass) {
return new $commandClass($jsonParameters, $url);
};
}
private function extractJsonParameters($arguments)
{
$this->checkArguments($arguments);
if (count($arguments) == 0) {
return NULL;
}
return $arguments[0];
}
private function checkArguments($arguments)
{
if (count($arguments) > 1) {
throw new Exception('You cannot call a command with multiple method arguments.');
}
}
private function newCommand($commandName, $jsonParameters)
{
if (isset($this->commands[$commandName])) {
$factoryMethod = $this->commands[$commandName];
$url = $this->url->addCommand($commandName);
$command = $factoryMethod($jsonParameters, $url);
return $command;
}
throw new BadMethodCallException("The command '$commandName' is not existent or not supported yet.");
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Driver.php 0000664 0000764 0000764 00000013365 11735520166 023363 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Driver for creating browser session with Selenium 2 (WebDriver API).
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_Driver
{
/**
* @var string
*/
private $browser;
public function __construct(PHPUnit_Extensions_Selenium2TestCase_URL $seleniumServerUrl)
{
$this->seleniumServerUrl = $seleniumServerUrl;
}
public function startSession($browser, PHPUnit_Extensions_Selenium2TestCase_URL $browserUrl)
{
$this->browser = $browser;
$sessionCreation = $this->seleniumServerUrl->descend("/wd/hub/session");
$response = $this->curl('POST', $sessionCreation, array(
'desiredCapabilities' => array(
'browserName' => $browser
)
));
$sessionPrefix = $response->getURL();
return new PHPUnit_Extensions_Selenium2TestCase_Session($this, $sessionPrefix, $browserUrl);
}
/**
* Performs an HTTP request to the Selenium 2 server.
*
* @param string $method 'GET'|'POST'|'DELETE'|...
* @param string $url
* @param array $params JSON parameters for POST requests
*/
public function curl($http_method,
PHPUnit_Extensions_Selenium2TestCase_URL $url,
$params = NULL)
{
$curl = curl_init($url->getValue());
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl,
CURLOPT_HTTPHEADER,
array(
'Content-type: application/json;charset=UTF-8',
'Accept: application/json;charset=UTF-8'
));
if ($http_method === 'POST') {
curl_setopt($curl, CURLOPT_POST, TRUE);
if ($params && is_array($params)) {
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($params));
}
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
} else if ($http_method == 'DELETE') {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
}
$rawResponse = trim(curl_exec($curl));
$info = curl_getinfo($curl);
if ($info['http_code'] == 404) {
if ($this->isNotAnAndroidDriverErrorToWorkAround($info)) {
throw new BadMethodCallException("The command $url is not recognized by the server.");
}
}
curl_close($curl);
$content = json_decode($rawResponse, TRUE);
if ($info['http_code'] == 500) {
if (isset($content['value']['message'])) {
$message = $content['value']['message'];
} else {
$message = "Internal server error while executing $http_method request at $url";
}
throw new RuntimeException($message);
}
return new PHPUnit_Extensions_Selenium2TestCase_Response($content, $info);
}
public function execute(PHPUnit_Extensions_Selenium2TestCase_Command $command)
{
return $this->curl($command->httpMethod(),
$command->url(),
$command->jsonParameters());
}
/**
* TODO: how to test this automatically?
* @return boolean
*/
private function isNotAnAndroidDriverErrorToWorkAround(array $info)
{
if ($this->browser == 'android'
&& preg_match('/wd\/hub\/session\/[0-9]*/', $info['url'])) {
return FALSE;
}
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/ElementCriteria.php 0000664 0000764 0000764 00000005502 11735520166 025176 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Conditions for selecting a DOM element.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
* @see http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element
*/
class PHPUnit_Extensions_Selenium2TestCase_ElementCriteria extends ArrayObject
{
public function __construct($strategy)
{
$this['using'] = $strategy;
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_ElementCriteria
*/
public function value($searchTarget)
{
$this['value'] = $searchTarget;
return $this;
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Element.php 0000664 0000764 0000764 00000014531 11735520166 023515 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Object representing a DOM element.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
* @method string attribute($name) Retrieves an element's attribute
* @method void clear() Empties the content of a form element.
* @method void click()
* @method string css($propertyName) Retrieves the value of a CSS property
* @method bool displayed() Checks an element's visibility
* @method bool enabled() Checks a form element's state
* @method bool equals(PHPUnit_Extensions_Selenium2TestCase_Element $another) Checks if the two elements are the same on the page
* @method array location() Retrieves the element's position in the page: keys 'x' and 'y' in the returned array
* @method string name() Retrieves the tag name
* @method bool selected() Checks the state of an option or other form element
* @method array size() Retrieves the dimensions of the element: 'width' and 'height' of the returned array
* @method void submit() Submits a form; can be called on its children
* @method string value($newValue = NULL) Get or set value of form elements
* @method string text() Get content of ordinary elements
*/
class PHPUnit_Extensions_Selenium2TestCase_Element
extends PHPUnit_Extensions_Selenium2TestCase_CommandsHolder
{
/**
* @return integer
*/
public function getId()
{
return $this->url->lastSegment();
}
/**
* @return array class names
*/
protected function initCommands()
{
return array(
'attribute' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Attribute',
'clear' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'click' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Click',
'css' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Css',
'displayed' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'enabled' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'equals' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Equals',
'location' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'name' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'selected' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'size' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'submit' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'text' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'value' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_Value'
);
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function element(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$value = $this->postCommand('element', $criteria);
return self::fromResponseValue($value, $this->url->ascend(), $this->driver);
}
/**
* @return array instances of PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function elements(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$values = $this->postCommand('elements', $criteria);
$elements = array();
foreach ($values as $value) {
$elements[] = self::fromResponseValue($value, $this->url->ascend(), $this->driver);
}
return $elements;
}
public static function fromResponseValue(array $value, PHPUnit_Extensions_Selenium2TestCase_URL $parentFolder, PHPUnit_Extensions_Selenium2TestCase_Driver $driver)
{
if (!isset($value['ELEMENT'])) {
throw new InvalidArgumentException('Element not found.');
}
$url = $parentFolder->descend($value['ELEMENT']);
return new self($driver, $url);
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_ElementCriteria
*/
protected function criteria($using)
{
return new PHPUnit_Extensions_Selenium2TestCase_ElementCriteria($using);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Exception.php 0000664 0000764 0000764 00000004727 11735520166 024070 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Indicates an exception during the execution of Selenium 2 commands.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_Selenium2TestCase_Exception extends RuntimeException
{
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Response.php 0000664 0000764 0000764 00000006106 11735520166 023721 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Object representing an HTTP response from the Selenium Server.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_Response
{
/**
* @var array decoded response
*/
private $jsonResponse;
/**
* @var array CURL info for the response.
*/
private $info;
public function __construct($jsonResponse, $info)
{
$this->jsonResponse = $jsonResponse;
$this->info = $info;
}
public function getValue()
{
if (isset($this->jsonResponse['value'])) {
return $this->jsonResponse['value'];
}
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public function getURL()
{
return new PHPUnit_Extensions_Selenium2TestCase_URL($this->info['url']);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Session.php 0000664 0000764 0000764 00000024007 11735520166 023546 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* Browser session for Selenium 2: main point of entry for functionality.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_Selenium2TestCase_Session
extends PHPUnit_Extensions_Selenium2TestCase_CommandsHolder
{
/**
* @var string the base URL for this session,
* which all relative URLs will refer to
*/
private $baseUrl;
/**
* @var boolean
*/
private $stopped = FALSE;
public function __construct($driver,
PHPUnit_Extensions_Selenium2TestCase_URL $url,
PHPUnit_Extensions_Selenium2TestCase_URL $baseUrl)
{
$this->baseUrl = $baseUrl;
parent::__construct($driver, $url);
}
protected function initCommands()
{
$baseUrl = $this->baseUrl;
return array(
'acceptAlert' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_AcceptAlert',
'alertText' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_AlertText',
'back' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'dismissAlert' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_DismissAlert',
'execute' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'executeAsync' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'forward' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'frame' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Frame',
'refresh' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericPost',
'screenshot' => 'PHPUnit_Extensions_Selenium2TestCase_ElementCommand_GenericAccessor',
'source' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_GenericAccessor',
'title' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_GenericAccessor',
'url' => function ($jsonParameters, $commandUrl) use ($baseUrl) {
return new PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Url($jsonParameters, $commandUrl, $baseUrl);
},
'window' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_Window',
'windowHandle' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_GenericAccessor',
'windowHandles' => 'PHPUnit_Extensions_Selenium2TestCase_SessionCommand_GenericAccessor'
);
}
/**
* @params string $commandClass a class name, descending from
PHPUnit_Extensions_Selenium2TestCase_Command
* @return callable
*/
private function factoryMethod($commandClass)
{
return function($jsonParameters, $url) use ($commandClass) {
return new $commandClass($jsonParameters, $url);
};
}
public function __destruct()
{
$this->stop();
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public function getSessionUrl()
{
return $this->url;
}
/**
* Closed the browser.
* @return void
*/
public function stop()
{
if ($this->stopped) {
return;
}
$this->driver->curl('DELETE', $this->url);
$this->stopped = TRUE;
}
/**
* @param string $value e.g. 'container'
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function byClassName($value)
{
return $this->by('class name', $value);
}
/**
* @param string $value e.g. 'div.container'
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function byCssSelector($value)
{
return $this->by('css selector', $value);
}
/**
* @param string $value e.g. 'uniqueId'
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function byId($value)
{
return $this->by('id', $value);
}
/**
* @param string $value e.g. 'email_address'
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function byName($value)
{
return $this->by('name', $value);
}
/**
* @param string $value e.g. '/div[@attribute="value"]'
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function byXPath($value)
{
return $this->by('xpath', $value);
}
/**
* @param string $strategy supported by JsonWireProtocol element/ command
* @param string $value
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
protected function by($strategy, $value)
{
return $this->element($this->using($strategy)->value($value));
}
/**
* @param string $strategy
* @return PHPUnit_Extensions_Selenium2TestCase_ElementCriteria
*/
public function using($strategy)
{
return new PHPUnit_Extensions_Selenium2TestCase_ElementCriteria($strategy);
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function element(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$value = $this->postCommand('element', $criteria);
return PHPUnit_Extensions_Selenium2TestCase_Element::fromResponseValue($value,
$this->url->descend('element'),
$this->driver);
}
/**
* @return array instances of PHPUnit_Extensions_Selenium2TestCase_Element
*/
public function elements(PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria)
{
$values = $this->postCommand('elements', $criteria);
$elements = array();
foreach ($values as $value) {
$elements[] = PHPUnit_Extensions_Selenium2TestCase_Element::fromResponseValue($value, $this->url->descend('element'), $this->driver);
}
return $elements;
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Element_Select
*/
public function select(PHPUnit_Extensions_Selenium2TestCase_Element $element)
{
return PHPUnit_Extensions_Selenium2TestCase_Element_Select::fromElement($element);
}
/**
* @param string $id id attribute, e.g. 'container'
* @return void
*/
public function clickOnElement($id)
{
return $this->element($this->using('id')->value($id))->click();
}
public function timeouts()
{
return new PHPUnit_Extensions_Selenium2TestCase_Session_Timeouts($this->driver,
$this->url->descend('timeouts'));
}
/**
* @return string a BLOB of a PNG file
*/
public function currentScreenshot()
{
return base64_decode($this->screenshot());
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Window
*/
public function currentWindow()
{
$url = $this->url->descend('window')->descend($this->windowHandle());
return new PHPUnit_Extensions_Selenium2TestCase_Window($this->driver, $url);
}
public function closeWindow()
{
$this->driver->curl('DELETE', $this->url->descend('window'));
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Session_Cookie
*/
public function cookie()
{
$url = $this->url->descend('cookie');
return new PHPUnit_Extensions_Selenium2TestCase_Session_Cookie($this->driver, $url);
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_Session_Storage
*/
public function localStorage()
{
$url = $this->url->addCommand('localStorage');
return new PHPUnit_Extensions_Selenium2TestCase_Session_Storage($this->driver, $url);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/SessionStrategy.php 0000664 0000764 0000764 00000005616 11735520166 025276 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* Specifies how to create Session objects for running tests.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
interface PHPUnit_Extensions_Selenium2TestCase_SessionStrategy
{
/**
* @param array $parameters 'host' => Selenium Server machine
'port' => Selenium Server port
'browser' => a browser name
* 'browserUrl' => base URL to use during the test
*/
public function session(array $parameters);
public function notSuccessfulTest();
public function endOfTest(PHPUnit_Extensions_Selenium2TestCase_Session $session);
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/StateCommand.php 0000664 0000764 0000764 00000005153 11735520166 024503 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.5
*/
/**
* Gets or sets an attribute of an object.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.5
*/
class PHPUnit_Extensions_Selenium2TestCase_StateCommand
extends PHPUnit_Extensions_Selenium2TestCase_Command
{
public function httpMethod()
{
if ($this->jsonParameters) {
return 'POST';
}
return 'GET';
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/URL.php 0000664 0000764 0000764 00000011107 11735520166 022562 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* URL Value Object allowing easy concatenation.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
final class PHPUnit_Extensions_Selenium2TestCase_URL
{
/**
* @var string
*/
private $value;
/**
* @param string $value
*/
public function __construct($value)
{
$this->value = $value;
}
/**
* @param string $host
* @param int port
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public static function fromHostAndPort($host, $port)
{
return new self("http://{$host}:{$port}");
}
/**
* @return string
*/
public function getValue()
{
return $this->value;
}
public function __toString()
{
return $this->getValue();
}
/**
* @param string $addition
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public function descend($addition)
{
$newValue = rtrim($this->value, '/')
. '/'
. ltrim($addition, '/');
return new self($newValue);
}
/**
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public function ascend()
{
$lastSlash = strrpos($this->value, "/");
$newValue = substr($this->value, 0, $lastSlash);
return new self($newValue);
}
/**
* @return string
*/
public function lastSegment()
{
$segments = explode('/', $this->value);
return end($segments);
}
/**
* @param string $command
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public function addCommand($command)
{
return $this->descend($this->camelCaseToUnderScores($command));
}
/**
* @param string $newUrl
* @return PHPUnit_Extensions_Selenium2TestCase_URL
*/
public function jump($newUrl)
{
if ($this->isAbsolute($newUrl)) {
return new self($newUrl);
} else {
return $this->descend($newUrl);
}
}
private function camelCaseToUnderScores($string)
{
$string = preg_replace('/([A-Z]{1,1})/', ' \1', $string);
$string = strtolower($string);
return str_replace(' ', '_', $string);
}
private function isAbsolute($urlValue)
{
return preg_match('/^(http|https):\/\//', $urlValue) > 0;
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase/Window.php 0000664 0000764 0000764 00000005372 11735520166 023376 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.5
*/
/**
* Object representing a browser window.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.5
*/
class PHPUnit_Extensions_Selenium2TestCase_Window extends PHPUnit_Extensions_Selenium2TestCase_CommandsHolder
{
/**
* @return array class names
*/
protected function initCommands()
{
return array(
'size' => 'PHPUnit_Extensions_Selenium2TestCase_StateCommand',
'position' => 'PHPUnit_Extensions_Selenium2TestCase_StateCommand'
);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestCase/Autoload.php 0000664 0000764 0000764 00000016074 11735520166 023616 0 ustar sb sb .
* 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 Sebastian Bergmann
* @copyright 2002-2010 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.1.0
*/
require_once 'File/Iterator/Autoload.php';
function phpunit_selenium_autoload($class = NULL) {
static $classes = NULL;
static $path = NULL;
if ($classes === NULL) {
$classes = array(
'phpunit_extensions_selenium2testcase' => '/Extensions/Selenium2TestCase.php',
'phpunit_extensions_selenium2testcase_command' => '/Extensions/Selenium2TestCase/Command.php',
'phpunit_extensions_selenium2testcase_commandsholder' => '/Extensions/Selenium2TestCase/CommandsHolder.php',
'phpunit_extensions_selenium2testcase_driver' => '/Extensions/Selenium2TestCase/Driver.php',
'phpunit_extensions_selenium2testcase_element' => '/Extensions/Selenium2TestCase/Element.php',
'phpunit_extensions_selenium2testcase_element_select' => '/Extensions/Selenium2TestCase/Element/Select.php',
'phpunit_extensions_selenium2testcase_elementcommand_attribute' => '/Extensions/Selenium2TestCase/ElementCommand/Attribute.php',
'phpunit_extensions_selenium2testcase_elementcommand_click' => '/Extensions/Selenium2TestCase/ElementCommand/Click.php',
'phpunit_extensions_selenium2testcase_elementcommand_css' => '/Extensions/Selenium2TestCase/ElementCommand/Css.php',
'phpunit_extensions_selenium2testcase_elementcommand_equals' => '/Extensions/Selenium2TestCase/ElementCommand/Equals.php',
'phpunit_extensions_selenium2testcase_elementcommand_genericaccessor' => '/Extensions/Selenium2TestCase/ElementCommand/GenericAccessor.php',
'phpunit_extensions_selenium2testcase_elementcommand_genericpost' => '/Extensions/Selenium2TestCase/ElementCommand/GenericPost.php',
'phpunit_extensions_selenium2testcase_elementcommand_value' => '/Extensions/Selenium2TestCase/ElementCommand/Value.php',
'phpunit_extensions_selenium2testcase_elementcriteria' => '/Extensions/Selenium2TestCase/ElementCriteria.php',
'phpunit_extensions_selenium2testcase_exception' => '/Extensions/Selenium2TestCase/Exception.php',
'phpunit_extensions_selenium2testcase_response' => '/Extensions/Selenium2TestCase/Response.php',
'phpunit_extensions_selenium2testcase_session' => '/Extensions/Selenium2TestCase/Session.php',
'phpunit_extensions_selenium2testcase_session_cookie' => '/Extensions/Selenium2TestCase/Session/Cookie.php',
'phpunit_extensions_selenium2testcase_session_cookie_builder' => '/Extensions/Selenium2TestCase/Session/Cookie/Builder.php',
'phpunit_extensions_selenium2testcase_session_storage' => '/Extensions/Selenium2TestCase/Session/Storage.php',
'phpunit_extensions_selenium2testcase_session_timeouts' => '/Extensions/Selenium2TestCase/Session/Timeouts.php',
'phpunit_extensions_selenium2testcase_sessioncommand_acceptalert' => '/Extensions/Selenium2TestCase/SessionCommand/AcceptAlert.php',
'phpunit_extensions_selenium2testcase_sessioncommand_alerttext' => '/Extensions/Selenium2TestCase/SessionCommand/AlertText.php',
'phpunit_extensions_selenium2testcase_sessioncommand_dismissalert' => '/Extensions/Selenium2TestCase/SessionCommand/DismissAlert.php',
'phpunit_extensions_selenium2testcase_sessioncommand_frame' => '/Extensions/Selenium2TestCase/SessionCommand/Frame.php',
'phpunit_extensions_selenium2testcase_sessioncommand_genericaccessor' => '/Extensions/Selenium2TestCase/SessionCommand/GenericAccessor.php',
'phpunit_extensions_selenium2testcase_sessioncommand_url' => '/Extensions/Selenium2TestCase/SessionCommand/Url.php',
'phpunit_extensions_selenium2testcase_sessioncommand_window' => '/Extensions/Selenium2TestCase/SessionCommand/Window.php',
'phpunit_extensions_selenium2testcase_sessionstrategy' => '/Extensions/Selenium2TestCase/SessionStrategy.php',
'phpunit_extensions_selenium2testcase_sessionstrategy_isolated' => '/Extensions/Selenium2TestCase/SessionStrategy/Isolated.php',
'phpunit_extensions_selenium2testcase_sessionstrategy_shared' => '/Extensions/Selenium2TestCase/SessionStrategy/Shared.php',
'phpunit_extensions_selenium2testcase_statecommand' => '/Extensions/Selenium2TestCase/StateCommand.php',
'phpunit_extensions_selenium2testcase_url' => '/Extensions/Selenium2TestCase/URL.php',
'phpunit_extensions_selenium2testcase_window' => '/Extensions/Selenium2TestCase/Window.php',
'phpunit_extensions_seleniumbrowsersuite' => '/Extensions/SeleniumBrowserSuite.php',
'phpunit_extensions_seleniumtestcase' => '/Extensions/SeleniumTestCase.php',
'phpunit_extensions_seleniumtestcase_driver' => '/Extensions/SeleniumTestCase/Driver.php',
'phpunit_extensions_seleniumtestsuite' => '/Extensions/SeleniumTestSuite.php'
);
$path = dirname(dirname(dirname(__FILE__)));
}
if ($class === NULL) {
$result = array(__FILE__);
foreach ($classes as $file) {
$result[] = $path . $file;
}
return $result;
}
$cn = strtolower($class);
if (isset($classes[$cn])) {
$file = $path . $classes[$cn];
require $file;
}
}
spl_autoload_register('phpunit_selenium_autoload');
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestCase/Driver.php 0000664 0000764 0000764 00000121567 11735520166 023305 0 ustar sb sb .
* 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 Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.0.0
*/
/**
* Implementation of the Selenium RC client/server protocol.
*
* @package PHPUnit_Selenium
* @author Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.0.0
*/
class PHPUnit_Extensions_SeleniumTestCase_Driver
{
/**
* @var PHPUnit_Extensions_SeleniumTestCase
*/
protected $testCase;
/**
* @var string
*/
protected $testId;
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $browser;
/**
* @var string
*/
protected $browserUrl;
/**
* @var boolean
*/
protected $collectCodeCoverageInformation = FALSE;
/**
* @var string
*/
protected $host = 'localhost';
/**
* @var integer
*/
protected $port = 4444;
/**
* @var integer
*/
protected $httpTimeout = 45;
/**
* @var integer
*/
protected $seleniumTimeout = 30;
/**
* @var string
*/
protected $sessionId;
/**
* @var integer
*/
protected $sleep = 0;
/**
* @var boolean
*/
protected $useWaitForPageToLoad = TRUE;
/**
* @var boolean
*/
protected $wait = 5;
/**
* @var array
*/
protected static $autoGeneratedCommands = array();
/**
* @var array
*/
protected $commands = array();
/**
* @var array $userCommands A numerical array which holds custom user commands.
*/
protected $userCommands = array();
/**
* @var array
*/
protected $verificationErrors = array();
public function __construct()
{
if (empty(self::$autoGeneratedCommands)) {
self::autoGenerateCommands();
}
}
/**
* @return string
*/
public function start()
{
if ($this->browserUrl == NULL) {
throw new PHPUnit_Framework_Exception(
'setBrowserUrl() needs to be called before start().'
);
}
if (!isset($this->sessionId)) {
$this->sessionId = $this->getString(
'getNewBrowserSession',
array($this->browser, $this->browserUrl)
);
$this->doCommand('setTimeout', array($this->seleniumTimeout * 1000));
}
return $this->sessionId;
}
/**
* @return string
* @since Method available since Release 1.1.0
*/
public function getSessionId()
{
return $this->sessionId;
}
/**
* @param string
* @since Method available since Release 1.2.0
*/
public function setSessionId($sessionId)
{
$this->sessionId = $sessionId;
}
/**
*/
public function stop()
{
if (!isset($this->sessionId)) {
return;
}
$this->doCommand('testComplete');
$this->sessionId = NULL;
}
/**
* @param boolean $flag
* @throws InvalidArgumentException
*/
public function setCollectCodeCoverageInformation($flag)
{
if (!is_bool($flag)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean');
}
$this->collectCodeCoverageInformation = $flag;
}
/**
* @param PHPUnit_Extensions_SeleniumTestCase $testCase
*/
public function setTestCase(PHPUnit_Extensions_SeleniumTestCase $testCase)
{
$this->testCase = $testCase;
}
/**
* @param integer $testId
*/
public function setTestId($testId)
{
$this->testId = $testId;
}
/**
* @param string $name
* @throws InvalidArgumentException
*/
public function setName($name)
{
if (!is_string($name)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->name = $name;
}
/**
* @param string $browser
* @throws InvalidArgumentException
*/
public function setBrowser($browser)
{
if (!is_string($browser)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->browser = $browser;
}
/**
* @param string $browserUrl
* @throws InvalidArgumentException
*/
public function setBrowserUrl($browserUrl)
{
if (!is_string($browserUrl)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->browserUrl = $browserUrl;
}
/**
* @param string $host
* @throws InvalidArgumentException
*/
public function setHost($host)
{
if (!is_string($host)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->host = $host;
}
/**
* @return string
* @since Method available since Release 1.1.0
*/
public function getHost()
{
return $this->host;
}
/**
* @param integer $port
* @throws InvalidArgumentException
*/
public function setPort($port)
{
if (!is_int($port)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
}
$this->port = $port;
}
/**
* @return integer
* @since Method available since Release 1.1.0
*/
public function getPort()
{
return $this->port;
}
/**
* @param integer $timeout for Selenium RC in seconds
* @throws InvalidArgumentException
*/
public function setTimeout($timeout)
{
if (!is_int($timeout)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
}
$this->seleniumTimeout = $timeout;
}
/**
* @param integer $timeout for HTTP connection to Selenium RC in seconds
* @throws InvalidArgumentException
*/
public function setHttpTimeout($timeout)
{
if (!is_int($timeout)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
}
$this->httpTimeout = $timeout;
}
/**
* @param integer $seconds
* @throws InvalidArgumentException
*/
public function setSleep($seconds)
{
if (!is_int($seconds)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
}
$this->sleep = $seconds;
}
/**
* Sets the number of seconds to sleep() after *AndWait commands
* when setWaitForPageToLoad(FALSE) is used.
*
* @param integer $seconds
* @throws InvalidArgumentException
*/
public function setWait($seconds)
{
if (!is_int($seconds)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
}
$this->wait = $seconds;
}
/**
* Sets whether waitForPageToLoad (TRUE) or sleep() (FALSE)
* is used after *AndWait commands.
*
* @param boolean $flag
* @throws InvalidArgumentException
*/
public function setWaitForPageToLoad($flag)
{
if (!is_bool($flag)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'boolean');
}
$this->useWaitForPageToLoad = $flag;
}
/**
* Adds allowed user commands into {@link self::$userCommands}. See
* {@link self::__call()} (switch/case -> default) for usage.
*
* @param string $command A command.
*
* @return $this
* @see self::__call()
*/
public function addUserCommand($command)
{
if (!is_string($command)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->userCommands[] = $command;
return $this;
}
/**
* This method implements the Selenium RC protocol.
*
* @param string $command
* @param array $arguments
* @return mixed
* @method unknown addLocationStrategy()
* @method unknown addLocationStrategyAndWait()
* @method unknown addScript()
* @method unknown addScriptAndWait()
* @method unknown addSelection()
* @method unknown addSelectionAndWait()
* @method unknown allowNativeXpath()
* @method unknown allowNativeXpathAndWait()
* @method unknown altKeyDown()
* @method unknown altKeyDownAndWait()
* @method unknown altKeyUp()
* @method unknown altKeyUpAndWait()
* @method unknown answerOnNextPrompt()
* @method unknown assignId()
* @method unknown assignIdAndWait()
* @method unknown attachFile()
* @method unknown break()
* @method unknown captureEntirePageScreenshot()
* @method unknown captureEntirePageScreenshotAndWait()
* @method unknown captureEntirePageScreenshotToStringAndWait()
* @method unknown captureScreenshotAndWait()
* @method unknown captureScreenshotToStringAndWait()
* @method unknown check()
* @method unknown checkAndWait()
* @method unknown chooseCancelOnNextConfirmation()
* @method unknown chooseCancelOnNextConfirmationAndWait()
* @method unknown chooseOkOnNextConfirmation()
* @method unknown chooseOkOnNextConfirmationAndWait()
* @method unknown click()
* @method unknown clickAndWait()
* @method unknown clickAt()
* @method unknown clickAtAndWait()
* @method unknown close()
* @method unknown contextMenu()
* @method unknown contextMenuAndWait()
* @method unknown contextMenuAt()
* @method unknown contextMenuAtAndWait()
* @method unknown controlKeyDown()
* @method unknown controlKeyDownAndWait()
* @method unknown controlKeyUp()
* @method unknown controlKeyUpAndWait()
* @method unknown createCookie()
* @method unknown createCookieAndWait()
* @method unknown deleteAllVisibleCookies()
* @method unknown deleteAllVisibleCookiesAndWait()
* @method unknown deleteCookie()
* @method unknown deleteCookieAndWait()
* @method unknown deselectPopUp()
* @method unknown deselectPopUpAndWait()
* @method unknown doubleClick()
* @method unknown doubleClickAndWait()
* @method unknown doubleClickAt()
* @method unknown doubleClickAtAndWait()
* @method unknown dragAndDrop()
* @method unknown dragAndDropAndWait()
* @method unknown dragAndDropToObject()
* @method unknown dragAndDropToObjectAndWait()
* @method unknown dragDrop()
* @method unknown dragDropAndWait()
* @method unknown echo()
* @method unknown fireEvent()
* @method unknown fireEventAndWait()
* @method unknown focus()
* @method unknown focusAndWait()
* @method string getAlert()
* @method array getAllButtons()
* @method array getAllFields()
* @method array getAllLinks()
* @method array getAllWindowIds()
* @method array getAllWindowNames()
* @method array getAllWindowTitles()
* @method string getAttribute(string $attributeLocator)
* @method array getAttributeFromAllWindows(string $attributeName)
* @method string getBodyText()
* @method string getConfirmation()
* @method string getCookie()
* @method string getCookieByName(string $name)
* @method integer getCssCount(string $locator)
* @method integer getCursorPosition(string $locator)
* @method integer getElementHeight(string $locator)
* @method integer getElementIndex(string $locator)
* @method integer getElementPositionLeft(string $locator)
* @method integer getElementPositionTop(string $locator)
* @method integer getElementWidth(string $locator)
* @method string getEval(string $script)
* @method string getExpression(string $expression)
* @method string getHtmlSource()
* @method string getLocation()
* @method string getLogMessages()
* @method integer getMouseSpeed()
* @method string getPrompt()
* @method array getSelectOptions(string $selectLocator)
* @method string getSelectedId(string $selectLocator)
* @method array getSelectedIds(string $selectLocator)
* @method string getSelectedIndex(string $selectLocator)
* @method array getSelectedIndexes(string $selectLocator)
* @method string getSelectedLabel(string $selectLocator)
* @method array getSelectedLabels(string $selectLocator)
* @method string getSelectedValue(string $selectLocator)
* @method array getSelectedValues(string $selectLocator)
* @method unknown getSpeed()
* @method unknown getSpeedAndWait()
* @method string getTable(string $tableCellAddress)
* @method string getText(string $locator)
* @method string getTitle()
* @method string getValue(string $locator)
* @method boolean getWhetherThisFrameMatchFrameExpression(string $currentFrameString, string $target)
* @method boolean getWhetherThisWindowMatchWindowExpression(string $currentWindowString, string $target)
* @method integer getXpathCount(string $xpath)
* @method unknown goBack()
* @method unknown goBackAndWait()
* @method unknown highlight(string $locator)
* @method unknown highlightAndWait(string $locator)
* @method unknown ignoreAttributesWithoutValue(string $ignore)
* @method unknown ignoreAttributesWithoutValueAndWait(string $ignore)
* @method boolean isAlertPresent()
* @method boolean isChecked(locator)
* @method boolean isConfirmationPresent()
* @method boolean isCookiePresent(string $name)
* @method boolean isEditable(string $locator)
* @method boolean isElementPresent(string $locator)
* @method boolean isOrdered(string $locator1, string $locator2)
* @method boolean isPromptPresent()
* @method boolean isSomethingSelected(string $selectLocator)
* @method boolean isTextPresent(pattern)
* @method boolean isVisible(locator)
* @method unknown keyDown()
* @method unknown keyDownAndWait()
* @method unknown keyDownNative()
* @method unknown keyDownNativeAndWait()
* @method unknown keyPress()
* @method unknown keyPressAndWait()
* @method unknown keyPressNative()
* @method unknown keyPressNativeAndWait()
* @method unknown keyUp()
* @method unknown keyUpAndWait()
* @method unknown keyUpNative()
* @method unknown keyUpNativeAndWait()
* @method unknown metaKeyDown()
* @method unknown metaKeyDownAndWait()
* @method unknown metaKeyUp()
* @method unknown metaKeyUpAndWait()
* @method unknown mouseDown()
* @method unknown mouseDownAndWait()
* @method unknown mouseDownAt()
* @method unknown mouseDownAtAndWait()
* @method unknown mouseMove()
* @method unknown mouseMoveAndWait()
* @method unknown mouseMoveAt()
* @method unknown mouseMoveAtAndWait()
* @method unknown mouseOut()
* @method unknown mouseOutAndWait()
* @method unknown mouseOver()
* @method unknown mouseOverAndWait()
* @method unknown mouseUp()
* @method unknown mouseUpAndWait()
* @method unknown mouseUpAt()
* @method unknown mouseUpAtAndWait()
* @method unknown mouseUpRight()
* @method unknown mouseUpRightAndWait()
* @method unknown mouseUpRightAt()
* @method unknown mouseUpRightAtAndWait()
* @method unknown open()
* @method unknown openWindow()
* @method unknown openWindowAndWait()
* @method unknown pause()
* @method unknown refresh()
* @method unknown refreshAndWait()
* @method unknown removeAllSelections()
* @method unknown removeAllSelectionsAndWait()
* @method unknown removeScript()
* @method unknown removeScriptAndWait()
* @method unknown removeSelection()
* @method unknown removeSelectionAndWait()
* @method unknown retrieveLastRemoteControlLogs()
* @method unknown rollup()
* @method unknown rollupAndWait()
* @method unknown runScript()
* @method unknown runScriptAndWait()
* @method unknown select()
* @method unknown selectAndWait()
* @method unknown selectFrame()
* @method unknown selectPopUp()
* @method unknown selectPopUpAndWait()
* @method unknown selectWindow()
* @method unknown setBrowserLogLevel()
* @method unknown setBrowserLogLevelAndWait()
* @method unknown setContext()
* @method unknown setCursorPosition()
* @method unknown setCursorPositionAndWait()
* @method unknown setMouseSpeed()
* @method unknown setMouseSpeedAndWait()
* @method unknown setSpeed()
* @method unknown setSpeedAndWait()
* @method unknown shiftKeyDown()
* @method unknown shiftKeyDownAndWait()
* @method unknown shiftKeyUp()
* @method unknown shiftKeyUpAndWait()
* @method unknown shutDownSeleniumServer()
* @method unknown store()
* @method unknown submit()
* @method unknown submitAndWait()
* @method unknown type()
* @method unknown typeAndWait()
* @method unknown typeKeys()
* @method unknown typeKeysAndWait()
* @method unknown uncheck()
* @method unknown uncheckAndWait()
* @method unknown useXpathLibrary()
* @method unknown useXpathLibraryAndWait()
* @method unknown waitForCondition()
* @method unknown waitForPageToLoad()
* @method unknown waitForPopUp()
* @method unknown windowFocus()
* @method unknown windowMaximize()
*/
public function __call($command, $arguments)
{
$arguments = $this->preprocessParameters($arguments);
$wait = FALSE;
if (substr($command, -7, 7) == 'AndWait') {
$command = substr($command, 0, -7);
$wait = TRUE;
}
switch ($command) {
case 'addLocationStrategy':
case 'addScript':
case 'addSelection':
case 'allowNativeXpath':
case 'altKeyDown':
case 'altKeyUp':
case 'answerOnNextPrompt':
case 'assignId':
case 'attachFile':
case 'break':
case 'captureEntirePageScreenshot':
case 'captureScreenshot':
case 'check':
case 'chooseCancelOnNextConfirmation':
case 'chooseOkOnNextConfirmation':
case 'click':
case 'clickAt':
case 'close':
case 'contextMenu':
case 'contextMenuAt':
case 'controlKeyDown':
case 'controlKeyUp':
case 'createCookie':
case 'deleteAllVisibleCookies':
case 'deleteCookie':
case 'deselectPopUp':
case 'doubleClick':
case 'doubleClickAt':
case 'dragAndDrop':
case 'dragAndDropToObject':
case 'dragDrop':
case 'echo':
case 'fireEvent':
case 'focus':
case 'goBack':
case 'highlight':
case 'ignoreAttributesWithoutValue':
case 'keyDown':
case 'keyDownNative':
case 'keyPress':
case 'keyPressNative':
case 'keyUp':
case 'keyUpNative':
case 'metaKeyDown':
case 'metaKeyUp':
case 'mouseDown':
case 'mouseDownAt':
case 'mouseMove':
case 'mouseMoveAt':
case 'mouseOut':
case 'mouseOver':
case 'mouseUp':
case 'mouseUpAt':
case 'mouseUpRight':
case 'mouseUpRightAt':
case 'open':
case 'openWindow':
case 'pause':
case 'refresh':
case 'removeAllSelections':
case 'removeScript':
case 'removeSelection':
case 'retrieveLastRemoteControlLogs':
case 'rollup':
case 'runScript':
case 'select':
case 'selectFrame':
case 'selectPopUp':
case 'selectWindow':
case 'setBrowserLogLevel':
case 'setContext':
case 'setCursorPosition':
case 'setMouseSpeed':
case 'setSpeed':
case 'shiftKeyDown':
case 'shiftKeyUp':
case 'shutDownSeleniumServer':
case 'store':
case 'submit':
case 'type':
case 'typeKeys':
case 'uncheck':
case 'useXpathLibrary':
case 'windowFocus':
case 'windowMaximize':
case isset(self::$autoGeneratedCommands[$command]): {
// Pre-Command Actions
switch ($command) {
case 'open':
case 'openWindow': {
if ($this->collectCodeCoverageInformation) {
$this->deleteCookie('PHPUNIT_SELENIUM_TEST_ID', 'path=/');
$this->createCookie(
'PHPUNIT_SELENIUM_TEST_ID=' . $this->testId,
'path=/'
);
}
}
break;
case 'store':
// store is a synonym of storeExpression
// and RC only understands storeExpression
$command = 'storeExpression';
break;
}
if (isset(self::$autoGeneratedCommands[$command]) && self::$autoGeneratedCommands[$command]['functionHelper']) {
$helperArguments = array($command, $arguments, self::$autoGeneratedCommands[$command]);
call_user_func_array(array($this, self::$autoGeneratedCommands[$command]['functionHelper']), $helperArguments);
} else {
$this->doCommand($command, $arguments);
}
// Post-Command Actions
switch ($command) {
case 'addLocationStrategy':
case 'allowNativeXpath':
case 'assignId':
case 'captureEntirePageScreenshot':
case 'captureScreenshot': {
// intentionally empty
}
break;
default: {
if ($wait) {
if ($this->useWaitForPageToLoad) {
$this->waitForPageToLoad($this->seleniumTimeout * 1000);
} else {
sleep($this->wait);
}
}
if ($this->sleep > 0) {
sleep($this->sleep);
}
$this->testCase->runDefaultAssertions($command);
}
}
}
break;
case 'getWhetherThisFrameMatchFrameExpression':
case 'getWhetherThisWindowMatchWindowExpression':
case 'isAlertPresent':
case 'isChecked':
case 'isConfirmationPresent':
case 'isCookiePresent':
case 'isEditable':
case 'isElementPresent':
case 'isOrdered':
case 'isPromptPresent':
case 'isSomethingSelected':
case 'isTextPresent':
case 'isVisible': {
return $this->getBoolean($command, $arguments);
}
break;
case 'getCssCount':
case 'getCursorPosition':
case 'getElementHeight':
case 'getElementIndex':
case 'getElementPositionLeft':
case 'getElementPositionTop':
case 'getElementWidth':
case 'getMouseSpeed':
case 'getSpeed':
case 'getXpathCount': {
$result = $this->getNumber($command, $arguments);
if ($wait) {
$this->waitForPageToLoad($this->seleniumTimeout * 1000);
}
return $result;
}
break;
case 'getAlert':
case 'getAttribute':
case 'getBodyText':
case 'getConfirmation':
case 'getCookie':
case 'getCookieByName':
case 'getEval':
case 'getExpression':
case 'getHtmlSource':
case 'getLocation':
case 'getLogMessages':
case 'getPrompt':
case 'getSelectedId':
case 'getSelectedIndex':
case 'getSelectedLabel':
case 'getSelectedValue':
case 'getTable':
case 'getText':
case 'getTitle':
case 'captureEntirePageScreenshotToString':
case 'captureScreenshotToString':
case 'getValue': {
$result = $this->getString($command, $arguments);
if ($wait) {
$this->waitForPageToLoad($this->seleniumTimeout * 1000);
}
return $result;
}
break;
case 'getAllButtons':
case 'getAllFields':
case 'getAllLinks':
case 'getAllWindowIds':
case 'getAllWindowNames':
case 'getAllWindowTitles':
case 'getAttributeFromAllWindows':
case 'getSelectedIds':
case 'getSelectedIndexes':
case 'getSelectedLabels':
case 'getSelectedValues':
case 'getSelectOptions': {
$result = $this->getStringArray($command, $arguments);
if ($wait) {
$this->waitForPageToLoad($this->seleniumTimeout * 1000);
}
return $result;
}
break;
case 'waitForCondition':
case 'waitForFrameToLoad':
case 'waitForPopUp': {
if (count($arguments) == 1) {
$arguments[] = $this->seleniumTimeout * 1000;
}
$this->doCommand($command, $arguments);
$this->testCase->runDefaultAssertions($command);
}
break;
case 'waitForPageToLoad': {
if (empty($arguments)) {
$arguments[] = $this->seleniumTimeout * 1000;
}
$this->doCommand($command, $arguments);
$this->testCase->runDefaultAssertions($command);
}
break;
default: {
if (!in_array($command, $this->userCommands)) {
throw new BadMethodCallException(
"Method $command not defined."
);
}
$this->doCommand($command, $arguments);
}
}
}
/**
* Send a command to the Selenium RC server.
*
* @param string $command
* @param array $arguments
* @return string
* @author Seth Casana
*/
protected function doCommand($command, array $arguments = array())
{
$url = sprintf(
'http://%s:%s/selenium-server/driver/',
$this->host,
$this->port
);
$numArguments = count($arguments);
$postData = sprintf('cmd=%s', urlencode($command));
for ($i = 0; $i < $numArguments; $i++) {
$argNum = strval($i + 1);
if ($arguments[$i] == ' ') {
$postData .= sprintf('&%s=%s', $argNum, urlencode($arguments[$i]));
} else {
$postData .= sprintf('&%s=%s', $argNum, urlencode(trim($arguments[$i])));
}
}
if (isset($this->sessionId)) {
$postData .= sprintf('&%s=%s', 'sessionId', $this->sessionId);
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
$response = curl_exec($curl);
$info = curl_getinfo($curl);
if (!$response) {
throw new RuntimeException("CURL error while accessing the Selenium Server at '$url': " . curl_error($curl));
}
curl_close($curl);
if (!preg_match('/^OK/', $response)) {
throw new RuntimeException("Invalid response while accessing the Selenium Server at '$url': " . $response);
}
if ($info['http_code'] != 200) {
throw new RuntimeException(
'The response from the Selenium RC server is invalid: ' .
$response
);
}
return $response;
}
protected function preprocessParameters($params)
{
foreach ($params as $key => $param ) {
if (is_string($param) && (strlen($param) > 0)) {
$params[$key] = $this->getString('getExpression', array($param));
}
}
return $params;
}
/**
* Send a command to the Selenium RC server and treat the result
* as a boolean.
*
* @param string $command
* @param array $arguments
* @return boolean
* @author Shin Ohno
* @author Bjoern Schotte
*/
protected function getBoolean($command, array $arguments)
{
$result = $this->getString($command, $arguments);
switch ($result) {
case 'true': return TRUE;
case 'false': return FALSE;
default: {
throw new PHPUnit_Framework_Exception(
'Result is neither "true" nor "false": ' . PHPUnit_Util_Type::export($result)
);
}
}
}
/**
* Send a command to the Selenium RC server and treat the result
* as a number.
*
* @param string $command
* @param array $arguments
* @return numeric
* @author Shin Ohno
* @author Bjoern Schotte
*/
protected function getNumber($command, array $arguments)
{
$result = $this->getString($command, $arguments);
if (!is_numeric($result)) {
throw new PHPUnit_Framework_Exception(
'Result is not numeric: ' . PHPUnit_Util_Type::export($result)
);
}
return $result;
}
/**
* Send a command to the Selenium RC server and treat the result
* as a string.
*
* @param string $command
* @param array $arguments
* @return string
* @author Shin Ohno
* @author Bjoern Schotte
*/
protected function getString($command, array $arguments)
{
try {
$result = $this->doCommand($command, $arguments);
}
catch (RuntimeException $e) {
throw $e;
}
return (strlen($result) > 3) ? substr($result, 3) : '';
}
/**
* Send a command to the Selenium RC server and treat the result
* as an array of strings.
*
* @param string $command
* @param array $arguments
* @return array
* @author Shin Ohno
* @author Bjoern Schotte
*/
protected function getStringArray($command, array $arguments)
{
$csv = $this->getString($command, $arguments);
$token = '';
$tokens = array();
$letters = preg_split('//', $csv, -1, PREG_SPLIT_NO_EMPTY);
$count = count($letters);
for ($i = 0; $i < $count; $i++) {
$letter = $letters[$i];
switch($letter) {
case '\\': {
$letter = $letters[++$i];
$token .= $letter;
}
break;
case ',': {
$tokens[] = $token;
$token = '';
}
break;
default: {
$token .= $letter;
}
}
}
$tokens[] = $token;
return $tokens;
}
public function getVerificationErrors()
{
return $this->verificationErrors;
}
public function clearVerificationErrors()
{
$this->verificationErrors = array();
}
protected function assertCommand($command, $arguments, $info)
{
$method = $info['originalMethod'];
$requiresTarget = $info['requiresTarget'];
$result = $this->__call($method, $arguments);
if ($info['isBoolean']) {
if (!isset($info['negative']) || !$info['negative']) {
PHPUnit_Framework_Assert::assertTrue(
$result, $arguments[count($arguments) - 1]
);
} else {
PHPUnit_Framework_Assert::assertFalse(
$result, $arguments[count($arguments) - 1]
);
}
} else {
if ($requiresTarget === TRUE) {
$expected = $arguments[1];
} else {
$expected = $arguments[0];
}
if (strpos($expected, 'exact:') === 0) {
$expected = substr($expected, strlen('exact:'));
if (!isset($info['negative']) || !$info['negative']) {
PHPUnit_Framework_Assert::assertEquals($expected, $result);
} else {
PHPUnit_Framework_Assert::assertNotEquals($expected, $result);
}
} else {
$caseInsensitive = FALSE;
if (strpos($expected, 'regexp:') === 0) {
$expected = substr($expected, strlen('regexp:'));
}
else if (strpos($expected, 'regexpi:') === 0) {
$expected = substr($expected, strlen('regexpi:'));
$caseInsensitive = TRUE;
}
else {
if (strpos($expected, 'glob:') === 0) {
$expected = substr($expected, strlen('glob:'));
}
$expected = str_replace(
array('*', '?'), array('.*', '.?'), $expected
);
}
$expected = '/' . str_replace('/', '\/', $expected) . '/';
if ($caseInsensitive) {
$expected .= 'i';
}
if (!isset($info['negative']) || !$info['negative']) {
PHPUnit_Framework_Assert::assertRegExp(
$expected, $result
);
} else {
PHPUnit_Framework_Assert::assertNotRegExp(
$expected, $result
);
}
}
}
}
protected function verifyCommand($command, $arguments, $info)
{
try {
$this->assertCommand($command, $arguments, $info);
}
catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
}
protected function waitForCommand($command, $arguments, $info)
{
for ($second = 0; ; $second++) {
if ($second > $this->httpTimeout) {
PHPUnit_Framework_Assert::fail('timeout');
}
try {
$this->assertCommand($command, $arguments, $info);
return;
}
catch (Exception $e) {
}
sleep(1);
}
}
/**
* Parses the docblock of PHPUnit_Extensions_SeleniumTestCase_Driver::__call
* for get*(), is*(), assert*(), verify*(), assertNot*(), verifyNot*(),
* store*(), waitFor*(), and waitForNot*() methods.
*/
protected static function autoGenerateCommands()
{
$method = new ReflectionMethod(__CLASS__, '__call');
$docComment = $method->getDocComment();
if (preg_match_all('(@method\s+(\w+)\s+([\w]+)\((.*)\))', $docComment, $matches)) {
foreach ($matches[2] as $methodKey => $method) {
if (preg_match('/^(get|is)([A-Z].+)$/', $method, $methodMatches)) {
$baseName = $methodMatches[2];
$isBoolean = $methodMatches[1] == 'is';
$requiresTarget = (strlen($matches[3][$methodKey]) > 0);
if (preg_match('/^(.*)Present$/', $baseName, $methodMatches)) {
$notBaseName = $methodMatches[1] . 'NotPresent';
} else {
$notBaseName = 'Not' . $baseName;
}
self::$autoGeneratedCommands['store' . $baseName] = array(
'functionHelper' => FALSE
);
self::$autoGeneratedCommands['assert' . $baseName] = array(
'originalMethod' => $method,
'isBoolean' => $isBoolean,
'functionHelper' => 'assertCommand',
'requiresTarget' => $requiresTarget
);
self::$autoGeneratedCommands['assert' . $notBaseName] = array(
'originalMethod' => $method,
'isBoolean' => $isBoolean,
'negative' => TRUE,
'functionHelper' => 'assertCommand',
'requiresTarget' => $requiresTarget
);
self::$autoGeneratedCommands['verify' . $baseName] = array(
'originalMethod' => $method,
'isBoolean' => $isBoolean,
'functionHelper' => 'verifyCommand',
'requiresTarget' => $requiresTarget
);
self::$autoGeneratedCommands['verify' . $notBaseName] = array(
'originalMethod' => $method,
'isBoolean' => $isBoolean,
'negative' => TRUE,
'functionHelper' => 'verifyCommand',
'requiresTarget' => $requiresTarget
);
self::$autoGeneratedCommands['waitFor' . $baseName] = array(
'originalMethod' => $method,
'isBoolean' => $isBoolean,
'functionHelper' => 'waitForCommand',
'requiresTarget' => $requiresTarget
);
self::$autoGeneratedCommands['waitFor' . $notBaseName] = array(
'originalMethod' => $method,
'isBoolean' => $isBoolean,
'negative' => TRUE,
'functionHelper' => 'waitForCommand',
'requiresTarget' => $requiresTarget
);
}
}
}
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestCase/append.php 0000664 0000764 0000764 00000005427 11735520166 023315 0 ustar sb sb .
* 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 Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.0.0
*/
if ( isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) &&
!isset($_GET['PHPUNIT_SELENIUM_TEST_ID']) &&
extension_loaded('xdebug')) {
$GLOBALS['PHPUNIT_FILTERED_FILES'][] = __FILE__;
$data = xdebug_get_code_coverage();
xdebug_stop_code_coverage();
foreach ($GLOBALS['PHPUNIT_FILTERED_FILES'] as $file) {
unset($data[$file]);
}
if (is_string($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']) &&
is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
$file = $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] .
DIRECTORY_SEPARATOR . md5($_SERVER['SCRIPT_FILENAME']);
} else {
$file = $_SERVER['SCRIPT_FILENAME'];
}
file_put_contents(
$name = $file . '.' . md5(uniqid(rand(), TRUE)) . '.' . $_COOKIE['PHPUNIT_SELENIUM_TEST_ID'],
serialize($data)
);
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php 0000664 0000764 0000764 00000006647 11735520166 025415 0 ustar sb sb .
* 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 Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.0.0
*/
require_once 'File/Iterator/Autoload.php';
require_once 'PHP/CodeCoverage/Autoload.php';
// Set this to the directory that contains the code coverage files.
// It defaults to getcwd(). If you have configured a different directory
// in prepend.php, you need to configure the same directory here.
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = getcwd();
if (isset($_GET['PHPUNIT_SELENIUM_TEST_ID'])) {
$facade = new File_Iterator_Facade;
$files = $facade->getFilesAsArray(
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'],
$_GET['PHPUNIT_SELENIUM_TEST_ID']
);
$coverage = array();
foreach ($files as $file) {
$data = unserialize(file_get_contents($file));
unlink($file);
unset($file);
$filter = new PHP_CodeCoverage_Filter();
foreach ($data as $file => $lines) {
if ($filter->isFile($file)) {
if (!isset($coverage[$file])) {
$coverage[$file] = array(
'md5' => md5_file($file), 'coverage' => $lines
);
} else {
foreach ($lines as $line => $flag) {
if (!isset($coverage[$file]['coverage'][$line]) ||
$flag > $coverage[$file]['coverage'][$line]) {
$coverage[$file]['coverage'][$line] = $flag;
}
}
}
}
}
}
print serialize($coverage);
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestCase/prepend.php 0000664 0000764 0000764 00000005354 11735520166 023502 0 ustar sb sb .
* 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 Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.0.0
*/
// By default the code coverage files are written to the same directory
// that contains the covered sourcecode files. Use this setting to change
// the default behaviour and set a specific directory to write the files to.
// If you change the default setting, please make sure to also configure
// the same directory in phpunit_coverage.php. Also note that the webserver
// needs write access to the directory.
if (!isset($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = FALSE;
}
if ( isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) &&
!isset($_GET['PHPUNIT_SELENIUM_TEST_ID']) &&
extension_loaded('xdebug')) {
$GLOBALS['PHPUNIT_FILTERED_FILES'] = array(__FILE__);
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/Selenium2TestCase.php 0000664 0000764 0000764 00000020141 11735520166 022116 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.0
*/
/**
* TestCase class that uses Selenium 2
* (WebDriver API and JsonWire protocol) to provide
* the functionality required for web testing.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
* @method void acceptAlert() Press OK on an alert, or confirms a dialog
* @method mixed alertText($value = NULL) Gets the alert dialog text, or sets the text for a prompt dialog
* @method void back()
* @method \PHPUnit_Extensions_Selenium2TestCase_Element byCssSelector($value)
* @method \PHPUnit_Extensions_Selenium2TestCase_Element byClassName($vaue)
* @method \PHPUnit_Extensions_Selenium2TestCase_Element byId($value)
* @method \PHPUnit_Extensions_Selenium2TestCase_Element byName($value)
* @method \PHPUnit_Extensions_Selenium2TestCase_Element byXPath($value)
* @method void clickOnElement($id)
* @method string currentScreenshot() BLOB of the image file
* @method void dismissAlert() Press Cancel on an alert, or does not confirm a dialog
* @method \PHPUnit_Extensions_Selenium2TestCase_Element element(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria) Retrieves an element
* @method array elements(\PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $criteria) Retrieves an array of Element instances
* @method string execute($javaScriptCode) Injects arbitrary JavaScript in the page and returns the last
* @method string executeAsync($javaScriptCode) Injects arbitrary JavaScript and wait for the callback (last element of arguments) to be called
* @method void forward()
* @method void frame($elementId) Changes the focus to a frame in the page
* @method void refresh()
* @method \PHPUnit_Extensions_Selenium2TestCase_Element_Select select($element)
* @method string source() Returns the HTML source of the page
* @method \PHPUnit_Extensions_Selenium2TestCase_Session_Timeouts timeouts()
* @method string title()
* @method void|string url($url = NULL)
* @method PHPUnit_Extensions_Selenium2TestCase_ElementCriteria using($strategy) Factory Method for Criteria objects
* @method void window($name) Changes the focus to another window
* @method string windowHandle() Retrieves the current window handle
* @method string windowHandles() Retrieves a list of all available window handles
*/
abstract class PHPUnit_Extensions_Selenium2TestCase extends PHPUnit_Framework_TestCase
{
/**
* @var PHPUnit_Extensions_Selenium2TestCase_Session
*/
private $session;
/**
* @var string
*/
private $host = 'localhost';
/**
* @var int
*/
private $port = 4444;
/**
* @var string
*/
private $browser;
/**
* @var PHPUnit_Extensions_Selenium2TestCase_URL
*/
private $browserUrl;
/**
* @var PHPUnit_Extensions_Selenium2TestCase_SessionStrategy
*/
private static $sessionStrategy;
/**
* @param boolean
*/
public static function shareSession($shareSession)
{
if (!is_bool($shareSession)) {
throw new InvalidArgumentException("The shared session support can only be switched on or off.");
}
if (!$shareSession) {
self::$sessionStrategy = self::defaultSessionStrategy();
} else {
self::$sessionStrategy = new PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Shared(self::defaultSessionStrategy());
}
}
private static function sessionStrategy()
{
if (!self::$sessionStrategy) {
self::$sessionStrategy = self::defaultSessionStrategy();
}
return self::$sessionStrategy;
}
private static function defaultSessionStrategy()
{
return new PHPUnit_Extensions_Selenium2TestCase_SessionStrategy_Isolated;
}
/**
* @throws RuntimeException
*/
protected function runTest()
{
$this->session = self::sessionStrategy()->session(array(
'host' => $this->host,
'port' => $this->port,
'browser' => $this->browser,
'browserUrl' => $this->browserUrl
));
parent::runTest();
if (!empty($this->verificationErrors)) {
$this->fail(implode("\n", $this->verificationErrors));
}
self::sessionStrategy()->endOfTest($this->session);
}
public function onNotSuccessfulTest(Exception $e)
{
self::sessionStrategy()->notSuccessfulTest();
parent::onNotSuccessfulTest($e);
}
/**
* Delegate method calls to the Session.
*
* @param string $command
* @param array $arguments
* @return mixed
*/
public function __call($command, $arguments)
{
$result = call_user_func_array(
array($this->session, $command), $arguments
);
return $result;
}
/**
* @param string $host
* @throws InvalidArgumentException
*/
public function setHost($host)
{
if (!is_string($host)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->host = $host;
}
/**
* @param integer $port
* @throws InvalidArgumentException
*/
public function setPort($port)
{
if (!is_int($port)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'integer');
}
$this->port = $port;
}
/**
* @param string $browser
* @throws InvalidArgumentException
*/
public function setBrowser($browser)
{
if (!is_string($browser)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->browser = $browser;
}
/**
* @param string $browserUrl
* @throws InvalidArgumentException
*/
public function setBrowserUrl($browserUrl)
{
if (!is_string($browserUrl)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
$this->browserUrl = new PHPUnit_Extensions_Selenium2TestCase_URL($browserUrl);
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumBrowserSuite.php 0000664 0000764 0000764 00000006777 11735520166 023001 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.6
*/
/**
* TestSuite class for a set of tests from a single Testcase Class
* executed with a particular browser.
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.6
*/
class PHPUnit_Extensions_SeleniumBrowserSuite extends PHPUnit_Framework_TestSuite
{
/**
* Overriding the default: Selenium suites are always built from a TestCase class.
* @var boolean
*/
protected $testCase = TRUE;
public function addTestMethod(ReflectionClass $class, ReflectionMethod $method)
{
return parent::addTestMethod($class, $method);
}
public static function fromClassAndBrowser($className, array $browser)
{
$browserSuite = new self();
$browserSuite->setName($className . ': ' . $browser['name']);
return $browserSuite;
}
public function setupSpecificBrowser(array $browser)
{
$this->browserOnAllTests($this, $browser);
}
private function browserOnAllTests(PHPUnit_Framework_TestSuite $suite, array $browser)
{
foreach ($suite->tests() as $test) {
if ($test instanceof PHPUnit_Framework_TestSuite) {
$this->browserOnAllTests($test, $browser);
} else {
$test->setupSpecificBrowser($browser);
}
}
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestCase.php 0000664 0000764 0000764 00000075314 11735520166 022050 0 ustar sb sb .
* 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 Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.0.0
*/
/**
* TestCase class that uses Selenium to provide
* the functionality required for web testing.
*
* @package PHPUnit_Selenium
* @author Sebastian Bergmann
* @copyright 2010-2012 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.0.0
*
* @method unknown addLocationStrategy()
* @method unknown addLocationStrategyAndWait()
* @method unknown addScript()
* @method unknown addScriptAndWait()
* @method unknown addSelection()
* @method unknown addSelectionAndWait()
* @method unknown allowNativeXpath()
* @method unknown allowNativeXpathAndWait()
* @method unknown altKeyDown()
* @method unknown altKeyDownAndWait()
* @method unknown altKeyUp()
* @method unknown altKeyUpAndWait()
* @method unknown answerOnNextPrompt()
* @method unknown assignId()
* @method unknown assignIdAndWait()
* @method unknown attachFile()
* @method unknown break()
* @method unknown captureEntirePageScreenshot()
* @method unknown captureEntirePageScreenshotAndWait()
* @method unknown captureEntirePageScreenshotToStringAndWait()
* @method unknown captureScreenshotAndWait()
* @method unknown captureScreenshotToStringAndWait()
* @method unknown check()
* @method unknown checkAndWait()
* @method unknown chooseCancelOnNextConfirmation()
* @method unknown chooseCancelOnNextConfirmationAndWait()
* @method unknown chooseOkOnNextConfirmation()
* @method unknown chooseOkOnNextConfirmationAndWait()
* @method unknown click()
* @method unknown clickAndWait()
* @method unknown clickAt()
* @method unknown clickAtAndWait()
* @method unknown close()
* @method unknown contextMenu()
* @method unknown contextMenuAndWait()
* @method unknown contextMenuAt()
* @method unknown contextMenuAtAndWait()
* @method unknown controlKeyDown()
* @method unknown controlKeyDownAndWait()
* @method unknown controlKeyUp()
* @method unknown controlKeyUpAndWait()
* @method unknown createCookie()
* @method unknown createCookieAndWait()
* @method unknown deleteAllVisibleCookies()
* @method unknown deleteAllVisibleCookiesAndWait()
* @method unknown deleteCookie()
* @method unknown deleteCookieAndWait()
* @method unknown deselectPopUp()
* @method unknown deselectPopUpAndWait()
* @method unknown doubleClick()
* @method unknown doubleClickAndWait()
* @method unknown doubleClickAt()
* @method unknown doubleClickAtAndWait()
* @method unknown dragAndDrop()
* @method unknown dragAndDropAndWait()
* @method unknown dragAndDropToObject()
* @method unknown dragAndDropToObjectAndWait()
* @method unknown dragDrop()
* @method unknown dragDropAndWait()
* @method unknown echo()
* @method unknown fireEvent()
* @method unknown fireEventAndWait()
* @method unknown focus()
* @method unknown focusAndWait()
* @method string getAlert()
* @method array getAllButtons()
* @method array getAllFields()
* @method array getAllLinks()
* @method array getAllWindowIds()
* @method array getAllWindowNames()
* @method array getAllWindowTitles()
* @method string getAttribute()
* @method array getAttributeFromAllWindows()
* @method string getBodyText()
* @method string getConfirmation()
* @method string getCookie()
* @method string getCookieByName()
* @method integer getCursorPosition()
* @method integer getElementHeight()
* @method integer getElementIndex()
* @method integer getElementPositionLeft()
* @method integer getElementPositionTop()
* @method integer getElementWidth()
* @method string getEval()
* @method string getExpression()
* @method string getHtmlSource()
* @method string getLocation()
* @method string getLogMessages()
* @method integer getMouseSpeed()
* @method string getPrompt()
* @method array getSelectOptions()
* @method string getSelectedId()
* @method array getSelectedIds()
* @method string getSelectedIndex()
* @method array getSelectedIndexes()
* @method string getSelectedLabel()
* @method array getSelectedLabels()
* @method string getSelectedValue()
* @method array getSelectedValues()
* @method unknown getSpeed()
* @method unknown getSpeedAndWait()
* @method string getTable()
* @method string getText()
* @method string getTitle()
* @method string getValue()
* @method boolean getWhetherThisFrameMatchFrameExpression()
* @method boolean getWhetherThisWindowMatchWindowExpression()
* @method integer getXpathCount()
* @method unknown goBack()
* @method unknown goBackAndWait()
* @method unknown highlight()
* @method unknown highlightAndWait()
* @method unknown ignoreAttributesWithoutValue()
* @method unknown ignoreAttributesWithoutValueAndWait()
* @method boolean isAlertPresent()
* @method boolean isChecked()
* @method boolean isConfirmationPresent()
* @method boolean isCookiePresent()
* @method boolean isEditable()
* @method boolean isElementPresent()
* @method boolean isOrdered()
* @method boolean isPromptPresent()
* @method boolean isSomethingSelected()
* @method boolean isTextPresent()
* @method boolean isVisible()
* @method unknown keyDown()
* @method unknown keyDownAndWait()
* @method unknown keyDownNative()
* @method unknown keyDownNativeAndWait()
* @method unknown keyPress()
* @method unknown keyPressAndWait()
* @method unknown keyPressNative()
* @method unknown keyPressNativeAndWait()
* @method unknown keyUp()
* @method unknown keyUpAndWait()
* @method unknown keyUpNative()
* @method unknown keyUpNativeAndWait()
* @method unknown metaKeyDown()
* @method unknown metaKeyDownAndWait()
* @method unknown metaKeyUp()
* @method unknown metaKeyUpAndWait()
* @method unknown mouseDown()
* @method unknown mouseDownAndWait()
* @method unknown mouseDownAt()
* @method unknown mouseDownAtAndWait()
* @method unknown mouseMove()
* @method unknown mouseMoveAndWait()
* @method unknown mouseMoveAt()
* @method unknown mouseMoveAtAndWait()
* @method unknown mouseOut()
* @method unknown mouseOutAndWait()
* @method unknown mouseOver()
* @method unknown mouseOverAndWait()
* @method unknown mouseUp()
* @method unknown mouseUpAndWait()
* @method unknown mouseUpAt()
* @method unknown mouseUpAtAndWait()
* @method unknown mouseUpRight()
* @method unknown mouseUpRightAndWait()
* @method unknown mouseUpRightAt()
* @method unknown mouseUpRightAtAndWait()
* @method unknown open()
* @method unknown openWindow()
* @method unknown openWindowAndWait()
* @method unknown pause()
* @method unknown refresh()
* @method unknown refreshAndWait()
* @method unknown removeAllSelections()
* @method unknown removeAllSelectionsAndWait()
* @method unknown removeScript()
* @method unknown removeScriptAndWait()
* @method unknown removeSelection()
* @method unknown removeSelectionAndWait()
* @method unknown retrieveLastRemoteControlLogs()
* @method unknown rollup()
* @method unknown rollupAndWait()
* @method unknown runScript()
* @method unknown runScriptAndWait()
* @method unknown select()
* @method unknown selectAndWait()
* @method unknown selectFrame()
* @method unknown selectPopUp()
* @method unknown selectPopUpAndWait()
* @method unknown selectWindow()
* @method unknown setBrowserLogLevel()
* @method unknown setBrowserLogLevelAndWait()
* @method unknown setContext()
* @method unknown setCursorPosition()
* @method unknown setCursorPositionAndWait()
* @method unknown setMouseSpeed()
* @method unknown setMouseSpeedAndWait()
* @method unknown setSpeed()
* @method unknown setSpeedAndWait()
* @method unknown shiftKeyDown()
* @method unknown shiftKeyDownAndWait()
* @method unknown shiftKeyUp()
* @method unknown shiftKeyUpAndWait()
* @method unknown shutDownSeleniumServer()
* @method unknown store()
* @method unknown submit()
* @method unknown submitAndWait()
* @method unknown type()
* @method unknown typeAndWait()
* @method unknown typeKeys()
* @method unknown typeKeysAndWait()
* @method unknown uncheck()
* @method unknown uncheckAndWait()
* @method unknown useXpathLibrary()
* @method unknown useXpathLibraryAndWait()
* @method unknown waitForCondition()
* @method unknown waitForPageToLoad()
* @method unknown waitForPopUp()
* @method unknown windowFocus()
* @method unknown windowMaximize()
*/
abstract class PHPUnit_Extensions_SeleniumTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var array
*/
public static $browsers = array();
/**
* @var string
*/
protected $browserName;
/**
* @var boolean
*/
protected $collectCodeCoverageInformation = FALSE;
/**
* @var string
*/
protected $coverageScriptUrl = '';
/**
* @var PHPUnit_Extensions_SeleniumTestCase_Driver[]
*/
protected $drivers = array();
/**
* @var boolean
*/
protected $inDefaultAssertions = FALSE;
/**
* @var string
*/
protected $testId;
/**
* @var array
* @access protected
*/
protected $verificationErrors = array();
/**
* @var boolean
*/
protected $captureScreenshotOnFailure = FALSE;
/**
* @var string
*/
protected $screenshotPath = '';
/**
* @var string
*/
protected $screenshotUrl = '';
/**
* @var integer the number of seconds to wait before declaring
* the Selenium server not reachable
*/
protected $serverConnectionTimeOut = 10;
/**
* @var boolean
*/
private $serverRunning;
/**
* @var boolean
*/
private static $shareSession;
/**
* The last sessionId used for running a test.
* @var string
*/
private static $sessionId;
/**
* @param boolean
*/
public static function shareSession($shareSession)
{
self::$shareSession = $shareSession;
}
/**
* @param string $name
* @param array $data
* @param string $dataName
* @param array $browser
* @throws InvalidArgumentException
*/
public function __construct($name = NULL, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$this->testId = md5(uniqid(rand(), TRUE));
$this->getDriver(array());
}
public function setupSpecificBrowser(array $browser)
{
$this->getDriver($browser);
}
/**
* Stops any shared session still open at the end of the current
* PHPUnit process.
*/
public function __destruct()
{
$this->stopSession();
}
/**
* @param string $className
* @return PHPUnit_Framework_TestSuite
*/
public static function suite($className)
{
return PHPUnit_Extensions_SeleniumTestSuite::fromTestCaseClass($className);
}
/**
* Runs the test case and collects the results in a TestResult object.
* If no TestResult object is passed a new one will be created.
*
* @param PHPUnit_Framework_TestResult $result
* @return PHPUnit_Framework_TestResult
* @throws InvalidArgumentException
*/
public function run(PHPUnit_Framework_TestResult $result = NULL)
{
if ($result === NULL) {
$result = $this->createResult();
}
$this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
foreach ($this->drivers as $driver) {
$driver->setCollectCodeCoverageInformation(
$this->collectCodeCoverageInformation
);
}
parent::run($result);
if ($this->collectCodeCoverageInformation) {
$result->getCodeCoverage()->append(
$this->getCodeCoverage(), $this
);
}
return $result;
}
/**
* @param array $browser
* @return PHPUnit_Extensions_SeleniumTestCase_Driver
*/
protected function getDriver(array $browser)
{
if (isset($browser['name'])) {
if (!is_string($browser['name'])) {
throw new InvalidArgumentException(
'Array element "name" is no string.'
);
}
} else {
$browser['name'] = '';
}
if (isset($browser['browser'])) {
if (!is_string($browser['browser'])) {
throw new InvalidArgumentException(
'Array element "browser" is no string.'
);
}
} else {
$browser['browser'] = '';
}
if (isset($browser['host'])) {
if (!is_string($browser['host'])) {
throw new InvalidArgumentException(
'Array element "host" is no string.'
);
}
} else {
$browser['host'] = 'localhost';
}
if (isset($browser['port'])) {
if (!is_int($browser['port'])) {
throw new InvalidArgumentException(
'Array element "port" is no integer.'
);
}
} else {
$browser['port'] = 4444;
}
if (isset($browser['timeout'])) {
if (!is_int($browser['timeout'])) {
throw new InvalidArgumentException(
'Array element "timeout" is no integer.'
);
}
} else {
$browser['timeout'] = 30;
}
if (isset($browser['httpTimeout'])) {
if (!is_int($browser['httpTimeout'])) {
throw new InvalidArgumentException(
'Array element "httpTimeout" is no integer.'
);
}
} else {
$browser['httpTimeout'] = 45;
}
$driver = new PHPUnit_Extensions_SeleniumTestCase_Driver;
$driver->setName($browser['name']);
$driver->setBrowser($browser['browser']);
$driver->setHost($browser['host']);
$driver->setPort($browser['port']);
$driver->setTimeout($browser['timeout']);
$driver->setHttpTimeout($browser['httpTimeout']);
$driver->setTestCase($this);
$driver->setTestId($this->testId);
$this->drivers[0] = $driver;
return $driver;
}
public function skipWithNoServerRunning()
{
try {
fsockopen($this->drivers[0]->getHost(), $this->drivers[0]->getPort(), $errno, $errstr, $this->serverConnectionTimeOut);
$this->serverRunning = TRUE;
} catch (PHPUnit_Framework_Error_Warning $e) {
$this->markTestSkipped(
sprintf(
'Could not connect to the Selenium Server on %s:%d.',
$this->drivers[0]->getHost(),
$this->drivers[0]->getPort()
)
);
$this->serverRunning = FALSE;
}
}
/**
* @return string
*/
protected function prepareTestSession()
{
$testCaseClassVars = get_class_vars(get_class($this));
if ($testCaseClassVars['browsers']) {
return $this->start();
}
if (self::$shareSession && self::$sessionId !== NULL) {
$this->setSessionId(self::$sessionId);
$this->selectWindow('null');
} else {
self::$sessionId = $this->start();
}
return self::$sessionId;
}
/**
* @throws RuntimeException
*/
protected function runTest()
{
$this->skipWithNoServerRunning();
$this->prepareTestSession();
if (!is_file($this->getName(FALSE))) {
$result = parent::runTest();
} else {
$this->runSelenese($this->getName(FALSE));
}
if (!empty($this->verificationErrors)) {
$this->fail(implode("\n", $this->verificationErrors));
}
if (!self::$shareSession) {
$this->stopSession();
}
return $result;
}
private function stopSession()
{
try {
$this->stop();
} catch (RuntimeException $e) { }
}
/**
* Returns a string representation of the test case.
*
* @return string
*/
public function toString()
{
$buffer = parent::toString();
if (!empty($this->browserName)) {
$buffer .= ' with browser ' . $this->browserName;
}
return $buffer;
}
/**
* Runs a test from a Selenese (HTML) specification.
*
* @param string $filename
*/
public function runSelenese($filename)
{
$document = PHPUnit_Util_XML::loadFile($filename, TRUE);
$xpath = new DOMXPath($document);
$rows = $xpath->query('body/table/tbody/tr');
foreach ($rows as $row) {
$action = NULL;
$arguments = array();
$columns = $xpath->query('td', $row);
foreach ($columns as $column) {
if ($action === NULL) {
$action = PHPUnit_Util_XML::nodeToText($column);
} else {
$arguments[] = PHPUnit_Util_XML::nodeToText($column);
}
}
if (method_exists($this, $action)) {
call_user_func_array(array($this, $action), $arguments);
} else {
$this->__call($action, $arguments);
}
}
}
/**
* Delegate method calls to the driver.
*
* @param string $command
* @param array $arguments
* @return mixed
*/
public function __call($command, $arguments)
{
$result = call_user_func_array(
array($this->drivers[0], $command), $arguments
);
$this->verificationErrors = array_merge(
$this->verificationErrors, $this->drivers[0]->getVerificationErrors()
);
$this->drivers[0]->clearVerificationErrors();
return $result;
}
/**
* Asserts that an element's value is equal to a given string.
*
* @param string $locator
* @param string $text
* @param string $message
*/
public function assertElementValueEquals($locator, $text, $message = '')
{
$this->assertEquals($text, $this->getValue($locator), $message);
}
/**
* Asserts that an element's value is not equal to a given string.
*
* @param string $locator
* @param string $text
* @param string $message
*/
public function assertElementValueNotEquals($locator, $text, $message = '')
{
$this->assertNotEquals($text, $this->getValue($locator), $message);
}
/**
* Asserts that an element's value contains a given string.
*
* @param string $locator
* @param string $text
* @param string $message
*/
public function assertElementValueContains($locator, $text, $message = '')
{
$this->assertContains($text, $this->getValue($locator), $message);
}
/**
* Asserts that an element's value does not contain a given string.
*
* @param string $locator
* @param string $text
* @param string $message
*/
public function assertElementValueNotContains($locator, $text, $message = '')
{
$this->assertNotContains($text, $this->getValue($locator), $message);
}
/**
* Asserts that an element contains a given string.
*
* @param string $locator
* @param string $text
* @param string $message
*/
public function assertElementContainsText($locator, $text, $message = '')
{
$this->assertContains($text, $this->getText($locator), $message);
}
/**
* Asserts that an element does not contain a given string.
*
* @param string $locator
* @param string $text
* @param string $message
*/
public function assertElementNotContainsText($locator, $text, $message = '')
{
$this->assertNotContains($text, $this->getText($locator), $message);
}
/**
* Asserts that a select element has a specific option.
*
* @param string $selectLocator
* @param string $option
* @param string $message
*/
public function assertSelectHasOption($selectLocator, $option, $message = '')
{
$this->assertContains($option, $this->getSelectOptions($selectLocator), $message);
}
/**
* Asserts that a select element does not have a specific option.
*
* @param string $selectLocator
* @param string $option
* @param string $message
*/
public function assertSelectNotHasOption($selectLocator, $option, $message = '')
{
$this->assertNotContains($option, $this->getSelectOptions($selectLocator), $message);
}
/**
* Asserts that a specific label is selected.
*
* @param string $selectLocator
* @param string $value
* @param string $message
*/
public function assertSelected($selectLocator, $option, $message = '')
{
if ($message == '') {
$message = sprintf(
'Label "%s" not selected in "%s".',
$option,
$selectLocator
);
}
$this->assertEquals(
$option,
$this->getSelectedLabel($selectLocator),
$message
);
}
/**
* Asserts that a specific label is not selected.
*
* @param string $selectLocator
* @param string $value
* @param string $message
*/
public function assertNotSelected($selectLocator, $option, $message = '')
{
if ($message == '') {
$message = sprintf(
'Label "%s" selected in "%s".',
$option,
$selectLocator
);
}
$this->assertNotEquals(
$option,
$this->getSelectedLabel($selectLocator),
$message
);
}
/**
* Asserts that a specific value is selected.
*
* @param string $selectLocator
* @param string $value
* @param string $message
*/
public function assertIsSelected($selectLocator, $value, $message = '')
{
if ($message == '') {
$message = sprintf(
'Value "%s" not selected in "%s".',
$value,
$selectLocator
);
}
$this->assertEquals(
$value, $this->getSelectedValue($selectLocator),
$message
);
}
/**
* Asserts that a specific value is not selected.
*
* @param string $selectLocator
* @param string $value
* @param string $message
*/
public function assertIsNotSelected($selectLocator, $value, $message = '')
{
if ($message == '') {
$message = sprintf(
'Value "%s" selected in "%s".',
$value,
$selectLocator
);
}
$this->assertNotEquals(
$value,
$this->getSelectedValue($selectLocator),
$message
);
}
/**
* Template Method that is called after Selenium actions.
*
* @param string $action
*/
protected function defaultAssertions($action)
{
}
/**
* @return array
*/
protected function getCodeCoverage()
{
if (!empty($this->coverageScriptUrl)) {
$url = sprintf(
'%s?PHPUNIT_SELENIUM_TEST_ID=%s',
$this->coverageScriptUrl,
$this->testId
);
$buffer = @file_get_contents($url);
if ($buffer !== FALSE) {
$coverageData = unserialize($buffer);
if (is_array($coverageData)) {
return $this->matchLocalAndRemotePaths($coverageData);
} else {
throw new Exception('Empty or invalid code coverage data received from url "' . $url . '"');
}
}
}
return array();
}
/**
* @param array $coverage
* @return array
* @author Mattis Stordalen Flister
*/
protected function matchLocalAndRemotePaths(array $coverage)
{
$coverageWithLocalPaths = array();
foreach ($coverage as $originalRemotePath => $data) {
$remotePath = $originalRemotePath;
$separator = $this->findDirectorySeparator($remotePath);
while (!($localpath = PHPUnit_Util_Filesystem::fileExistsInIncludePath($remotePath)) &&
strpos($remotePath, $separator) !== FALSE) {
$remotePath = substr($remotePath, strpos($remotePath, $separator) + 1);
}
if ($localpath && md5_file($localpath) == $data['md5']) {
$coverageWithLocalPaths[$localpath] = $data['coverage'];
}
}
return $coverageWithLocalPaths;
}
/**
* @param string $path
* @return string
* @author Mattis Stordalen Flister
*/
protected function findDirectorySeparator($path)
{
if (strpos($path, '/') !== FALSE) {
return '/';
}
return '\\';
}
/**
* @param string $path
* @return array
* @author Mattis Stordalen Flister
*/
protected function explodeDirectories($path)
{
return explode($this->findDirectorySeparator($path), dirname($path));
}
/**
* @param string $directory
* @param string $suffix
* @return array
*/
protected static function getSeleneseFiles($directory, $suffix)
{
$facade = new File_Iterator_Facade;
return $facade->getFilesAsArray($directory, $suffix);
}
/**
* @param string $action
*/
public function runDefaultAssertions($action)
{
if (!$this->inDefaultAssertions) {
$this->inDefaultAssertions = TRUE;
$this->defaultAssertions($action);
$this->inDefaultAssertions = FALSE;
}
}
/**
* This method is called when a test method did not execute successfully.
*
* @param Exception $e
*/
protected function onNotSuccessfulTest(Exception $e)
{
if (!$this->serverRunning) {
throw $e;
}
try {
$this->restoreSessionStateAfterFailedTest();
$buffer = 'Current URL: ' . $this->drivers[0]->getLocation() .
"\n";
if ($this->captureScreenshotOnFailure) {
$screenshotInfo = $this->takeScreenshot();
if ($screenshotInfo != '') {
$buffer .= $screenshotInfo;
}
}
$this->stopSession();
} catch (Exception $another) {
$buffer = "Issues while capturing the screenshot:\n" . $another->getMessage();
}
if ($e instanceof PHPUnit_Framework_ExpectationFailedException
&& is_object($e->getComparisonFailure())) {
$message = $e->getComparisonFailure()->toString();
} else {
$message = $e->getMessage();
}
$buffer .= "\n" . $message;
// gain the screenshot path, lose the stack trace
if ($this->captureScreenshotOnFailure) {
throw new PHPUnit_Framework_Error($buffer, $e->getCode(), $e->getFile(), $e->getLine(), $e->getTrace());
}
// yes to stack trace and everything
if ($e instanceof PHPUnit_Framework_IncompleteTestError
|| $e instanceof PHPUnit_Framework_SkippedTestError
|| $e instanceof PHPUnit_Framework_AssertionFailedError) {
throw $e;
}
// yes to stack trace, only for F tests
// PHPUnit issue 471 prevents getTrace() from being useful
throw new PHPUnit_Framework_Error($buffer, $e->getCode(), $e->getFile(), $e->getLine(), $e->getTrace());
}
private function restoreSessionStateAfterFailedTest()
{
self::$sessionId = NULL;
}
/**
* Returns correct path to screenshot save path.
*
* @return string
*/
protected function getScreenshotPath()
{
$path = $this->screenshotPath;
if (!in_array(substr($path, strlen($path) -1, 1), array("/","\\"))) {
$path .= DIRECTORY_SEPARATOR;
}
return $path;
}
/**
* Take a screenshot and return information about it.
* Return an empty string if the screenshotPath and screenshotUrl
* properties are empty.
* Issue #88.
*
* @access protected
* @return string
*/
protected function takeScreenshot()
{
if (!empty($this->screenshotPath) &&
!empty($this->screenshotUrl)) {
$filename = $this->getScreenshotPath() . $this->testId . '.png';
$this->drivers[0]->captureEntirePageScreenshot($filename);
return 'Screenshot: ' . $this->screenshotUrl . '/' .
$this->testId . ".png\n";
} else {
return '';
}
}
}
PHPUnit_Selenium-1.2.6/PHPUnit/Extensions/SeleniumTestSuite.php 0000664 0000764 0000764 00000013513 11735520166 022257 0 ustar sb sb .
* 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
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://www.phpunit.de/
* @since File available since Release 1.2.2
*/
/**
* TestSuite class for Selenium 1 tests
*
* @package PHPUnit_Selenium
* @author Giorgio Sironi
* @copyright 2010-2011 Sebastian Bergmann
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version Release: 1.2.6
* @link http://www.phpunit.de/
* @since Class available since Release 1.2.0
*/
class PHPUnit_Extensions_SeleniumTestSuite extends PHPUnit_Framework_TestSuite
{
/**
* Overriding the default: Selenium suites are always built from a TestCase class.
* @var boolean
*/
protected $testCase = TRUE;
/**
* Making the method public.
*/
public function addTestMethod(ReflectionClass $class, ReflectionMethod $method)
{
return parent::addTestMethod($class, $method);
}
/**
* @param string $className extending PHPUnit_Extensions_SeleniumTestCase
* @return PHPUnit_Extensions_SeleniumTestSuite
*/
public static function fromTestCaseClass($className)
{
$suite = new self();
$suite->setName($className);
$class = new ReflectionClass($className);
$classGroups = PHPUnit_Util_Test::getGroups($className);
$staticProperties = $class->getStaticProperties();
// Create tests from Selenese/HTML files.
if (isset($staticProperties['seleneseDirectory']) &&
is_dir($staticProperties['seleneseDirectory'])) {
$files = array_merge(
self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.htm'),
self::getSeleneseFiles($staticProperties['seleneseDirectory'], '.html')
);
// Create tests from Selenese/HTML files for multiple browsers.
if (!empty($staticProperties['browsers'])) {
foreach ($staticProperties['browsers'] as $browser) {
$browserSuite = PHPUnit_Extensions_SeleniumBrowserSuite::fromClassAndBrowser($className, $browser);
foreach ($files as $file) {
self::addGeneratedTestTo($browserSuite,
new $className($file, array(), '', $browser),
$classGroups
);
}
$suite->addTest($browserSuite);
}
}
else {
// Create tests from Selenese/HTML files for single browser.
foreach ($files as $file) {
self::addGeneratedTestTo($suite,
new $className($file),
$classGroups);
}
}
}
// Create tests from test methods for multiple browsers.
if (!empty($staticProperties['browsers'])) {
foreach ($staticProperties['browsers'] as $browser) {
$browserSuite = PHPUnit_Extensions_SeleniumBrowserSuite::fromClassAndBrowser($className, $browser);
foreach ($class->getMethods() as $method) {
$browserSuite->addTestMethod($class, $method);
}
$browserSuite->setupSpecificBrowser($browser);
$suite->addTest($browserSuite);
}
}
else {
// Create tests from test methods for single browser.
foreach ($class->getMethods() as $method) {
$suite->addTestMethod($class, $method);
}
}
return $suite;
}
private static function addGeneratedTestTo(PHPUnit_Framework_TestSuite $suite, PHPUnit_Framework_TestCase $test, $classGroups)
{
list ($methodName, ) = explode(' ', $test->getName());
$test->setDependencies(
PHPUnit_Util_Test::getDependencies(get_class($test), $methodName)
);
$suite->addTest($test, $classGroups);
}
}
PHPUnit_Selenium-1.2.6/ChangeLog.markdown 0000664 0000764 0000764 00000006456 11735520166 016070 0 ustar sb sb PHPUnit_Selenium 1.2
====================
This is the list of changes for the PHPUnit_Selenium 1.2 release series.
PHPUnit_Selenium 1.2.6
----------------------
* Fixed #114 and #115: regressions of @depends/@dataProvider.
* Added $this->cookie() for adding and removing cookies via a Builder.
* Added Selenium2TestCase_Exception in the Cookie api.
* Supporting absolute URLs (http://...) in $this->url().
* Supporting uppercase URLs.
* Raising error message for stale elements reference (#117).
* No 500 errors when communicating with Selenium Server.
* Supporting Selenium 2.20.
* Tests for 404 pages.
* Supporting @depends/@dataProvider and similar annotations in SeleniumTestCase.
* Added getCssCount() in SeleniumTestCase.
PHPUnit_Selenium 1.2.5
----------------------
* Added Window object accessible via $this->currentWindow().
* Implemented $this->timeouts()->asyncScript().
* Fixed #105: $browsers static property.
PHPUnit_Selenium 1.2.4
----------------------
* Implemented $element->size().
* Implemented $element->location().
* Implemented $element->name(), $element->attribute(), $element->equals(), $element->enabled(), $element->displayed(), $element->css().
* Implemented $this->elements() for multiple element selection in the whole page.
* Implemented $this->frame() to switch focus between frames on a page.
* Implemented $this->execute() and $this->executeAsync() for executing arbitrary JavaScript.
* Implemented $this->windowHandle(), $this->windowHandles and $this->source().
* Implemented $this->alertText("...") for answering prompts.
* Supporting form submit (also via children elements).
* Supporting radio boxes.
* Supporting implicit waits on $this->by*().
* Supporting back and forward buttons via $this->back() and $this->forward().
* Supporting refresh of pages via $this->refresh().
* Supporting $element->clear().
* Correctly marking Selenium 1 tests as skipped when server is not running.
PHPUnit_Selenium 1.2.3
----------------------
* Fixed package.xml to include missing SeleniumTestSuite.php file.
PHPUnit_Selenium 1.2.2
----------------------
* Implemented Select object, available via $this->select().
* Added defaults for Selenium Server host and port.
* Added @method annotations on Selenium2TestCase.
* Fixed #83: `setUpBeforeClass` and `tearDownAfterClass` do not work with `PHPUnit_Extensions_SeleniumTestCase`.
* Fixed #85: using POST instead of GET in Selenium RC Driver.
* Supporting AndroidDriver, both on devices and emulators.
* Supporting UTF-8 characters in Element::value().
PHPUnit_Selenium 1.2.1
----------------------
* Fixed #82: `@depends` annotation does not work with `PHPUnit_Extensions_SeleniumTestCase`.
* `package.xml` misses classes for Selenium 2 support.
PHPUnit_Selenium 1.2.0
----------------------
* Introduced `PHPUnit_Extensions_Selenium2TestCase` class for using WebDriver API.
* Introduced session sharing for WebDriver API.
* Introduced URL opening and element selection in WebDriver API.
* Introduced clicking on elements and `clickOnElement($id)` shorthand in WebDriver API.
* Introduced partial `alert()` management in WebDriver API.
* Introduced element manipulation in WebDriver API: text accessor, value mutator.
* Introduced `by*()` quick selectors in WebDriver API.
* Extracted a base command class for extending the supported session and element commands in WebDriver API.
PHPUnit_Selenium-1.2.6/LICENSE 0000664 0000764 0000764 00000003017 11735520166 013470 0 ustar sb sb PHPUnit_Selenium
Copyright (c) 2002-2012, Sebastian Bergmann .
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.sig 0000664 0000764 0000764 00000000306 11735520176 010767 0 ustar sb sb -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEABECAAYFAk92oH4ACgkQaGfFFLhbXWmXVgCfR1bpAdj3D/MM4Qtuizh+FoHK
iGMAn29aw7SmJiN5LYzDu/D9CD6+Jxn4
=CNoi
-----END PGP SIGNATURE-----