thefrontside / thefrontside/interactors
Documentation - show saving a query to a variable
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 36
- Forks
- 2
- Avg merge
- 4m
- Merged PRs (30d)
- 2
Description
I think this could be part of a Test Examples section of the documentation, or something similar.
When working on my first BigTest written from scratch, I found that I was repeating myself a lot with things like TextField('something', {focused: true}). I was surprised to learn that you can safely save this to a variable used in a test:
const someInput = TextField('something', {focused: true})
export default test('Interactors with BigTest')
.step(Page.visit('/'))
.step(someInput).exists()
// etc
This was very cool and very surprising to me, after coming from other test frameworks that have lots of side effects and leaks from issues like this. It might be worth mentioning why this is safe from leaking - mainly that you aren't running the query when you create the variable. The query is only run when you use it to make interactions or assertions.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the documentation's proposed Test Examples section or the nearest existing examples area. Use the issue's TextField and test snippet as the source, and consider the work done when the docs show saving a query to a variable and explain that the query runs only when used, avoiding leaks or side effects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100