The CSS selector that this interactor uses to find matching elements
Call this InteractorConstructor to initialize a accordion Interactor. The accordion interactor can be used to interact with accordions on the page and to assert on their state.
The accordion is located by the aria-label
attribute or visible text on the accordion's summary in otherwise.
await Accordion('Overview').toggle();
await Accordion('Overview').is({ expanded: true });
await Accordion({ id: 'overview-accordion', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the accordion is disabled. Defaults to false
.expanded
: boolean – Filter by whether the accordion is expanded.expand()
: Interaction – Expand the accordioncollapse()
: Interaction – Collapse the accordiontoggle()
: Interaction – Toggle the accordionCall this InteractorConstructor to initialize a bottom navigation Interactor. The bottom navigation interactor can be used to interact with bottom navigation on the page and to assert on their state.
The bottom navigation can be located by value
filter.
await BottomNavigation().navigate('Favorites');
await BottomNavigation().has({ value: 'Recents' });
await BottomNavigation({ value: 'Nearby' }).exists();
value
: string – Filter by valuenavigate(value: string)
: Interaction – Navigate to new destinationCall this InteractorConstructor to initialize a button Interactor. The button interactor can be used to interact with buttons on the page and to assert on their state.
The button is located by the aria-label
attribute or the visible text on the button in otherwise.
await Button('Submit').click();
await Button('Submit').is({ disabled: true });
await Button({ id: 'submit-button', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the button is disabled. Defaults to false
.focused
: boolean – Filter by whether the button is focused. See focused.href
: string - Filter by href if it's button linkclick()
: Interaction – Click on the buttonfocus()
: Interaction – Move focus to the buttonblur()
: Interaction – Move focus away from the buttonCall this InteractorConstructor to initialize a calendar Interactor. The calendar interactor can be used to interact with calendars on the page and to assert on their state.
The calendar is located by selected day and title text divided by space (ex. '18 August 2014').
await Calendar('18 August 2014').setDay(13);
await Calendar('18 August 2014').has({ weekDay: 'Mo' });
await Calendar({ title: 'August 2014', day: 18 }).exists();
title
: string – Filter by titleyear
: number – Filter by yearmonth
: string – Filter by monthday
: number – Filter by dayweekDay
: string – Filter by weekDaynextMonth()
: Interaction – Switch calendar view to the next monthprevMonth()
: Interaction – Switch calendar view to the previous monthsetYear(value: number)
: Interaction – Switch calendar view to the target yearsetMonth(value: string)
: Interaction – Switch calendar view to the target monthsetDay(value: number)
: Interaction – Set a new date for calendar with previously selected year and monthCall this InteractorConstructor to initialize a checkbox Interactor. The checkbox interactor can be used to interact with checkboxes on the page and to assert on their state.
The checkbox is located by the text of its label or by aria-label
attribute.
await CheckBox('Accept').check();
await CheckBox('Accept').is({ disabled: true });
await CheckBox({ id: 'accept', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.valid
: boolean – Filter by whether the checkbox is valid.checked
: boolean – Filter by whether the checkbox is checked.indeterminate
: boolean - Filter by whether the checkbox has indeterminate state.disabled
: boolean – Filter by whether the checkbox is disabled. Defaults to false
.focused
: boolean – Filter by whether the checkbox is focused. See focused.click()
: Interaction – Click on the checkboxfocus()
: Interaction – Focus the checkboxblur()
: Interaction – Blur the checkboxcheck()
: Interaction – Check the checkbox if it is not checkeduncheck()
: Interaction – Uncheck the checkbox if it is checkedtoggle()
: Interaction – Toggle the checkboxCall this InteractorConstructor to initialize a date field Interactor. The date field interactor can be used to interact with date fields on the page and to assert on their state. A date field is the date type input tag with a text-like interface.
The date field is located by the text of its label.
await DateField('Date of birth').fillIn('2012-06-13');
await DateField('Date of birth').has({ value: '2014-08-18' });
await DateField({ id: 'birth-date', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.value
: string – Filter by the date field's current value in ISO format.date
: Date | null – Filter by the date field's current value as date.timestamp
: number – Filter by the date field's current value as timestamp.placeholder
: string – Filter by the date field's placeholder attribute.valid
: boolean – Filter by whether the date field is valid.disabled
: boolean – Filter by whether the date field is disabled. Defaults to false
.focused
: boolean – Filter by whether the date field is focused. See focused.click()
: Interaction – Click on the date fieldfocus()
: Interaction – Move focus to the date fieldblur()
: Interaction – Move focus away from the date fieldfillIn(value: string)
: Interaction – Fill in the date field with the given value. See fillIn.Call this InteractorConstructor to initialize a date-time field Interactor. The date-time field interactor can be used to interact with date fields on the page and to assert on their state. A date-time field is the date-time type input tag with a text-like interface.
The date-time field is located by the text of its label.
await DateTimeField('Appointment').fillIn('2012-06-13T09:13');
await DateTimeField('Appointment').has({ value: '2014-08-18T09:13' });
await DateTimeField({ id: 'appointment', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.value
: string – Filter by the date-time field's current value in ISO format.timestamp
: number – Filter by the date-time field's current value as timestamp.placeholder
: string – Filter by the date-time field's placeholder attribute.valid
: boolean – Filter by whether the date-time field is valid.disabled
: boolean – Filter by whether the date-time field is disabled. Defaults to false
.focused
: boolean – Filter by whether the date-time field is focused. See focused.click()
: Interaction – Click on the date-time fieldfocus()
: Interaction – Move focus to the date-time fieldblur()
: Interaction – Move focus away from the date-time fieldfillIn(value: string)
: Interaction – Fill in the date-time field with the given value. See fillIn.Call this InteractorConstructor to initialize a dialog Interactor. The dialog interactor can be used to interact with dialog windows on the page and to assert on their state.
The dialog is located by the text of its label or by title text content.
await Dialog('Login').close();
await Dialog({ id: 'login-modal' }).exists();
id
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.close()
: Interaction – Close the dialog windowCall this InteractorConstructor to initialize a floating action button Interactor. The fab interactor can be used to interact with fabs on the page and to assert on their state.
The fab is located by the aria-label
attribute or the visible text on the fab in otherwise.
await Fab('add').click();
await Fab('add').is({ disabled: true });
await Fab({ id: 'add-button', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the fab is disabled. Defaults to false
.focused
: boolean – Filter by whether the fab is focused. See focused.svgIcon
: boolean - Filter by whether the fab has icon.click()
: Interaction – Click on the fabfocus()
: Interaction – Move focus to the fabblur()
: Interaction – Move focus away from the fabCall this InteractorConstructor to initialize a form control Interactor. The form control interactor can be used to assert on form fields state.
The form control is located by the text of its label.
await FormControl('Email').has({ description: 'Email for newsletters' });
await FormControl({ id: 'email-field', valid: true }).exists();
id
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.valid
: boolean – Filter by whether the form field is valid.description
: string – Filter by the form's field description text.disabled
: boolean – Filter by whether the form field is disabled. Defaults to false
.Use this InteractorConstructor as a base for creating interactors which work with form fields. This allows you to use field labels as locators, and also provides some basic filters which are convenient for most form fields.
Locates the form field by its label.
const PasswordField = FormField.extend<HTMLInputElement>('password field')
.selector('input[type=password'])
.filters({
value: (element) => element.value,
placeholder: (element) => element.placeholder,
})
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.focused
: boolean – Filter by whether the form field is focused. See focused.valid
: boolean – Filter by whether the form field is valid.disabled
: boolean – Filter by whether the form field is disabled. Defaults to false
.click()
: Interaction – Click on the form fieldfocus()
: Interaction – Move focus to the form fieldblur()
: Interaction – Move focus away from the form fieldUse this InteractorConstructor as a base for creating interactors which work with HTML elements. This provides some basic functionality which is convenient for most HTML elements.
const Link = HTML.extend<HTMLLinkElement>('link')
.selector('a[href]')
.filters({
href: (element) => element.href
})
classList
: string[] — Filter by the list of classes found in element's className
className
: string — Filter by element's className
title
: string – Filter by titleid
: string – Filter by idtext
: string – Filter by the text content of this element.visible
: boolean – Filter by visibility. Defaults to true
. See isVisible.focused
: boolean – Filter by whether the element is focused. See focused.click()
: Interaction – Click on the elementfocus()
: Interaction – Move focus to the elementblur()
: Interaction – Move focus away from the elementCall this InteractorConstructor to initialize a button Interactor. The button interactor can be used to interact with buttons on the page and to assert on their state.
The button is located by the visible text on the button.
await Button('Submit').click();
await Button('Submit').is({ disabled: true });
await Button({ id: 'submit-button', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the button is disabled. Defaults to false
.focused
: boolean – Filter by whether the button is focused. See focused.click()
: Interaction – Click on the buttonfocus()
: Interaction – Move focus to the buttonblur()
: Interaction – Move focus away from the buttonCall this InteractorConstructor to initialize a checkbox Interactor. The checkbox interactor can be used to interact with checkboxes on the page and to assert on their state.
The checkbox is located by the text of its label.
await CheckBox('Accept').check();
await CheckBox('Accept').is({ disabled: true });
await CheckBox({ id: 'accept', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.valid
: boolean – Filter by whether the checkbox is valid.checked
: boolean – Filter by whether the checkbox is checked.indeterminate
: boolean - Filter by whether the checkbox has indeterminate state.disabled
: boolean – Filter by whether the checkbox is disabled. Defaults to false
.focused
: boolean – Filter by whether the checkbox is focused. See focused.click()
: Interaction – Click on the checkboxfocus()
: Interaction – Focus the checkboxblur()
: Interaction – Blur the checkboxcheck()
: Interaction – Check the checkbox if it is not checkeduncheck()
: Interaction – Uncheck the checkbox if it is checkedtoggle()
: Interaction – Toggle the checkboxCall this InteractorConstructor to initialize a link Interactor. The link interactor can be used to interact with links on the page and to assert on their state.
The link is located by its text.
await Link('Home').click();
await Link('Home').has({ href: '/' });
await Link({ id: 'home-link', href: '/' }).exists();
title
: string – Filter by titleid
: string – Filter by idhref
: string – The value of the href attribute that the link points tovisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.focused
: boolean – Filter by whether the link is focused. See focused.click()
: Interaction – Click on the linkfocus()
: Interaction – Focus the linkblur()
: Interaction – Blur the linkCall this InteractorConstructor to initialize an Interactor
for select boxes with multiple select. The multi select interactor can be
used to interact with select boxes with the multiple
attribute and to
assert on their state.
See Select for an interactor for single select boxes.
The multi select is located by the text of its label.
await MultiSelect('Language').select('English');
await MultiSelect('Language').select('German');
await MultiSelect('Language').deselect('Swedish');
await MultiSelect('Language').has({ values: ['English', 'German'] });
title
: string – Filter by titleid
: string – Filter by idvalid
: boolean – Filter by whether the select box is valid.values
: string[] – Filter by the text of the selected options.visible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the select box is disabled. Defaults to false
.focused
: boolean – Filter by whether the select box is focused. See focused.click()
: Interaction – Click on the multi selectfocus()
: Interaction – Move focus to the multi selectblur()
: Interaction – Move focus away from the multi selectchoose(text: string)
: Interaction – Choose the option with the given text from the multi select. Will deselect all other selected options.select(text: string)
: Interaction – Add the option with the given text to the selection.deselect(text: string)
: Interaction – Remove the option with the given text from the selection.Call this InteractorConstructor to initialize a radio button Interactor. The radio button interactor can be used to interact with radio buttons on the page and to assert on their state.
The radio button is located by the text of its label.
await RadioButton('Public').click();
await RadioButton('Private').is({ disabled: true });
await RadioButton({ id: 'privacy-public', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.valid
: boolean – Filter by whether the radio button is valid.checked
: boolean – Filter by whether the radio button is checked.disabled
: boolean – Filter by whether the radio button is disabled. Defaults to false
.focused
: boolean – Filter by whether the radio button is focused. See focused.click()
: Interaction – Click on the radio buttonchoose()
: Interaction – Click on the radio buttonfocus()
: Interaction – Focus the radio buttonblur()
: Interaction – Blur the radio buttonCall this InteractorConstructor to initialize an Interactor for select boxes. The select interactor can be used to interact with select boxes and to assert on their state.
For interacting with multiple select boxes, see MultiSelect.
The select box is located by the text of its label.
await Select('Language').select('English');
await Select('Language').has({ value: 'English' });
title
: string – Filter by titleid
: string – Filter by idvalid
: boolean – Filter by whether the select box is valid.value
: string – Filter by the text of the selected option.visible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the select box is disabled. Defaults to false
.focused
: boolean – Filter by whether the select box is focused. See focused.click()
: Interaction – Click on the select boxfocus()
: Interaction – Move focus to the select boxblur()
: Interaction – Move focus away from the select boxchoose(text: string)
: Interaction – Choose the option with the given text from the select box.Call this InteractorConstructor to initialize a text field Interactor. The text field interactor can be used to interact with text
fields on the page and to assert on their state. A text field is any input
tag with a text-like interface, so input fields with e.g. email
or number
types are also considered text fields, as is any input field with an unknown
type.
The text field is located by the text of its label.
await TextField('Email').fillIn('jonas@example.com');
await TextField('Email').has({ value: 'jonas@example.com' });
await TextField({ id: 'email-field', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.value
: string – Filter by the text field's current value.placeholder
: string – Filter by the text field's placeholder attribute.valid
: boolean – Filter by whether the text field is valid.disabled
: boolean – Filter by whether the text field is disabled. Defaults to false
.focused
: boolean – Filter by whether the text field is focused. See focused.click()
: Interaction – Click on the text fieldfocus()
: Interaction – Move focus to the text fieldblur()
: Interaction – Move focus away from the text fieldfillIn(value: string)
: Interaction – Fill in the text field with the given value. See fillIn.Call this InteractorConstructor to initialize a heading Interactor.
The heading interactor can be used to assert on the state of headings on the page,
represented by the h1
through h6
tags.
Call this InteractorConstructor to initialize a link Interactor. The link interactor can be used to interact with links on the page and to assert on their state.
The link is located by its text.
await Link('Home').click();
await Link('Home').has({ href: '/' });
await Link({ id: 'home-link', href: '/' }).exists();
title
: string – Filter by titleid
: string – Filter by idhref
: string – The value of the href attribute that the link points tovisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.focused
: boolean – Filter by whether the link is focused. See focused.click()
: Interaction – Click on the linkfocus()
: Interaction – Focus the linkblur()
: Interaction – Blur the linkCall this InteractorConstructor to initialize a list Interactor. The list interactor can be used to assert on lists state.
Call this InteractorConstructor to initialize a list item Interactor. The list item interactor can be used to interact with items on the page and to assert on their state.
The list item is located by the visible text on the item.
await ListItem('Install `@interactors/material-ui`').click();
await ListItem({ index: 2, disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the item is disabled. Defaults to false
.index
: number - Filter by the item's zero-based index position in a list.click()
: Interaction – Click on the list itemCall this InteractorConstructor to initialize a menu Interactor. The menu interactor can be used to interact with menus on the page and to assert on their state.
The menu is located by the aria-label
attribute or the visible text on the menu in otherwise.
await Menu('Options').open();
await Menu('Options').is({ disabled: true });
await Menu({ id: 'options', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the menu is disabled. Defaults to false
.focused
: boolean – Filter by whether the menu is focused. See focused.open()
: Interaction – Open the menuclick(value: string)
: Interaction – Click on the menu's itemfocus()
: Interaction – Move focus to the menublur()
: Interaction – Move focus away from the menuCall this InteractorConstructor to initialize a menu item Interactor. The menu item interactor can be used to interact with items on the page and to assert on their state.
The menu item is located by the visible text on the item.
await MenuItem('Edit').click();
await MenuItem({ id: 'edit', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the item is disabled. Defaults to false
.click()
: Interaction – Click on the menu itemCall this InteractorConstructor to initialize a select Interactor.
The select interactor can be used to interact with selects with the multiple
attribute
and to assert on their state.
See Select for an interactor for single select.
The multi select is located by the text of its label.
await MultiSelect('Language').select('English');
await MultiSelect('Language').select('German');
await MultiSelect('Language').deselect('Swedish');
await MultiSelect('Language').has({ values: ['English', 'German'] });
id
: string – Filter by idvalid
: boolean – Filter by whether the select is valid.required
: boolean – Filter by whether the select is required.description
: string – Filter by description.value
: string – Filter by the text of the selected option.disabled
: boolean – Filter by whether the select is disabled. Defaults to false
.click()
: Interaction – Click on the multi selectfocus()
: Interaction – Move focus to the multi selectblur()
: Interaction – Move focus away from the multi selectchoose(text: string)
: Interaction – Choose the option with the given text from the multi select. Will deselect all other selected options.select(text: string)
: Interaction – Add the option with the given text to the selection.deselect(text: string)
: Interaction – Remove the option with the given text from the selection.Call this InteractorConstructor to initialize a select Interactor.
The select interactor can be used to interact with selects with the multiple
attribute
and to assert on their state.
See Select for an interactor for single select.
The multi select is located by the text of its label.
await MultiSelect('Language').select('English');
await MultiSelect('Language').select('German');
await MultiSelect('Language').deselect('Swedish');
await MultiSelect('Language').has({ values: ['English', 'German'] });
title
: string – Filter by titleid
: string – Filter by idvalid
: boolean – Filter by whether the select is valid.required
: boolean – Filter by whether the select is required.description
: string – Filter by description.value
: string – Filter by the text of the selected option.visible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the select is disabled. Defaults to false
.focused
: boolean – Filter by whether the select is focused. See focused.click()
: Interaction – Click on the multi selectfocus()
: Interaction – Move focus to the multi selectblur()
: Interaction – Move focus away from the multi selectchoose(text: string)
: Interaction – Choose the option with the given text from the multi select. Will deselect all other selected options.select(text: string)
: Interaction – Add the option with the given text to the selection.deselect(text: string)
: Interaction – Remove the option with the given text from the selection.Call this InteractorConstructor to initialize a select Interactor. The select interactor can be used to interact with selects and to assert on their state.
For interacting with multiple selects, see MultiSelect.
The select is located by the text of its label.
await Select('Language').select('English');
await Select('Language').has({ value: 'English' });
title
: string – Filter by titleid
: string – Filter by idvalid
: boolean – Filter by whether the select is valid.required
: boolean – Filter by whether the select is required.description
: string – Filter by description.value
: string – Filter by the text of the selected option.visible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the select is disabled. Defaults to false
.focused
: boolean – Filter by whether the select is focused. See focused.click()
: Interaction – Click on the selectfocus()
: Interaction – Move focus to the selectblur()
: Interaction – Move focus away from the selectchoose(text: string)
: Interaction – Choose the option with the given text from the select.This Interactor can be used to assert on global properties of the page. When using the BigTest test runner, it can also be used for interacting with the page itself, for example through nagivation.
await Page.has({ title: 'Welcome to my app!' });
Navigation, for BigTest test runner only:
await Page.visit('/archive');
title
: string – the title of the documenturl
: string – the URL of the documentvisit(path: string)
: Interaction – visit the given path in the test frame, BigTest runner only.Call this InteractorConstructor to initialize a popover Interactor. The popover interactor can be used to interact with popover on the page and to assert on their state.
The popover is located by the text of its label or by title text content.
await Popover().close();
visible
: boolean – Filter by visibility. Defaults to true
. See isVisible.close()
: Interaction – Close the popoverCall this InteractorConstructor to initialize a radio button Interactor. The radio button interactor can be used to interact with radio buttons on the page and to assert on their state.
The radio button is located by the text of its label.
await RadioButton('Public').click();
await RadioButton('Private').is({ disabled: true });
await RadioButton({ id: 'privacy-public', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.valid
: boolean – Filter by whether the radio button is valid.checked
: boolean – Filter by whether the radio button is checked.disabled
: boolean – Filter by whether the radio button is disabled. Defaults to false
.focused
: boolean – Filter by whether the radio button is focused. See focused.click()
: Interaction – Click on the radio buttonchoose()
: Interaction – Click on the radio buttonfocus()
: Interaction – Focus the radio buttonblur()
: Interaction – Blur the radio buttonCall this InteractorConstructor to initialize a select Interactor. The select interactor can be used to interact with selects and to assert on their state.
For interacting with multiple selects, see MultiSelect.
The select is located by the text of its label.
await Select('Language').select('English');
await Select('Language').has({ value: 'English' });
id
: string – Filter by idvalid
: boolean – Filter by whether the select is valid.required
: boolean – Filter by whether the select is required.description
: string – Filter by description.value
: string – Filter by the text of the selected option.disabled
: boolean – Filter by whether the select is disabled. Defaults to false
.click()
: Interaction – Click on the selectfocus()
: Interaction – Move focus to the selectblur()
: Interaction – Move focus away from the selectchoose(text: string)
: Interaction – Choose the option with the given text from the select.Call this InteractorConstructor to initialize a slider Interactor. The slider interactor can be used to interact with sliders on the page and to assert on their state.
The slider is located by the label or the aria-label
attribute.
await Slider('Submit').click();
await Slider('Submit').is({ disabled: true });
await Slider({ id: 'submit-slider', disabled: true }).exists();
id
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the slider is disabled. Defaults to false
.orientation
: horizontal | vertical - Filter by orientationhorizontal
: boolean - Filter by whether the slider has horizontal orientationvertical
: boolean - Filter by whether the slider has vertical orientationminValue
: number - Filter by the least possible valuemaxValue
: number - Filter by the greatest possible valuevalue
: number - Filter by the current valuetextValue
: string - Filter by the text representation of current valuemin
: boolean - Filter by whether the slider value is equal minValue
max
: boolean - Filter by whether the slider value is equal maxValue
focus()
: Interaction – Move focus to the sliderblur()
: Interaction – Move focus away from the sliderdecrease(steps: number = 1)
: Interaction – Decrease slider value by specific stepsincrease(steps: number = 1)
: Interaction – Increase slider value by specific stepssetMin()
: Interaction - Set value to the least possiblesetMax()
: Interaction – Set value to the greatest possiblesetValue(value: number)
: Interaction – Set current valueCall this InteractorConstructor to initialize a snackbar Interactor. The snackbar interactor can be used to assert on snackbars state.
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.
await Switch('Theme').toggle();
await Switch('Theme').is({ disabled: true });
await Switch({ id: 'theme-toggler', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. 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 to false
.focused
: boolean – Filter by whether the switch is focused. See focused.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 switchCall this InteractorConstructor to initialize a tab Interactor. The tab interactor can be used to interact with tabs on the page and to assert on their state.
The tab is located by the text of its label or by text content.
await Tab('Preview').click();
await Tab({ id: 'preview-tab' }).exists();
id
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the tab is disabled. Defaults to false
.active
: boolean – Filter by whether the tab is active.click()
: Interaction – Click on the tabCall this InteractorConstructor to initialize a tabs Interactor. The tabs interactor can be used to interact with tabs containers on the page and to assert on their state.
The tabs is located by the aria-label
attribute.
await Tab('View modes').click();
await Tab({ value: 'preview' }).exists();
id
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.disabled
: boolean – Filter by whether the tabs are disabled. Defaults to false
.value
: string – Filter by the active tab.click(value: string)
: Interaction – Click on the specific tabCall this InteractorConstructor to initialize a text field Interactor. The text field interactor can be used to interact with text
fields on the page and to assert on their state. A text field is any input
tag with a text-like interface, so input fields with e.g. email
or number
types are also considered text fields, as is any input field with an unknown
type.
The text field is located by the text of its label or placeholder.
await TextField('Email').fillIn('jonas@example.com');
await TextField('Email').has({ value: 'jonas@example.com' });
await TextField({ id: 'email-field', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.value
: string – Filter by the text field's current value.placeholder
: string – Filter by the text field's placeholder attribute.description
: string – Filter by the text field's description attribute.valid
: boolean – Filter by whether the text field is valid.required
: boolean – Filter by whether the text field is required.disabled
: boolean – Filter by whether the text field is disabled. Defaults to false
.focused
: boolean – Filter by whether the text field is focused. See focused.click()
: Interaction – Click on the text fieldfocus()
: Interaction – Move focus to the text fieldblur()
: Interaction – Move focus away from the text fieldfillIn(value: string)
: Interaction – Fill in the text field with the given value. See fillIn.Call this InteractorConstructor to initialize a time field Interactor. The time field interactor can be used to interact with date fields on the page and to assert on their state. A time field is the time type input tag with a text-like interface.
The time field is located by the text of its label.
await DateTimeField('Alarm').fillIn('09:13');
await DateTimeField('Alarm').has({ value: '09:13' });
await DateTimeField({ id: 'alarm', disabled: true }).exists();
title
: string – Filter by titleid
: string – Filter by idvisible
: boolean – Filter by visibility. Defaults to true
. See isVisible.value
: string – Filter by the time field's current value in ISO format.date
: Date | null – Filter by the time field's current value as date.timestamp
: number – Filter by the time field's current value as timestamp.placeholder
: string – Filter by the time field's placeholder attribute.valid
: boolean – Filter by whether the time field is valid.disabled
: boolean – Filter by whether the time field is disabled. Defaults to false
.focused
: boolean – Filter by whether the time field is focused. See focused.click()
: Interaction – Click on the time fieldfocus()
: Interaction – Move focus to the time fieldblur()
: Interaction – Move focus away from the time fieldfillIn(value: string)
: Interaction – Fill in the time field with the given value. See fillIn.Helper function for blur action, performs element.blur()
on the selected element.
Can be used with object property value shorthand in your interactor actions.
actions: {
focus,
}
Create a custom interactor with the given name.
let Paragraph = createInteractor('paragraph').selector('p');
Note the double function call!
The type of DOM Element that this interactor operates on. By specifying the element type, actions and filters defined for the interactor can be type checked against the actual element type.
You will need to call the returned builder to create an interactor.
Fill in text into an element by emulating how a user would do it, first focusing the element, then filling in the text letter by letter, generating the appropriate keyboard events.
The element to fill in text in
The text value to fill in
Helper function for focus action, performs element.focus()
on the selected element.
Can be used with object property value shorthand in your interactor actions.
actions: {
focus,
}
Helper function for focused filters, returns whether the given element is focused.
Generated using TypeDoc
A function which returns a string value for a matched element, which can be used to locate a specific instance of this interactor. The
value
parameter of an InteractorConstructor must match the value returned from the locator function.