Skip to content

Better soft assertions support #1887

@dprevost-LMI

Description

@dprevost-LMI

Soft assertions currently have three limitations:

  1. It does not support basic matchers like toBe or toEqual from the expect library, but only custom matchers of wdio. This line is related.
  2. If we support the above, the current implementation uses await by default, which is not required when called for basic matchers. See this code line.
  3. When using Jasmine augmentation, the soft assertions method is not available in the typing. See jasmine.d.ts
  • Also, if jasmine is used as the global ambient soft is not working vs if we import expect from expect-webdriverio. However, this is potentially a @wdio/jasmine-framework or @wdio/local-runner bugs and not one from expect-webdriverio

To expand a bit

  1. matchers from import { matchers } from './index.js' only contains custom matcher. Removing it allows us to expand to more matchers, but also removes "the checks"
  2. Depending on whether the matcher is expecting void or Promise<void>, we should somehow fork the code to await or not. However, how can we achieve that?
  3. See the two screenshots below taken using this project: https://github.com/dprevost-LMI/jasmine-boilerplate/tree/test-latest-expect-webdriverio_jasmine-expectAsync

When Jasmine is the global ambient, the functions are not registered when used with @wdio/jasmine-framework and @wdio/local-runner, and globally, we need to explicitly use import { expect } from 'expect-webdriverio' to have it working
Image

Unavailable typing on jasmine augmentation (maybe something we do not want to support, though)
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions