UNPKG

@testim/testim-cli

Version:

Command line interface for running Testing on you CI

54 lines (46 loc) 1.65 kB
var firebaseConnection = require('./testimFirebaseConnection.js'); var Promise = require('bluebird'); var TestRun = function(executionId, testId, testName){ this._executionId = executionId; this._testId = testId; this._testName = testName; }; TestRun.prototype.getTestUrl = function(baseUrl){ var executionRunUrl = "http://run.testim.io/" + firebaseConnection.getToken() + "/" + firebaseConnection.getProject() + "/" + this._executionId + "/" + this._testId; if(baseUrl){ executionRunUrl += '?baseUrl=' + baseUrl; } return executionRunUrl; }; TestRun.prototype.getTestId = function(){ return this._testId; }; TestRun.prototype.getTestName = function(){ return this._testName; }; TestRun.prototype.clearTestResult = function() { return firebaseConnection.clearTestResult(this._executionId, this._testId); }; TestRun.prototype.onStarted = function(){ return new Promise(function(resolve) { firebaseConnection.waitForTestStart(this._executionId, this._testId) .then(function(){ return resolve(); }.bind(this)); }.bind(this)); }; TestRun.prototype.onCompleted = function(){ return new Promise(function(resolve) { firebaseConnection.waitForTestResult(this._executionId, this._testId) .then(function(testResult){ var resultObject = {}; resultObject[this._testId] = testResult; return resolve(resultObject); }.bind(this)); }.bind(this)); }; module.exports = TestRun;