-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.js
61 lines (54 loc) · 1.56 KB
/
main.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
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
var webdriver = require('selenium-webdriver');
var chrome = webdriver.Capabilities.chrome();
var join = require('path').join || require('fs').join;
var driver;
var checkPrerequisitesCb = function(res){
console.log(res);
try{
init();
}catch(e){
driver.quit();
console.log(e);
}
}
//Start setup/test runner page
var init = function(){
chrome.set("chromeOptions",{
'args':[
//'--allow-legacy-extension-manifests',
'--start-maximized',
//'--no-first-run',
//'--remote-debugging-port=9111',
//'--enable-extension-timeline-api',
'--user-data-dir='+join(__dirname,'userProfile'),
//'--load-extension='+join(__dirname,'speedtracer/src/Release/speedtracerheadless')
],
'extensions':[]//[join(__dirname,'speedtracer/src/Release/speedtracer.crx')]
});
driver = new webdriver.Builder().
withCapabilities(chrome).
build();
driver.manage().window().maximize();
driver.get(join('file://',__dirname,'tests','index.html'));
driver.executeScript("window.bla=42");
driver.wait(function() {
return driver.getTitle().then(function(title) {
var res = title === 'Starting Application Profiling...';
if(res){
//loadPageForProfiling();
}
return res;
});
}, 5000);
}
var loadPageForProfiling = function(){
driver.get('http://localhost:8080/wtv/index.html');
driver.wait(function() {
return driver.getTitle().then(function(title) {
var t = title === 'Index';
console.log("OK:",t);
return true;
});
}, 5000);
}
require("./lib/check_prerequisites.js").checkPrerequisites(checkPrerequisitesCb,console.log,console.log,console.log);