Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTML and FormField to the builtin interactor list. #845

Closed
cowboyd opened this issue Feb 8, 2021 · 0 comments · Fixed by #921
Closed

Add HTML and FormField to the builtin interactor list. #845

cowboyd opened this issue Feb 8, 2021 · 0 comments · Fixed by #921
Assignees
Labels
@bigtest/interactor higher order interface manipulation documentation

Comments

@cowboyd
Copy link
Member

cowboyd commented Feb 8, 2021

With the advent of the the builder syntax, we have extracted the HTML interactor which is the parent of almost all of our interactors. Not only is this handy for defining new interactors, but it is useful in its own right for making abstract assertions.

This is an example from a FOLIO test suite using RTL matchers to make a very broad assertion that the text "Not Authorized" is somewhere in the document. There was no clear way on how to do this with interactors, so the fallback was to go back to using a known method from RTL.

import { expect, getByText } from './test/helpers';

expect(getByText('Not Authorized')).toBeInTheDocument();

However, by using the generic HTML interactor combined with the containing() matcher we can achieve this elegantly:

import { HTML, including } from '@bigtest/interactor';

HTML(including('Not Authorized')).exists()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@bigtest/interactor higher order interface manipulation documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants