automation_model 1.0.594-dev → 1.0.596-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.
- package/lib/command_common.d.ts +2 -2
- package/lib/command_common.js +25 -8
- package/lib/command_common.js.map +1 -1
- package/lib/stable_browser.d.ts +3 -2
- package/lib/stable_browser.js +195 -63
- package/lib/stable_browser.js.map +1 -1
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +56 -1
- package/lib/utils.js.map +1 -1
- package/package.json +1 -1
package/lib/command_common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare function _preCommand(state: any, stable: any): Promise<void>;
|
|
1
|
+
export declare function _preCommand(state: any, stable: any, world?: any): Promise<void>;
|
|
2
2
|
export declare function _commandError(state: any, error: any, stable: any): Promise<void>;
|
|
3
|
-
export declare function _screenshot(state: any, stable: any): Promise<void>;
|
|
3
|
+
export declare function _screenshot(state: any, stable: any, specificElement?: any): Promise<void>;
|
|
4
4
|
export declare function _commandFinally(state: any, stable: any): void;
|
|
5
5
|
export declare function _validateSelectors(selectors: any): void;
|
|
6
6
|
export declare function _reportToWorld(world: any, properties: any): void;
|
package/lib/command_common.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getHumanReadableErrorMessage } from "./error-messages.js";
|
|
2
2
|
import { LocatorLog } from "./locator_log.js";
|
|
3
3
|
import { _fixUsingParams, maskValue } from "./utils.js";
|
|
4
|
-
export async function _preCommand(state, stable) {
|
|
4
|
+
export async function _preCommand(state, stable, world) {
|
|
5
5
|
if (!state) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
@@ -66,11 +66,21 @@ export async function _preCommand(state, stable) {
|
|
|
66
66
|
await _screenshot(state, stable);
|
|
67
67
|
}
|
|
68
68
|
if (state.highlight === true) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
if (world && world.screenshot && !world.screenshotPath) {
|
|
70
|
+
stable._highlightElements(state.element).then(async () => {
|
|
71
|
+
// console.log(`Highlighted in _preCommand`);
|
|
72
|
+
new Promise((r) => setTimeout(r, 1000)).then(async () => {
|
|
73
|
+
stable._unhighlightElements(state.element).then(() => {
|
|
74
|
+
// console.log(`Unhighlighted in _preCommand`);
|
|
75
|
+
}).catch((e) => {
|
|
76
|
+
// console.log(`Unhighlighting failed in _preCommand: ${e}`);
|
|
77
|
+
});
|
|
78
|
+
}).catch((e) => {
|
|
79
|
+
// console.log(`Error inbetween highlighting and unhighlighting: ${e}`);
|
|
80
|
+
});
|
|
81
|
+
}).catch((e) => {
|
|
82
|
+
// console.log(`Error in highlighting: ${e}`);
|
|
83
|
+
});
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
86
|
state.info.failCause.operationFailed = true;
|
|
@@ -108,8 +118,15 @@ export async function _commandError(state, error, stable) {
|
|
|
108
118
|
throw error;
|
|
109
119
|
}
|
|
110
120
|
}
|
|
111
|
-
export async function _screenshot(state, stable) {
|
|
112
|
-
|
|
121
|
+
export async function _screenshot(state, stable, specificElement) {
|
|
122
|
+
let focusedElement = null;
|
|
123
|
+
if (specificElement !== undefined) {
|
|
124
|
+
focusedElement = specificElement;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
focusedElement = state.element;
|
|
128
|
+
}
|
|
129
|
+
const { screenshotId, screenshotPath } = await stable._screenShot(state.options, state.world, state.info, focusedElement);
|
|
113
130
|
state.screenshotId = screenshotId;
|
|
114
131
|
state.screenshotPath = screenshotPath;
|
|
115
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command_common.js","sourceRoot":"","sources":["../../src/command_common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,C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Y,CAAC,CAAC;AAC5C,CAAC;AACD,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAC/C,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;KACtC;IACD,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAC/C;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;KAC5D;IACD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACtE;AACH,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,KAAU,EAAE,UAAe;IACxD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QAC3B,OAAO;KACR;IACD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
package/lib/stable_browser.d.ts
CHANGED
|
@@ -120,8 +120,8 @@ declare class StableBrowser {
|
|
|
120
120
|
};
|
|
121
121
|
loadTestDataAsync(type: string, dataSelector: string, world?: null): Promise<any>;
|
|
122
122
|
getTestData(world?: null): {};
|
|
123
|
-
_screenShot(options?: {}, world?: null, info?: null): Promise<{}>;
|
|
124
|
-
takeScreenshot(screenshotPath: any): Promise<any>;
|
|
123
|
+
_screenShot(options?: {}, world?: null, info?: null, focusedElement?: null): Promise<{}>;
|
|
124
|
+
takeScreenshot(screenshotPath: any, focusedElement?: null): Promise<any>;
|
|
125
125
|
verifyElementExistInPage(selectors: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
126
126
|
extractAttribute(selectors: any, attribute: any, variable: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
127
127
|
verifyAttribute(selectors: any, attribute: any, value: any, _params?: null, options?: {}, world?: null): Promise<any>;
|
|
@@ -130,6 +130,7 @@ declare class StableBrowser {
|
|
|
130
130
|
emailCode: any;
|
|
131
131
|
}>;
|
|
132
132
|
_highlightElements(scope: any, css: any): Promise<void>;
|
|
133
|
+
_unhighlightElements(scope: any, css: any): Promise<void>;
|
|
133
134
|
verifyPagePath(pathPart: any, options?: {}, world?: null): Promise<{} | undefined>;
|
|
134
135
|
findTextInAllFrames(dateAlternatives: any, numberAlternatives: any, text: any, state: any): Promise<{
|
|
135
136
|
elementCount: number;
|