fix: register type actions correctly

This commit is contained in:
Rohit
2025-01-29 17:41:59 +05:30
parent 4484abfc88
commit 3c0f7900a4

View File

@@ -22,7 +22,7 @@ import { getBestSelectorForAction } from "../utils";
import { browserPool } from "../../server"; import { browserPool } from "../../server";
import { uuid } from "uuidv4"; import { uuid } from "uuidv4";
import { capture } from "../../utils/analytics" import { capture } from "../../utils/analytics"
import { encrypt } from "../../utils/auth"; import { decrypt, encrypt } from "../../utils/auth";
interface PersistedGeneratedData { interface PersistedGeneratedData {
lastUsedSelector: string; lastUsedSelector: string;
@@ -1062,14 +1062,18 @@ export class WorkflowGenerator {
if (condition.args && condition.args[1]) { if (condition.args && condition.args[1]) {
if (!input.selector) { if (!input.selector) {
input.selector = condition.args[0]; input.selector = condition.args[0];
input.type = condition.args[2]
} }
if (input.selector === condition.args[0]) { if (input.selector === condition.args[0]) {
input.actionCounter++; input.actionCounter++;
if (condition.args[1].length === 1) { const decryptedKey = decrypt(condition.args[1]);
input.value = input.value + condition.args[1];
} else if (condition.args[1] === 'Backspace') { if (decryptedKey.length === 1) {
input.value += decryptedKey;
} else if (decryptedKey === 'Backspace') {
input.value = input.value.slice(0, -1); input.value = input.value.slice(0, -1);
} else if (condition.args[1] !== 'Shift') { } else if (decryptedKey !== 'Shift') {
pushTheOptimizedAction(pair, index); pushTheOptimizedAction(pair, index);
pair.what.splice(index + 1, 0, { pair.what.splice(index + 1, 0, {
action: 'waitForLoadState', action: 'waitForLoadState',
@@ -1081,7 +1085,7 @@ export class WorkflowGenerator {
pushTheOptimizedAction(pair, index); pushTheOptimizedAction(pair, index);
input = { input = {
selector: condition.args[0], selector: condition.args[0],
value: condition.args[1], value: decrypt(condition.args[1]),
type: condition.args[2], type: condition.args[2],
actionCounter: 1, actionCounter: 1,
}; };