forked from codeceptjs/CodeceptJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyahoo_test.js
30 lines (26 loc) · 858 Bytes
/
yahoo_test.js
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
Feature('Yahoo test');
Scenario('Nightmare basic test', (I) => {
I.amOnPage('http://yahoo.com');
I.fillField('p', 'github nightmare');
I.click('Search Web');
I.waitForElement('#main', 2);
I.seeElement('#main .searchCenterMiddle li a');
// I.seeElement("//a[contains(@href,'github.com/segmentio/nightmare')]");
I.see('segmentio/nightmare', 'li a');
});
// Our implementation of:
// nightmare
// .goto('http://yahoo.com')
// .type('form[action*="/search"] [name=p]', 'github nightmare')
// .click('form[action*="/search"] [type=submit]')
// .wait('#main')
// .evaluate(function () {
// return document.querySelector('#main .searchCenterMiddle li a').href
// })
// .end()
// .then(function (result) {
// console.log(result)
// })
// .catch(function (error) {
// console.error('Search failed:', error);
// });