Skip to content

Commit 3782f85

Browse files
committed
Add the NodeJS server for launching SeleniumBase tests
1 parent 2e107f4 commit 3782f85

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

integrations/node_js/server.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
var http = require('http');
2+
var express = require('express');
3+
var path = require('path');
4+
var app = express();
5+
var exec = require('child_process').exec;
6+
7+
function run_my_first_test_in_firefox() {
8+
exec("nosetests my_first_test.py --with-selenium");
9+
}
10+
11+
function run_my_first_test_in_chrome() {
12+
exec("nosetests my_first_test.py --with-selenium --browser=chrome");
13+
}
14+
15+
app.get('/', function(req, res) {
16+
res.sendFile(path.join(__dirname + '/index.html'));
17+
})
18+
19+
app.get('/run_my_first_test_in_firefox', function(req, res) {
20+
res.sendFile(path.join(__dirname + '/index.html'));
21+
res.redirect('/');
22+
run_my_first_test_in_firefox()
23+
})
24+
25+
app.get('/run_my_first_test_in_chrome', function(req, res) {
26+
res.sendFile(path.join(__dirname + '/index.html'));
27+
res.redirect('/');
28+
run_my_first_test_in_chrome()
29+
})
30+
31+
app.listen(3000, "127.0.0.1", function() {
32+
console.log('Server running at http://127.0.0.1:3000/');
33+
});
34+

0 commit comments

Comments
 (0)