包详细信息

rize

g-plane14MIT0.9.0

High-level, fluent and chainable API provided library for puppeteer.

rize, puppeteer, test, testing

自述文件

Rize

Circle CI Build Status Coverage License NPM Version NPM Downloads

Rize is a high-level, fluent and chainable API provided library which let you use puppeteer simply.

"Rize" is pronounced like /ɾize/, not /raɪzɪ/. "Rize" is one of characters in Is the Order a Rabbit?.

Translations

简体中文

We need your help to translate the docs!

Installation

You should install puppeteer at the same time.

yarn add --dev puppeteer rize

or via npm:

npm install --save-dev puppeteer rize

If you are in China, you may specify Chromium binary mirror.

On Linux or macOS:

PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors yarn add --dev puppeteer rize

On Windows:

SET PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors yarn add --dev puppeteer rize

Basic Usage

Import

It's recommended to use ES-style import:

import Rize from 'rize'

Or using CommonJS-style import, if you don't use any build tools:

const Rize = require('rize')

Getting Started

Just like this:

const rize = new Rize()

You can pass some options to the constructor, and these options are puppeteer's options:

const rize = new Rize({ headless: false })

All Rize's APIs are chainable, so you can do something like this:

const rize = new Rize()
rize
  .goto('https://github.com/')
  .type('input.header-search-input', 'node')
  .press('Enter')
  .waitForNavigation()
  .assertSee('Node.js')
  .end()  // Don't forget to call `end` function to exit browser!

All available APIs are listed here.

Documentation

Please visit rize.js.org

Contribution

Before you contribute to Rize, please read Contributing Guide.

License

MIT License

Copyright (c) 2018-present Pig Fang

更新日志

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[Unreleased]

Added

  • New API: boxModel
  • New option waitForNavigation for click method, which allows to wait for a navigation after clicked.

    Changed

  • Enable type checking on methods evaluate, evaluateWithReturn and waitForEvaluation.

[0.8.0] - 2018-08-23

Changed

  • Use tuple list to simplify type definitions, which allows type checking for methods like find and findAll.

[0.7.0] - 2018-05-14

Fixed

  • Throw all types of errors which from Rize. (Not only AssertionError)

[0.6.0] - 2018-03-24

Added

  • New API: awaitPromise
  • The addScriptTag method now supports passing ES module with an option.
  • New API: blur

    Fixed

  • Remove data-rize attribute after calling find or findAll or findByXPath method.

[0.5.0] - 2018-03-15

Added

  • New API: clickLink
  • New API: assertHashIs
  • New API: assertHashBeginsWith
  • New option: browser
  • New lifecycle hook: beforeEachStep
  • New lifecycle hook: afterEachStep
  • Added a new parameter for html method to determine retrieve inner or outer HTML.

    Changed

  • Hooks now do not support passing arguments to function

    Fixed

  • Fix that Jest shows assertion message twice.
  • Fix missing this pointer of beforeExit hook.

[0.4.0] - 2018-03-12

Added

  • New lifecycle hook: beforeExit

    Changed

  • Improved error stack trace

[0.3.0] - 2018-03-08

Added

  • New option: defaultNavigationTimeout
  • New API: findWithText

    Changed

  • Better assertions messages.

[0.2.0] - 2018-03-06

Added

[0.1.0] - 2018-03-05

Added

  • Add all methods.