automation_model 1.0.471-dev → 1.0.473-dev

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.
@@ -0,0 +1,5 @@
1
+ export declare function _preCommand(state: any, stable: any): Promise<void>;
2
+ export declare function _commandError(state: any, error: any, stable: any): Promise<void>;
3
+ export declare function _screenshot(state: any, stable: any): Promise<void>;
4
+ export declare function _commandFinally(state: any, stable: any): void;
5
+ export declare function _validateSelectors(selectors: any): void;
@@ -0,0 +1,102 @@
1
+ export async function _preCommand(state, stable) {
2
+ if (!state) {
3
+ return;
4
+ }
5
+ if (state.selectors) {
6
+ _validateSelectors(state.selectors);
7
+ }
8
+ if (state.locate !== false) {
9
+ state.locate = true;
10
+ }
11
+ if (state.scroll !== false) {
12
+ state.scroll = true;
13
+ }
14
+ if (state.screenshot !== false) {
15
+ state.screenshot = true;
16
+ }
17
+ if (state.highlight !== false) {
18
+ state.highlight = true;
19
+ }
20
+ state.info = {};
21
+ if (state.value) {
22
+ state.value = stable._fixUsingParams(state.value, state._params);
23
+ state.info.value = state.value;
24
+ }
25
+ state.startTime = Date.now();
26
+ state.info.selectors = state.selectors;
27
+ state.info.log = state.log ? state.log : "";
28
+ state.info.operation = state.operation;
29
+ state.error = null;
30
+ state.screenshotId = null;
31
+ state.screenshotPath = null;
32
+ if (state.locate === true) {
33
+ state.element = await stable._locate(state.selectors, state.info, state._params);
34
+ }
35
+ if (state.scroll === true) {
36
+ await stable.scrollIfNeeded(state.element, state.info);
37
+ }
38
+ if (state.screenshot === true) {
39
+ await _screenshot(state, stable);
40
+ }
41
+ if (state.highlight === true) {
42
+ try {
43
+ await stable._highlightElements(state.element);
44
+ }
45
+ catch (e) {
46
+ // ignore
47
+ }
48
+ }
49
+ }
50
+ export async function _commandError(state, error, stable) {
51
+ stable.logger.error(state.text + " failed " + state.info.log);
52
+ const { screenshotId, screenshotPath } = await stable._screenShot(state.options, state.world, state.info);
53
+ state.screenshotId = screenshotId;
54
+ state.screenshotPath = screenshotPath;
55
+ state.info.screenshotPath = screenshotPath;
56
+ Object.assign(error, { info: state.info });
57
+ state.error = error;
58
+ throw error;
59
+ }
60
+ export async function _screenshot(state, stable) {
61
+ const { screenshotId, screenshotPath } = await stable._screenShot(state.options, state.world, state.info);
62
+ state.screenshotId = screenshotId;
63
+ state.screenshotPath = screenshotPath;
64
+ }
65
+ export function _commandFinally(state, stable) {
66
+ var _a;
67
+ state.endTime = Date.now();
68
+ stable._reportToWorld(state.world, {
69
+ element_name: state.selectors.element_name,
70
+ type: state.type,
71
+ text: state.text,
72
+ screenshotId: state.screenshotId,
73
+ result: state.error
74
+ ? {
75
+ status: "FAILED",
76
+ startTime: state.startTime,
77
+ endTime: state.endTime,
78
+ message: (_a = state.error) === null || _a === void 0 ? void 0 : _a.message,
79
+ }
80
+ : {
81
+ status: "PASSED",
82
+ startTime: state.startTime,
83
+ endTime: state.endTime,
84
+ },
85
+ info: state.info,
86
+ });
87
+ }
88
+ export function _validateSelectors(selectors) {
89
+ if (!selectors) {
90
+ throw new Error("selectors is null");
91
+ }
92
+ if (!selectors.locators) {
93
+ throw new Error("selectors.locators is null");
94
+ }
95
+ if (!Array.isArray(selectors.locators)) {
96
+ throw new Error("selectors.locators expected to be array");
97
+ }
98
+ if (selectors.locators.length === 0) {
99
+ throw new Error("selectors.locators expected to be non empty array");
100
+ }
101
+ }
102
+ //# sourceMappingURL=command_common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command_common.js","sourceRoot":"","sources":["../../src/command_common.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAU,EAAE,MAAW;IACvD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;KACR;IACD,IAAI,KAAK,CAAC,SAAS,EAAE;QACnB,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;KACrC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,EAAE;QAC1B,KAAK,CA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yC,CAAC,CAAC;KAC5D;IACD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;AACH,CAAC"}
@@ -20,7 +20,6 @@ declare class StableBrowser {
20
20
  registerConsoleLogListener(page: Page, context: any): void;
21
21
  registerRequestListener(page: Page, context: any, logFile: string): void;
22
22
  goto(url: string): Promise<void>;
23
- _validateSelectors(selectors: any): void;
24
23
  _fixUsingParams(text: any, _params: Params): any;
25
24
  _fixLocatorUsingParams(locator: any, _params: Params): any;
26
25
  _isObject(value: any): any;
@@ -39,15 +38,15 @@ declare class StableBrowser {
39
38
  }>;
40
39
  simpleClick(elementDescription: any, _params?: Params, options?: {}, world?: null): Promise<void>;
41
40
  simpleClickType(elementDescription: any, value: any, _params?: Params, options?: {}, world?: null): Promise<void>;
42
- click(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
43
- setCheck(selectors: any, checked?: boolean, _params?: Params, options?: {}, world?: null): Promise<{}>;
44
- hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<{}>;
45
- selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<{}>;
46
- type(_value: any, _params?: null, options?: {}, world?: null): Promise<{}>;
41
+ click(selectors: any, _params?: Params, options?: {}, world?: null): Promise<any>;
42
+ setCheck(selectors: any, checked?: boolean, _params?: Params, options?: {}, world?: null): Promise<any>;
43
+ hover(selectors: any, _params?: Params, options?: {}, world?: null): Promise<any>;
44
+ selectOption(selectors: any, values: any, _params?: null, options?: {}, world?: null): Promise<any>;
45
+ type(_value: any, _params?: null, options?: {}, world?: null): Promise<any>;
47
46
  setInputValue(selectors: any, value: any, _params?: null, options?: {}, world?: null): Promise<void>;
48
47
  setDateTime(selectors: any, value: any, format?: null, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<void>;
49
- clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
50
- fill(selectors: any, value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<{}>;
48
+ clickType(selectors: any, _value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<any>;
49
+ fill(selectors: any, value: any, enter?: boolean, _params?: null, options?: {}, world?: null): Promise<any>;
51
50
  getText(selectors: any, _params?: null, options?: {}, info?: {}, world?: null): Promise<{
52
51
  text: any;
53
52
  screenshotId: any;
@@ -74,8 +73,8 @@ declare class StableBrowser {
74
73
  value: any;
75
74
  element?: undefined;
76
75
  }>;
77
- containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<{}>;
78
- containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<{}>;
76
+ containsPattern(selectors: any, pattern: any, text: any, _params?: null, options?: {}, world?: null): Promise<any>;
77
+ containsText(selectors: any, text: any, climb: any, _params?: null, options?: {}, world?: null): Promise<any>;
79
78
  _getDataFile(world?: null): string;
80
79
  waitForUserInput(message: any, world?: null): Promise<void>;
81
80
  setTestData(testData: any, world?: null): void;
@@ -90,7 +89,7 @@ declare class StableBrowser {
90
89
  getTestData(world?: null): {};
91
90
  _screenShot(options?: {}, world?: null, info?: null): Promise<{}>;
92
91
  takeScreenshot(screenshotPath: any): Promise<any>;
93
- verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<{}>;
92
+ verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
94
93
  extractAttribute(selectors: any, attribute: any, variable: any, _params?: null, options?: {}, world?: null): Promise<{}>;
95
94
  extractEmailData(emailAddress: any, options: any, world: any): Promise<{
96
95
  emailUrl: any;