Skip to content

Commit

Permalink
Refactor converter.ts to handle keyDown and keyUp actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmesh-hemaram committed Sep 18, 2024
1 parent f9607e5 commit 9e22d90
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/acf-extension/src/devtools/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Action, CONFIG_SOURCE, Configuration, getDefaultAction, getDefaultConfi

import { Recording, Step } from './index.types';

let ELEMENT_FINDER: string;

const getProps = (selectors: Array<Array<string>>) => {
let elementFinder = '';
let name = '';
Expand All @@ -17,6 +19,7 @@ const getProps = (selectors: Array<Array<string>>) => {
}
return true;
});
ELEMENT_FINDER = elementFinder;
return { elementFinder, name };
};

Expand Down Expand Up @@ -47,6 +50,12 @@ export const ConvertStep = (step: Step) => {
break;
case 'keyDown':
case 'keyUp':
{
action.elementFinder = ELEMENT_FINDER;
action.name = step.key;
action.value = `KeyboardEvents::${step.key}`;
}
break;
case 'navigate':
case 'setViewport':
break;
Expand Down Expand Up @@ -76,6 +85,8 @@ export const ConvertRecording = (recording: Recording) => {
console.assert(navigate.url, 'URL is required for navigate step');
config = getConfig(navigate.url);
configs.push(config);
} else {
console.assert(false, 'First step should be navigate');
}

console.assert(steps.length === 0, 'No steps found in recording');
Expand Down

0 comments on commit 9e22d90

Please sign in to comment.