Skip to content

Commit

Permalink
fix: add parsing for visible, attributes, and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf committed Dec 22, 2022
1 parent 67a1ee8 commit 29e10db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/SchemaUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ function parseOptionalString(step: object, prop: string): string | undefined {
return undefined;
}

function parseOptionalBoolean(step: object, prop: string): boolean | undefined {
if (hasProperty(step, prop)) {
return parseBoolean(step, prop);
}
return undefined;
}

function parseString(step: object, prop: string): string {
if (hasProperty(step, prop)) {
const maybeString = step[prop];
Expand Down Expand Up @@ -429,6 +436,13 @@ function parseWaitForElementStep(step: object): WaitForElementStep {
type: StepType.WaitForElement,
operator: operator as '>=' | '==' | '<=' | undefined,
count: parseOptionalNumber(step, 'count'),
visible: parseOptionalBoolean(step, 'visible'),
attributes: hasProperty(step, 'attributes')
? (step.attributes as { [name: string]: string })
: undefined,
properties: hasProperty(step, 'properties')
? (step.properties as { [name: string]: string })
: undefined,
};
}

Expand Down
6 changes: 6 additions & 0 deletions test/SchemaUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ describe('SchemaUtils', () => {
selectors: [['aria/Test']],
operator: '==',
count: 1,
properties: {},
attributes: {},
visible: true,
},
],
}),
Expand All @@ -333,6 +336,9 @@ describe('SchemaUtils', () => {
selectors: [['aria/Test']],
operator: '==',
count: 1,
properties: {},
attributes: {},
visible: true,
},
],
}
Expand Down

0 comments on commit 29e10db

Please sign in to comment.