Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 18f7ce5

Browse files
committed
All examples up and working
1 parent a57bc3c commit 18f7ce5

File tree

6 files changed

+55
-17
lines changed

6 files changed

+55
-17
lines changed

bin/launchpad

Whitespace-only changes.

examples/browserstack.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var launch = require('../lib');
2+
3+
launch.browserstack({
4+
username : '<your browserstack username>',
5+
password : 'password'
6+
}, function(err, launcher) {
7+
launcher('http://github.com', {
8+
browser : 'firefox',
9+
version : 'latest',
10+
os : 'win'
11+
}, function(err, worker) {
12+
console.log('Started browser', worker.id);
13+
worker.status(function(status) {
14+
console.log('Browser status is:', status);
15+
setTimeout(function() {
16+
worker.stop(function(err, worker) {
17+
console.log('Stopped browser', worker);
18+
});
19+
}, 5000);
20+
})
21+
});
22+
});

examples/local.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
var launch = require('../lib');
22

3-
launch.local({}, function(err, launcher) {
4-
launcher.firefox('http://github.com/daffl', function() {
3+
launch.local(function(err, launcher) {
4+
// User the launcher api
5+
launcher('http://github.com/ekryski', {
6+
browser : 'opera'
7+
}, function(error, worker) {
8+
console.log('Launched Opera. Process id:', worker.id);
9+
setTimeout(function() {
10+
worker.stop(function() {
11+
console.log('Opera stopped');
12+
});
13+
}, 4000);
14+
});
515

16+
// Short hand launcher
17+
launcher.firefox('http://github.com/daffl', function(err, worker) {
18+
console.log('Launched Firefox. Process id:', worker.id);
19+
setTimeout(function() {
20+
worker.stop(function() {
21+
console.log('Firefox stopped');
22+
});
23+
}, 2000);
624
});
725
});

examples/remote.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@ launch.remote({
55
host : 'localhost',
66
username : 'launcher',
77
password : 'testing'
8-
}, function(err, api) {
9-
console.log(api);
10-
api('http://github.com', {
11-
browser : 'opera',
8+
}, function(err, launcher) {
9+
launcher('http://github.com', {
10+
browser : 'firefox',
1211
version : 'latest'
13-
}, function(err, instance) {
14-
instance.status(function() {
15-
console.log(arguments);
16-
console.dir(instance);
12+
}, function(err, worker) {
13+
console.log('Started browser', worker.id);
14+
worker.status(function(status) {
15+
console.log('Browser status is:', status);
1716
setTimeout(function() {
18-
instance.stop(function(err, worker) {
19-
console.log(worker);
17+
worker.stop(function(err, worker) {
18+
console.log('Stopped browser', worker);
2019
});
2120
}, 5000);
2221
})

examples/server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ var emitter = launch.server({
77
});
88

99
emitter.on('listening', function(configuration, server) {
10-
console.log('Listening on port ' + configuration.port);
10+
console.log('Listening on port', configuration.port);
1111
});
1212

1313
emitter.on('authorized', function(req, res) {
14-
console.log('Authorized ', req.authorization.basic.username);
14+
console.log('Authorized', req.authorization.basic.username);
1515
});
1616

1717
emitter.on('started', function(info, instance) {
18-
console.log('Started browser ', info)
18+
console.log('Started browser', info)
1919
});
2020

2121
emitter.on('stopped', function(info) {
22-
console.log('Stopped browser ', info);
22+
console.log('Stopped browser', info);
2323
});

lib/remote/server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ module.exports = function (config) {
131131
next(new Error('You are not authorized'));
132132
});
133133

134-
// URL routing
135134
server.get('/', api.index);
136135
server.get('/1/browsers', api.listBrowsers);
137136
server.get('/1/worker', api.listWorkers);

0 commit comments

Comments
 (0)