@auxcode/auxta 0.4.0 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "0.4.0",
3
+ "version": "0.4.4",
4
4
  "description": "",
5
5
  "main": "src/AuxTA.ts",
6
6
  "scripts": {
package/src/AuxTA.ts CHANGED
@@ -41,7 +41,7 @@ class AuxTA extends FunctionHelper {
41
41
  } catch (e) {
42
42
  console.log("Missing field in auxta.json:", e)
43
43
  }
44
- this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct);
44
+ this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct,jsonConfig.environment);
45
45
  } catch (e) {
46
46
  console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
47
47
  console.log(e);
@@ -43,11 +43,7 @@ export async function onTestEnd(body: any, featureName: string, scenarioName: st
43
43
  }
44
44
  }
45
45
  if (isFinal) await afterComplete(body);
46
- else if (body && body.nextSuites && body.nextSuites[0])
47
- try {
48
- await startSuite(body.nextSuites, body.reportId);
49
- } catch {
50
- }
46
+ else if (body && body.nextSuites) await startSuite(body.nextSuites, body.reportId);
51
47
  }
52
48
 
53
49
  export async function afterComplete(body: UploadModel) {
@@ -7,12 +7,12 @@ export class UploadModel {
7
7
  private readonly _organization: string;
8
8
  private _environment: string;
9
9
 
10
- constructor(org: string, baseUrl: string, digitalProduct: string) {
10
+ constructor(org: string, baseUrl: string, digitalProduct: string, environment: string) {
11
11
  this._reportId = '';
12
12
  this._nextSuites = [];
13
13
  this._organization = org;
14
14
  this._digitalProduct = digitalProduct;
15
- this._environment = process.env.NODE_ENV || "";
15
+ this._environment = environment;
16
16
  this._baseUrl = baseUrl;
17
17
  }
18
18
 
@@ -29,6 +29,12 @@ export class LogSteps {
29
29
 
30
30
  public clear() {
31
31
  this.stepLog = [];
32
+ this.statusCounter = {
33
+ [StatusOfStep.PASSED]: 0,
34
+ [StatusOfStep.FAILED]: 0,
35
+ [StatusOfStep.SKIPPED]: 0,
36
+ [StatusOfStep.SUGGESTION]: 0,
37
+ }
32
38
  }
33
39
 
34
40
  public push(keyword: string, name: string, status: StatusOfStep) {
@@ -1,11 +1,16 @@
1
1
  import axios from 'axios';
2
2
  import { config } from "../configs/config";
3
3
 
4
- export function startSuite(suites: string[], reportId?: string) {
5
- console.log('Starting next suite: ' + suites[0]);
6
- //todo on error, end the test
7
- return axios.post(
8
- `${config.netlifyPath}.netlify/functions/${suites.shift()}?token=${config.token}`,
9
- { nextSuites: suites, reportId: reportId}
10
- );
4
+ export async function startSuite(suites: string[], reportId?: string) {
5
+ if (suites.length === 0) return;
6
+ const next = suites.shift();
7
+ console.log('Starting next suite: ' + next);
8
+ try{
9
+ await axios.post(
10
+ `${config.netlifyPath}.netlify/functions/${next}?token=${config.token}`,
11
+ {nextSuites: suites, reportId: reportId})
12
+ } catch (e){
13
+ // skip the suite if not found
14
+ await startSuite(suites, reportId);
15
+ }
11
16
  }
@@ -16,17 +16,14 @@ export class Puppeteer {
16
16
 
17
17
  public async startBrowser() {
18
18
  let args = [
19
- '--start-maximized',
20
- '--no-sandbox',
21
- '--disable-setuid-sandbox',
22
- '--disable-dev-shm-usage',
23
- '--single-process'
19
+ '--start-maximized'
24
20
  ];
25
21
  if (process.env.ENVIRONMENT != 'LOCAL')
26
22
  args.push(`--window-size=${config.screenWidth},${config.screenHeight}`)
27
23
  this.browser = await chromium.puppeteer.launch({
28
24
  executablePath: process.env.ENVIRONMENT === 'LOCAL' ? undefined : await chromium.executablePath,
29
25
  args,
26
+ ignoreDefaultArgs: ["--enable-automation"],
30
27
  defaultViewport: process.env.ENVIRONMENT === 'LOCAL' ? null : {
31
28
  width: config.screenWidth,
32
29
  height: config.screenHeight
@@ -69,7 +66,7 @@ export class Puppeteer {
69
66
  await callback(event)
70
67
  log.push('When', `Finished puppeteer process`, StatusOfStep.PASSED);
71
68
  } catch (err) {
72
- console.log(`Error ${err}`);
69
+ console.log("Error", err);
73
70
  errMessage = err;
74
71
  statusCode = 500;
75
72
  screenshotBuffer = await captureScreenshot();
@@ -85,7 +82,7 @@ export class Puppeteer {
85
82
  error: errMessage
86
83
  });
87
84
  } catch (e){
88
- console.log(e);
85
+ console.log("Lib error:", e);
89
86
  } finally {
90
87
  log.clear();
91
88
  }