Skip to content

Better failure message when received object is undefined #1615

@christian-bromann

Description

@christian-bromann

Given a simple scenario:

const elems = $$('div')
await expect(elems[123]).toHaveText('foobar')

This fails with Cannot read properties of undefined (reading 'getText') as the object passed into expect is undefined. We should provide a better error message here and fail early.

This should be also fixed in the @wdio/runner where we currently just pass in the browser if a passed in object is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions