Skip to content

Commit

Permalink
fix: add flag status to trigger next action
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Mar 9, 2024
1 parent a1416c5 commit 3600a6b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,19 @@ function runAction(stagedActions, index, element) {

function runSpecialAction(actions, index, element, actionName, params) {
if (!params) return "next";
let elements
let elements, status = "next"
switch (actionName) {
case 'event':
console.log("Waiting Event....");
status = ""
document.addEventListener(params, () => {
console.log('Event Action (Received event from other section) ====== ' + params);
runNextAction(actions, index, element);
}, { once: true })
break;
case 'timeout':
status = ""

let delayTime = parseInt(params);
if (delayTime > 0) {
setTimeout(function () {
Expand Down Expand Up @@ -141,8 +144,14 @@ function runSpecialAction(actions, index, element, actionName, params) {
form.click();
break;
default:
return "next";
elements = queryElements({ element, selector: params, type: 'selector' });
for (let i = 0; i < elements.length; i++) {
if (elements[i][actionName])
elements[i][actionName]();
}
}

return status
}

function runNextAction(actions, index, element) {
Expand Down

0 comments on commit 3600a6b

Please sign in to comment.