Const
Call this InteractorConstructor to initialize a switch Interactor. The switch interactor can be used to interact with switches on the page and to assert on their state.
The switch is located by the text of its label or by aria-label attribute.
aria-label
await Switch('Theme').toggle();await Switch('Theme').is({ disabled: true });await Switch({ id: 'theme-toggler', disabled: true }).exists(); Copy
await Switch('Theme').toggle();await Switch('Theme').is({ disabled: true });await Switch({ id: 'theme-toggler', disabled: true }).exists();
title
id
visible
true
valid
checked
disabled
false
focused
click()
focus()
blur()
check()
uncheck()
toggle()
Call this InteractorConstructor to initialize a switch Interactor. The switch interactor can be used to interact with switches on the page and to assert on their state.
The switch is located by the text of its label or by
aria-label
attribute.Example
Filters
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults totrue
. See isVisible.valid
: boolean – Filter by whether the switch is valid.checked
: boolean – Filter by whether the switch is checked..disabled
: boolean – Filter by whether the switch is disabled. Defaults tofalse
.focused
: boolean – Filter by whether the switch is focused. See focused.Actions
click()
: Interaction – Click on the switchfocus()
: Interaction – Focus the switchblur()
: Interaction – Blur the switchcheck()
: Interaction – Check the switch if it is not checkeduncheck()
: Interaction – Uncheck the switch if it is checkedtoggle()
: Interaction – Toggle the switch