Finally maybe it'll work.

This commit is contained in:
Sébastien Lucas 2013-11-28 11:45:54 +01:00
rodič 99768e82ee
revize 198323773d
4 změnil soubory, kde provedl 165 přidání a 1 odebrání

Zobrazit soubor

@ -19,3 +19,5 @@ env:
- secure: VVxocvmz6WYr3tZSTA42M/LUhaHoBWw5onh85hnquoMaxspd3tDCyfQIowTTmEXikRh2T0CkTH7X3dhVwRTd/Ha9isja1qDo9Lc2flGCoWICF7WFZuom084+d+O+EWx4WZMAw4Lz4w6a5xflpPKnzNs9B0+de0BdTlQ5qSXVrcA=
addons:
sauce_connect: true
hosts:
- cops-travis

136
test/Sauce.php Normal file
Zobrazit soubor

@ -0,0 +1,136 @@
<?php
require_once 'vendor/autoload.php';
class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase
class WebDriverDemo extends WebDriverTestCase
{
public static $browsers = array(
// // run FF15 on Windows 8 on Sauce
// array(
// 'browserName' => 'firefox',
// 'desiredCapabilities' => array(
// 'version' => '15',
// 'platform' => 'Windows 2012',
// )
// ),
// // run IE9 on Windows 7 on Sauce
// array(
// 'browserName' => 'internet explorer',
// 'desiredCapabilities' => array(
// 'version' => '9',
// 'platform' => 'Windows 7',
// )
// ),
// // run IE10 on Windows 8 on Sauce
// array(
// 'browserName' => 'internet explorer',
// 'desiredCapabilities' => array(
// 'version' => '10',
// 'platform' => 'Windows 8',
// )
// ),
// // run Opera 12 on Windows 7 on Sauce
// array(
// 'browserName' => 'opera',
// 'desiredCapabilities' => array(
// 'version' => '12',
// 'platform' => 'Windows 7',
// )
// ),
// // run Mobile Safari on iOS
// array(
// 'browserName' => '',
// 'desiredCapabilities' => array(
// 'app' => 'safari',
// 'device' => 'iPhone Simulator',
// 'version' => '6.1',
// 'platform' => 'Mac 10.8',
// )
// ),
// run Chrome on Linux on Sauce
array(
'browserName' => 'chrome',
'desiredCapabilities' => array(
'version' => '30',
'platform' => 'Linux'
)
)
// run Mobile Browser on Android
// array(
// 'browserName' => 'Android',
// 'desiredCapabilities' => array(
// 'version' => '4.0',
// 'platform' => 'Linux',
// )
// )
// run Chrome locally
//array(
//'browserName' => 'chrome',
//'local' => true,
//'sessionStrategy' => 'shared'
//)
);
public function setUp()
{
$caps = $this->getDesiredCapabilities();
$caps['build'] = getenv ("TRAVIS_JOB_NUMBER");
$caps['tunnel-identifier'] = getenv ("TRAVIS_JOB_NUMBER");
$caps['name'] = "COPS ";
$this->setDesiredCapabilities($caps);
parent::setUp ();
}
public function setUpPage()
{
$this->url('http://cops-travis:8888/index.php');
}
public function string_to_ascii($string)
{
$ascii = NULL;
for ($i = 0; $i < strlen($string); $i++)
{
$ascii += ord($string[$i]);
}
return mb_detect_encoding($string) . "X" . $ascii;
}
public function testTitle()
{
$driver = $this;
$title_test = function($value) use ($driver) {
$text = $driver->byXPath('//h1')->text ();
return $text == $value;
};
$this->spinAssert("Home Title", $title_test, [ "COPS DEMO" ]);
$author = $this->byXPath ('//h2[contains(text(), "Authors")]');
$author->click ();
$this->spinAssert("Author Title", $title_test, [ "AUTHORS" ]);
$cog = $this->byId ("searchImage");
// try {
// $search = $this->byName ("query");
// $this->fail ();
// }
// catch (Exception $e) {
// }
$search = $this->byName ("query");
$this->assertFalse ($search->displayed ());
$cog->click ();
//$this->implicitWait(2000);
$search = $this->byName ("query");
$this->assertTrue ($search->displayed ());
}
}

Zobrazit soubor

@ -0,0 +1,23 @@
<?php
if (!isset($config))
$config = array();
/*
* The directory containing calibre's metadata.db file, with sub-directories
* containing all the formats.
* BEWARE : it has to end with a /
*/
$config['calibre_directory'] = 'test/BaseWithSomeBooks/';
/*
* Catalog's title
*/
$config['cops_title_default'] = "COPS";
/*
* use URL rewriting for downloading of ebook in HTML catalog
* See README for more information
* 1 : enable
* 0 : disable
*/
$config['cops_use_url_rewriting'] = "0";

Zobrazit soubor

@ -12,4 +12,7 @@ fi
echo "Good PHP version"
curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php
curl -s https://raw.github.com/jlipps/sausage-bun/master/givememysausage.php | php
cp test/config_local.php.sauce config_local.php
php -S localhost:8888 2> /dev/null &
vendor/bin/phpunit Sauce.php