@auxcode/auxta 1.3.109 → 1.3.112

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/README.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # AuxTA
2
2
 
3
+ ## Guidelines for the Frontend Programmers
4
+
5
+ Every HTML element on a web page can be a selector, which can be used to create AuxTA scenarios.
6
+
7
+ Of course, not all HTML elemets are used as selectors to create AuxTA scenarios.
8
+
9
+ Those HTML elements, which will be used as selectors for AuxTA scenarios, should have a Unique ID. This way AuxTA scenarios are created the fastest.
10
+
11
+ The best candidate for this is the HTML "id" attribute.
12
+
13
+ The ID value should reflect the functionality of the place.
14
+
15
+ To create a unique ID, make it multipart, beginning with more general parts which are guaranteed to be unique. This way one creates namespaces, which make it easier after that to end up with a unique ID.
16
+
17
+ For expmple:
18
+
19
+ id="shop_cart_button_submit"
20
+
21
+ More than one of the same element, For example several tables on one page, each should have a unique ID.
22
+
23
+ If it has nested elements they can have the same selectors as in the other elements, but it’s not necessary.
24
+
3
25
  ## Implementing
4
26
 
5
27
  The main thing is a `scenario`.
@@ -28,6 +50,14 @@ waitforseelctorbytext `depreciated`
28
50
 
29
51
  ### Complex Workflows
30
52
 
53
+ #### Use Bulilding Blocks
54
+
55
+ Building Blocks do one simple thing each and allow you to build State Scripts and Scenrios.
56
+
57
+ #### Use State Scripts
58
+
59
+ State Scripts bring the system to a desired state from which a specific scenario begins.
60
+
31
61
  #### Email
32
62
 
33
63
  * (AuxTA) We do some action on the website.
@@ -106,4 +136,4 @@ control click go to source directory
106
136
 
107
137
  Also some improvements to the platform in general:
108
138
 
109
- * get the console state after a fail, this would increase the value of each failed report.
139
+ * get the console state after a fail, this would increase the value of each failed report.
@@ -24,7 +24,7 @@ export declare class LogSteps {
24
24
  };
25
25
  private stepLog;
26
26
  private lastStepTime;
27
- private _tag;
27
+ private _tags;
28
28
  addSuggestion(text: string): void;
29
29
  addPerformanceFail(text: string, screenshot?: ArrayBuffer): void;
30
30
  clear(): void;
@@ -33,6 +33,7 @@ export declare class LogSteps {
33
33
  getStatusCount(status: StatusOfStep): number;
34
34
  get tag(): string;
35
35
  set tag(value: string);
36
+ clearTag(): void;
36
37
  }
37
38
  declare const log: LogSteps;
38
39
  export default log;
@@ -14,12 +14,12 @@ class LogSteps {
14
14
  };
15
15
  this.stepLog = [];
16
16
  this.lastStepTime = new Date().getTime();
17
- this._tag = 'default';
17
+ this._tags = ['default'];
18
18
  }
19
19
  addSuggestion(text) {
20
20
  this.statusCounter[status_of_step_1.StatusOfStep.SUGGESTION]++;
21
21
  this.stepLog.push({
22
- keyword: 'Suggestion', tag: this._tag, name: text, imageCompareKey: '', result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
22
+ keyword: 'Suggestion', tag: this.tag, name: text, imageCompareKey: '', result: { status: status_of_step_1.StatusOfStep.SUGGESTION, duration: 0 }
23
23
  });
24
24
  }
25
25
  addPerformanceFail(text, screenshot = new ArrayBuffer(0)) {
@@ -32,7 +32,7 @@ class LogSteps {
32
32
  };
33
33
  this.stepLog.push({
34
34
  keyword: 'PerformanceFail',
35
- tag: this._tag,
35
+ tag: this.tag,
36
36
  name: text,
37
37
  imageCompareKey: '',
38
38
  result: { status: status_of_step_1.StatusOfStep.PERFORMANCE_FAIL, duration: currentStep - this.lastStepTime, embedding: embedding }
@@ -41,7 +41,7 @@ class LogSteps {
41
41
  else {
42
42
  this.stepLog.push({
43
43
  keyword: 'PerformanceFail',
44
- tag: this._tag,
44
+ tag: this.tag,
45
45
  name: text,
46
46
  imageCompareKey: '',
47
47
  result: { status: status_of_step_1.StatusOfStep.PERFORMANCE_FAIL, duration: currentStep - this.lastStepTime }
@@ -95,10 +95,13 @@ class LogSteps {
95
95
  return this.statusCounter[status];
96
96
  }
97
97
  get tag() {
98
- return this._tag;
98
+ return this._tags.length === 1 ? this._tags[0] : this._tags[1];
99
99
  }
100
100
  set tag(value) {
101
- this._tag = value;
101
+ this._tags.push(value);
102
+ }
103
+ clearTag() {
104
+ this._tags.pop();
102
105
  }
103
106
  }
104
107
  exports.LogSteps = LogSteps;
@@ -7,6 +7,7 @@ export declare class FunctionHelper extends ExtendDefaultPage {
7
7
  log(keyword: string, name: string, status: StatusOfStep, screenshot?: ArrayBuffer): void;
8
8
  setTag(tag: string): void;
9
9
  clearTag(): void;
10
+ callREST(method: string, url: string, headers?: object, body?: object): Promise<import("axios").AxiosResponse<any, any>>;
10
11
  screenshot(page?: import("puppeteer").Page): Promise<Buffer | undefined>;
11
12
  screenshotCompare(key: string, threshold?: number, page?: import("puppeteer").Page): Promise<void>;
12
13
  suggest(name: string): void;
@@ -21,17 +21,27 @@ const extend_default_page_1 = require("./extend-default-page");
21
21
  const puppeteer_2 = require("puppeteer");
22
22
  const screenshot_helper_1 = require("../../auxta/utilities/screenshot.helper");
23
23
  const report_service_1 = require("../../auxta/services/report.service");
24
+ const axios_1 = __importDefault(require("axios"));
24
25
  class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
25
26
  log(keyword, name, status, screenshot) {
26
27
  log_service_1.default.push(keyword, log_service_1.default.tag, name, status, screenshot);
27
28
  }
28
29
  setTag(tag) {
29
- if (!log_service_1.default.tag || log_service_1.default.tag === '' || log_service_1.default.tag === 'default') {
30
- log_service_1.default.tag = tag;
31
- }
30
+ log_service_1.default.tag = tag;
32
31
  }
33
32
  clearTag() {
34
- log_service_1.default.tag = '';
33
+ log_service_1.default.clearTag();
34
+ }
35
+ callREST(method, url, headers, body) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const response = yield (0, axios_1.default)({
38
+ method: method,
39
+ url: url,
40
+ headers: headers,
41
+ data: body
42
+ });
43
+ return response;
44
+ });
35
45
  }
36
46
  screenshot(page = puppeteer_1.default.defaultPage) {
37
47
  return __awaiter(this, void 0, void 0, function* () {
@@ -262,7 +272,7 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
262
272
  }
263
273
  yield this.timeout(1000);
264
274
  yield loginPage.keyboard.press('Enter');
265
- if (!staySignIn) {
275
+ if (staySignIn) {
266
276
  yield this.waitForResponse('2_11d9e3bcdfede9ce5ce5ace2d129f1c4', true, loginPage);
267
277
  yield this.timeout(1000);
268
278
  yield loginPage.keyboard.press('Enter');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.109",
3
+ "version": "1.3.112",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",