tomation 0.0.6 → 0.0.8
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/.vite/manifest.json +1 -1
- package/dist/{dom/actions.d.ts → actions.d.ts} +43 -2
- package/dist/automation.d.ts +137 -0
- package/dist/main.cjs +1 -1
- package/dist/main.d.ts +4 -13
- package/dist/main.js +710 -602
- package/dist/{dsl/ui-element.d.ts → ui-element-builder.d.ts} +13 -1
- package/package.json +1 -1
- package/dist/dsl/actions.d.ts +0 -53
- package/dist/dsl/task.d.ts +0 -2
- package/dist/dsl/test.d.ts +0 -4
- package/dist/dsl/ui-element-filters.d.ts +0 -12
- package/dist/engine/compiler.d.ts +0 -8
- package/dist/engine/events.d.ts +0 -25
- package/dist/engine/runner.d.ts +0 -49
- package/dist/feedback/logger.d.ts +0 -7
- package/dist/tomation.d.ts +0 -9
- /package/dist/{utils/date-utils.d.ts → date-utils.d.ts} +0 -0
- /package/dist/{feedback/ui-utils.d.ts → ui-utils.d.ts} +0 -0
package/dist/.vite/manifest.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UIElement } from "
|
|
1
|
+
import { UIElement } from "./ui-element-builder";
|
|
2
2
|
interface ActionContext {
|
|
3
3
|
url: string;
|
|
4
4
|
beforeHTML: string;
|
|
@@ -59,6 +59,7 @@ declare class Action extends AbstractAction {
|
|
|
59
59
|
error: string;
|
|
60
60
|
};
|
|
61
61
|
resetAction(): void;
|
|
62
|
+
private handlePause;
|
|
62
63
|
continue(): Promise<void>;
|
|
63
64
|
executeAction(): Promise<void>;
|
|
64
65
|
setParams(params?: any): void;
|
|
@@ -440,4 +441,44 @@ declare class ReloadPageAction extends AbstractAction {
|
|
|
440
441
|
executeAction(): Promise<void>;
|
|
441
442
|
resetAction(): void;
|
|
442
443
|
}
|
|
443
|
-
|
|
444
|
+
declare class IfAction extends AbstractAction {
|
|
445
|
+
condition: () => boolean | Promise<boolean>;
|
|
446
|
+
ifAction: Action;
|
|
447
|
+
elseAction?: Action;
|
|
448
|
+
conditionDescription: string;
|
|
449
|
+
constructor(condition: () => boolean | Promise<boolean>, ifAction: Action, elseAction?: Action, conditionDescription?: string);
|
|
450
|
+
getDescription(): string;
|
|
451
|
+
getJSON(): {
|
|
452
|
+
type: string;
|
|
453
|
+
conditionDescription: string;
|
|
454
|
+
ifAction: {
|
|
455
|
+
type: string;
|
|
456
|
+
params: any;
|
|
457
|
+
steps: Object[];
|
|
458
|
+
id: string;
|
|
459
|
+
description: string;
|
|
460
|
+
context: ActionContext;
|
|
461
|
+
status: ACTION_STATUS;
|
|
462
|
+
error: string;
|
|
463
|
+
};
|
|
464
|
+
elseAction: {
|
|
465
|
+
type: string;
|
|
466
|
+
params: any;
|
|
467
|
+
steps: Object[];
|
|
468
|
+
id: string;
|
|
469
|
+
description: string;
|
|
470
|
+
context: ActionContext;
|
|
471
|
+
status: ACTION_STATUS;
|
|
472
|
+
error: string;
|
|
473
|
+
} | undefined;
|
|
474
|
+
id: string;
|
|
475
|
+
description: string;
|
|
476
|
+
context: ActionContext;
|
|
477
|
+
status: ACTION_STATUS;
|
|
478
|
+
error: string;
|
|
479
|
+
};
|
|
480
|
+
executeAction(): Promise<void>;
|
|
481
|
+
resetAction(): void;
|
|
482
|
+
compileSteps(): void;
|
|
483
|
+
}
|
|
484
|
+
export { AbstractAction, Action, ActionOnElement, ClickAction, SelectAction, TypeAction, TypePasswordAction, PressEscKeyAction, PressDownKeyAction, PressTabKeyAction, PressKeyAction, KEY_MAP, PressEnterKeyAction, UploadFileAction, AssertTextIsAction, AssertContainsTextAction, AssertValueIsAction, AssertExistsAction, AssertNotExistsAction, SaveValueAction, WaitAction, WaitUntilElementRemovedAction, PauseAction, ManualAction, ReloadPageAction, IfAction, ACTION_STATUS, };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { AbstractAction, Action, KEY_MAP, ACTION_STATUS } from './actions';
|
|
2
|
+
import { UIUtils } from "./ui-utils";
|
|
3
|
+
import { UIElement } from './ui-element-builder';
|
|
4
|
+
import DateUtils from './date-utils';
|
|
5
|
+
declare const setAutomationLogs: (enabled: boolean) => void;
|
|
6
|
+
declare enum EVENT_NAMES {
|
|
7
|
+
ACTION_UPDATE = "tomation-action-update",
|
|
8
|
+
SAVE_VALUE = "tomation-save-value",
|
|
9
|
+
REGISTER_TEST = "tomation-register-test",
|
|
10
|
+
TEST_STARTED = "tomation-test-started",
|
|
11
|
+
TEST_PASSED = "tomation-test-passed",
|
|
12
|
+
TEST_FAILED = "tomation-test-failed",
|
|
13
|
+
TEST_END = "tomation-test-end",
|
|
14
|
+
TEST_STOP = "tomation-test-stop",
|
|
15
|
+
TEST_PAUSE = "tomation-test-pause",
|
|
16
|
+
TEST_PLAY = "tomation-test-play",
|
|
17
|
+
USER_ACCEPT = "tomation-user-accept",
|
|
18
|
+
USER_REJECT = "tomation-user-reject",
|
|
19
|
+
SESSION_INIT = "tomation-session-init",
|
|
20
|
+
ACTION_ERROR = "tomation-action-error"
|
|
21
|
+
}
|
|
22
|
+
type AutomationEventHandlerType = ((action?: any) => void);
|
|
23
|
+
declare class EventDispatcher {
|
|
24
|
+
events: Map<EVENT_NAMES, Array<AutomationEventHandlerType>>;
|
|
25
|
+
constructor();
|
|
26
|
+
on(eventName: EVENT_NAMES, callback: AutomationEventHandlerType): void;
|
|
27
|
+
off(eventName: EVENT_NAMES, callback: AutomationEventHandlerType): void;
|
|
28
|
+
dispatch(eventName: EVENT_NAMES, data?: any): void;
|
|
29
|
+
}
|
|
30
|
+
declare const AutomationEvents: EventDispatcher;
|
|
31
|
+
declare enum TestSpeed {
|
|
32
|
+
SLOW = 2000,
|
|
33
|
+
NORMAL = 1000,
|
|
34
|
+
FAST = 200
|
|
35
|
+
}
|
|
36
|
+
declare enum TestPlayStatus {
|
|
37
|
+
PLAYING = "Playing",
|
|
38
|
+
STOPPED = "Stopped",
|
|
39
|
+
PAUSED = "Paused"
|
|
40
|
+
}
|
|
41
|
+
declare enum RunMode {
|
|
42
|
+
NORMAL = "Normal",
|
|
43
|
+
STEPBYSTEP = "Step By Step"
|
|
44
|
+
}
|
|
45
|
+
declare const Test: (id: string, steps: () => void) => void;
|
|
46
|
+
declare const RunTest: (id: string) => void;
|
|
47
|
+
declare const Task: <T>(id: string, steps: (params: T) => void) => (params?: T | undefined) => Promise<void>;
|
|
48
|
+
declare const Click: (uiElement: UIElement) => void;
|
|
49
|
+
declare const Assert: (uiElement: UIElement) => {
|
|
50
|
+
textIs: (text: string) => void;
|
|
51
|
+
containsText: (text: string) => void;
|
|
52
|
+
valueIs: (value: string) => void;
|
|
53
|
+
exists: () => void;
|
|
54
|
+
notExists: () => void;
|
|
55
|
+
};
|
|
56
|
+
declare const Select: (value: string) => {
|
|
57
|
+
in: (uiElement: UIElement) => void;
|
|
58
|
+
};
|
|
59
|
+
declare const Type: (value: string) => {
|
|
60
|
+
in: (uiElement: UIElement) => void;
|
|
61
|
+
};
|
|
62
|
+
declare const ClearValue: () => {
|
|
63
|
+
in: (uiElement: UIElement) => void;
|
|
64
|
+
};
|
|
65
|
+
declare const PressEscKey: () => {
|
|
66
|
+
in: (uiElement: UIElement) => void;
|
|
67
|
+
};
|
|
68
|
+
declare const PressDownKey: () => {
|
|
69
|
+
in: (uiElement: UIElement) => void;
|
|
70
|
+
};
|
|
71
|
+
declare const PressTabKey: () => {
|
|
72
|
+
in: (uiElement: UIElement) => void;
|
|
73
|
+
};
|
|
74
|
+
declare const PressEnterKey: () => {
|
|
75
|
+
in: (uiElement: UIElement) => void;
|
|
76
|
+
};
|
|
77
|
+
declare const PressKey: (key: KEY_MAP) => {
|
|
78
|
+
in: (uiElement: UIElement) => void;
|
|
79
|
+
};
|
|
80
|
+
declare const TypePassword: (value: string) => {
|
|
81
|
+
in: (uiElement: UIElement) => void;
|
|
82
|
+
};
|
|
83
|
+
declare const UploadFile: (file: File) => {
|
|
84
|
+
in: (uiElement: UIElement) => void;
|
|
85
|
+
};
|
|
86
|
+
declare const SaveValue: (uiElement: UIElement) => {
|
|
87
|
+
in: (memorySlotName: string) => void;
|
|
88
|
+
};
|
|
89
|
+
declare const Wait: {
|
|
90
|
+
(miliseconds: number): void;
|
|
91
|
+
untilElement(uiElement: UIElement): {
|
|
92
|
+
isRemoved: () => void;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
declare const Pause: () => void;
|
|
96
|
+
declare const ManualTask: (description: string) => void;
|
|
97
|
+
declare const ReloadPage: () => void;
|
|
98
|
+
declare const If: (description: string, condition: () => boolean) => {
|
|
99
|
+
then: (thenSteps: Action) => {
|
|
100
|
+
else: (elseSteps: Action) => void;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
declare class Automation {
|
|
104
|
+
private _document;
|
|
105
|
+
debug: Boolean;
|
|
106
|
+
private _uiUtils;
|
|
107
|
+
speed: TestSpeed;
|
|
108
|
+
status: TestPlayStatus;
|
|
109
|
+
runMode: RunMode;
|
|
110
|
+
currentActionCallback: ((action: AbstractAction) => {}) | undefined;
|
|
111
|
+
currentAction: AbstractAction | undefined;
|
|
112
|
+
constructor(window: Window);
|
|
113
|
+
get document(): Document;
|
|
114
|
+
get uiUtils(): UIUtils;
|
|
115
|
+
get isStepByStepMode(): boolean;
|
|
116
|
+
get isStopped(): boolean;
|
|
117
|
+
get isPlaying(): boolean;
|
|
118
|
+
get isPaused(): boolean;
|
|
119
|
+
pause(): void;
|
|
120
|
+
continue(): void;
|
|
121
|
+
next(): void;
|
|
122
|
+
stop(): void;
|
|
123
|
+
retryAction(): void;
|
|
124
|
+
skipAction(): void;
|
|
125
|
+
saveCurrentAction(callback: (action: AbstractAction) => {}, action: AbstractAction): void;
|
|
126
|
+
setDebug(value: boolean): void;
|
|
127
|
+
}
|
|
128
|
+
declare let AutomationInstance: Automation;
|
|
129
|
+
declare const Setup: (window: Window, tests?: Array<any>) => Automation;
|
|
130
|
+
interface TomationOptions {
|
|
131
|
+
matches: string | RegExp;
|
|
132
|
+
tests: any[];
|
|
133
|
+
speed?: keyof typeof TestSpeed;
|
|
134
|
+
debug?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export declare function tomation(options: TomationOptions): void;
|
|
137
|
+
export { Setup, AutomationInstance, Test, RunTest, Task, Click, Assert, Select, Type, TypePassword, ClearValue, PressEscKey, PressDownKey, PressTabKey, PressKey, PressEnterKey, KEY_MAP, UploadFile, SaveValue, Wait, Pause, ManualTask, ReloadPage, If, DateUtils, AutomationEvents, EVENT_NAMES, TestSpeed, ACTION_STATUS, setAutomationLogs, };
|
package/dist/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";var at=Object.defineProperty;var ct=(e,t,n)=>t in e?at(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var i=(e,t,n)=>(ct(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class z{constructor(t,n,s,o){i(this,"name");i(this,"selector");i(this,"parent");i(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 V;const lt=e=>{V=e},W=(e,t)=>(s=V,o)=>{s=s||V,console.log("Searching elem from Root = ",s);const a=[];s.querySelectorAll(e).forEach(c=>{c.style.display!=="none"&&a.push(c)});let r;return t?(console.log("Applying filter ",t),console.log(" -- to "+a.length+"elements: ",a),r=a.filter((c,E,x)=>{console.log("Apply filter to item "+E+": ",c);const m=t(c,E,x);return console.log(` -> Item ${E} ${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},L=(e,t,n)=>({as:s=>new z(s,e,t,n)}),ut=(e,t)=>({...L(e,t),postProcess:n=>({...L(e,t,n)})}),G=e=>({...L(e,null),childOf:t=>({...ut(e,t)}),postProcess:t=>({...L(e,null,t)})}),N=e=>({where:t=>G(W(e,t))}),ht=N("div"),dt=N("button"),pt=N("input"),mt=N("textarea"),gt=e=>G(W("#"+e)),yt=e=>N(e);let Q=!1;const Et=e=>{Q=e},w=(...e)=>{Q&&console.log("[UIElement Filter]",...e)},At=e=>t=>{const n=t.className==e;return w(`classIs('${e}') on`,t,"=>",n),n},wt=e=>t=>{const n=t.className.split(" ").includes(e);return w(`classIncludes('${e}') on`,t,"=>",n),n},ft=e=>t=>{var s;const n=((s=t.textContent)==null?void 0:s.trim())==e;return w(`innerTextIs('${e}') on`,t,"=>",n),n},xt=e=>t=>{const n=t.innerText.trim().includes(e);return w(`innerTextContains('${e}') on`,t,"=>",n),n},Ct=e=>t=>{const n=t.title==e;return w(`titleIs('${e}') on`,t,"=>",n),n},St=e=>t=>{const n=t.placeholder===e;return w(`placeholderIs('${e}') on`,t,"=>",n),n},Tt=()=>(e,t)=>{const n=t===0;return w("isFirstElement on",e,"index",t,"=>",n),n},It=e=>(t,n)=>{const s=n===e;return w(`elementIndexIs(${e}) on`,t,"elemIndex",n,"=>",s),s},kt=e=>t=>{const n=(t==null?void 0:t.firstChild).innerText.trim()===e;return w(`firstChildTextIs('${e}') on`,t,"=>",n),n},vt=e=>(t,n)=>{const s=e.every((o,a)=>{const r=o(t,n);return w(`and condition[${a}] on`,t,"elemIndex",n,"=>",r),r});return w("and final result on",t,"elemIndex",n,"=>",s),s},Nt={DIV:ht,BUTTON:dt,INPUT:pt,TEXTAREA:mt,ELEMENT:yt,identifiedBy:gt};let O;const bt=new Uint8Array(16);function Ot(){if(!O&&(O=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!O))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return O(bt)}const p=[];for(let e=0;e<256;++e)p.push((e+256).toString(16).slice(1));function Dt(e,t=0){return(p[e[t+0]]+p[e[t+1]]+p[e[t+2]]+p[e[t+3]]+"-"+p[e[t+4]]+p[e[t+5]]+"-"+p[e[t+6]]+p[e[t+7]]+"-"+p[e[t+8]]+p[e[t+9]]+"-"+p[e[t+10]]+p[e[t+11]]+p[e[t+12]]+p[e[t+13]]+p[e[t+14]]+p[e[t+15]]).toLowerCase()}const Pt=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),H={randomUUID:Pt};function Z(e,t,n){if(H.randomUUID&&!t&&!e)return H.randomUUID();e=e||{};const s=e.random||(e.rng||Ot)();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 Dt(s)}const A=(e=2e3)=>new Promise(t=>{setTimeout(()=>{t(null)},e)}),f=(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 Lt{constructor(t){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=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&&f(s,n.styles),n.parent&&n.parent.appendChild(s)),s}async logAction(t){const n=exports.AutomationInstance.document.createElement("DIV");n.innerText=t,f(n,{padding:"3px 10px",opacity:"1",transition:"opacity 1s"}),this.devToolsMessageContainer.appendChild(n),await A(4e3),n.style.opacity="0",await A(4e3),this.devToolsMessageContainer.removeChild(n),await A(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 A(200)}async showAlert(t){const n=exports.AutomationInstance.document.createElement("DIV"),s=exports.AutomationInstance.document.body;n.innerText=t,f(s,{paddingTop:"30px"}),f(this.devToolsAlertContainer,{display:"flex"}),this.devToolsAlertContainer.appendChild(n)}async hideAlert(){f(this.devToolsAlertContainer,{display:"none"});const t=exports.AutomationInstance.document.body;f(t,{paddingTop:"0"}),this.devToolsAlertContainer.firstChild&&this.devToolsAlertContainer.removeChild(this.devToolsAlertContainer.firstChild)}async hideCheckElementContainer(){this.devToolsCheckElementContainer.style.opacity="0",await A(200),this.devToolsCheckElementContainer.style.display="none"}displayContext(t){f(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",f(n,{flex:"50%",width:"100%",height:"auto",border:"2px solid orange"});const s=this.document.createElement("DIV");s.id="context-viewer-after",f(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),f(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]})},F=null,D=async(e,t,n,s=1e3,o=0,a=10,r=!1)=>{if(console.log("Automation Status: ",exports.AutomationInstance.status),exports.AutomationInstance.isPaused)return new Promise((c,E)=>{exports.AutomationInstance.saveCurrentAction(async x=>{if(x.status=="skipped")return c(null);try{const m=await D(x,t,n,s,o,a,r);c(m)}catch(m){E(m)}},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(),r?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?r?(await A(s),await D(e,t,n,s,++o,a,r)):(console.log("Element found = ",c),c):r?(console.log("Element removed."),F):(await A(s),await D(e,t,n,s,++o,a,r))}},U=async(e,t,n=1e3,s=10,o=!1)=>{const a=t==null?void 0:t.getElementName();console.group("Looking for Element: "+a);let r=null;if(t.parent)try{console.groupCollapsed("Look for Parent ",t.parent.getElementName()),r=await U(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(),F;throw console.groupEnd(),c}try{console.log("Using parent element: ",r);const c=await D(e,t,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(),F;throw console.groupEnd(),c}};var B=(e=>(e.WAITING="waiting",e.RUNNING="running",e.STOPPED="stopped",e.PAUSED="paused",e.SUCCESS="success",e.ERROR="error",e.SKIPPED="skipped",e))(B||{});class y{constructor(){i(this,"status");i(this,"error");i(this,"id");i(this,"context");this.status="waiting",this.error="",this.id=Z(),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){h.dispatch(S.ACTION_UPDATE,{action:t.getJSON()})}}class Y extends y{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 handlePause(){return new Promise((n,s)=>{exports.AutomationInstance.saveCurrentAction(async o=>{if(o.status==="skipped"){n();return}try{await this.continue(),n()}catch(a){s(a)}},this)})}async continue(){for(;this.index<this.steps.length;){if(exports.AutomationInstance.isStopped)throw new Error("Test stopped manually");const n=this.steps[this.index];try{if(await A(exports.AutomationInstance.speed),await n.execute(),exports.AutomationInstance.isPaused){if(await this.handlePause(),n.status==="skipped"){this.index++;continue}}else this.index++}catch(s){throw h.dispatch(S.ACTION_ERROR,{action:this.getJSON(),step:n,error:s.message,index:this.index}),s}}}async executeAction(){this.index=0,await this.continue()}setParams(n){this.params=n}addStep(n){this.steps.push(n)}}class d extends y{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(E,x)=>{var I;const m=async(C,b=1e3,k=0,v=!1)=>{if(console.groupCollapsed(`tries ${k}/${a}`),n.updateTries(k),await y.notifyActionUpdated(n),k===a)throw console.groupEnd(),v?new Error(`UI Element ${c||"UNKNOWN"} still present after 10 tries`):new Error(`UI Element ${c||"UNKNOWN"} not found after 10 tries`);{const K=s.selector(C,s.postProcess);return console.groupEnd(),K?v?(await A(b),await m(C,b,++k,v)):(console.log("Element found = ",K),K):v?(console.log("Element removed."),null):(await A(b),await m(C,b,++k,v))}};console.group("[Action On Element] Looking for Element: "+c);let T=null,J=!0;if(s.parent){console.groupCollapsed("Look for Parent ",s.parent.getElementName());try{T=await d.waitForElement(n,s.parent,o,a,r)}catch{J=!1}finally{console.groupEnd()}}if(J){console.log("using parent element: ",T);try{const C=await m(T,o,0,r);console.groupEnd(),E(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 U(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 $t extends d{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 Ut 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 Rt 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 Jt 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 Kt extends d{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 Vt extends d{constructor(t){super(t)}async executeAction(){var t;try{this.element=await U(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 Ft 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 _ 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 Mt 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 Wt extends d{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 Bt extends d{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 qt extends d{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 Ht extends d{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 tt=(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))(tt||{});const X={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 jt 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:X[this.key],charCode:0,which:X[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 Xt 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 E;return c!=null&&c.parentElement?((E=c.parentElement)==null?void 0:E.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 zt 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(S.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 Gt extends y{constructor(n){super();i(this,"miliseconds");this.miliseconds=n}getDescription(){return"Wait "+this.miliseconds+" miliseconds"}getJSON(){return{...super.getJSON(),type:"Wait"}}async executeAction(){await A(this.miliseconds)}resetAction(){}}class Qt extends y{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 U(this,this.uiElement,1e3,10,!0)}getDescription(){return"Wait until "+this.getElementName()+" is removed"}getJSON(){return{...super.getJSON(),type:"WaitUntilElementRemoved"}}}class Zt extends y{constructor(){super()}getDescription(){return"Paused"}getJSON(){return{...super.getJSON(),type:"Pause"}}async executeAction(){await exports.AutomationInstance.pause()}resetAction(){}}class Yt extends y{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(S.USER_ACCEPT,async()=>(await exports.AutomationInstance.uiUtils.hideAlert(),n(!0))),h.on(S.USER_REJECT,async()=>(await exports.AutomationInstance.uiUtils.hideAlert(),s()))})}resetAction(){}}class _t extends y{constructor(){super()}getDescription(){return"Reload page"}getJSON(){return{...super.getJSON(),type:"ReloadPage"}}async executeAction(){await location.reload()}resetAction(){}}class te extends y{constructor(n,s,o,a="condition"){super();i(this,"condition");i(this,"ifAction");i(this,"elseAction");i(this,"conditionDescription");this.condition=n,this.ifAction=s,this.elseAction=o,this.conditionDescription=a}getDescription(){const n=this.elseAction?`, else ${this.elseAction.getDescription()}`:"";return`If ${this.conditionDescription}, then ${this.ifAction.getDescription()}${n}`}getJSON(){var n;return{...super.getJSON(),type:"If",conditionDescription:this.conditionDescription,ifAction:this.ifAction.getJSON(),elseAction:(n=this.elseAction)==null?void 0:n.getJSON()}}async executeAction(){try{await this.condition(),await this.ifAction.execute()}catch{this.elseAction&&await this.elseAction.execute()}}resetAction(){var n;this.ifAction.reset(),(n=this.elseAction)==null||n.reset()}compileSteps(){var n;this.ifAction.compileSteps(),(n=this.elseAction)==null||n.compileSteps()}}const $=e=>e.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}),R=e=>{const t=new Date;return $(new Date(t.setDate(t.getDate()+e)))},et=e=>{const t=new Date;return $(new Date(t.setMonth(t.getMonth()+e)))},ee=R(1),ne=R(-1),se=R(7),oe=R(-7),ie=et(1),re=et(-1),ae={formatDate:$,today:$(new Date),tomorrow:ee,nextWeek:se,nextMonth:ie,yesterday:ne,lastWeek:oe,lastMonth:re};class ce{constructor(){i(this,"enabled",!1)}setEnabled(t){this.enabled=t}log(...t){this.enabled&&console.log("[tomation]",...t)}groupCollapsed(...t){this.enabled&&console.groupCollapsed("[tomation]",...t)}groupEnd(){this.enabled&&console.groupEnd()}error(...t){this.enabled&&console.error("[tomation]",...t)}}const l=new ce,nt=e=>{l.setEnabled(e)},g=class g{static compileAction(t){const n=g.currentAction;g.currentAction=t,t.compileSteps(),g.currentAction=n}static compileConditionalAction(t){const n=g.currentAction;g.currentAction=t,t.compileSteps(),g.currentAction=n}static addAction(t){l.log("Add action: ",t.getDescription()),g.currentAction.addStep(t)}static init(t){g.currentAction=t,g.isCompiling=!0,l.groupCollapsed("Compile: "+t.getDescription()),t.compileSteps(),g.isCompiling=!1,l.log("Compilation finished"),l.groupEnd()}};i(g,"currentAction"),i(g,"isCompiling");let u=g;var S=(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.ACTION_ERROR="tomation-action-error",e))(S||{});class le{constructor(){i(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 h=new le;var q=(e=>(e[e.SLOW=2e3]="SLOW",e[e.NORMAL=1e3]="NORMAL",e[e.FAST=200]="FAST",e))(q||{});class st{static async start(t){if(exports.AutomationInstance.status!=="Stopped")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.");exports.AutomationInstance.status="Playing",exports.AutomationInstance.runMode="Normal",l.groupCollapsed("Start Action: ",t.getDescription()),h.dispatch("tomation-test-started",{action:t==null?void 0:t.getJSON()});try{await(t==null?void 0:t.execute()),h.dispatch("tomation-test-passed",{id:t.name}),exports.AutomationInstance.status="Stopped"}catch(n){throw h.dispatch("tomation-test-failed",{id:t.name}),exports.AutomationInstance.uiUtils.hideCheckElementContainer(),l.error(`🤖 Error running task ${t.getDescription()}. Reason: ${n.message}`),exports.AutomationInstance.status="Paused",n}finally{l.groupEnd(),h.dispatch("tomation-test-end",{action:t==null?void 0:t.getJSON()})}}}const P={},ue=(e,t)=>{console.log(`Registering Test: ${e}...`);const n=new Y(e,t);h.dispatch("tomation-register-test",{id:e}),console.log(`Registered Test: ${e} in TestsMap`),P[e]=()=>{l.log(`Compilation of Test ${e} starts...`),u.init(n),l.log(`Compilation of Test ${e} Finished.`),l.log(`Start running Test ${e}...`),st.start(n)}},ot=e=>{if(P[e])P[e]();else throw console.log("Available Tests:",Object.keys(P)),new Error(`Test with id ${e} not found.`)},he=(e,t)=>async n=>{const s=new Y(e,t);if(s.setParams(n),exports.AutomationInstance.status=="Stopped"&&!u.isCompiling)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 st.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)},de=e=>{const t=new $t(e);u.addAction(t)},pe=e=>({textIs:t=>{u.addAction(new Ut(e,t))},containsText:t=>{u.addAction(new Rt(e,t))},valueIs:t=>{u.addAction(new Jt(e,t))},exists:()=>{u.addAction(new Kt(e))},notExists:()=>{u.addAction(new Vt(e))}}),me=e=>({in:t=>{const n=new Ft(t,e);u.addAction(n)}}),ge=e=>({in:t=>{const n=new _(t,e);u.addAction(n)}}),ye=()=>({in:e=>{const t=new _(e,"");u.addAction(t)}}),Ee=()=>({in:e=>{u.addAction(new Wt(e))}}),Ae=()=>({in:e=>{u.addAction(new Bt(e))}}),we=()=>({in:e=>{u.addAction(new qt(e))}}),fe=()=>({in:e=>{u.addAction(new Ht(e))}}),xe=e=>({in:t=>{u.addAction(new jt(t,e))}}),Ce=e=>({in:t=>{const n=new Mt(t,e);u.addAction(n)}}),Se=e=>({in:t=>{const n=new Xt(t,e);u.addAction(n)}}),Te=e=>({in:t=>{const n=new zt(e,t);u.addAction(n)}}),it=e=>{u.addAction(new Gt(e))};it.untilElement=e=>({isRemoved:()=>{u.addAction(new Qt(e))}});const Ie=()=>{u.addAction(new Zt)},ke=e=>{u.addAction(new Yt(e))},ve=()=>{u.addAction(new _t)},Ne=(e,t)=>({then:n=>({else:s=>{const o=new te(t,n,s,e);u.addAction(o)}})});class be{constructor(t){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=t.document,this.debug=!0,this._uiUtils=new Lt(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",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="Paused",this.runMode="Step By Step",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=B.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){nt(t)}}exports.AutomationInstance=void 0;const M=(e,t)=>(exports.AutomationInstance=new be(e),lt(exports.AutomationInstance.document),t==null||t.forEach(n=>n()),exports.AutomationInstance);function rt(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(S).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:E,payload:x}=r.data||{},{cmd:m,params:T}=x||{};if(E!=="web-extension")return;if(c==="contentScript-to-injectedScript"){const I={"run-test-request":()=>ot(T==null?void 0:T.testId),"reload-tests-request":()=>M(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)}}),window.postMessage({message:"injectedScript-to-contentScript",sender:"tomation",payload:{cmd:"tomation-session-init",params:{sessionId:Z()}}}),M(window,n),exports.AutomationInstance.setDebug(o),exports.AutomationInstance.speed=q[s],console.log("[tomation] Ready ✓")}catch(r){console.error("[tomation] Initialization failed:",r)}}exports.ACTION_STATUS=B;exports.Assert=pe;exports.AutomationEvents=h;exports.ClearValue=ye;exports.Click=de;exports.DateUtils=ae;exports.EVENT_NAMES=S;exports.If=Ne;exports.KEY_MAP=tt;exports.ManualTask=ke;exports.Pause=Ie;exports.PressDownKey=Ae;exports.PressEnterKey=fe;exports.PressEscKey=Ee;exports.PressKey=xe;exports.PressTabKey=we;exports.ReloadPage=ve;exports.RunTest=ot;exports.SaveValue=Te;exports.Select=me;exports.SelectorBuilder=W;exports.Setup=M;exports.Task=he;exports.Test=ue;exports.TestSpeed=q;exports.Type=ge;exports.TypePassword=Ce;exports.UIElement=z;exports.UploadFile=Se;exports.Wait=it;exports.and=vt;exports.classIncludes=wt;exports.classIs=At;exports.default=rt;exports.elementIndexIs=It;exports.firstChildTextIs=kt;exports.innerTextContains=xt;exports.innerTextIs=ft;exports.is=Nt;exports.isFirstElement=Tt;exports.placeholderIs=St;exports.setAutomationLogs=nt;exports.setFilterLogs=Et;exports.titleIs=Ct;exports.tomation=rt;exports.wait=A;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and } from './
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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';
|
|
1
|
+
import { SelectorBuilder, UIElement, is, classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and, setFilterLogs } from './ui-element-builder';
|
|
2
|
+
import { Setup, Test, RunTest, Task, Click, Assert, Select, Type, TypePassword, ClearValue, PressEscKey, PressDownKey, PressTabKey, PressEnterKey, PressKey, KEY_MAP, UploadFile, SaveValue, Wait, ManualTask, Pause, DateUtils, AutomationEvents, AutomationInstance, EVENT_NAMES, TestSpeed, ReloadPage, If, ACTION_STATUS, setAutomationLogs, tomation } from './automation';
|
|
3
|
+
import { wait } from './ui-utils';
|
|
13
4
|
export default 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,
|
|
5
|
+
export { tomation, SelectorBuilder, UIElement, is, classIs, classIncludes, innerTextIs, innerTextContains, titleIs, placeholderIs, isFirstElement, elementIndexIs, firstChildTextIs, and, setFilterLogs, Setup, Test, RunTest, Task, Click, Assert, Select, Type, TypePassword, ClearValue, PressEscKey, PressDownKey, PressTabKey, PressKey, PressEnterKey, KEY_MAP, UploadFile, SaveValue, Wait, Pause, ManualTask, ReloadPage, If, DateUtils, AutomationEvents, AutomationInstance, EVENT_NAMES, TestSpeed, wait, ACTION_STATUS, setAutomationLogs, };
|