@auxcode/auxta 1.3.94 → 1.3.96

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.
@@ -25,7 +25,7 @@ function headers(token) {
25
25
  }
26
26
  function auth() {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
- return axios_1.default.post(config_1.config.auxtaURL + 'login', config_1.config.auxtaCredentials, {
28
+ let token = yield axios_1.default.post(config_1.config.auxtaURL + 'login', config_1.config.auxtaCredentials, {
29
29
  headers: {
30
30
  'Content-Type': 'application/json',
31
31
  }
@@ -34,8 +34,22 @@ function auth() {
34
34
  return data.token;
35
35
  })
36
36
  .catch(() => {
37
- throw new Error("Invalid login credentials");
37
+ return false;
38
38
  });
39
+ if (token == false) {
40
+ token = axios_1.default.post(config_1.config.auxtaURL + 'login', config_1.config.auxtaCredentials, {
41
+ headers: {
42
+ 'Content-Type': 'application/json',
43
+ }
44
+ })
45
+ .then(({ data }) => {
46
+ return data.token;
47
+ })
48
+ .catch(() => {
49
+ throw new Error("Invalid login credentials");
50
+ });
51
+ }
52
+ return token;
39
53
  });
40
54
  }
41
55
  function createEmptyReport(body) {
@@ -8,7 +8,7 @@ export declare class FunctionHelper extends ExtendDefaultPage {
8
8
  screenshot(page?: import("puppeteer").Page): Promise<Buffer | undefined>;
9
9
  screenshotCompare(key: string, threshold?: number, page?: import("puppeteer").Page): Promise<void>;
10
10
  suggest(name: string): void;
11
- performanceFail(name: string, screenshot?: ArrayBuffer): void;
11
+ performanceFail(name: string, screenshot?: boolean, page?: import("puppeteer").Page): Promise<void>;
12
12
  clickByText(selector: string, text: string, dotOrText?: string, options?: {}, page?: import("puppeteer").Page, time?: number, log_message?: boolean): Promise<void>;
13
13
  clickByTextWithClass(class_selector: string, class_name: string, selector: string, text: string, dotOrText?: string, page?: import("puppeteer").Page): Promise<void>;
14
14
  waitForSelectorWithText(selector: string, text: string, dotOrText?: string, page?: import("puppeteer").Page): Promise<boolean>;
@@ -56,8 +56,16 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
56
56
  suggest(name) {
57
57
  log_service_1.default.addSuggestion(name);
58
58
  }
59
- performanceFail(name, screenshot) {
60
- log_service_1.default.addPerformanceFail(name, screenshot);
59
+ performanceFail(name, screenshot = true, page = puppeteer_1.default.defaultPage) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ if (screenshot) {
62
+ const screenshotBuffer = yield (0, screenshot_helper_1.captureScreenshotPage)(page);
63
+ log_service_1.default.addPerformanceFail(name, screenshotBuffer);
64
+ }
65
+ else {
66
+ log_service_1.default.addPerformanceFail(name);
67
+ }
68
+ });
61
69
  }
62
70
  clickByText(selector, text, dotOrText = '.', options = {}, page = puppeteer_1.default.defaultPage, time = this.defaultTimeout, log_message = true) {
63
71
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.94",
3
+ "version": "1.3.96",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",