Expect

Playwright\Testing\ExpectInterface

Methods

toBeAttached()

void
function toBeAttached(): void

toBeVisible()

void
function toBeVisible(): void

toBeHidden()

void
function toBeHidden(): void

toHaveText()

void
function toHaveText(string $text): void

toContainText()

void
function toContainText(string $text): void

toHaveExactText()

void
function toHaveExactText(string $text): void

toHaveValue()

void
function toHaveValue(string $value): void

toHaveAttribute()

void
function toHaveAttribute(string $name, string $value): void

toBeChecked()

void
function toBeChecked(): void

toBeEnabled()

void
function toBeEnabled(): void

toBeDisabled()

void
function toBeDisabled(): void

toHaveCSS()

void
function toHaveCSS(string $name, string $value): void

toHaveId()

void
function toHaveId(string $id): void

toHaveClass()

void

Asserts the element's class attribute matches the expected list exactly. Order matters and extra classes fail the assertion. Use an array or a space-separated string interchangeably; surrounding and repeated whitespace is ignored on both sides.

function toHaveClass(string|array $class): void

toBeEmpty()

void
function toBeEmpty(): void

toHaveCount()

void
function toHaveCount(int $count): void

toBeFocused()

void
function toBeFocused(): void

toHaveFocus()

void
function toHaveFocus(): void

toHaveTitle()

void
function toHaveTitle(string $title): void

toHaveURL()

void
function toHaveURL(string $url): void

not()

self
function not(): self

withTimeout()

self
function withTimeout(int $timeoutMs): self

withPollInterval()

self
function withPollInterval(int $pollIntervalMs): self