-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgithub.ts
46 lines (41 loc) · 1.48 KB
/
github.ts
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
import {NightwatchAPI, NightwatchTests} from 'nightwatch';
const home: NightwatchTests = {
'Github Title test': () => {
browser
.url('https://github.com')
.assert.titleContains('GitHub');
},
'Github search for nightwatch repository': () => {
browser
.url('https://github.com/search')
.clearValue('[placeholder=\'Search GitHub\']')
.setValue('[placeholder=\'Search GitHub\']', 'nightwatch')
.perform(function(this: NightwatchAPI) {
const actions = this.actions({async: true});
return actions.keyDown(this.Keys['ENTER']).keyUp(this.Keys['ENTER']);
})
.waitForElementVisible('.header-search-button')
.assert.textEquals('.header-search-button', 'nightwatch')
.waitForElementVisible('div[data-testid="results-list"]:first-child')
.assert.textContains(
'div[data-testid="results-list"]:first-child',
'End-to-end testing framework written in Node.js and using the W3C Webdriver API'
);
},
'Github login with fake credentials': () => {
browser
.url('https://github.com/login')
.clearValue('#login_field')
.setValue('#login_field', 'nightwatch')
.clearValue('#password')
.setValue('#password', 'testpassword')
.waitForElementVisible('[value=\'Sign in\']')
.click('[value=\'Sign in\']')
.assert.textContains(
'#js-flash-container .flash.flash-error',
'Incorrect username or password.'
)
.end();
}
};
export default home;