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 7472456
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 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,15 @@ function parseWaitForElementStep(step: object): WaitForElementStep {
type: StepType.WaitForElement,
operator: operator as '>=' | '==' | '<=' | undefined,
count: parseOptionalNumber(step, 'count'),
visible: parseOptionalBoolean(step, 'visible'),
attributes:
'attributes' in step
? (step.attributes as { [name: string]: string })
: undefined,
properties:
'properties' in step
? (step.properties as { [name: string]: string })
: undefined,
};
}

Expand Down

0 comments on commit 7472456

Please sign in to comment.