forked from appium-boneyard/sample-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathios_simple.pl
More file actions
42 lines (33 loc) · 1.06 KB
/
ios_simple.pl
File metadata and controls
42 lines (33 loc) · 1.06 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
#! /usr/bin/perl
use strict;
use warnings;
use Test::More;
use Cwd qw/getcwd abs_path/;
use Selenium::Remote::Driver 0.20;
my $app = getcwd() . '/../../apps/TestApp/build/release-iphonesimulator/TestApp.app';
my $caps = {
app => abs_path($app),
browserName => "",
deviceName => "iPhone 6",
platformName => "iOS",
platformVersion => "8.1"
};
my $driver = Selenium::Remote::Driver->new_from_caps(
remote_server_addr => "127.0.0.1",
port => 4723,
desired_capabilities => $caps
);
ok(defined $driver, 'Instantiated an iOS driver!');
my $expected_sum;
foreach (qw/1 2/) {
my $text_field = $driver->find_element('TextField' . $_, 'name');
my $rand = int(rand(20));
$expected_sum += $rand;
$text_field->send_keys($rand);
}
my $compute_button = $driver->find_element('ComputeSumButton', 'name');
$compute_button->click;
my $sum_element = $driver->find_element($expected_sum, 'name');
ok($sum_element->get_text eq $expected_sum, 'We can do addition!');
$driver->quit;
done_testing;