Skip to content

Commit

Permalink
(fix): guard element calls - refs 95d97bd#r138469988
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Feb 12, 2024
1 parent e4b3439 commit 8d146c6
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/matchers/element/toBeClickable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function toBeClickable(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isClickable(), options)
const result = await executeCommandBe.call(this, received, el => el?.isClickable(), options)

await options.afterAssertion?.({
matcherName: 'toBeClickable',
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/element/toBeDisplayed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function toBeDisplayed(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isDisplayed(), options)
const result = await executeCommandBe.call(this, received, el => el?.isDisplayed(), options)

await options.afterAssertion?.({
matcherName: 'toBeDisplayed',
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/element/toBeDisplayedInViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function toBeDisplayedInViewport(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isDisplayedInViewport(), options)
const result = await executeCommandBe.call(this, received, el => el?.isDisplayedInViewport(), options)

await options.afterAssertion?.({
matcherName: 'toBeDisplayedInViewport',
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/element/toBeEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function toBeEnabled(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isEnabled(), options)
const result = await executeCommandBe.call(this, received, el => el?.isEnabled(), options)

await options.afterAssertion?.({
matcherName: 'toBeEnabled',
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/element/toBeExisting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function toExist(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isExisting(), options)
const result = await executeCommandBe.call(this, received, el => el?.isExisting(), options)

await options.afterAssertion?.({
matcherName: 'toExist',
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/element/toBeFocused.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function toBeFocused(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isFocused(), options)
const result = await executeCommandBe.call(this, received, el => el?.isFocused(), options)

await options.afterAssertion?.({
matcherName: 'toBeFocused',
Expand Down
2 changes: 1 addition & 1 deletion src/matchers/element/toBeSelected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function toBeSelected(
options,
})

const result = await executeCommandBe.call(this, received, el => el.isSelected(), options)
const result = await executeCommandBe.call(this, received, el => el?.isSelected(), options)

await options.afterAssertion?.({
matcherName: 'toBeSelected',
Expand Down

0 comments on commit 8d146c6

Please sign in to comment.