mirror of
https://github.com/appium/appium.git
synced 2026-05-04 17:29:28 -05:00
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// To run this test, install Sausage (see http://github.com/jlipps/sausage-bun
|
||||
// to get the curl one-liner to run in this directory), then run:
|
||||
// vendor/bin/phpunit SauceTest.php
|
||||
|
||||
require_once "vendor/autoload.php";
|
||||
define("APP_URL", "https://raw.github.com/appium/appium/master/assets/TestApp.app.zip");
|
||||
|
||||
class SauceTest extends Sauce\Sausage\WebDriverTestCase
|
||||
{
|
||||
protected $numValues = array();
|
||||
|
||||
public static $browsers = array(
|
||||
array(
|
||||
'browserName' => '',
|
||||
'seleniumServerRequestsTimeout' => 240,
|
||||
'desiredCapabilities' => array(
|
||||
'platform' => 'Mac 10.8',
|
||||
'device' => 'iPhone Simulator',
|
||||
'app' => APP_URL,
|
||||
'version' => '',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function elemsByTag($tag)
|
||||
{
|
||||
return $this->elements($this->using('tag name')->value($tag));
|
||||
}
|
||||
|
||||
protected function populate()
|
||||
{
|
||||
$elems = $this->elemsByTag('textField');
|
||||
foreach ($elems as $elem) {
|
||||
$randNum = rand(0, 10);
|
||||
$elem->value($randNum);
|
||||
$this->numValues[] = $randNum;
|
||||
}
|
||||
}
|
||||
|
||||
public function testUiComputation()
|
||||
{
|
||||
$this->populate();
|
||||
$buttons = $this->elemsByTag('button');
|
||||
$buttons[0]->click();
|
||||
$texts = $this->elemsByTag('staticText');
|
||||
$this->assertEquals(array_sum($this->numValues), (int)($texts[0]->text()));
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,9 @@
|
||||
// To run this test, install Sausage (see http://github.com/jlipps/sausage-bun
|
||||
// to get the curl one-liner to run in this directory), then run:
|
||||
// vendor/bin/phpunit SimpleTest.php
|
||||
// NOTE: this test is currently broken, waiting on this fix:
|
||||
// https://github.com/giorgiosironi/phpunit-selenium/pull/18
|
||||
|
||||
require_once "vendor/autoload.php";
|
||||
define("APP_PATH", realpath(dirname(__FILE__).'/../../apps/UICatalog/build/Release-iphonesimulator/UICatalog.app'));
|
||||
define("APP_PATH", realpath(dirname(__FILE__).'/../../apps/TestApp/build/Release-iphonesimulator/TestApp.app'));
|
||||
if (!APP_PATH) {
|
||||
die("App did not exist!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user