0.3.3 • Published 5 years ago

taiko-react v0.3.3

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
5 years ago

taiko-react Build Status Coverage Status Known Vulnerabilities Greenkeeper badge CircleCI Build status

taiko-react allows you to select React components on the webpage that you want to perform tests on.

It uses resq to find the React components.

Pre-requisites

  1. The webpage that is being tested needs to be using React.
  2. React needs to be running in development mode (not production).

Install

npm i taiko-react

Usage

Load up the plugin and navigate to the React powered webpage ⚡️

const { openBrowser, goto, loadPlugin } = require('taiko')
const { ID, clientHandler, react } = require('taiko-react')

await loadPlugin(ID, clientHandler)

await openBrowser()
await goto("http://localhost:8080")

Now you may use various selectors to find React elements on the page 🔎

Select using a string

const selection = await react('App')

Select using a React component class

class App extends React.Component {/* ... */}

const selection = await react(App)

Select using a function

function App() {
  return <div>Hello world!</div>
}

const selection = await react(App)

Select using a React component instance

const selection = await react(<App />)

API

.exists() -> Boolean

Checks whether the component exists.

const selection = await react(App)

assert(selection.exists())

.length() -> Number

Finds the number of said components.

const list = await react(List)
const listItem = await react(ListItem, { multiple: true })

assert(list.length() === 1)
assert(listItem.length() === 3)

Functional tests

Status

Build Status

Repository

taiko-react/taiko-react-functional-tests

Made with 💟 + ☕️ from 🇮🇳

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago