|
1 | | -import LambdaRestClient from '@lambdatest/node-rest-client' |
2 | 1 | import logger from '@wdio/logger' |
3 | 2 |
|
4 | | -import { getParentSuiteName } from './util.js' |
| 3 | +import { getParentSuiteName, updateSessionById } from './util.js' |
5 | 4 |
|
6 | 5 | const log = logger('@wdio/lambdatest-service') |
7 | 6 |
|
@@ -29,6 +28,7 @@ export default class LambdaRestService { |
29 | 28 | _testTitle; |
30 | 29 | _error; |
31 | 30 | _ltErrorRemark; |
| 31 | + _lambdaCredentials; |
32 | 32 |
|
33 | 33 | constructor(options = {}, capabilities = {}, config = {}) { |
34 | 34 | this._options = { ...DEFAULT_OPTIONS, ...options }; |
@@ -71,12 +71,8 @@ export default class LambdaRestService { |
71 | 71 | } |
72 | 72 |
|
73 | 73 | this._isServiceEnabled = lambdaCredentials.username && lambdaCredentials.accessKey; |
74 | | - |
75 | | - try { |
76 | | - this._api = LambdaRestClient.AutomationClient(lambdaCredentials); |
77 | | - } catch (_) { |
78 | | - this._isServiceEnabled = false; |
79 | | - } |
| 74 | + this._lambdaCredentials=lambdaCredentials; |
| 75 | + |
80 | 76 | } |
81 | 77 |
|
82 | 78 | async beforeScenario(world, context) { |
@@ -273,18 +269,7 @@ export default class LambdaRestService { |
273 | 269 | { |
274 | 270 | await this._setSessionRemarks(this._error); |
275 | 271 | } |
276 | | - |
277 | | - await new Promise((resolve, reject) => { |
278 | | - if (!this._api) { |
279 | | - return reject(new Error('LambdaTest service is not enabled')); |
280 | | - } |
281 | | - this._api.updateSessionById(sessionId, body, (err, result) => { |
282 | | - if (err) { |
283 | | - return reject(err); |
284 | | - } |
285 | | - return resolve(result); |
286 | | - }); |
287 | | - }); |
| 272 | + await updateSessionById(sessionId, body, this._lambdaCredentials); |
288 | 273 | } catch (ex) { |
289 | 274 | console.log(ex); |
290 | 275 | } |
|
0 commit comments