-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleTest.php
More file actions
54 lines (47 loc) · 1.54 KB
/
SimpleTest.php
File metadata and controls
54 lines (47 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?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 SimpleTest.php
require_once "vendor/autoload.php";
define("APP_PATH", realpath(dirname(__FILE__).'/../../apps/TestApp/build/release-iphonesimulator/TestApp-iphonesimulator.app'));
if (!APP_PATH) {
die("App did not exist!");
}
class SimpleTest extends Sauce\Sausage\WebDriverTestCase
{
protected $numValues = array();
public static $browsers = array(
array(
'local' => true,
'port' => 4723,
'browserName' => '',
'desiredCapabilities' => array(
'deviceName' => '=iPhone 5s',
'version' => '8.4 Simulator',
'platformName' => 'iOS',
'app' => APP_PATH
)
)
);
public function elemsByTag($tag)
{
return $this->elements($this->using('class name')->value($tag));
}
protected function populate()
{
$elems = $this->elemsByTag('UIATextField');
foreach ($elems as $elem) {
$randNum = rand(0, 10);
$elem->value($randNum);
$this->numValues[] = $randNum;
}
}
public function testUiComputation()
{
$this->populate();
$buttons = $this->elemsByTag('UIAButton');
$buttons[0]->click();
$texts = $this->elemsByTag('UIAStaticText');
$this->assertEquals(array_sum($this->numValues), (int)($texts[0]->text()));
}
}