-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
33 lines (27 loc) · 889 Bytes
/
test.js
File metadata and controls
33 lines (27 loc) · 889 Bytes
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
import test from 'ava';
var Nightmare = require('nightmare'),
nightmare = Nightmare();
let port = 8080; // Your testing port number
test('homescreen loads', async t => {
// Convert first homescreen box promise to string and
// see if it contains the first Gurdwara
function chk(homescreenbox){
homescreenbox = homescreenbox.toString();
if (homescreenbox.includes("Akal Takht")) {
return true;
}
}
t.true(chk(await loadPageCall));
});
// Promise for homescreen loads test
var loadPageCall = new Promise(function(resolve, reject) {
nightmare.goto('http://localhost:'+ port)
.evaluate(function(){
return document.querySelector('body span').innerHTML;
})
.end()
.then(function(title){
resolve(title);
})
.catch(function(e) { reject(e.details); });
});