Skip to content

Commit

Permalink
fix: add hover to schema parser (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Jun 10, 2022
1 parent f6cb25d commit 5f3e390
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/SchemaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type {
UserFlow,
ClickAttributes,
DoubleClickStep,
HoverStep,
} from './Schema.js';

export function assertAllStepTypesAreHandled(s: never): never;
Expand Down Expand Up @@ -323,6 +324,13 @@ function parseDoubleClickStep(step: object): DoubleClickStep {
};
}

function parseHoverStep(step: object): HoverStep {
return {
...parseStepWithSelectors('hover', step),
type: 'hover',
};
}

function parseChangeStep(step: object): ChangeStep {
return {
...parseStepWithSelectors('click', step),
Expand Down Expand Up @@ -464,6 +472,8 @@ export function parseStep(step: unknown, idx?: number): Step {
return parseClickStep(step);
case 'doubleClick':
return parseDoubleClickStep(step);
case 'hover':
return parseHoverStep(step);
case 'change':
return parseChangeStep(step);
case 'keyDown':
Expand Down
16 changes: 16 additions & 0 deletions test/SchemaUtils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ describe('SchemaUtils', () => {
offsetX: 213.5,
offsetY: 46,
},
{
type: 'hover',
selectors: [
['aria/Google'],
['body > div.L3eUgb > div.o3j99.LLD4me.yr19Zb.LS8OJ > div > img'],
],
target: 'main',
},
{
type: 'click',
selectors: [
Expand Down Expand Up @@ -138,6 +146,14 @@ describe('SchemaUtils', () => {
offsetX: 213.5,
offsetY: 46,
},
{
type: 'hover',
selectors: [
['aria/Google'],
['body > div.L3eUgb > div.o3j99.LLD4me.yr19Zb.LS8OJ > div > img'],
],
target: 'main',
},
{
type: 'click',
selectors: [
Expand Down

0 comments on commit 5f3e390

Please sign in to comment.