Coder Social home page Coder Social logo

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 🇮🇳

taiko-react's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.