@auxcode/auxta 0.1.4 → 0.1.5
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 +1 -1
- package/src/AuxTA.ts +2 -2
- package/src/auxta/enums/step-status.enum.ts +1 -0
- package/src/auxta/hooks/report.hook.ts +1 -1
- package/src/auxta/models/upload.model.ts +0 -2
- package/src/auxta/services/report.service.ts +1 -1
- package/src/auxta/utilities/screenshot.helper.ts +4 -3
- package/src/puppeteer/puppeteer.ts +5 -5
package/package.json
CHANGED
package/src/AuxTA.ts
CHANGED
|
@@ -2,7 +2,7 @@ import puppeteer, { Puppeteer } from "./puppeteer/puppeteer";
|
|
|
2
2
|
import f, { FunctionHelper } from "./macros/helpers/code.helper";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import fs from "fs";
|
|
5
|
-
import
|
|
5
|
+
import StepStatusEnum from "./auxta/enums/step-status.enum";
|
|
6
6
|
import { UploadModel } from "./auxta/models/upload.model";
|
|
7
7
|
import * as dotenv from "dotenv";
|
|
8
8
|
import { config, setupConfig } from "./auxta/configs/config";
|
|
@@ -50,7 +50,7 @@ class AuxTA {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
public async run(event: any) {
|
|
53
|
-
const model = this.
|
|
53
|
+
const model = this.uploadModel;
|
|
54
54
|
let token: string = event.queryStringParameters.token;
|
|
55
55
|
let reportId: string | undefined = event.queryStringParameters.reportId;
|
|
56
56
|
if (token !== config.token) return {statusCode: 401, message: 'Unauthorized'}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '../services/report.service';
|
|
11
11
|
import { startSuite } from '../utilities/start-suite.helper';
|
|
12
12
|
import { StepStatusEnum } from "../enums/step-status.enum";
|
|
13
|
-
import UploadModel from "../models/upload.model";
|
|
13
|
+
import { UploadModel } from "../models/upload.model";
|
|
14
14
|
|
|
15
15
|
export async function AfterEach(body: any, featureName: string, scenarioName: string, statusCode: number, screenshotBuffer: Buffer, errMessage?: string) {
|
|
16
16
|
let isFinal: boolean = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { Step } from "./log.service";
|
|
3
3
|
import { config } from "../configs/config";
|
|
4
|
-
import UploadModel from "../models/upload.model";
|
|
4
|
+
import { UploadModel } from "../models/upload.model";
|
|
5
5
|
|
|
6
6
|
export interface Feature {
|
|
7
7
|
featureId: string,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import puppeteer from "../../puppeteer/puppeteer";
|
|
2
2
|
|
|
3
3
|
export async function captureScreenshot() {
|
|
4
|
-
const pages = await
|
|
4
|
+
const pages = await puppeteer.defaultPage.browser().pages();
|
|
5
|
+
if (!pages.length) throw `Browser is closed`;
|
|
5
6
|
const lastPage = pages[pages.length - 1];
|
|
6
7
|
|
|
7
8
|
const screenshotBuffer = await lastPage.screenshot({
|
|
@@ -9,7 +10,7 @@ export async function captureScreenshot() {
|
|
|
9
10
|
encoding: 'binary'
|
|
10
11
|
}
|
|
11
12
|
);
|
|
12
|
-
if (Buffer.isBuffer(screenshotBuffer))
|
|
13
|
+
if (Buffer.isBuffer(screenshotBuffer))
|
|
13
14
|
return screenshotBuffer;
|
|
14
15
|
else throw `Failed to capture buffer screenshot`;
|
|
15
16
|
}
|
|
@@ -6,6 +6,8 @@ import auxta from "../AuxTA";
|
|
|
6
6
|
import { StepStatusEnum } from "../auxta/enums/step-status.enum";
|
|
7
7
|
import { UploadModel } from "../auxta/models/upload.model";
|
|
8
8
|
import puppeteer_core from 'puppeteer-core';
|
|
9
|
+
import { config } from "./../auxta/configs/config";
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
export class Puppeteer {
|
|
11
13
|
public defaultPage!: puppeteer_core.Page;
|
|
@@ -21,15 +23,13 @@ export class Puppeteer {
|
|
|
21
23
|
'--disable-dev-shm-usage',
|
|
22
24
|
'--single-process'
|
|
23
25
|
],
|
|
24
|
-
defaultViewport:
|
|
26
|
+
defaultViewport: null,
|
|
25
27
|
// Return back to headless for commit
|
|
26
28
|
headless: process.env.ENVIRONMENT == 'LOCAL' ? false : chromium.headless
|
|
27
29
|
});
|
|
28
30
|
this.defaultPage = (await this.browser.pages())[0];
|
|
29
|
-
await this.defaultPage.
|
|
30
|
-
|
|
31
|
-
height: 900
|
|
32
|
-
});
|
|
31
|
+
await this.defaultPage.goto(config.baseURL)
|
|
32
|
+
await this.defaultPage.waitForNetworkIdle();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public async close() {
|