No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Baird is a set of tools to write acceptance tests on the web. Following TDD best practices, you must start writing your acceptance before any tests.

But in web development, there is no easy way to write them. You are creating user behavioral, the only way to test it is with E2E testing.

Normal E2E testing has many problems, one of them is the dependency on a backend server. Trying to set up the server with the right state in order to be ready to do the test is complex.

Baird is a proposal for E2E testing with server stubbing.


Install Baird

npm i -S baird baird-server baird-page-objects

Create a jest.config.js

module.exports = {

Setup your server stub

// src/setupTests.js
const BairdServer = require('baird-server');

beforeAll(async () => { = await global.browser.newPage();
  global.server = new BairdServer({ baseUrl: });

  await BairdServer.intercept(, global.server);

afterAll(async () => {
  if (!global.debug) {
    await page.close();

Create your page objects

import { page as createPage } from 'baird-page-objects';

const urls = {
  register: host => `${host}/register`,

const selectors = {
  buttons: {
    createAccount: '[data-test-id="register-button"]',
  inputs: {
    email: 'input[data-test-id="register-email"]',
    password: 'input[data-test-id="register-password"]',

export default (page, host) => ({
  ...createPage(page, selectors),
  async go() { await ;}

Write your test

let registerPage;
beforeEach(async () => {
  registerPage = createRegisterPage(,;
  await registerPage.go();

// Verify if the inputs in register page exist
test('should have username and password inputs', async () => {
  await expect(;
  await expect(registerPage.inputs.password).toExist();