Skip to content
Newer
Older
100644 83 lines (70 sloc) 2.2 KB
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
1 <?php
2
3854591 @jlipps better keywords for packagist
authored Sep 18, 2012
3 require_once 'vendor/autoload.php';
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
4
d00a8fc @jlipps better names for these classes
authored Sep 18, 2012
5 class WebDriverDemo extends Sauce\Sausage\WebDriverTestCase
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
6 {
132d572 @jlipps make sure we don't try to nav to a url in setuppage if we haven't set…
authored Dec 20, 2013
7
8 protected $start_url = 'http://saucelabs.com/test/guinea-pig';
9
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
10 public static $browsers = array(
ed51daf @jlipps change comment too
authored Oct 29, 2012
11 // run FF15 on Windows 8 on Sauce
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
12 array(
13 'browserName' => 'firefox',
14 'desiredCapabilities' => array(
15 'version' => '15',
4992363 @jlipps allow video upload options for selenium rc in sausage
authored Nov 14, 2012
16 'platform' => 'Windows 2012',
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
17 )
aa6ad82 @jlipps set build via desired caps, and accept more build env vars
authored Dec 20, 2013
18 ),
19 // run Chrome on Linux on Sauce
20 array(
21 'browserName' => 'chrome',
22 'desiredCapabilities' => array(
23 'platform' => 'Linux'
24 )
25 ),
1259bc9 @jlipps update dependencies
authored Sep 24, 2013
26 // run Mobile Safari on iOS
27 //array(
28 //'browserName' => '',
29 //'desiredCapabilities' => array(
30 //'app' => 'safari',
31 //'device' => 'iPhone Simulator',
32 //'version' => '6.1',
33 //'platform' => 'Mac 10.8',
34 //)
35 //)//,
6b9c66f @jlipps add local test support to WebDriverTestCase
authored Sep 24, 2012
36 // run Chrome locally
0a2295e @jlipps comment out local stuff since demo people might not have it
authored Sep 26, 2012
37 //array(
38 //'browserName' => 'chrome',
39 //'local' => true,
40 //'sessionStrategy' => 'shared'
41 //)
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
42 );
43
44 public function testTitle()
45 {
46 $this->assertContains("I am a page title", $this->title());
47 }
48
49 public function testLink()
50 {
51 $link = $this->byId('i am a link');
52 $link->click();
53 $this->assertContains("I am another page title", $this->title());
54 }
55
56 public function testTextbox()
57 {
58 $test_text = "This is some text";
59 $textbox = $this->byId('i_am_a_textbox');
60 $textbox->click();
2e76cab @imurchie Add mobile test case
imurchie authored May 19, 2014
61 $textbox->clear();
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
62 $this->keys($test_text);
63 $this->assertEquals($textbox->value(), $test_text);
64 }
65
66 public function testSubmitComments()
67 {
68 $comment = "This is a very insightful comment.";
f43502c @jlipps refactor
authored Oct 15, 2012
69 $this->byId('comments')->value($comment);
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
70 $this->byId('submit')->submit();
d5718cb @jlipps Add spinAssert functionality to WebDriverTestCase, demo in WebDriverTest
authored Sep 14, 2012
71 $driver = $this;
72
f43502c @jlipps refactor
authored Oct 15, 2012
73 $comment_test = function() use ($comment, $driver) {
74 $text = $driver->byId('your_comments')->text();
75 return $text == "Your comments: $comment";
76 };
d5718cb @jlipps Add spinAssert functionality to WebDriverTestCase, demo in WebDriverTest
authored Sep 14, 2012
77
78 $this->spinAssert("Comment never showed up!", $comment_test);
79
615f65f @jlipps add testfile for webdrivertestcase
authored Sep 14, 2012
80 }
81
82 }
Something went wrong with that request. Please try again.