Skip to content

Commit

Permalink
📝 Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
wwilsman committed Feb 6, 2024
1 parent be833b8 commit 360f8a1
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
</p>

<p align="center">
Interactor.js is a composable, immutable, asynchronous way to <br/>
interact with components or applications like a user would.
Fast, intuitive, asynchronous interactions for anything that runs in a browser.
</p>

<p align="center">
Expand All @@ -18,13 +17,41 @@
</a>
</p>

## Introduction

Interactors work anywhere there is DOM, and run alongside your tests to produce blazingly fast results. They automatically wait for elements to exist in the DOM before interacting with them and also provide a simple interface for making asynchronous assertions against the DOM as well.

## Documentation

Documentation can be found at [interactorjs.io](https://interactorjs.io)
## What is interactor.js?

Interactor.js works with anything that runs in a browser, and can run alongside your tests to
produce blazingly fast results. Interactions automatically wait for elements to exist or other
assertions to pass before running, and assertions are run again after they succeed to add a layer of
reliability. Interactions and assertions can also be chained together and reused to create complex
user interactions.

## Quick start

An interactor instance is provided out-of-the-box so you can immediately start creating
interactions. In the example below, interactions are used with a TodoMVC application to create and
mark a todo item as completed.

``` javascript
import { I } from 'interactor.js';

// find elements by their contents like users would
await I.find('What needs to be done?')
.then.type('Write documentation')
.then.press('Enter')
// chain multiple interactions together
.then.type('Release update')
.then.press('Enter');

// a query selector can be used instead of text content
await I.find('$(.todo-list li)').times(2)
.then.assert.text('Write documentation')
// chained .find() continues searching from the previous element
.then.find('$(li)').text('Release update');

// test attributes can also be referenced with a similar syntax
await I.click('::(todo-item-toggle)') // == $([data-test="todo-item-toggle"])
.then.find('Write documentation').matches('.completed');
```

## License

Expand Down

0 comments on commit 360f8a1

Please sign in to comment.