Playwright.Test.Assertions (Playwright v1.65.0-rc.3)

Copy Markdown View Source

ExUnit's assert/1,2 and refute/1,2, each also recorded as an expect step of the running test, as upstream's expect(value).toBe(...) is (Expect "assert"). Elixir only: upstream's assertions are its matchers.

use Playwright.Test imports them in place of ExUnit.Assertions' (with assert_steps: false, ExUnit's own). A helper module opts in with

import ExUnit.Assertions, except: [assert: 1, assert: 2, refute: 1, refute: 2]
import Playwright.Test.Assertions

(the first line only if it imports ExUnit.Assertions). A library with its own assert/2 excludes exactly the arities it defines (import Playwright.Test.Assertions, except: [assert: 2]). ExUnit's refute match?(...) calls an unqualified refute(value, expr: ..., ...), so a library's own refute/2 takes that form too (delegating it to refute/2 here). It can tell whether a module has these from Playwright.Test.Assertions in __CALLER__.macros. See "Assertions" in Playwright.Test.

Summary

Functions

ExUnit.Assertions.assert/1, also a step of the running test (category: 'expect'), as upstream's expect(value).toBe(...) is: Expect "assert", with the expression as its subtitle and its expression param. It expands to ExUnit's assert, then records the step, so the assertion binds and fails as ExUnit's (see "Assertions" in Playwright.Test).

ExUnit.Assertions.assert/2, also a step of the running test, titled by the message, as upstream's expect(value, message) is. See assert/1.

ExUnit.Assertions.refute/1, also a step of the running test: Expect "refute". See assert/1.

ExUnit.Assertions.refute/2, also a step of the running test, titled by the message. See assert/1.

Functions

assert(assertion)

(macro)

ExUnit.Assertions.assert/1, also a step of the running test (category: 'expect'), as upstream's expect(value).toBe(...) is: Expect "assert", with the expression as its subtitle and its expression param. It expands to ExUnit's assert, then records the step, so the assertion binds and fails as ExUnit's (see "Assertions" in Playwright.Test).

assert(value, message)

(macro)

ExUnit.Assertions.assert/2, also a step of the running test, titled by the message, as upstream's expect(value, message) is. See assert/1.

refute(assertion)

(macro)

ExUnit.Assertions.refute/1, also a step of the running test: Expect "refute". See assert/1.

refute(value, message)

(macro)

ExUnit.Assertions.refute/2, also a step of the running test, titled by the message. See assert/1.