tomation 0.0.5 → 0.0.6
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/dist/{actions.d.ts → dom/actions.d.ts} +1 -1
- package/dist/dsl/actions.d.ts +53 -0
- package/dist/dsl/task.d.ts +2 -0
- package/dist/dsl/test.d.ts +4 -0
- package/dist/dsl/ui-element-filters.d.ts +12 -0
- package/dist/{ui-element-builder.d.ts → dsl/ui-element.d.ts} +1 -13
- package/dist/engine/compiler.d.ts +8 -0
- package/dist/engine/events.d.ts +25 -0
- package/dist/engine/runner.d.ts +49 -0
- package/dist/feedback/logger.d.ts +7 -0
- package/dist/main.cjs +1 -1
- package/dist/main.d.ts +13 -4
- package/dist/main.js +569 -631
- package/dist/tomation.d.ts +9 -0
- package/package.json +2 -1
- package/dist/automation.d.ts +0 -131
- /package/dist/{ui-utils.d.ts → feedback/ui-utils.d.ts} +0 -0
- /package/dist/{date-utils.d.ts → utils/date-utils.d.ts} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { UIElement } from "./ui-element";
|
|
2
|
+
import { KEY_MAP } from '../dom/actions';
|
|
3
|
+
declare const Click: (uiElement: UIElement) => void;
|
|
4
|
+
declare const Assert: (uiElement: UIElement) => {
|
|
5
|
+
textIs: (text: string) => void;
|
|
6
|
+
containsText: (text: string) => void;
|
|
7
|
+
valueIs: (value: string) => void;
|
|
8
|
+
exists: () => void;
|
|
9
|
+
notExists: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare const Select: (value: string) => {
|
|
12
|
+
in: (uiElement: UIElement) => void;
|
|
13
|
+
};
|
|
14
|
+
declare const Type: (value: string) => {
|
|
15
|
+
in: (uiElement: UIElement) => void;
|
|
16
|
+
};
|
|
17
|
+
declare const ClearValue: () => {
|
|
18
|
+
in: (uiElement: UIElement) => void;
|
|
19
|
+
};
|
|
20
|
+
declare const PressEscKey: () => {
|
|
21
|
+
in: (uiElement: UIElement) => void;
|
|
22
|
+
};
|
|
23
|
+
declare const PressDownKey: () => {
|
|
24
|
+
in: (uiElement: UIElement) => void;
|
|
25
|
+
};
|
|
26
|
+
declare const PressTabKey: () => {
|
|
27
|
+
in: (uiElement: UIElement) => void;
|
|
28
|
+
};
|
|
29
|
+
declare const PressEnterKey: () => {
|
|
30
|
+
in: (uiElement: UIElement) => void;
|
|
31
|
+
};
|
|
32
|
+
declare const PressKey: (key: KEY_MAP) => {
|
|
33
|
+
in: (uiElement: UIElement) => void;
|
|
34
|
+
};
|
|
35
|
+
declare const TypePassword: (value: string) => {
|
|
36
|
+
in: (uiElement: UIElement) => void;
|
|
37
|
+
};
|
|
38
|
+
declare const UploadFile: (file: File) => {
|
|
39
|
+
in: (uiElement: UIElement) => void;
|
|
40
|
+
};
|
|
41
|
+
declare const SaveValue: (uiElement: UIElement) => {
|
|
42
|
+
in: (memorySlotName: string) => void;
|
|
43
|
+
};
|
|
44
|
+
declare const Wait: {
|
|
45
|
+
(miliseconds: number): void;
|
|
46
|
+
untilElement(uiElement: UIElement): {
|
|
47
|
+
isRemoved: () => void;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
declare const Pause: () => void;
|
|
51
|
+
declare const ManualTask: (description: string) => void;
|
|
52
|
+
declare const ReloadPage: () => void;
|
|
53
|
+
export { Click, Assert, Select, Type, ClearValue, PressEscKey, PressDownKey, PressTabKey, PressEnterKey, PressKey, TypePassword, UploadFile, SaveValue, Wait, Pause, ManualTask, ReloadPage };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const setFilterLogs: (enabled: boolean) => void;
|
|
2
|
+
declare const classIs: (className: string) => (elem: HTMLElement) => boolean;
|
|
3
|
+
declare const classIncludes: (className: string) => (elem: HTMLElement) => boolean;
|
|
4
|
+
declare const innerTextIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
5
|
+
declare const innerTextContains: (text: string) => (elem: HTMLElement) => boolean;
|
|
6
|
+
declare const titleIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
7
|
+
declare const placeholderIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
8
|
+
declare const isFirstElement: () => (elem: HTMLElement, index: number) => boolean;
|
|
9
|
+
declare const elementIndexIs: (index: number) => (elem: HTMLElement, elemIndex: number) => boolean;
|
|
10
|
+
declare const firstChildTextIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
11
|
+
declare const and: (conditions: any[]) => (elem: HTMLElement, elemIndex: number) => boolean;
|
|
12
|
+
export { classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and, setFilterLogs, };
|
|
@@ -7,18 +7,6 @@ declare class UIElement {
|
|
|
7
7
|
getElementName(): string;
|
|
8
8
|
}
|
|
9
9
|
declare const setDocument: (doc: Document) => void;
|
|
10
|
-
declare const SelectorBuilder: (query: string, filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => (root?: Document, postProcess?: ((elem: HTMLElement) => HTMLElement) | undefined) => HTMLElement;
|
|
11
|
-
declare const setFilterLogs: (enabled: boolean) => void;
|
|
12
|
-
declare const classIs: (className: string) => (elem: HTMLElement) => boolean;
|
|
13
|
-
declare const classIncludes: (className: string) => (elem: HTMLElement) => boolean;
|
|
14
|
-
declare const innerTextIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
15
|
-
declare const innerTextContains: (text: string) => (elem: HTMLElement) => boolean;
|
|
16
|
-
declare const titleIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
17
|
-
declare const placeholderIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
18
|
-
declare const isFirstElement: () => (elem: HTMLElement, index: number) => boolean;
|
|
19
|
-
declare const elementIndexIs: (index: number) => (elem: HTMLElement, elemIndex: number) => boolean;
|
|
20
|
-
declare const firstChildTextIs: (text: string) => (elem: HTMLElement) => boolean;
|
|
21
|
-
declare const and: (conditions: any[]) => (elem: HTMLElement, elemIndex: number) => boolean;
|
|
22
10
|
declare const is: {
|
|
23
11
|
DIV: {
|
|
24
12
|
where: (filterFn?: ((value: HTMLElement, index: number, array: readonly HTMLElement[]) => Boolean) | undefined) => {
|
|
@@ -283,4 +271,4 @@ declare const is: {
|
|
|
283
271
|
as: (uiElementId: string) => UIElement;
|
|
284
272
|
};
|
|
285
273
|
};
|
|
286
|
-
export {
|
|
274
|
+
export { UIElement, is, setDocument };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AbstractAction, Action } from "~/dom/actions";
|
|
2
|
+
export declare const AutomationCompiler: {
|
|
3
|
+
init: (startAction: Action) => void;
|
|
4
|
+
addAction: (action: AbstractAction) => void;
|
|
5
|
+
compileAction: (action: Action) => void;
|
|
6
|
+
getCurrentAction: () => Action;
|
|
7
|
+
getIsCompiling: () => boolean;
|
|
8
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare enum EVENT_NAMES {
|
|
2
|
+
ACTION_UPDATE = "tomation-action-update",
|
|
3
|
+
SAVE_VALUE = "tomation-save-value",
|
|
4
|
+
REGISTER_TEST = "tomation-register-test",
|
|
5
|
+
TEST_STARTED = "tomation-test-started",
|
|
6
|
+
TEST_PASSED = "tomation-test-passed",
|
|
7
|
+
TEST_FAILED = "tomation-test-failed",
|
|
8
|
+
TEST_END = "tomation-test-end",
|
|
9
|
+
TEST_STOP = "tomation-test-stop",
|
|
10
|
+
TEST_PAUSE = "tomation-test-pause",
|
|
11
|
+
TEST_PLAY = "tomation-test-play",
|
|
12
|
+
USER_ACCEPT = "tomation-user-accept",
|
|
13
|
+
USER_REJECT = "tomation-user-reject",
|
|
14
|
+
SESSION_INIT = "tomation-session-init"
|
|
15
|
+
}
|
|
16
|
+
type AutomationEventHandlerType = ((action?: any) => void);
|
|
17
|
+
declare class EventDispatcher {
|
|
18
|
+
events: Map<EVENT_NAMES, Array<AutomationEventHandlerType>>;
|
|
19
|
+
constructor();
|
|
20
|
+
on(eventName: EVENT_NAMES, callback: AutomationEventHandlerType): void;
|
|
21
|
+
off(eventName: EVENT_NAMES, callback: AutomationEventHandlerType): void;
|
|
22
|
+
dispatch(eventName: EVENT_NAMES, data?: any): void;
|
|
23
|
+
}
|
|
24
|
+
declare const AutomationEvents: EventDispatcher;
|
|
25
|
+
export { EVENT_NAMES, AutomationEvents };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AbstractAction, Action } from "~/dom/actions";
|
|
2
|
+
import { UIUtils } from "~/feedback/ui-utils";
|
|
3
|
+
declare enum TestSpeed {
|
|
4
|
+
SLOW = 2000,
|
|
5
|
+
NORMAL = 1000,
|
|
6
|
+
FAST = 200
|
|
7
|
+
}
|
|
8
|
+
declare enum TestPlayStatus {
|
|
9
|
+
PLAYING = "Playing",
|
|
10
|
+
STOPPED = "Stopped",
|
|
11
|
+
PAUSED = "Paused"
|
|
12
|
+
}
|
|
13
|
+
declare enum RunMode {
|
|
14
|
+
NORMAL = "Normal",
|
|
15
|
+
STEPBYSTEP = "Step By Step"
|
|
16
|
+
}
|
|
17
|
+
declare class Automation {
|
|
18
|
+
private _document;
|
|
19
|
+
debug: Boolean;
|
|
20
|
+
private _uiUtils;
|
|
21
|
+
speed: TestSpeed;
|
|
22
|
+
status: TestPlayStatus;
|
|
23
|
+
runMode: RunMode;
|
|
24
|
+
currentActionCallback: ((action: AbstractAction) => {}) | undefined;
|
|
25
|
+
currentAction: AbstractAction | undefined;
|
|
26
|
+
constructor(window: Window);
|
|
27
|
+
get document(): Document;
|
|
28
|
+
get uiUtils(): UIUtils;
|
|
29
|
+
get isStepByStepMode(): boolean;
|
|
30
|
+
get isStopped(): boolean;
|
|
31
|
+
get isPlaying(): boolean;
|
|
32
|
+
get isPaused(): boolean;
|
|
33
|
+
pause(): void;
|
|
34
|
+
continue(): void;
|
|
35
|
+
next(): void;
|
|
36
|
+
stop(): void;
|
|
37
|
+
retryAction(): void;
|
|
38
|
+
skipAction(): void;
|
|
39
|
+
saveCurrentAction(callback: (action: AbstractAction) => {}, action: AbstractAction): void;
|
|
40
|
+
setDebug(value: boolean): void;
|
|
41
|
+
}
|
|
42
|
+
declare let AutomationInstance: Automation;
|
|
43
|
+
declare const Setup: (window: Window, tests?: Array<any>) => Automation;
|
|
44
|
+
declare function start(startAction: Action): Promise<void>;
|
|
45
|
+
declare const AutomationRunner: {
|
|
46
|
+
start: typeof start;
|
|
47
|
+
readonly running: boolean;
|
|
48
|
+
};
|
|
49
|
+
export { AutomationRunner, TestPlayStatus, TestSpeed, RunMode, Setup, AutomationInstance };
|
package/dist/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ce=Object.defineProperty;var le=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var i=(t,e,n)=>(le(t,typeof e!="symbol"?e+"":e,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class Q{constructor(e,n,s,o){i(this,"name");i(this,"selector");i(this,"parent");i(this,"postProcess");this.name=e,this.selector=n,this.parent=s||null,this.postProcess=o}getElementName(){let e="";return this.parent&&(e=" in "+this.parent.getElementName()),`${this.name}${e}`}}let M;const ue=t=>{M=t},q=(t,e)=>(s=M,o)=>{s=s||M,console.log("Searching elem from Root = ",s);const a=[];s.querySelectorAll(t).forEach(c=>{c.style.display!=="none"&&a.push(c)});let r;return e?(console.log("Applying filter ",e),console.log(" -- to "+a.length+"elements: ",a),r=a.filter((c,y,x)=>{console.log("Apply filter to item "+y+": ",c);const m=e(c,y,x);return console.log(` -> Item ${y} ${m?"Match":"Discarded"}`),m})[0]):r=a[0],r&&o&&(console.log("Apply post process to = ",r),r=o(r)),console.log("Return elem = ",r),r},$=(t,e,n)=>({as:s=>new Q(s,t,e,n)}),he=(t,e)=>({...$(t,e),postProcess:n=>({...$(t,e,n)})}),Z=t=>({...$(t,null),childOf:e=>({...he(t,e)}),postProcess:e=>({...$(t,null,e)})}),O=t=>({where:e=>Z(q(t,e))}),de=O("div"),pe=O("button"),me=O("input"),ge=O("textarea"),ye=t=>Z(q("#"+t)),Ee=t=>O(t);let Y=!1;const we=t=>{Y=t},f=(...t)=>{Y&&console.log("[UIElement Filter]",...t)},fe=t=>e=>{const n=e.className==t;return f(`classIs('${t}') on`,e,"=>",n),n},Ae=t=>e=>{const n=e.className.split(" ").includes(t);return f(`classIncludes('${t}') on`,e,"=>",n),n},xe=t=>e=>{var s;const n=((s=e.textContent)==null?void 0:s.trim())==t;return f(`innerTextIs('${t}') on`,e,"=>",n),n},Ce=t=>e=>{const n=e.innerText.trim().includes(t);return f(`innerTextContains('${t}') on`,e,"=>",n),n},Te=t=>e=>{const n=e.title==t;return f(`titleIs('${t}') on`,e,"=>",n),n},ke=t=>e=>{const n=e.placeholder===t;return f(`placeholderIs('${t}') on`,e,"=>",n),n},Se=()=>(t,e)=>{const n=e===0;return f("isFirstElement on",t,"index",e,"=>",n),n},Ie=t=>(e,n)=>{const s=n===t;return f(`elementIndexIs(${t}) on`,e,"elemIndex",n,"=>",s),s},ve=t=>e=>{const n=(e==null?void 0:e.firstChild).innerText.trim()===t;return f(`firstChildTextIs('${t}') on`,e,"=>",n),n},Ne=t=>(e,n)=>{const s=t.every((o,a)=>{const r=o(e,n);return f(`and condition[${a}] on`,e,"elemIndex",n,"=>",r),r});return f("and final result on",e,"elemIndex",n,"=>",s),s},be={DIV:de,BUTTON:pe,INPUT:me,TEXTAREA:ge,ELEMENT:Ee,identifiedBy:ye};let P;const Oe=new Uint8Array(16);function De(){if(!P&&(P=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!P))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return P(Oe)}const p=[];for(let t=0;t<256;++t)p.push((t+256).toString(16).slice(1));function Pe(t,e=0){return(p[t[e+0]]+p[t[e+1]]+p[t[e+2]]+p[t[e+3]]+"-"+p[t[e+4]]+p[t[e+5]]+"-"+p[t[e+6]]+p[t[e+7]]+"-"+p[t[e+8]]+p[t[e+9]]+"-"+p[t[e+10]]+p[t[e+11]]+p[t[e+12]]+p[t[e+13]]+p[t[e+14]]+p[t[e+15]]).toLowerCase()}const Le=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),X={randomUUID:Le};function _(t,e,n){if(X.randomUUID&&!e&&!t)return X.randomUUID();t=t||{};const s=t.random||(t.rng||De)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,e){n=n||0;for(let o=0;o<16;++o)e[n+o]=s[o];return e}return Pe(s)}const E=(t=2e3)=>new Promise(e=>{setTimeout(()=>{e(null)},t)}),A=(t,e)=>{Object.entries(e).map(([s,o])=>({key:s,value:o})).forEach(s=>{const{key:o,value:a}=s;t.style[o]=a})};class Ue{constructor(e){i(this,"window");i(this,"document");i(this,"devToolsMessageContainer");i(this,"devToolsCheckElementContainer");i(this,"darkLayerLeft");i(this,"darkLayerTop");i(this,"darkLayerRight");i(this,"darkLayerBottom");i(this,"currentCheckElem");i(this,"contextViewerContainer");i(this,"devToolsAlertContainer");this.document=e.document,this.window=e,this.devToolsMessageContainer=this.createElement("DIV",{id:"dev-tools-message-container",styles:{width:"500px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",position:"fixed",bottom:"10px",right:"10px",fontFamily:"monospace",zIndex:"9999"},parent:this.document.body}),this.devToolsAlertContainer=this.createElement("DIV",{id:"dev-tools-alert-container",styles:{width:"100%",height:"30px",backgroundColor:"#b00",color:"white",position:"absolute ",top:0,fontFamily:"monospace",zIndex:"9999",display:"none",alignItems:"center",justifyContent:"center",padding:"5px"},parent:this.document.body}),this.devToolsCheckElementContainer=this.createElement("DIV",{id:"dev-tools-check-element-container",styles:{width:"100%",height:this.document.body.clientHeight+"px",position:"absolute",top:"0px",left:"0px",zIndex:"9990",display:"none",opacity:"0",transition:"opacity .2s"},parent:this.document.body});const n={zIndex:"9991",backgroundColor:"rgba(0,0,0,0.3)",position:"absolute"};this.darkLayerLeft=this.createElement("DIV",{id:"dark-layer-left",styles:n,parent:this.devToolsCheckElementContainer}),this.darkLayerTop=this.createElement("DIV",{id:"dark-layer-top",styles:n,parent:this.devToolsCheckElementContainer}),this.darkLayerRight=this.createElement("DIV",{id:"dark-layer-right",styles:n,parent:this.devToolsCheckElementContainer}),this.darkLayerBottom=this.createElement("DIV",{id:"dark-layer-bottom",styles:n,parent:this.devToolsCheckElementContainer}),this.currentCheckElem=this.createElement("DIV",{id:"current-check-elem",parent:this.devToolsCheckElementContainer}),this.contextViewerContainer=this.createElement("DIV",{id:"context-viewer-container",styles:{width:"100%",height:this.document.body.clientHeight+"px",position:"absolute",top:"0px",left:"0px",zIndex:"10000",display:"none"},parent:this.document.body})}createElement(e,n){const s=this.document.createElement(e);return n&&(n.id&&(s.id=n==null?void 0:n.id),n.styles&&A(s,n.styles),n.parent&&n.parent.appendChild(s)),s}async logAction(e){const n=exports.AutomationInstance.document.createElement("DIV");n.innerText=e,A(n,{padding:"3px 10px",opacity:"1",transition:"opacity 1s"}),this.devToolsMessageContainer.appendChild(n),await E(4e3),n.style.opacity="0",await E(4e3),this.devToolsMessageContainer.removeChild(n),await E(1e3)}async checkElement(e,n){if(!e)return;const s=e.getBoundingClientRect(),o=this.document.body.getBoundingClientRect();this.darkLayerLeft.style.left="0px",this.darkLayerLeft.style.top=s.top+"px",this.darkLayerLeft.style.width=this.window.scrollX+s.left+"px",this.darkLayerLeft.style.height=s.height+"px",this.darkLayerTop.style.left=this.window.scrollX+"px",this.darkLayerTop.style.top="0px",this.darkLayerTop.style.width="100%",this.darkLayerTop.style.height=s.top+"px",this.darkLayerRight.style.left=this.window.scrollX+s.left+s.width+"px",this.darkLayerRight.style.top=s.top+"px",this.darkLayerRight.style.width=o.width-(s.left+s.width)+"px",this.darkLayerRight.style.height=s.height+"px",this.darkLayerBottom.style.left=this.window.scrollX+"px",this.darkLayerBottom.style.top=s.top+s.height+"px",this.darkLayerBottom.style.width="100%",this.darkLayerBottom.style.height=o.height-(s.top+s.height)+"px",this.currentCheckElem.id=`dev-tools-current-check-elem-${n}`,this.currentCheckElem.style.top=s.top+"px",this.currentCheckElem.style.left=this.window.scrollX+s.left+"px",this.currentCheckElem.style.height=s.height+"px",this.currentCheckElem.style.width=s.width+"px",this.currentCheckElem.style.boxShadow="0px 0px 5px 2px lightgreen",this.currentCheckElem.style.position="absolute",this.currentCheckElem.style.zIndex="9992",this.devToolsCheckElementContainer.style.display="block",this.devToolsCheckElementContainer.style.opacity="1",await E(200)}async showAlert(e){const n=exports.AutomationInstance.document.createElement("DIV"),s=exports.AutomationInstance.document.body;n.innerText=e,A(s,{paddingTop:"30px"}),A(this.devToolsAlertContainer,{display:"flex"}),this.devToolsAlertContainer.appendChild(n)}async hideAlert(){A(this.devToolsAlertContainer,{display:"none"});const e=exports.AutomationInstance.document.body;A(e,{paddingTop:"0"}),this.devToolsAlertContainer.firstChild&&this.devToolsAlertContainer.removeChild(this.devToolsAlertContainer.firstChild)}async hideCheckElementContainer(){this.devToolsCheckElementContainer.style.opacity="0",await E(200),this.devToolsCheckElementContainer.style.display="none"}displayContext(e){A(this.contextViewerContainer,{display:"flex","background-color":"white",position:"absolute",top:"0px",left:"0px","z-index":"9999"});const n=this.document.createElement("DIV");n.id="context-viewer-before",A(n,{flex:"50%",width:"100%",height:"auto",border:"2px solid orange"});const s=this.document.createElement("DIV");s.id="context-viewer-after",A(s,{flex:"50%",width:"100%",height:"auto",border:"2px solid green"});const o=this.document.createElement("DIV");o.innerHTML=e.beforeHTML,z(o,e.beforeInputValues);const a=this.document.createElement("DIV");a.innerHTML=e.afterHTML,z(a,e.afterInputValues),this.contextViewerContainer.appendChild(n),n.appendChild(o),setTimeout(()=>{this.contextViewerContainer.removeChild(n),this.contextViewerContainer.appendChild(s),s.appendChild(a),setTimeout(()=>{this.contextViewerContainer.removeChild(s),A(this.contextViewerContainer,{display:"none"})},2e3)},2e3)}}const z=(t,e)=>{t.querySelectorAll("input").forEach(n=>{const s=n.getAttribute("input-id")||"";n.value=e[s]})},W=null,L=async(t,e,n,s=1e3,o=0,a=10,r=!1)=>{if(console.log("Automation Status: ",exports.AutomationInstance.status),exports.AutomationInstance.isPaused)return new Promise((c,y)=>{exports.AutomationInstance.saveCurrentAction(async x=>{if(x.status=="skipped")return c(null);try{const m=await L(x,e,n,s,o,a,r);c(m)}catch(m){y(m)}},t)});if(exports.AutomationInstance.isStopped)throw new Error("Test stopped manually");if(console.groupCollapsed(`tries ${o}/${a}`),t&&(t.updateTries(o),await g.notifyActionUpdated(t)),o===a)throw console.groupEnd(),r?new Error(`UI Element ${e.getElementName()||"UNKNOWN"} still present after 10 tries`):new Error(`UI Element ${e.getElementName()||"UNKNOWN"} not found after 10 tries`);{const c=e.selector(n,e.postProcess);return console.groupEnd(),c?r?(await E(s),await L(t,e,n,s,++o,a,r)):(console.log("Element found = ",c),c):r?(console.log("Element removed."),W):(await E(s),await L(t,e,n,s,++o,a,r))}},J=async(t,e,n=1e3,s=10,o=!1)=>{const a=e==null?void 0:e.getElementName();console.group("Looking for Element: "+a);let r=null;if(e.parent)try{console.groupCollapsed("Look for Parent ",e.parent.getElementName()),r=await J(t,e.parent,n,s,o),console.groupEnd()}catch(c){if(console.groupEnd(),o&&c.message.includes("not found"))return console.log("Parent not found, so element was removed"),console.groupEnd(),W;throw console.groupEnd(),c}try{console.log("Using parent element: ",r);const c=await L(t,e,r,n,0,s,o);return console.groupEnd(),c}catch(c){if(o&&c.message.includes("not found"))return console.log("Parent not found, so element was removed"),console.groupEnd(),W;throw console.groupEnd(),c}};var H=(t=>(t.WAITING="waiting",t.RUNNING="running",t.STOPPED="stopped",t.PAUSED="paused",t.SUCCESS="success",t.ERROR="error",t.SKIPPED="skipped",t))(H||{});class g{constructor(){i(this,"status");i(this,"error");i(this,"id");i(this,"context");this.status="waiting",this.error="",this.id=_(),this.context={beforeHTML:"",beforeInputValues:{},afterInputValues:{},afterHTML:"",url:"",startTimestamp:"",endTimestamp:""}}getJSON(){return{id:this.id,description:this.getDescription(),context:this.context,status:this.status,error:this.error}}reset(){this.status="waiting",this.error="",this.resetAction()}getInputValuesFromPage(){const e={};return exports.AutomationInstance.document.querySelectorAll("input").forEach((s,o)=>{const a=`value-id-${o}`;s.setAttribute("input-id",a),e[a]=s.value}),e}async execute(){try{this.status="running",this.context.beforeInputValues=this.getInputValuesFromPage(),this.context.beforeHTML=exports.AutomationInstance.document.body.innerHTML,await g.notifyActionUpdated(this),console.log("Action: ",this.getDescription()),await this.executeAction(),this.status="success",this.error="",exports.AutomationInstance.isStepByStepMode&&exports.AutomationInstance.pause()}catch(e){if(this.status="error",this.error=e.message,e.message=="Test stopped manually")throw Error("Error in Action "+this.getDescription()+". Message: "+e.message);this.status="paused",exports.AutomationInstance.pause()}finally{this.context.afterInputValues=this.getInputValuesFromPage(),this.context.afterHTML=exports.AutomationInstance.document.body.innerHTML,await g.notifyActionUpdated(this)}}static async notifyActionUpdated(e){h.dispatch(k.ACTION_UPDATE,{action:e.getJSON()})}}class ee extends g{constructor(n,s){super();i(this,"name");i(this,"stepsFn");i(this,"steps");i(this,"params");i(this,"index");this.name=n,this.stepsFn=s,this.steps=[],this.index=0}getDescription(){return this.name}compileSteps(){super.reset(),this.stepsFn(this.params)}stepsToJSON(){return this.steps.reduce((n,s)=>(n.push(s.getJSON()),n),[])}getJSON(){return{...super.getJSON(),type:"Action",params:this.params,steps:this.stepsToJSON()}}resetAction(){this.steps.length=0,this.index=0}async continue(){if(exports.AutomationInstance.isPaused)return new Promise((n,s)=>{exports.AutomationInstance.saveCurrentAction(async o=>{if(o.status=="skipped")return n();try{await o.continue(),n()}catch(a){s(a)}},this)});if(exports.AutomationInstance.isStopped)throw new Error("Test stopped manually");if(this.index<this.steps.length){const n=this.steps[this.index];try{if(await E(exports.AutomationInstance.speed),await n.execute(),!exports.AutomationInstance.isPaused)this.index++,await this.continue();else return new Promise((s,o)=>{exports.AutomationInstance.saveCurrentAction(async a=>{if(a.status=="skipped")return this.index++,await g.notifyActionUpdated(n),await this.continue(),s();try{await a.continue(),s()}catch(r){o(r)}},n)})}catch(s){throw s}}}async executeAction(){this.index=0,await this.continue()}setParams(n){this.params=n}addStep(n){this.steps.push(n)}}class d extends g{constructor(n){super();i(this,"uiElement");i(this,"element");i(this,"tries");this.uiElement=n,this.element=null,this.tries=0}getElementName(){var n;return(n=this.uiElement)==null?void 0:n.getElementName()}updateTries(n){this.tries=n}resetTries(){this.tries=0}getJSON(){return{id:this.id,element:this.getElementName(),description:this.getDescription(),status:this.status,error:this.error,context:this.context,tries:this.tries}}static waitForElement(n,s,o=1e3,a=10,r=!1){const c=s.getElementName();return new Promise(async(y,x)=>{var I;const m=async(C,D=1e3,v=0,N=!1)=>{if(console.groupCollapsed(`tries ${v}/${a}`),n.updateTries(v),await g.notifyActionUpdated(n),v===a)throw console.groupEnd(),N?new Error(`UI Element ${c||"UNKNOWN"} still present after 10 tries`):new Error(`UI Element ${c||"UNKNOWN"} not found after 10 tries`);{const F=s.selector(C,s.postProcess);return console.groupEnd(),F?N?(await E(D),await m(C,D,++v,N)):(console.log("Element found = ",F),F):N?(console.log("Element removed."),null):(await E(D),await m(C,D,++v,N))}};console.group("[Action On Element] Looking for Element: "+c);let T=null,V=!0;if(s.parent){console.groupCollapsed("Look for Parent ",s.parent.getElementName());try{T=await d.waitForElement(n,s.parent,o,a,r)}catch{V=!1}finally{console.groupEnd()}}if(V){console.log("using parent element: ",T);try{const C=await m(T,o,0,r);console.groupEnd(),y(C)}catch(C){console.groupEnd(),x(new Error(C.message))}}else console.groupEnd(),x(new Error(`Parent ${(I=s.parent)==null?void 0:I.getElementName()} of UI Element ${s.name||"UNKNOWN"} not found`))})}async executeAction(){var n;try{this.element=await J(this,this.uiElement),(n=this.element)==null||n.setAttribute("test-id",this.getElementName()),await exports.AutomationInstance.uiUtils.checkElement(this.element,this.getElementName()),this.executeActionOnElement(),await exports.AutomationInstance.uiUtils.hideCheckElementContainer()}catch(s){throw Error(s.message)}}resetAction(){this.element=null,this.resetTries()}}class $e extends d{constructor(e){super(e)}executeActionOnElement(){var e;return(e=this.element)==null?void 0:e.click()}getDescription(){return"Click in "+this.getElementName()}getJSON(){return{...super.getJSON(),type:"Click"}}}class Re extends d{constructor(n,s){super(n);i(this,"text");this.text=s}executeActionOnElement(){var s;if(!(((s=this.element)==null?void 0:s.innerText)===this.text))throw new Error(`Text in element ${this.getElementName()} is not '${this.text}'`)}getDescription(){return`Assert that text in ${this.getElementName()} is '${this.text}'`}getJSON(){return{...super.getJSON(),type:"AssertTextIsAction",value:this.text}}}class Je extends d{constructor(n,s){super(n);i(this,"text");this.text=s}executeActionOnElement(){var s;if(!((s=this.element)==null?void 0:s.innerText.includes(this.text)))throw new Error(`Text in element ${this.getElementName()} doesn't contain '${this.text}'`)}getDescription(){return`Assert that ${this.getElementName()} contains '${this.text}'`}getJSON(){return{...super.getJSON(),type:"AssertContainsText",value:this.text}}}class Ke extends d{constructor(n,s){super(n);i(this,"value");this.value=s}executeActionOnElement(){if(!(this.element.value===this.value))throw new Error(`Value in element ${this.getElementName()} is not '${this.value}'`)}getDescription(){return`Assert that value in ${this.getElementName()} is '${this.value}'`}getJSON(){return{...super.getJSON(),type:"AssertValueIsAction",value:this.value}}}class Ve extends d{constructor(e){super(e)}executeActionOnElement(){if(!!!this.element)throw new Error(`Element ${this.getElementName()} doesn't exist`)}getDescription(){return`Assert that ${this.getElementName()} exists`}getJSON(){return{...super.getJSON(),type:"AssertExistsAction"}}}class Fe extends d{constructor(e){super(e)}async executeAction(){var e;try{this.element=await J(this,this.uiElement,1e3,5,!0),(e=this.element)==null||e.setAttribute("test-id",this.getElementName()),await exports.AutomationInstance.uiUtils.checkElement(this.element,this.getElementName()),this.executeActionOnElement(),await exports.AutomationInstance.uiUtils.hideCheckElementContainer()}catch(n){throw Error(n.message)}}executeActionOnElement(){if(!!this.element)throw new Error(`Element ${this.getElementName()} was not expected to exist`)}getDescription(){return`Assert that ${this.getElementName()} doesn't exist`}getJSON(){return{...super.getJSON(),type:"AssertNotExistsAction"}}}class Me extends d{constructor(n,s){super(n);i(this,"value");this.value=s}executeActionOnElement(){var s,o,a,r;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(r=this.element)==null?void 0:r.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to type value in element "+this.getElementName());n.value=this.value,n.dispatchEvent(new Event("change"))}getDescription(){return`Select value '${this.value}' in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"Select",value:this.value}}}class te extends d{constructor(n,s){super(n);i(this,"value");this.value=s}executeActionOnElement(){var s,o,a,r;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(r=this.element)==null?void 0:r.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to type value in element "+this.getElementName());n.value=this.value,n.dispatchEvent(new Event("change")),n.dispatchEvent(new Event("keyup",{bubbles:!0})),n.dispatchEvent(new Event("input",{bubbles:!0}))}getDescription(){return`Type value '${this.value}' in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"Type",value:this.value}}}class We extends d{constructor(n,s){super(n);i(this,"value");this.value=s}executeActionOnElement(){var s,o,a,r;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(r=this.element)==null?void 0:r.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to type value in element "+this.getElementName());n.value=this.value,n.dispatchEvent(new Event("change")),n.dispatchEvent(new Event("keyup",{bubbles:!0})),n.dispatchEvent(new Event("input",{bubbles:!0}))}getDescription(){return`Type a password in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"TypePassword",value:this.value}}}class Be extends d{constructor(e){super(e)}executeActionOnElement(){var e;(e=this.element)==null||e.dispatchEvent(new KeyboardEvent("keydown",{altKey:!1,code:"Escape",ctrlKey:!1,isComposing:!1,key:"Escape",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:27,charCode:0,keyCode:27}))}getDescription(){return`Press Esc key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressEscKey"}}}class qe extends d{constructor(e){super(e)}executeActionOnElement(){var e;(e=this.element)==null||e.dispatchEvent(new KeyboardEvent("keyup",{altKey:!1,code:"Down",ctrlKey:!1,isComposing:!1,key:"Down",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:40,charCode:0,keyCode:40}))}getDescription(){return`Press Down key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressDownKey"}}}class He extends d{constructor(e){super(e)}executeActionOnElement(){var e;(e=this.element)==null||e.dispatchEvent(new KeyboardEvent("keydown",{altKey:!1,code:"Tab",ctrlKey:!1,isComposing:!1,key:"Tab",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:9,charCode:0,keyCode:9}))}getDescription(){return`Press Tab key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressTabKey"}}}class je extends d{constructor(e){super(e)}executeActionOnElement(){var e;(e=this.element)==null||e.dispatchEvent(new KeyboardEvent("keydown",{altKey:!1,code:"Enter",ctrlKey:!1,isComposing:!1,key:"Enter",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:13,charCode:0,keyCode:13}))}getDescription(){return`Press Enter key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressEnterKey"}}}var ne=(t=>(t.ESCAPE="Escape",t.ENTER="Enter",t.TAB="Tab",t.ARROW_DOWN="ArrowDown",t.ARROW_UP="ArrowUp",t.ARROW_LEFT="ArrowLeft",t.ARROW_RIGHT="ArrowRight",t.BACKSPACE="Backspace",t.DELETE="Delete",t.SHIFT="Shift",t.CONTROL="Control",t.ALT="Alt",t.META="Meta",t))(ne||{});const G={Escape:27,Enter:13,Tab:9,ArrowDown:40,ArrowUp:38,ArrowLeft:37,ArrowRight:39,Backspace:8,Delete:46,Shift:16,Control:17,Alt:18,Meta:91};class Xe extends d{constructor(n,s){super(n);i(this,"key");this.key=s}executeActionOnElement(){var n;(n=this.element)==null||n.dispatchEvent(new KeyboardEvent("keydown",{key:this.key,code:this.key,keyCode:G[this.key],charCode:0,which:G[this.key],altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,isComposing:!1,location:0,repeat:!1}))}getDescription(){return`Press ${this.key} key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressKey",key:this.key}}}class ze extends d{constructor(n,s){super(n);i(this,"file");this.file=s}executeActionOnElement(){const n=this.element,s=new DataTransfer;s.items.add(this.file);const o=s.files;n.files=o,n.dispatchEvent(new Event("change"));function a(c){var y;return c!=null&&c.parentElement?((y=c.parentElement)==null?void 0:y.tagName.toLowerCase())==="form"?c.parentElement:a(c.parentElement):null}const r=a(n);r&&r.dispatchEvent(new Event("change"))}getDescription(){return`Upload file in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"UploadFile"}}}class Ge extends d{constructor(n,s){super(n);i(this,"memorySlotName");this.memorySlotName=s}executeActionOnElement(){var s,o,a,r;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(r=this.element)==null?void 0:r.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to save value from element "+this.getElementName());h.dispatch(k.SAVE_VALUE,{memorySlotName:this.memorySlotName,value:n.value})}getDescription(){return`Save value of ${this.getElementName()} in ${this.memorySlotName}`}getJSON(){return{...super.getJSON(),type:"SaveValue",memorySlotName:this.memorySlotName}}}class Qe extends g{constructor(n){super();i(this,"miliseconds");this.miliseconds=n}getDescription(){return"Wait "+this.miliseconds+" miliseconds"}getJSON(){return{...super.getJSON(),type:"Wait"}}async executeAction(){await E(this.miliseconds)}resetAction(){}}class Ze extends g{constructor(n){super();i(this,"uiElement");i(this,"tries");this.uiElement=n,this.tries=0}updateTries(n){this.tries=n}resetAction(){this.tries=0}getElementName(){var n;return(n=this.uiElement)==null?void 0:n.getElementName()}async executeAction(){await J(this,this.uiElement,1e3,10,!0)}getDescription(){return"Wait until "+this.getElementName()+" is removed"}getJSON(){return{...super.getJSON(),type:"WaitUntilElementRemoved"}}}class Ye extends g{constructor(){super()}getDescription(){return"Paused"}getJSON(){return{...super.getJSON(),type:"Pause"}}async executeAction(){await exports.AutomationInstance.pause()}resetAction(){}}class _e extends g{constructor(n){super();i(this,"description");this.description=n}getDescription(){return"Manual Step: "+this.description}getJSON(){return{...super.getJSON(),type:"ManualStep"}}async executeAction(){return await exports.AutomationInstance.uiUtils.showAlert("Waiting manual step..."),new Promise((n,s)=>{h.on(k.USER_ACCEPT,async()=>(await exports.AutomationInstance.uiUtils.hideAlert(),n(!0))),h.on(k.USER_REJECT,async()=>(await exports.AutomationInstance.uiUtils.hideAlert(),s()))})}resetAction(){}}class et extends g{constructor(){super()}getDescription(){return"Reload page"}getJSON(){return{...super.getJSON(),type:"ReloadPage"}}async executeAction(){await location.reload()}resetAction(){}}const R=t=>t.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}),K=t=>{const e=new Date;return R(new Date(e.setDate(e.getDate()+t)))},se=t=>{const e=new Date;return R(new Date(e.setMonth(e.getMonth()+t)))},tt=K(1),nt=K(-1),st=K(7),ot=K(-7),it=se(1),rt=se(-1),at={formatDate:R,today:R(new Date),tomorrow:tt,nextWeek:st,nextMonth:it,yesterday:nt,lastWeek:ot,lastMonth:rt};class ct{constructor(){i(this,"enabled",!1)}setEnabled(e){this.enabled=e}log(...e){this.enabled&&console.log("[tomation]",...e)}groupCollapsed(...e){this.enabled&&console.groupCollapsed("[tomation]",...e)}groupEnd(){this.enabled&&console.groupEnd()}error(...e){this.enabled&&console.error("[tomation]",...e)}}const l=new ct,oe=t=>{l.setEnabled(t)},w=class w{static compileAction(e){const n=w.currentAction;w.currentAction=e,e.compileSteps(),w.currentAction=n}static addAction(e){l.log("Add action: ",e.getDescription()),w.currentAction.addStep(e)}static init(e){w.currentAction=e,w.isCompiling=!0,l.groupCollapsed("Compile: "+e.getDescription()),e.compileSteps(),w.isCompiling=!1,l.log("Compilation finished"),l.groupEnd()}};i(w,"currentAction"),i(w,"isCompiling");let u=w;var k=(t=>(t.ACTION_UPDATE="tomation-action-update",t.SAVE_VALUE="tomation-save-value",t.REGISTER_TEST="tomation-register-test",t.TEST_STARTED="tomation-test-started",t.TEST_PASSED="tomation-test-passed",t.TEST_FAILED="tomation-test-failed",t.TEST_END="tomation-test-end",t.TEST_STOP="tomation-test-stop",t.TEST_PAUSE="tomation-test-pause",t.TEST_PLAY="tomation-test-play",t.USER_ACCEPT="tomation-user-accept",t.USER_REJECT="tomation-user-reject",t.SESSION_INIT="tomation-session-init",t))(k||{});class lt{constructor(){i(this,"events");this.events=new Map}on(e,n){var s;this.events.has(e)||this.events.set(e,[]),(s=this.events.get(e))==null||s.push(n)}off(e,n){var s;this.events.has(e)&&this.events.set(e,((s=this.events.get(e))==null?void 0:s.filter(o=>o!==n))||[])}dispatch(e,n){var s;this.events.has(e)&&((s=this.events.get(e))==null||s.forEach(o=>{console.log(`Dispatch Event ${e}:`,n),o(n)}))}}const h=new lt;var j=(t=>(t[t.SLOW=2e3]="SLOW",t[t.NORMAL=1e3]="NORMAL",t[t.FAST=200]="FAST",t))(j||{});const S=class S{static async start(e){if(S.running)throw l.error("Not able to run test while other test is running."),new Error("Not able to run test while other test is running.");S.running=!0,exports.AutomationInstance.status="Playing",exports.AutomationInstance.runMode="Normal",l.groupCollapsed("Start Action: ",e.getDescription()),h.dispatch("tomation-test-started",{action:e==null?void 0:e.getJSON()});try{await(e==null?void 0:e.execute()),h.dispatch("tomation-test-passed",{id:e.name})}catch(n){throw h.dispatch("tomation-test-failed",{id:e.name}),exports.AutomationInstance.uiUtils.hideCheckElementContainer(),l.error(`🤖 Error running task ${e.getDescription()}. Reason: ${n.message}`),n}finally{l.groupEnd(),S.running=!1,h.dispatch("tomation-test-end",{action:e==null?void 0:e.getJSON()})}}};i(S,"running",!1);let b=S;const U={},ut=(t,e)=>{console.log(`Registering Test: ${t}...`);const n=new ee(t,e);u.init(n),console.log(`Compiled Test: ${t}`),h.dispatch("tomation-register-test",{id:t,action:n.getJSON()}),console.log(`Registered Test: ${t} in TestsMap`),U[t]=()=>{b.start(n)}},ie=t=>{if(U[t])U[t]();else throw console.log("Available Tests:",Object.keys(U)),new Error(`Test with id ${t} not found.`)},ht=(t,e)=>async n=>{const s=new ee(t,e);if(s.setParams(n),!b.running&&!u.isCompiling)try{l.log(`Compilation of Task ${t} starts...`),u.init(s),l.log(`Compilation of Task ${t} Finished.`),l.log(`Start running Task ${t}...`),await b.start(s),l.log(`End of Task ${t}: SUCCESS`)}catch(o){l.error("Error running task "+t+". "+o.message)}else l.log(`Adding action ${t} to compilation stack`),u.addAction(s),u.compileAction(s)},dt=t=>{const e=new $e(t);u.addAction(e)},pt=t=>({textIs:e=>{u.addAction(new Re(t,e))},containsText:e=>{u.addAction(new Je(t,e))},valueIs:e=>{u.addAction(new Ke(t,e))},exists:()=>{u.addAction(new Ve(t))},notExists:()=>{u.addAction(new Fe(t))}}),mt=t=>({in:e=>{const n=new Me(e,t);u.addAction(n)}}),gt=t=>({in:e=>{const n=new te(e,t);u.addAction(n)}}),yt=()=>({in:t=>{const e=new te(t,"");u.addAction(e)}}),Et=()=>({in:t=>{u.addAction(new Be(t))}}),wt=()=>({in:t=>{u.addAction(new qe(t))}}),ft=()=>({in:t=>{u.addAction(new He(t))}}),At=()=>({in:t=>{u.addAction(new je(t))}}),xt=t=>({in:e=>{u.addAction(new Xe(e,t))}}),Ct=t=>({in:e=>{const n=new We(e,t);u.addAction(n)}}),Tt=t=>({in:e=>{const n=new ze(e,t);u.addAction(n)}}),kt=t=>({in:e=>{const n=new Ge(t,e);u.addAction(n)}}),re=t=>{u.addAction(new Qe(t))};re.untilElement=t=>({isRemoved:()=>{u.addAction(new Ze(t))}});const St=()=>{u.addAction(new Ye)},It=t=>{u.addAction(new _e(t))},vt=()=>{u.addAction(new et)};class Nt{constructor(e){i(this,"_document");i(this,"debug");i(this,"_uiUtils");i(this,"speed");i(this,"status");i(this,"runMode");i(this,"currentActionCallback");i(this,"currentAction");this._document=e.document,this.debug=!0,this._uiUtils=new Ue(e),this.speed=1e3,this.status="Stopped",this.runMode="Normal"}get document(){return this._document}get uiUtils(){return this._uiUtils}get isStepByStepMode(){return this.runMode=="Step By Step"}get isStopped(){return this.status=="Stopped"}get isPlaying(){return this.status=="Playing"}get isPaused(){return this.status=="Paused"}pause(){l.log("Pause Test"),this.status="Paused",h.dispatch("tomation-test-pause")}continue(){l.log("Continue Test"),this.status="Playing",this.runMode="Normal",h.dispatch("tomation-test-play"),this.currentActionCallback&&this.currentAction&&(l.log("Continue: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}next(){l.log("Continue Test to Next Step..."),this.status="Playing",this.runMode="Step By Step",h.dispatch("tomation-test-play"),this.currentActionCallback&&this.currentAction&&(l.log("Next: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}stop(){l.log("Stop Test"),this.status="Stopped",this.currentActionCallback&&this.currentAction&&(l.log("Stop: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0),h.dispatch("tomation-test-stop")}retryAction(){l.log("Retry current step"),this.status="Playing",h.dispatch("tomation-test-play"),this.currentActionCallback&&this.currentAction&&(this.currentAction.resetTries&&(l.log("Retry: Resetting tries for current action"),this.currentAction.resetTries()),l.log("Retry: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}skipAction(){l.log("Skip current step"),this.status="Playing",this.currentActionCallback&&this.currentAction&&(this.currentAction.status=H.SKIPPED,l.log("Skip: Marked current action as SKIPPED"),g.notifyActionUpdated(this.currentAction),l.log("Skip: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}saveCurrentAction(e,n){l.log("Save current action"),this.currentActionCallback=e,this.currentAction=n}setDebug(e){oe(e)}}exports.AutomationInstance=void 0;const B=(t,e)=>(exports.AutomationInstance=new Nt(t),ue(exports.AutomationInstance.document),e==null||e.forEach(n=>n()),exports.AutomationInstance);function ae(t){const{matches:e,tests:n=[],speed:s="NORMAL",debug:o=!1}=t;if(!(typeof e=="string"?document.location.href.includes(e):!!document.location.href.match(e))){console.log(`[tomation] URL "${document.location.href}" does not match "${e}"`);return}try{console.log("[tomation] Setting up messaging bridge with extension..."),Object.values(k).forEach(r=>{console.log(`[tomation] Setting up listener for event "${r}"`),h.on(r,c=>{console.log(`[tomation] Dispatching event "${r}" to extension`,c),window.postMessage({message:"injectedScript-to-contentScript",sender:"tomation",payload:{cmd:r,params:c}})})}),window.addEventListener("message",r=>{try{console.log("[tomation] Received message from extension:",r.data);const{message:c,sender:y,payload:x}=r.data||{},{cmd:m,params:T}=x||{};if(y!=="web-extension")return;if(c==="contentScript-to-injectedScript"){const I={"run-test-request":()=>ie(T==null?void 0:T.testId),"reload-tests-request":()=>B(window,n||[]),"pause-test-request":()=>exports.AutomationInstance.pause(),"stop-test-request":()=>exports.AutomationInstance.stop(),"continue-test-request":()=>exports.AutomationInstance.continue(),"next-step-request":()=>exports.AutomationInstance.next(),"retry-action-request":()=>exports.AutomationInstance.retryAction(),"skip-action-request":()=>exports.AutomationInstance.skipAction(),"user-accept-request":()=>h.dispatch("tomation-user-accept"),"user-reject-request":()=>h.dispatch("tomation-user-reject")}[m];I?(console.log(`[tomation] Executing command "${m}" from extension`),I()):console.warn(`[tomation] Unknown command "${m}" from extension`);return}}catch(c){console.error("[tomation] Error handling message from extension:",c)}}),B(window,n),exports.AutomationInstance.setDebug(o),exports.AutomationInstance.speed=j[s],window.postMessage({message:"injectedScript-to-contentScript",sender:"tomation",payload:{cmd:"tomation-session-init",params:{speed:exports.AutomationInstance.speed,sessionId:_()}}}),console.log("[tomation] Ready ✓")}catch(r){console.error("[tomation] Initialization failed:",r)}}exports.ACTION_STATUS=H;exports.Assert=pt;exports.AutomationEvents=h;exports.ClearValue=yt;exports.Click=dt;exports.DateUtils=at;exports.EVENT_NAMES=k;exports.KEY_MAP=ne;exports.ManualTask=It;exports.Pause=St;exports.PressDownKey=wt;exports.PressEnterKey=At;exports.PressEscKey=Et;exports.PressKey=xt;exports.PressTabKey=ft;exports.ReloadPage=vt;exports.RunTest=ie;exports.SaveValue=kt;exports.Select=mt;exports.SelectorBuilder=q;exports.Setup=B;exports.Task=ht;exports.Test=ut;exports.TestSpeed=j;exports.Type=gt;exports.TypePassword=Ct;exports.UIElement=Q;exports.UploadFile=Tt;exports.Wait=re;exports.and=Ne;exports.classIncludes=Ae;exports.classIs=fe;exports.default=ae;exports.elementIndexIs=Ie;exports.firstChildTextIs=ve;exports.innerTextContains=Ce;exports.innerTextIs=xe;exports.is=be;exports.isFirstElement=Se;exports.placeholderIs=ke;exports.setAutomationLogs=oe;exports.setFilterLogs=we;exports.titleIs=Te;exports.tomation=ae;exports.wait=E;
|
|
1
|
+
"use strict";var re=Object.defineProperty;var ae=(e,t,n)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var r=(e,t,n)=>(ae(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const ce=e=>t=>t.className==e,le=e=>t=>t.className.split(" ").includes(e),ue=e=>t=>{var s;return((s=t.textContent)==null?void 0:s.trim())==e},he=e=>t=>t.innerText.trim().includes(e),de=e=>t=>t.title==e,pe=e=>t=>t.placeholder===e,me=()=>(e,t)=>t===0,ge=e=>(t,n)=>n===e,ye=e=>t=>(t==null?void 0:t.firstChild).innerText.trim()===e,Ee=e=>(t,n)=>e.every((o,a)=>o(t,n));class G{constructor(t,n,s,o){r(this,"name");r(this,"selector");r(this,"parent");r(this,"postProcess");this.name=t,this.selector=n,this.parent=s||null,this.postProcess=o}getElementName(){let t="";return this.parent&&(t=" in "+this.parent.getElementName()),`${this.name}${t}`}}let M;const we=e=>{M=e},Q=(e,t)=>(s=M,o)=>{s=s||M,console.log("Searching elem from Root = ",s);const a=[];s.querySelectorAll(e).forEach(c=>{c.style.display!=="none"&&a.push(c)});let i;return t?(console.log("Applying filter ",t),console.log(" -- to "+a.length+"elements: ",a),i=a.filter((c,E,f)=>{console.log("Apply filter to item "+E+": ",c);const g=t(c,E,f);return console.log(` -> Item ${E} ${g?"Match":"Discarded"}`),g})[0]):i=a[0],i&&o&&(console.log("Apply post process to = ",i),i=o(i)),console.log("Return elem = ",i),i},U=(e,t,n)=>({as:s=>new G(s,e,t,n)}),Ae=(e,t)=>({...U(e,t),postProcess:n=>({...U(e,t,n)})}),Z=e=>({...U(e,null),childOf:t=>({...Ae(e,t)}),postProcess:t=>({...U(e,null,t)})}),N=e=>({where:t=>Z(Q(e,t))}),fe=N("div"),xe=N("button"),Te=N("input"),Ce=N("textarea"),Se=e=>Z(Q("#"+e)),ke=e=>N(e),Ie={DIV:fe,BUTTON:xe,INPUT:Te,TEXTAREA:Ce,ELEMENT:ke,identifiedBy:Se};var h=(e=>(e.ACTION_UPDATE="tomation-action-update",e.SAVE_VALUE="tomation-save-value",e.REGISTER_TEST="tomation-register-test",e.TEST_STARTED="tomation-test-started",e.TEST_PASSED="tomation-test-passed",e.TEST_FAILED="tomation-test-failed",e.TEST_END="tomation-test-end",e.TEST_STOP="tomation-test-stop",e.TEST_PAUSE="tomation-test-pause",e.TEST_PLAY="tomation-test-play",e.USER_ACCEPT="tomation-user-accept",e.USER_REJECT="tomation-user-reject",e.SESSION_INIT="tomation-session-init",e))(h||{});class ve{constructor(){r(this,"events");this.events=new Map}on(t,n){var s;this.events.has(t)||this.events.set(t,[]),(s=this.events.get(t))==null||s.push(n)}off(t,n){var s;this.events.has(t)&&this.events.set(t,((s=this.events.get(t))==null?void 0:s.filter(o=>o!==n))||[])}dispatch(t,n){var s;this.events.has(t)&&((s=this.events.get(t))==null||s.forEach(o=>{console.log(`Dispatch Event ${t}:`,n),o(n)}))}}const d=new ve;let v=!1;const l={setEnabled(e){v=e},log(...e){v&&console.log("[tomation]",...e)},groupCollapsed(...e){v&&console.groupCollapsed("[tomation]",...e)},groupEnd(){v&&console.groupEnd()},error(...e){v&&console.error("[tomation]",...e)}},w=(e=2e3)=>new Promise(t=>{setTimeout(()=>{t(null)},e)}),A=(e,t)=>{Object.entries(t).map(([s,o])=>({key:s,value:o})).forEach(s=>{const{key:o,value:a}=s;e.style[o]=a})};class Ne{constructor(t){r(this,"window");r(this,"document");r(this,"devToolsMessageContainer");r(this,"devToolsCheckElementContainer");r(this,"darkLayerLeft");r(this,"darkLayerTop");r(this,"darkLayerRight");r(this,"darkLayerBottom");r(this,"currentCheckElem");r(this,"contextViewerContainer");r(this,"devToolsAlertContainer");this.document=t.document,this.window=t,this.devToolsMessageContainer=this.createElement("DIV",{id:"dev-tools-message-container",styles:{width:"500px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",position:"fixed",bottom:"10px",right:"10px",fontFamily:"monospace",zIndex:"9999"},parent:this.document.body}),this.devToolsAlertContainer=this.createElement("DIV",{id:"dev-tools-alert-container",styles:{width:"100%",height:"30px",backgroundColor:"#b00",color:"white",position:"absolute ",top:0,fontFamily:"monospace",zIndex:"9999",display:"none",alignItems:"center",justifyContent:"center",padding:"5px"},parent:this.document.body}),this.devToolsCheckElementContainer=this.createElement("DIV",{id:"dev-tools-check-element-container",styles:{width:"100%",height:this.document.body.clientHeight+"px",position:"absolute",top:"0px",left:"0px",zIndex:"9990",display:"none",opacity:"0",transition:"opacity .2s"},parent:this.document.body});const n={zIndex:"9991",backgroundColor:"rgba(0,0,0,0.3)",position:"absolute"};this.darkLayerLeft=this.createElement("DIV",{id:"dark-layer-left",styles:n,parent:this.devToolsCheckElementContainer}),this.darkLayerTop=this.createElement("DIV",{id:"dark-layer-top",styles:n,parent:this.devToolsCheckElementContainer}),this.darkLayerRight=this.createElement("DIV",{id:"dark-layer-right",styles:n,parent:this.devToolsCheckElementContainer}),this.darkLayerBottom=this.createElement("DIV",{id:"dark-layer-bottom",styles:n,parent:this.devToolsCheckElementContainer}),this.currentCheckElem=this.createElement("DIV",{id:"current-check-elem",parent:this.devToolsCheckElementContainer}),this.contextViewerContainer=this.createElement("DIV",{id:"context-viewer-container",styles:{width:"100%",height:this.document.body.clientHeight+"px",position:"absolute",top:"0px",left:"0px",zIndex:"10000",display:"none"},parent:this.document.body})}createElement(t,n){const s=this.document.createElement(t);return n&&(n.id&&(s.id=n==null?void 0:n.id),n.styles&&A(s,n.styles),n.parent&&n.parent.appendChild(s)),s}async logAction(t){const n=exports.AutomationInstance.document.createElement("DIV");n.innerText=t,A(n,{padding:"3px 10px",opacity:"1",transition:"opacity 1s"}),this.devToolsMessageContainer.appendChild(n),await w(4e3),n.style.opacity="0",await w(4e3),this.devToolsMessageContainer.removeChild(n),await w(1e3)}async checkElement(t,n){if(!t)return;const s=t.getBoundingClientRect(),o=this.document.body.getBoundingClientRect();this.darkLayerLeft.style.left="0px",this.darkLayerLeft.style.top=s.top+"px",this.darkLayerLeft.style.width=this.window.scrollX+s.left+"px",this.darkLayerLeft.style.height=s.height+"px",this.darkLayerTop.style.left=this.window.scrollX+"px",this.darkLayerTop.style.top="0px",this.darkLayerTop.style.width="100%",this.darkLayerTop.style.height=s.top+"px",this.darkLayerRight.style.left=this.window.scrollX+s.left+s.width+"px",this.darkLayerRight.style.top=s.top+"px",this.darkLayerRight.style.width=o.width-(s.left+s.width)+"px",this.darkLayerRight.style.height=s.height+"px",this.darkLayerBottom.style.left=this.window.scrollX+"px",this.darkLayerBottom.style.top=s.top+s.height+"px",this.darkLayerBottom.style.width="100%",this.darkLayerBottom.style.height=o.height-(s.top+s.height)+"px",this.currentCheckElem.id=`dev-tools-current-check-elem-${n}`,this.currentCheckElem.style.top=s.top+"px",this.currentCheckElem.style.left=this.window.scrollX+s.left+"px",this.currentCheckElem.style.height=s.height+"px",this.currentCheckElem.style.width=s.width+"px",this.currentCheckElem.style.boxShadow="0px 0px 5px 2px lightgreen",this.currentCheckElem.style.position="absolute",this.currentCheckElem.style.zIndex="9992",this.devToolsCheckElementContainer.style.display="block",this.devToolsCheckElementContainer.style.opacity="1",await w(200)}async showAlert(t){const n=exports.AutomationInstance.document.createElement("DIV"),s=exports.AutomationInstance.document.body;n.innerText=t,A(s,{paddingTop:"30px"}),A(this.devToolsAlertContainer,{display:"flex"}),this.devToolsAlertContainer.appendChild(n)}async hideAlert(){A(this.devToolsAlertContainer,{display:"none"});const t=exports.AutomationInstance.document.body;A(t,{paddingTop:"0"}),this.devToolsAlertContainer.firstChild&&this.devToolsAlertContainer.removeChild(this.devToolsAlertContainer.firstChild)}async hideCheckElementContainer(){this.devToolsCheckElementContainer.style.opacity="0",await w(200),this.devToolsCheckElementContainer.style.display="none"}displayContext(t){A(this.contextViewerContainer,{display:"flex","background-color":"white",position:"absolute",top:"0px",left:"0px","z-index":"9999"});const n=this.document.createElement("DIV");n.id="context-viewer-before",A(n,{flex:"50%",width:"100%",height:"auto",border:"2px solid orange"});const s=this.document.createElement("DIV");s.id="context-viewer-after",A(s,{flex:"50%",width:"100%",height:"auto",border:"2px solid green"});const o=this.document.createElement("DIV");o.innerHTML=t.beforeHTML,j(o,t.beforeInputValues);const a=this.document.createElement("DIV");a.innerHTML=t.afterHTML,j(a,t.afterInputValues),this.contextViewerContainer.appendChild(n),n.appendChild(o),setTimeout(()=>{this.contextViewerContainer.removeChild(n),this.contextViewerContainer.appendChild(s),s.appendChild(a),setTimeout(()=>{this.contextViewerContainer.removeChild(s),A(this.contextViewerContainer,{display:"none"})},2e3)},2e3)}}const j=(e,t)=>{e.querySelectorAll("input").forEach(n=>{const s=n.getAttribute("input-id")||"";n.value=t[s]})};var H=(e=>(e[e.SLOW=2e3]="SLOW",e[e.NORMAL=1e3]="NORMAL",e[e.FAST=200]="FAST",e))(H||{});class be{constructor(t){r(this,"_document");r(this,"debug");r(this,"_uiUtils");r(this,"speed");r(this,"status");r(this,"runMode");r(this,"currentActionCallback");r(this,"currentAction");this._document=t.document,this.debug=!0,this._uiUtils=new Ne(t),this.speed=1e3,this.status="Stopped",this.runMode="Normal"}get document(){return this._document}get uiUtils(){return this._uiUtils}get isStepByStepMode(){return this.runMode=="Step By Step"}get isStopped(){return this.status=="Stopped"}get isPlaying(){return this.status=="Playing"}get isPaused(){return this.status=="Paused"}pause(){l.log("Pause Test"),this.status="Paused",d.dispatch(h.TEST_PAUSE)}continue(){l.log("Continue Test"),this.status="Playing",this.runMode="Normal",d.dispatch(h.TEST_PLAY),this.currentActionCallback&&this.currentAction&&(l.log("Continue: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}next(){l.log("Continue Test to Next Step..."),this.status="Playing",this.runMode="Step By Step",d.dispatch(h.TEST_PLAY),this.currentActionCallback&&this.currentAction&&(l.log("Next: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}stop(){l.log("Stop Test"),this.status="Stopped",this.currentActionCallback&&this.currentAction&&(l.log("Stop: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0),d.dispatch(h.TEST_STOP)}retryAction(){l.log("Retry current step"),this.status="Playing",d.dispatch(h.TEST_PLAY),this.currentActionCallback&&this.currentAction&&(this.currentAction.resetTries&&(l.log("Retry: Resetting tries for current action"),this.currentAction.resetTries()),l.log("Retry: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}skipAction(){l.log("Skip current step"),this.status="Playing",this.currentActionCallback&&this.currentAction&&(this.currentAction.status=_.SKIPPED,l.log("Skip: Marked current action as SKIPPED"),y.notifyActionUpdated(this.currentAction),l.log("Skip: Executing current action callback"),this.currentActionCallback(this.currentAction),this.currentActionCallback=void 0)}saveCurrentAction(t,n){l.log("Save current action"),this.currentActionCallback=t,this.currentAction=n}setDebug(t){l.setEnabled(t)}}exports.AutomationInstance=void 0;const F=(e,t)=>(exports.AutomationInstance=new be(e),we(exports.AutomationInstance.document),t==null||t.forEach(n=>n()),exports.AutomationInstance);let O=!1;async function De(e){if(O)throw l.error("Not able to run test while other test is running."),new Error("Not able to run test while other test is running.");O=!0,exports.AutomationInstance.status="Playing",exports.AutomationInstance.runMode="Normal",l.groupCollapsed("Start Action: ",e.getDescription()),d.dispatch(h.TEST_STARTED,{action:e==null?void 0:e.getJSON()});try{await(e==null?void 0:e.execute()),d.dispatch(h.TEST_PASSED,{id:e.name})}catch(t){throw d.dispatch(h.TEST_FAILED,{id:e.name}),exports.AutomationInstance.uiUtils.hideCheckElementContainer(),l.error(`🤖 Error running task ${e.getDescription()}. Reason: ${t.message}`),t}finally{l.groupEnd(),O=!1,d.dispatch(h.TEST_END,{action:e==null?void 0:e.getJSON()})}}const W={start:De,get running(){return O}};let D;const Oe=new Uint8Array(16);function Pe(){if(!D&&(D=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!D))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return D(Oe)}const m=[];for(let e=0;e<256;++e)m.push((e+256).toString(16).slice(1));function Le(e,t=0){return(m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]).toLowerCase()}const Ue=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),X={randomUUID:Ue};function Y(e,t,n){if(X.randomUUID&&!t&&!e)return X.randomUUID();e=e||{};const s=e.random||(e.rng||Pe)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,t){n=n||0;for(let o=0;o<16;++o)t[n+o]=s[o];return t}return Le(s)}const q=null,P=async(e,t,n,s=1e3,o=0,a=10,i=!1)=>{if(console.log("Automation Status: ",exports.AutomationInstance.status),exports.AutomationInstance.isPaused)return new Promise((c,E)=>{exports.AutomationInstance.saveCurrentAction(async f=>{if(f.status=="skipped")return c(null);try{const g=await P(f,t,n,s,o,a,i);c(g)}catch(g){E(g)}},e)});if(exports.AutomationInstance.isStopped)throw new Error("Test stopped manually");if(console.groupCollapsed(`tries ${o}/${a}`),e&&(e.updateTries(o),await y.notifyActionUpdated(e)),o===a)throw console.groupEnd(),i?new Error(`UI Element ${t.getElementName()||"UNKNOWN"} still present after 10 tries`):new Error(`UI Element ${t.getElementName()||"UNKNOWN"} not found after 10 tries`);{const c=t.selector(n,t.postProcess);return console.groupEnd(),c?i?(await w(s),await P(e,t,n,s,++o,a,i)):(console.log("Element found = ",c),c):i?(console.log("Element removed."),q):(await w(s),await P(e,t,n,s,++o,a,i))}},$=async(e,t,n=1e3,s=10,o=!1)=>{const a=t==null?void 0:t.getElementName();console.group("Looking for Element: "+a);let i=null;if(t.parent)try{console.groupCollapsed("Look for Parent ",t.parent.getElementName()),i=await $(e,t.parent,n,s,o),console.groupEnd()}catch(c){if(console.groupEnd(),o&&c.message.includes("not found"))return console.log("Parent not found, so element was removed"),console.groupEnd(),q;throw console.groupEnd(),c}try{console.log("Using parent element: ",i);const c=await P(e,t,i,n,0,s,o);return console.groupEnd(),c}catch(c){if(o&&c.message.includes("not found"))return console.log("Parent not found, so element was removed"),console.groupEnd(),q;throw console.groupEnd(),c}};var _=(e=>(e.WAITING="waiting",e.RUNNING="running",e.STOPPED="stopped",e.PAUSED="paused",e.SUCCESS="success",e.ERROR="error",e.SKIPPED="skipped",e))(_||{});class y{constructor(){r(this,"status");r(this,"error");r(this,"id");r(this,"context");this.status="waiting",this.error="",this.id=Y(),this.context={beforeHTML:"",beforeInputValues:{},afterInputValues:{},afterHTML:"",url:"",startTimestamp:"",endTimestamp:""}}getJSON(){return{id:this.id,description:this.getDescription(),context:this.context,status:this.status,error:this.error}}reset(){this.status="waiting",this.error="",this.resetAction()}getInputValuesFromPage(){const t={};return exports.AutomationInstance.document.querySelectorAll("input").forEach((s,o)=>{const a=`value-id-${o}`;s.setAttribute("input-id",a),t[a]=s.value}),t}async execute(){try{this.status="running",this.context.beforeInputValues=this.getInputValuesFromPage(),this.context.beforeHTML=exports.AutomationInstance.document.body.innerHTML,await y.notifyActionUpdated(this),console.log("Action: ",this.getDescription()),await this.executeAction(),this.status="success",this.error="",exports.AutomationInstance.isStepByStepMode&&exports.AutomationInstance.pause()}catch(t){if(this.status="error",this.error=t.message,t.message=="Test stopped manually")throw Error("Error in Action "+this.getDescription()+". Message: "+t.message);this.status="paused",exports.AutomationInstance.pause()}finally{this.context.afterInputValues=this.getInputValuesFromPage(),this.context.afterHTML=exports.AutomationInstance.document.body.innerHTML,await y.notifyActionUpdated(this)}}static async notifyActionUpdated(t){d.dispatch(h.ACTION_UPDATE,{action:t.getJSON()})}}class ee extends y{constructor(n,s){super();r(this,"name");r(this,"stepsFn");r(this,"steps");r(this,"params");r(this,"index");this.name=n,this.stepsFn=s,this.steps=[],this.index=0}getDescription(){return this.name}compileSteps(){super.reset(),this.stepsFn(this.params)}stepsToJSON(){return this.steps.reduce((n,s)=>(n.push(s.getJSON()),n),[])}getJSON(){return{...super.getJSON(),type:"Action",params:this.params,steps:this.stepsToJSON()}}resetAction(){this.steps.length=0,this.index=0}async continue(){if(exports.AutomationInstance.isPaused)return new Promise((n,s)=>{exports.AutomationInstance.saveCurrentAction(async o=>{if(o.status=="skipped")return n();try{await o.continue(),n()}catch(a){s(a)}},this)});if(exports.AutomationInstance.isStopped)throw new Error("Test stopped manually");if(this.index<this.steps.length){const n=this.steps[this.index];try{if(await w(exports.AutomationInstance.speed),await n.execute(),!exports.AutomationInstance.isPaused)this.index++,await this.continue();else return new Promise((s,o)=>{exports.AutomationInstance.saveCurrentAction(async a=>{if(a.status=="skipped")return this.index++,await y.notifyActionUpdated(n),await this.continue(),s();try{await a.continue(),s()}catch(i){o(i)}},n)})}catch(s){throw s}}}async executeAction(){this.index=0,await this.continue()}setParams(n){this.params=n}addStep(n){this.steps.push(n)}}class p extends y{constructor(n){super();r(this,"uiElement");r(this,"element");r(this,"tries");this.uiElement=n,this.element=null,this.tries=0}getElementName(){var n;return(n=this.uiElement)==null?void 0:n.getElementName()}updateTries(n){this.tries=n}resetTries(){this.tries=0}getJSON(){return{id:this.id,element:this.getElementName(),description:this.getDescription(),status:this.status,error:this.error,context:this.context,tries:this.tries}}static waitForElement(n,s,o=1e3,a=10,i=!1){const c=s.getElementName();return new Promise(async(E,f)=>{var S;const g=async(x,b=1e3,k=0,I=!1)=>{if(console.groupCollapsed(`tries ${k}/${a}`),n.updateTries(k),await y.notifyActionUpdated(n),k===a)throw console.groupEnd(),I?new Error(`UI Element ${c||"UNKNOWN"} still present after 10 tries`):new Error(`UI Element ${c||"UNKNOWN"} not found after 10 tries`);{const V=s.selector(x,s.postProcess);return console.groupEnd(),V?I?(await w(b),await g(x,b,++k,I)):(console.log("Element found = ",V),V):I?(console.log("Element removed."),null):(await w(b),await g(x,b,++k,I))}};console.group("[Action On Element] Looking for Element: "+c);let T=null,K=!0;if(s.parent){console.groupCollapsed("Look for Parent ",s.parent.getElementName());try{T=await p.waitForElement(n,s.parent,o,a,i)}catch{K=!1}finally{console.groupEnd()}}if(K){console.log("using parent element: ",T);try{const x=await g(T,o,0,i);console.groupEnd(),E(x)}catch(x){console.groupEnd(),f(new Error(x.message))}}else console.groupEnd(),f(new Error(`Parent ${(S=s.parent)==null?void 0:S.getElementName()} of UI Element ${s.name||"UNKNOWN"} not found`))})}async executeAction(){var n;try{this.element=await $(this,this.uiElement),(n=this.element)==null||n.setAttribute("test-id",this.getElementName()),await exports.AutomationInstance.uiUtils.checkElement(this.element,this.getElementName()),this.executeActionOnElement(),await exports.AutomationInstance.uiUtils.hideCheckElementContainer()}catch(s){throw Error(s.message)}}resetAction(){this.element=null,this.resetTries()}}class Re extends p{constructor(t){super(t)}executeActionOnElement(){var t;return(t=this.element)==null?void 0:t.click()}getDescription(){return"Click in "+this.getElementName()}getJSON(){return{...super.getJSON(),type:"Click"}}}class $e extends p{constructor(n,s){super(n);r(this,"text");this.text=s}executeActionOnElement(){var s;if(!(((s=this.element)==null?void 0:s.innerText)===this.text))throw new Error(`Text in element ${this.getElementName()} is not '${this.text}'`)}getDescription(){return`Assert that text in ${this.getElementName()} is '${this.text}'`}getJSON(){return{...super.getJSON(),type:"AssertTextIsAction",value:this.text}}}class Je extends p{constructor(n,s){super(n);r(this,"text");this.text=s}executeActionOnElement(){var s;if(!((s=this.element)==null?void 0:s.innerText.includes(this.text)))throw new Error(`Text in element ${this.getElementName()} doesn't contain '${this.text}'`)}getDescription(){return`Assert that ${this.getElementName()} contains '${this.text}'`}getJSON(){return{...super.getJSON(),type:"AssertContainsText",value:this.text}}}class Ke extends p{constructor(n,s){super(n);r(this,"value");this.value=s}executeActionOnElement(){if(!(this.element.value===this.value))throw new Error(`Value in element ${this.getElementName()} is not '${this.value}'`)}getDescription(){return`Assert that value in ${this.getElementName()} is '${this.value}'`}getJSON(){return{...super.getJSON(),type:"AssertValueIsAction",value:this.value}}}class Ve extends p{constructor(t){super(t)}executeActionOnElement(){if(!!!this.element)throw new Error(`Element ${this.getElementName()} doesn't exist`)}getDescription(){return`Assert that ${this.getElementName()} exists`}getJSON(){return{...super.getJSON(),type:"AssertExistsAction"}}}class Me extends p{constructor(t){super(t)}async executeAction(){var t;try{this.element=await $(this,this.uiElement,1e3,5,!0),(t=this.element)==null||t.setAttribute("test-id",this.getElementName()),await exports.AutomationInstance.uiUtils.checkElement(this.element,this.getElementName()),this.executeActionOnElement(),await exports.AutomationInstance.uiUtils.hideCheckElementContainer()}catch(n){throw Error(n.message)}}executeActionOnElement(){if(!!this.element)throw new Error(`Element ${this.getElementName()} was not expected to exist`)}getDescription(){return`Assert that ${this.getElementName()} doesn't exist`}getJSON(){return{...super.getJSON(),type:"AssertNotExistsAction"}}}class Fe extends p{constructor(n,s){super(n);r(this,"value");this.value=s}executeActionOnElement(){var s,o,a,i;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(i=this.element)==null?void 0:i.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to type value in element "+this.getElementName());n.value=this.value,n.dispatchEvent(new Event("change"))}getDescription(){return`Select value '${this.value}' in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"Select",value:this.value}}}class te extends p{constructor(n,s){super(n);r(this,"value");this.value=s}executeActionOnElement(){var s,o,a,i;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(i=this.element)==null?void 0:i.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to type value in element "+this.getElementName());n.value=this.value,n.dispatchEvent(new Event("change")),n.dispatchEvent(new Event("keyup",{bubbles:!0})),n.dispatchEvent(new Event("input",{bubbles:!0}))}getDescription(){return`Type value '${this.value}' in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"Type",value:this.value}}}class We extends p{constructor(n,s){super(n);r(this,"value");this.value=s}executeActionOnElement(){var s,o,a,i;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(i=this.element)==null?void 0:i.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to type value in element "+this.getElementName());n.value=this.value,n.dispatchEvent(new Event("change")),n.dispatchEvent(new Event("keyup",{bubbles:!0})),n.dispatchEvent(new Event("input",{bubbles:!0}))}getDescription(){return`Type a password in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"TypePassword",value:this.value}}}class qe extends p{constructor(t){super(t)}executeActionOnElement(){var t;(t=this.element)==null||t.dispatchEvent(new KeyboardEvent("keydown",{altKey:!1,code:"Escape",ctrlKey:!1,isComposing:!1,key:"Escape",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:27,charCode:0,keyCode:27}))}getDescription(){return`Press Esc key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressEscKey"}}}class Be extends p{constructor(t){super(t)}executeActionOnElement(){var t;(t=this.element)==null||t.dispatchEvent(new KeyboardEvent("keyup",{altKey:!1,code:"Down",ctrlKey:!1,isComposing:!1,key:"Down",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:40,charCode:0,keyCode:40}))}getDescription(){return`Press Down key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressDownKey"}}}class He extends p{constructor(t){super(t)}executeActionOnElement(){var t;(t=this.element)==null||t.dispatchEvent(new KeyboardEvent("keydown",{altKey:!1,code:"Tab",ctrlKey:!1,isComposing:!1,key:"Tab",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:9,charCode:0,keyCode:9}))}getDescription(){return`Press Tab key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressTabKey"}}}class _e extends p{constructor(t){super(t)}executeActionOnElement(){var t;(t=this.element)==null||t.dispatchEvent(new KeyboardEvent("keydown",{altKey:!1,code:"Enter",ctrlKey:!1,isComposing:!1,key:"Enter",location:0,metaKey:!1,repeat:!1,shiftKey:!1,which:13,charCode:0,keyCode:13}))}getDescription(){return`Press Enter key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressEnterKey"}}}var ne=(e=>(e.ESCAPE="Escape",e.ENTER="Enter",e.TAB="Tab",e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ARROW_LEFT="ArrowLeft",e.ARROW_RIGHT="ArrowRight",e.BACKSPACE="Backspace",e.DELETE="Delete",e.SHIFT="Shift",e.CONTROL="Control",e.ALT="Alt",e.META="Meta",e))(ne||{});const z={Escape:27,Enter:13,Tab:9,ArrowDown:40,ArrowUp:38,ArrowLeft:37,ArrowRight:39,Backspace:8,Delete:46,Shift:16,Control:17,Alt:18,Meta:91};class je extends p{constructor(n,s){super(n);r(this,"key");this.key=s}executeActionOnElement(){var n;(n=this.element)==null||n.dispatchEvent(new KeyboardEvent("keydown",{key:this.key,code:this.key,keyCode:z[this.key],charCode:0,which:z[this.key],altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,isComposing:!1,location:0,repeat:!1}))}getDescription(){return`Press ${this.key} key in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"PressKey",key:this.key}}}class Xe extends p{constructor(n,s){super(n);r(this,"file");this.file=s}executeActionOnElement(){const n=this.element,s=new DataTransfer;s.items.add(this.file);const o=s.files;n.files=o,n.dispatchEvent(new Event("change"));function a(c){var E;return c!=null&&c.parentElement?((E=c.parentElement)==null?void 0:E.tagName.toLowerCase())==="form"?c.parentElement:a(c.parentElement):null}const i=a(n);i&&i.dispatchEvent(new Event("change"))}getDescription(){return`Upload file in ${this.getElementName()}`}getJSON(){return{...super.getJSON(),type:"UploadFile"}}}class ze extends p{constructor(n,s){super(n);r(this,"memorySlotName");this.memorySlotName=s}executeActionOnElement(){var s,o,a,i;let n=this.element;if(((s=this.element)==null?void 0:s.tagName)!=="INPUT"&&((o=this.element)==null?void 0:o.tagName)!=="SELECT"&&((a=this.element)==null?void 0:a.tagName)!=="TEXTAREA"&&(n=(i=this.element)==null?void 0:i.querySelectorAll("input")[0],!n))throw new Error("Input element not found. Not able to save value from element "+this.getElementName());d.dispatch(h.SAVE_VALUE,{memorySlotName:this.memorySlotName,value:n.value})}getDescription(){return`Save value of ${this.getElementName()} in ${this.memorySlotName}`}getJSON(){return{...super.getJSON(),type:"SaveValue",memorySlotName:this.memorySlotName}}}class Ge extends y{constructor(n){super();r(this,"miliseconds");this.miliseconds=n}getDescription(){return"Wait "+this.miliseconds+" miliseconds"}getJSON(){return{...super.getJSON(),type:"Wait"}}async executeAction(){await w(this.miliseconds)}resetAction(){}}class Qe extends y{constructor(n){super();r(this,"uiElement");r(this,"tries");this.uiElement=n,this.tries=0}updateTries(n){this.tries=n}resetAction(){this.tries=0}getElementName(){var n;return(n=this.uiElement)==null?void 0:n.getElementName()}async executeAction(){await $(this,this.uiElement,1e3,10,!0)}getDescription(){return"Wait until "+this.getElementName()+" is removed"}getJSON(){return{...super.getJSON(),type:"WaitUntilElementRemoved"}}}class Ze extends y{constructor(){super()}getDescription(){return"Paused"}getJSON(){return{...super.getJSON(),type:"Pause"}}async executeAction(){await exports.AutomationInstance.pause()}resetAction(){}}class Ye extends y{constructor(n){super();r(this,"description");this.description=n}getDescription(){return"Manual Step: "+this.description}getJSON(){return{...super.getJSON(),type:"ManualStep"}}async executeAction(){return await exports.AutomationInstance.uiUtils.showAlert("Waiting manual step..."),new Promise((n,s)=>{d.on(h.USER_ACCEPT,async()=>(await exports.AutomationInstance.uiUtils.hideAlert(),n(!0))),d.on(h.USER_REJECT,async()=>(await exports.AutomationInstance.uiUtils.hideAlert(),s()))})}resetAction(){}}class et extends y{constructor(){super()}getDescription(){return"Reload page"}getJSON(){return{...super.getJSON(),type:"ReloadPage"}}async executeAction(){await location.reload()}resetAction(){}}let C,B;const tt=e=>{const t=C;C=e,e.compileSteps(),C=t},nt=e=>{l.log("Add action: ",e.getDescription()),C.addStep(e)},st=e=>{C=e,B=!0,l.groupCollapsed("Compile: "+e.getDescription()),e.compileSteps(),B=!1,l.log("Compilation finished"),l.groupEnd()},ot=()=>C,it=()=>B,u={init:st,addAction:nt,compileAction:tt,getCurrentAction:ot,getIsCompiling:it},L={},rt=e=>{if(L[e])L[e]();else throw console.log("Available Tests:",Object.keys(L)),new Error(`Test with id ${e} not found.`)},at=(e,t)=>{console.log(`Registering Test: ${e}...`);const n=new ee(e,t);u.init(n),console.log(`Compiled Test: ${e}`),d.dispatch(h.REGISTER_TEST,{id:e,action:n.getJSON()}),console.log(`Registered Test: ${e} in TestsMap`),L[e]=()=>{W.start(n)}};function se(e){const{matches:t,tests:n=[],speed:s="NORMAL",debug:o=!1}=e;if(!(typeof t=="string"?document.location.href.includes(t):!!document.location.href.match(t))){console.log(`[tomation] URL "${document.location.href}" does not match "${t}"`);return}try{console.log("[tomation] Setting up messaging bridge with extension..."),Object.values(h).forEach(i=>{console.log(`[tomation] Setting up listener for event "${i}"`),d.on(i,c=>{console.log(`[tomation] Dispatching event "${i}" to extension`,c),window.postMessage({message:"injectedScript-to-contentScript",sender:"tomation",payload:{cmd:i,params:c}})})}),window.addEventListener("message",i=>{try{console.log("[tomation] Received message from extension:",i.data);const{message:c,sender:E,payload:f}=i.data||{},{cmd:g,params:T}=f||{};if(E!=="web-extension")return;if(c==="contentScript-to-injectedScript"){const S={"run-test-request":()=>rt(T==null?void 0:T.testId),"reload-tests-request":()=>F(window,n||[]),"pause-test-request":()=>exports.AutomationInstance.pause(),"stop-test-request":()=>exports.AutomationInstance.stop(),"continue-test-request":()=>exports.AutomationInstance.continue(),"next-step-request":()=>exports.AutomationInstance.next(),"retry-action-request":()=>exports.AutomationInstance.retryAction(),"skip-action-request":()=>exports.AutomationInstance.skipAction(),"user-accept-request":()=>d.dispatch(h.USER_ACCEPT),"user-reject-request":()=>d.dispatch(h.USER_REJECT)}[g];S?(console.log(`[tomation] Executing command "${g}" from extension`),S()):console.warn(`[tomation] Unknown command "${g}" from extension`);return}}catch(c){console.error("[tomation] Error handling message from extension:",c)}}),F(window,n),exports.AutomationInstance.setDebug(o),exports.AutomationInstance.speed=H[s],window.postMessage({message:"injectedScript-to-contentScript",sender:"tomation",payload:{cmd:h.SESSION_INIT,params:{speed:exports.AutomationInstance.speed,sessionId:Y()}}}),console.log("[tomation] Ready ✓")}catch(i){console.error("[tomation] Initialization failed:",i)}}const ct=(e,t)=>async n=>{const s=new ee(e,t);if(s.setParams(n),!W.running&&!u.getIsCompiling())try{l.log(`Compilation of Task ${e} starts...`),u.init(s),l.log(`Compilation of Task ${e} Finished.`),l.log(`Start running Task ${e}...`),await W.start(s),l.log(`End of Task ${e}: SUCCESS`)}catch(o){l.error("Error running task "+e+". "+o.message)}else l.log(`Adding action ${e} to compilation stack`),u.addAction(s),u.compileAction(s)},lt=e=>{const t=new Re(e);u.addAction(t)},ut=e=>({textIs:t=>{u.addAction(new $e(e,t))},containsText:t=>{u.addAction(new Je(e,t))},valueIs:t=>{u.addAction(new Ke(e,t))},exists:()=>{u.addAction(new Ve(e))},notExists:()=>{u.addAction(new Me(e))}}),ht=e=>({in:t=>{const n=new Fe(t,e);u.addAction(n)}}),dt=e=>({in:t=>{const n=new te(t,e);u.addAction(n)}}),pt=()=>({in:e=>{const t=new te(e,"");u.addAction(t)}}),mt=()=>({in:e=>{u.addAction(new qe(e))}}),gt=()=>({in:e=>{u.addAction(new Be(e))}}),yt=()=>({in:e=>{u.addAction(new He(e))}}),Et=()=>({in:e=>{u.addAction(new _e(e))}}),wt=e=>({in:t=>{u.addAction(new je(t,e))}}),At=e=>({in:t=>{const n=new We(t,e);u.addAction(n)}}),ft=e=>({in:t=>{const n=new Xe(t,e);u.addAction(n)}}),xt=e=>({in:t=>{const n=new ze(e,t);u.addAction(n)}}),oe=e=>{u.addAction(new Ge(e))};oe.untilElement=e=>({isRemoved:()=>{u.addAction(new Qe(e))}});const Tt=()=>{u.addAction(new Ze)},Ct=e=>{u.addAction(new Ye(e))},St=()=>{u.addAction(new et)},R=e=>e.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}),J=e=>{const t=new Date;return R(new Date(t.setDate(t.getDate()+e)))},ie=e=>{const t=new Date;return R(new Date(t.setMonth(t.getMonth()+e)))},kt=J(1),It=J(-1),vt=J(7),Nt=J(-7),bt=ie(1),Dt=ie(-1),Ot={formatDate:R,today:R(new Date),tomorrow:kt,nextWeek:vt,nextMonth:bt,yesterday:It,lastWeek:Nt,lastMonth:Dt};exports.ACTION_STATUS=_;exports.Assert=ut;exports.AutomationEvents=d;exports.ClearValue=pt;exports.Click=lt;exports.DateUtils=Ot;exports.EVENT_NAMES=h;exports.KEY_MAP=ne;exports.ManualTask=Ct;exports.Pause=Tt;exports.PressDownKey=gt;exports.PressEnterKey=Et;exports.PressEscKey=mt;exports.PressKey=wt;exports.PressTabKey=yt;exports.ReloadPage=St;exports.SaveValue=xt;exports.Select=ht;exports.Setup=F;exports.Task=ct;exports.Test=at;exports.TestSpeed=H;exports.Type=dt;exports.TypePassword=At;exports.UIElement=G;exports.UploadFile=ft;exports.Wait=oe;exports.and=Ee;exports.classIncludes=le;exports.classIs=ce;exports.default=se;exports.elementIndexIs=ge;exports.firstChildTextIs=ye;exports.innerTextContains=he;exports.innerTextIs=ue;exports.is=Ie;exports.isFirstElement=me;exports.placeholderIs=pe;exports.titleIs=de;exports.tomation=se;exports.wait=w;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and } from './dsl/ui-element-filters';
|
|
2
|
+
import { is, UIElement } from './dsl/ui-element';
|
|
3
|
+
import { Test } from './dsl/test';
|
|
4
|
+
import { tomation } from './tomation';
|
|
5
|
+
import { wait } from './feedback/ui-utils';
|
|
6
|
+
import { Task } from './dsl/task';
|
|
7
|
+
import { Select, Click, Type, TypePassword, ClearValue, Assert, PressEscKey, PressDownKey, PressTabKey, PressKey, PressEnterKey, UploadFile, SaveValue, Wait, Pause, ManualTask, ReloadPage } from './dsl/actions';
|
|
8
|
+
import DateUtils from './utils/date-utils';
|
|
9
|
+
import { AutomationEvents, EVENT_NAMES } from './engine/events';
|
|
10
|
+
import { AutomationInstance, Setup } from './engine/runner';
|
|
11
|
+
import { TestSpeed } from './engine/runner';
|
|
12
|
+
import { ACTION_STATUS, KEY_MAP } from './dom/actions';
|
|
4
13
|
export default tomation;
|
|
5
|
-
export { tomation,
|
|
14
|
+
export { tomation, UIElement, is, classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and, Test, Task, Click, Assert, Select, Type, TypePassword, ClearValue, PressEscKey, PressDownKey, PressTabKey, PressKey, PressEnterKey, KEY_MAP, UploadFile, SaveValue, Wait, Pause, ManualTask, ReloadPage, DateUtils, AutomationEvents, AutomationInstance, Setup, EVENT_NAMES, TestSpeed, wait, ACTION_STATUS, };
|