forked from Codeception/Codeception
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebDriverTest.php
More file actions
743 lines (653 loc) · 25.5 KB
/
Copy pathWebDriverTest.php
File metadata and controls
743 lines (653 loc) · 25.5 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
<?php
use Codeception\Util\Stub;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverKeys;
require_once codecept_data_dir() . 'app/data.php';
require_once __DIR__ . '/../unit/Codeception/Module/TestsForBrowsers.php';
class WebDriverTest extends TestsForBrowsers
{
/**
* @var \Codeception\Module\WebDriver
*/
protected $module;
/**
* @var RemoteWebDriver
*/
protected $webDriver;
const MODULE_CLASS = 'Codeception\Module\WebDriver';
const WEBDRIVER_CLASS = 'Facebook\WebDriver\Remote\RemoteWebDriver';
public function _before()
{
$this->module = $this->getModule('WebDriver');
$this->webDriver = &$this->getModule('WebDriver')->webDriver;
}
public function _after()
{
data::clean();
}
public function testClickEventOnCheckbox()
{
$this->module->amOnPage('/form/checkbox');
$this->module->uncheckOption('#checkin');
$this->module->dontSee('ticked', '#notice');
$this->module->checkOption('#checkin');
$this->module->see('ticked', '#notice');
}
public function testAcceptPopup()
{
$this->notForPhantomJS();
$this->module->amOnPage('/form/popup');
$this->module->click('Confirm');
$this->module->acceptPopup();
$this->module->see('Yes', '#result');
}
public function testCancelPopup()
{
$this->notForPhantomJS();
$this->module->amOnPage('/form/popup');
$this->module->click('Confirm');
$this->module->cancelPopup();
$this->module->see('No', '#result');
}
public function testSelectByCss()
{
$this->module->amOnPage('/form/select');
$this->module->selectOption('form select[name=age]', '21-60');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('adult', $form['age']);
}
public function testSelectInvalidOptionForSecondSelectFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/select_second');
$this->module->selectOption('#select2', 'Value2');
}
public function testSeeInPopup()
{
$this->notForPhantomJS();
$this->module->amOnPage('/form/popup');
$this->module->click('Alert');
$this->module->seeInPopup('Really?');
$this->module->cancelPopup();
}
public function testScreenshot()
{
$this->module->amOnPage('/');
@unlink(\Codeception\Configuration::outputDir().'testshot.png');
$testName="debugTest";
$this->module->makeScreenshot($testName);
$this->assertFileExists(\Codeception\Configuration::outputDir().'debug/'.$testName.'.png');
@unlink(\Codeception\Configuration::outputDir().'debug/'.$testName.'.png');
$this->module->_saveScreenshot(\Codeception\Configuration::outputDir().'testshot.png');
$this->assertFileExists(\Codeception\Configuration::outputDir().'testshot.png');
@unlink(\Codeception\Configuration::outputDir().'testshot.png');
}
public function testSubmitForm()
{
$this->module->amOnPage('/form/complex');
$this->module->submitForm('form', [
'name' => 'Davert',
'age' => 'child',
'terms' => 'agree',
'description' => 'My Bio'
]);
$form = data::get('form');
$this->assertEquals('Davert', $form['name']);
$this->assertEquals('kill_all', $form['action']);
$this->assertEquals('My Bio', $form['description']);
$this->assertEquals('agree', $form['terms']);
$this->assertEquals('child', $form['age']);
}
public function testSubmitFormWithNumbers()
{
$this->module->amOnPage('/form/complex');
$this->module->submitForm('form', [
'name' => 'Davert',
'age' => 'child',
'terms' => 'agree',
'description' => 10
]);
$form = data::get('form');
$this->assertEquals('Davert', $form['name']);
$this->assertEquals('kill_all', $form['action']);
$this->assertEquals('10', $form['description']);
$this->assertEquals('agree', $form['terms']);
$this->assertEquals('child', $form['age']);
}
/**
* @dataProvider strictSelectorProvider
*/
public function testSubmitFormWithButtonAsStrictSelector(array $selector)
{
$this->module->amOnPage('/form/strict_selectors');
$this->module->submitForm('form', [
'name' => 'Davert',
'age' => 'child',
'terms' => 'agree',
'description' => 'My Bio'
], $selector);
$form = data::get('form');
$this->assertEquals('Davert', $form['name']);
$this->assertEquals('kill_all', $form['action']);
$this->assertEquals('My Bio', $form['description']);
$this->assertEquals('agree', $form['terms']);
$this->assertEquals('child', $form['age']);
}
public function strictSelectorProvider()
{
return [
'by id' => [['id' => 'submit_button']],
'by name' => [['name' => 'submit_button_name']],
'by css' => [['css' => 'form #submit_button']],
'by xpath' => [['xpath' => '//*[@id="submit_button"]']],
'by link' => [['link' => 'Submit']],
'by class' => [['class' => 'button']],
];
}
/**
* @dataProvider webDriverByProvider
*/
public function testSubmitFormWithButtonAsWebDriverBy(WebDriverBy $selector)
{
$this->module->amOnPage('/form/strict_selectors');
$this->module->submitForm('form', [
'name' => 'Davert',
'age' => 'child',
'terms' => 'agree',
'description' => 'My Bio'
], $selector);
$form = data::get('form');
$this->assertEquals('Davert', $form['name']);
$this->assertEquals('kill_all', $form['action']);
$this->assertEquals('My Bio', $form['description']);
$this->assertEquals('agree', $form['terms']);
$this->assertEquals('child', $form['age']);
}
public function webDriverByProvider()
{
return [
'by id' => [WebDriverBy::id('submit_button')],
'by name' => [WebDriverBy::name('submit_button_name')],
'by css selector' => [WebDriverBy::cssSelector('form #submit_button')],
'by xpath' => [WebDriverBy::xpath('//*[@id="submit_button"]')],
'by link text' => [WebDriverBy::linkText('Submit')],
'by class name' => [WebDriverBy::className('button')],
];
}
public function testRadioButtonByValue()
{
$this->module->amOnPage('/form/radio');
$this->module->selectOption('form', 'disagree');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('disagree', $form['terms']);
}
public function testRadioButtonByLabelOnContext()
{
$this->module->amOnPage('/form/radio');
$this->module->selectOption('form input', 'Get Off');
$this->module->seeOptionIsSelected('form input', 'disagree');
$this->module->dontSeeOptionIsSelected('form input', 'agree');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('disagree', $form['terms']);
}
public function testRadioButtonByLabel()
{
$this->module->amOnPage('/form/radio');
$this->module->checkOption('Get Off');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('disagree', $form['terms']);
}
public function testRawSelenium()
{
$this->module->amOnPage('/');
$this->module->executeInSelenium(function ($webdriver) {
$webdriver->findElement(WebDriverBy::id('link'))->click();
});
$this->module->seeCurrentUrlEquals('/info');
}
public function testKeys()
{
$this->module->amOnPage('/form/field');
$this->module->pressKey('#name', ['ctrl', 'a'], WebDriverKeys::DELETE);
$this->module->pressKey('#name', 'test', ['shift', '111']);
$this->module->pressKey('#name', '1');
$this->module->seeInField('#name', 'test!!!1');
}
public function testWait()
{
$this->module->amOnPage('/');
$time = time();
$this->module->wait(3);
$this->assertGreaterThanOrEqual($time+3, time());
}
public function testSelectInvalidOptionFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/select');
$this->module->selectOption('#age', '13-22');
}
public function testAppendFieldSelect()
{
$this->module->amOnPage('/form/select_multiple');
$this->module->selectOption('form #like', 'eat');
$this->module->appendField('form #like', 'code');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEmpty(array_diff($form['like'], ["eat", "code"]));
}
public function testAppendFieldSelectFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/select_multiple');
$this->module->appendField('form #like', 'code123');
}
public function testAppendFieldTextarea()
{
$this->module->amOnPage('/form/textarea');
$this->module->fillField('form #description', 'eat');
$this->module->appendField('form #description', ' code');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('eat code', $form['description']);
}
public function testAppendFieldTextareaFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/textarea');
$this->module->appendField('form #description123', ' code');
}
public function testAppendFieldText()
{
$this->module->amOnPage('/form/field');
$this->module->appendField('form #name', ' code');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('OLD_VALUE code', $form['name']);
}
public function testAppendFieldTextFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/field');
$this->module->appendField('form #name123', ' code');
}
public function testAppendFieldCheckboxByValue()
{
$this->module->amOnPage('/form/checkbox');
$this->module->appendField('form input[name=terms]', 'agree');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('agree', $form['terms']);
}
public function testAppendFieldCheckboxByValueFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/checkbox');
$this->module->appendField('form input[name=terms]', 'agree123');
}
public function testAppendFieldCheckboxByLabel()
{
$this->module->amOnPage('/form/checkbox');
$this->module->appendField('form input[name=terms]', 'I Agree');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('agree', $form['terms']);
}
public function testAppendFieldCheckboxByLabelFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/checkbox');
$this->module->appendField('form input[name=terms]', 'I Agree123');
}
public function testAppendFieldRadioButtonByValue()
{
$this->module->amOnPage('/form/radio');
$this->module->appendField('form input[name=terms]', 'disagree');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('disagree', $form['terms']);
}
public function testAppendFieldRadioButtonByValueFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/radio');
$this->module->appendField('form input[name=terms]', 'disagree123');
}
public function testAppendFieldRadioButtonByLabel()
{
$this->module->amOnPage('/form/radio');
$this->module->appendField('form input[name=terms]', 'Get Off');
$this->module->click('Submit');
$form = data::get('form');
$this->assertEquals('disagree', $form['terms']);
}
public function testAppendFieldRadioButtonByLabelFails()
{
$this->shouldFail();
$this->module->amOnPage('/form/radio');
$this->module->appendField('form input[name=terms]', 'Get Off123');
}
public function testPauseExecution()
{
$this->module->amOnPage('/');
$this->module->pauseExecution();
}
// Issue https://github.com/Codeception/Codeception/pull/875
public function testFillPasswordOnFormSubmit()
{
$this->module->amOnPage('/form/complex');
$this->module->submitForm('form', [
'password' => '123456'
]);
$form = data::get('form');
$this->assertEquals('123456', $form['password']);
}
public function testEmptyFormSubmit()
{
$this->shouldFail();
$this->module->amOnPage('/form/complex');
$this->module->submitForm('form111', []);
}
public function testWebDriverByLocators()
{
$this->module->amOnPage('/login');
$this->module->seeElement(WebDriverBy::id('submit-label'));
$this->module->seeElement(WebDriverBy::name('password'));
$this->module->seeElement(WebDriverBy::className('optional'));
$this->module->seeElement(WebDriverBy::cssSelector('form.global_form_box'));
$this->module->seeElement(WebDriverBy::xpath(\Codeception\Util\Locator::tabIndex(4)));
$this->module->fillField(WebDriverBy::name('password'), '123456');
$this->module->amOnPage('/form/select');
$this->module->selectOption(WebDriverBy::name('age'), 'child');
$this->module->amOnPage('/form/checkbox');
$this->module->checkOption(WebDriverBy::name('terms'));
$this->module->amOnPage('/');
$this->module->seeElement(WebDriverBy::linkText('Test'));
$this->module->click(WebDriverBy::linkText('Test'));
$this->module->seeCurrentUrlEquals('/form/hidden');
}
public function testSeeVisible()
{
$this->module->amOnPage('/info');
$this->module->dontSee('Invisible text');
$this->module->dontSee('Invisible', '.hidden');
$this->module->seeInPageSource('Invisible text');
}
public function testSeeInvisible()
{
$this->shouldFail();
$this->module->amOnPage('/info');
$this->module->see('Invisible text');
}
public function testFailWebDriverByLocator()
{
$this->shouldFail();
$this->module->amOnPage('/form/checkbox');
$this->module->checkOption(WebDriverBy::name('age'));
}
// fails in PhpBrowser :(
public function testSubmitUnchecked()
{
$this->module->amOnPage('/form/unchecked');
$this->module->seeCheckboxIsChecked('#checkbox');
$this->module->uncheckOption('#checkbox');
$this->module->click('#submit');
;
$this->module->see('0', '#notice');
}
public function testCreateCeptScreenshotFail()
{
$fakeWd = Stub::make('\Facebook\WebDriver\Remote\RemoteWebDriver', [
'takeScreenshot' => Stub::once(function () {
}),
'getPageSource' => Stub::once(function () {
}),
'manage' => Stub::make('\Facebook\WebDriver\WebDriverOptions', [
'getAvailableLogTypes' => Stub::atLeastOnce(function () {
return [];
}),
]),
]);
$module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
$cept = (new \Codeception\Test\Cept('loginCept', 'loginCept.php'));
$module->_failed($cept, new PHPUnit_Framework_AssertionFailedError());
}
public function testCreateCestScreenshotOnFail()
{
$fakeWd = Stub::make(self::WEBDRIVER_CLASS, [
'takeScreenshot' => Stub::once(function ($filename) {
PHPUnit_Framework_Assert::assertEquals(codecept_log_dir('stdClass.login.fail.png'), $filename);
}),
'getPageSource' => Stub::once(function () {
}),
'manage' => Stub::make('\Facebook\WebDriver\WebDriverOptions', [
'getAvailableLogTypes' => Stub::atLeastOnce(function () {
return [];
}),
]),
]);
$module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
$cest = new \Codeception\Test\Cest(new stdClass(), 'login', 'someCest.php');
$module->_failed($cest, new PHPUnit_Framework_AssertionFailedError());
}
public function testCreateTestScreenshotOnFail()
{
$test = Stub::make('\Codeception\TestCase\Test', ['getName' => 'testLogin']);
$fakeWd = Stub::make(self::WEBDRIVER_CLASS, [
'takeScreenshot' => Stub::once(function ($filename) use ($test) {
PHPUnit_Framework_Assert::assertEquals(
codecept_log_dir(get_class($test).'.testLogin.fail.png'),
$filename
);
}),
'getPageSource' => Stub::once(function () {
}),
'manage' => Stub::make('\Facebook\WebDriver\WebDriverOptions', [
'getAvailableLogTypes' => Stub::atLeastOnce(function () {
return [];
}),
]),
]);
$module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
$module->_failed($test, new PHPUnit_Framework_AssertionFailedError());
}
public function testWebDriverWaits()
{
$fakeWd = Stub::make(self::WEBDRIVER_CLASS, ['wait' => Stub::exactly(12, function () {
return new \Codeception\Util\Maybe();
})]);
$module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
$module->waitForElement(WebDriverBy::partialLinkText('yeah'));
$module->waitForElement(['id' => 'user']);
$module->waitForElement(['css' => '.user']);
$module->waitForElement('//xpath');
$module->waitForElementVisible(WebDriverBy::partialLinkText('yeah'));
$module->waitForElementVisible(['id' => 'user']);
$module->waitForElementVisible(['css' => '.user']);
$module->waitForElementVisible('//xpath');
$module->waitForElementNotVisible(WebDriverBy::partialLinkText('yeah'));
$module->waitForElementNotVisible(['id' => 'user']);
$module->waitForElementNotVisible(['css' => '.user']);
$module->waitForElementNotVisible('//xpath');
}
public function testBug1467()
{
$this->module->amOnPage('/form/bug1467');
$this->module->selectOption('form[name=form2] input[name=first_test_radio]', 'Yes');
$this->module->selectOption('form[name=form2] input[name=second_test_radio]', 'No');
$this->module->seeOptionIsSelected('form[name=form2] input[name=first_test_radio]', 'Yes');
$this->module->seeOptionIsSelected('form[name=form2] input[name=second_test_radio]', 'No');
// shouldn't have touched form1 at all
$this->module->dontSeeOptionIsSelected('form[name=form1] input[name=first_test_radio]', 'No');
$this->module->dontSeeOptionIsSelected('form[name=form1] input[name=first_test_radio]', 'Yes');
$this->module->dontSeeOptionIsSelected('form[name=form1] input[name=second_test_radio]', 'No');
$this->module->dontSeeOptionIsSelected('form[name=form1] input[name=second_test_radio]', 'Yes');
}
/**
* @Issue 1598
*/
public function testWaitForTextBug1598()
{
$this->module->amOnPage('/form/bug1598');
$this->module->waitForText('12,345', 10, '#field');
}
public function testSeeElementMalformedWdLocator()
{
$this->setExpectedException('Codeception\Exception\MalformedLocatorException');
$this->module->amOnPage('/');
$this->module->seeElement(WebDriverBy::xpath('H---EY!'));
}
public function testBug1637()
{
$this->module->amOnPage('/form/bug1637');
// confirm that options outside a form are still selectable
$this->module->selectOption('input[name=first_test_radio]', 'Yes');
// confirm that it did what we expected and did not do anything else
$this->module->seeOptionIsSelected('input[name=first_test_radio]', 'Yes');
$this->module->dontSeeOptionIsSelected('input[name=first_test_radio]', 'No');
}
public function testBug2046()
{
$this->module->webDriver = null;
$this->module->_saveScreenshot(\Codeception\Configuration::outputDir().'testshot.png');
}
public function testSessionSnapshots()
{
$this->notForPhantomJS();
$this->module->amOnPage('/');
$this->module->setCookie('PHPSESSID', '123456', ['path' => '/']);
$this->module->saveSessionSnapshot('login');
$this->module->seeCookie('PHPSESSID');
$this->webDriver->manage()->deleteAllCookies();
$this->module->dontSeeCookie('PHPSESSID');
$this->module->loadSessionSnapshot('login');
$this->module->seeCookie('PHPSESSID');
}
public function testSaveSessionSnapshotsExcludeInvalidCookieDomains()
{
$this->notForPhantomJS();
$fakeWdOptions = Stub::make('\Facebook\WebDriver\WebDriverOptions', [
'getCookies' => Stub::atLeastOnce(function () {
return [
[
'name' => 'PHPSESSID',
'value' => '123456',
'path' => '/',
],
[
'name' => '3rdParty',
'value' => '_value_',
'path' => '/',
'domain' => '.3rd-party.net',
]
];
}),
]);
$fakeWd = Stub::make(self::WEBDRIVER_CLASS, [
'manage' => Stub::atLeastOnce(function () use ($fakeWdOptions) {
return $fakeWdOptions;
}),
]);
// Mock the WebDriverOptions::getCookies() method on the first call to introduce a 3rd-party cookie
// which has to be ignored when saving a snapshot.
$originalWebDriver = $this->module->webDriver;
$this->module->webDriver = $fakeWd;
$this->module->seeCookie('PHPSESSID');
$this->module->seeCookie('3rdParty');
$this->module->saveSessionSnapshot('login');
// Restore the original WebDriver
$this->module->webDriver = $originalWebDriver;
$this->webDriver->manage()->deleteAllCookies();
$this->module->dontSeeCookie('PHPSESSID');
$this->module->dontSeeCookie('3rdParty');
$this->module->loadSessionSnapshot('login');
$this->module->seeCookie('PHPSESSID');
$this->module->dontSeeCookie('3rdParty');
}
public function testSeeInFieldTextarea()
{
$this->module->amOnPage('/form/textarea');
//make sure we see 'sunrise' which is the default text in the textarea
$this->module->seeInField('#description', 'sunrise');
//fill in some new text and see if we can see it
$textarea_value = 'test string';
$this->module->fillField('#description', $textarea_value);
$this->module->seeInField('#description', $textarea_value);
}
public function testAppendFieldDiv()
{
$this->notForPhantomJS();
$this->module->amOnPage('/form/div_content_editable');
//make sure we see 'sunrise' which is the default text in the textarea
$this->module->see('sunrise', '#description');
//fill in some new text and see if we can see it
$textarea_value = 'moonrise';
$this->module->appendField('#description', $textarea_value);
$this->module->see('sunrise' . $textarea_value, '#description');
}
public function testOpenPageException()
{
if (!$this->module->_getConfig('restart')) {
$this->markTestSkipped('works only on restarts');
}
parent::testOpenPageException();
}
public function testCookies()
{
$this->notForPhantomJS();
parent::testCookies();
}
public function testSendingCookies()
{
$this->notForPhantomJS();
parent::testSendingCookies();
}
public function testCookiesWithPath()
{
$this->notForPhantomJS();
parent::testCookiesWithPath();
}
protected function notForPhantomJS()
{
if ($this->module->_getConfig('browser') == 'phantomjs') {
$this->markTestSkipped('does not work for phantomjs');
}
}
public function testScrollTo()
{
$this->module->amOnPage('/form/example18');
$this->module->scrollTo('#clickme');
$this->module->click('Submit');
$this->module->see('Welcome to test app!');
}
/**
* @Issue 2921
*/
public function testSeeInFieldForTextarea()
{
$this->module->amOnPage('/form/bug2921');
$this->module->seeInField('foo', 'bar baz');
}
public function testClickHashLink()
{
$this->module->amOnPage('/form/anchor');
$this->module->click('Hash Link');
$this->module->seeCurrentUrlEquals('/form/anchor#b');
}
public function testClickHashButton()
{
$this->module->amOnPage('/form/anchor');
$this->module->click('Hash Button');
$this->module->seeCurrentUrlEquals('/form/anchor#c');
}
public function testSubmitHashForm()
{
$this->module->amOnPage('/form/anchor');
$this->module->click('Hash Form');
$this->module->seeCurrentUrlEquals('/form/anchor#a');
}
}