Commit e3777509 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg

First test of posting status to browserstack.

parent 3656d7b9
var request = require('request')
class BrowserStack {
static reportStatus(sessionID, status, reason) {
let options = {
url: 'https://www.browserstack.com/automate/sessions/' + sessionID + '.json',
method: 'PUT',
json: {
"status": status,
"reason": reason
}
}
// options.url = 'https://bfc.httpjs.net/automate/sessions/' + sessionID + '.json'
console.log("Config", options)
if (!process.env.BROWSERSTACK_USERNAME || !process.env.BROWSERSTACK_ACCESS_KEY) {
throw new Error("Missing credential to post status to Browserstack")
}
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log("Successfully posted status to browserstack for session ID " + sessionID)
} else {
console.error("Error posting status to browserstack status code [" + response.statusCode + "]", error)
console.error("Body ")
console.error(body)
}
}).auth(process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY)
}
}
exports.BrowserStack = BrowserStack
var assert = require('assert');
var Dataporten = require('../../lib/Dataporten')
var BrowserStack = require('../../lib/BrowserStack').BrowserStack
var settings = {
oauthserver: {
......@@ -90,6 +90,11 @@ describe('Login for the first time', function() {
page.debug()
});
});
BrowserStack.reportStatus(browser.requestHandler.sessionID, "error", "Problems yay")
console.log("---- sessionid")
console.log(browser.requestHandler.sessionID)
console.log("----- -----")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment