Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit bee998d

Browse files
committed
chore(webdriver): update the configuration file
closes #2402
1 parent ebc5472 commit bee998d

File tree

4 files changed

+47
-26
lines changed

4 files changed

+47
-26
lines changed

Diff for: README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ Clone the github repository:
4545
npm install
4646
cd ..
4747

48-
Start up a selenium server. By default, the tests expect the selenium server to be running at `http://localhost:4444/wd/hub`. A selenium server can be started with `webdriver-manager`.
48+
Start up a selenium server. By default, the tests expect the selenium server to be running at `http://localhost:4444/wd/hub`. A selenium server can be started with [webdriver-manager](https://github.com/angular/webdriver-manager).
4949

50-
bin/webdriver-manager start
50+
webdriver-manager update
51+
webdriver-manager start
5152

5253
Protractor's test suite runs against the included test application. Start that up with
5354

Diff for: config.json

+6
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33
"selenium": "2.53.0",
44
"chromedriver": "2.21",
55
"iedriver": "2.53.1"
6+
},
7+
"cdnUrls": {
8+
"selenium": "https://selenium-release.storage.googleapis.com/",
9+
"chromedriver": "https://chromedriver.storage.googleapis.com/",
10+
"iedriver": "https://selenium-release.storage.googleapis.com/"
611
}
12+
713
}

Diff for: lib/driverProviders/browserStack.ts

+37-23
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* It is responsible for setting up the account object, tearing
44
* it down, and setting up the driver correctly.
55
*/
6-
import * as request from 'request';
6+
import * as https from 'https';
7+
import * as querystring from 'querystring';
78
import * as q from 'q';
89
import * as util from 'util';
910

@@ -26,33 +27,46 @@ export class BrowserStack extends DriverProvider {
2627
let deferredArray = this.drivers_.map((driver: webdriver.WebDriver) => {
2728
let deferred = q.defer();
2829
driver.getSession().then((session: webdriver.Session) => {
29-
var jobStatus = update.passed ? 'completed' : 'error';
30+
let jobStatus = update.passed ? 'completed' : 'error';
3031
logger.info(
3132
'BrowserStack results available at ' +
3233
'https://www.browserstack.com/automate');
33-
request(
34-
{
35-
url: 'https://www.browserstack.com/automate/sessions/' +
36-
session.getId() + '.json',
37-
headers: {
38-
'Content-Type': 'application/json',
39-
'Authorization': 'Basic ' +
40-
new Buffer(
41-
this.config_.browserstackUser + ':' +
42-
this.config_.browserstackKey)
43-
.toString('base64')
44-
},
45-
method: 'PUT',
46-
form: {'status': jobStatus}
34+
let putData = querystring.stringify({'status': jobStatus});
35+
let putRequest = https.request({
36+
hostname: 'www.browserstack.com',
37+
port: 443,
38+
path: '/automate/sessions/' + session.getId() + '.json',
39+
headers: {
40+
'Content-Type': 'application/json',
41+
'Content-Length': Buffer.byteLength(putData),
42+
'Authorization': 'Basic ' +
43+
new Buffer(
44+
this.config_.browserstackUser + ':' +
45+
this.config_.browserstackKey)
46+
.toString('base64')
4747
},
48-
(error: Error) => {
49-
if (error) {
50-
throw new Error(
51-
'Error updating BrowserStack pass/fail status: ' +
52-
util.inspect(error));
53-
}
48+
method: 'PUT'
49+
},
50+
(res) => {
51+
res.on('data', (chunk: any) => {
52+
console.log('Response: ', chunk.toString());
5453
});
55-
deferred.resolve();
54+
res.on('error', (error: Error) => {
55+
console.log(error);
56+
})
57+
res.on('finish', () => {
58+
deferred.resolve();
59+
});
60+
});
61+
putRequest.on('error', (error: Error) => {
62+
if (error) {
63+
throw new Error(
64+
'Error updating BrowserStack pass/fail status: ' +
65+
util.inspect(error));
66+
}
67+
});
68+
putRequest.write(putData);
69+
putRequest.end();
5670
});
5771
return deferred.promise;
5872
});

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
},
4949
"bin": {
5050
"protractor": "bin/protractor",
51-
"webdriver-manager": "bin/webdriver-manager"
51+
"webdriver": "bin/webdriver-manager"
5252
},
5353
"main": "built/protractor.js",
5454
"scripts": {

0 commit comments

Comments
 (0)