Skip to content

A sample project for using NodeJS, WebdriverIO, Chromedriver to write browser based acceptance tests.

Notifications You must be signed in to change notification settings

snasirca/node-acceptance-testing-sample

Repository files navigation

Browser-Based Acceptance Testing with NodeJS

This sample project demonstrates how to use Express, WebdriverIO, Chrome, and Jest to write browser-based acceptance specs.

Steps:

  1. Drop in the acceptance_spec_helper module into your project located currently in the spec/acceptance directory
  2. Import it into each of the acceptance spec suites:
    import { setupEnvironment, browser, localUrl } from './acceptance_spec_helper'
  3. Before any test code such as a describe suite, add a call to the setupEnvironment function:
    setupEnvironment()
    
    // rest of the test suite
    It will set up all the before/after calls. When those are called during test execution it will start and stop the express server, chromedriver, and webdriverio. It'll also use the get-port library to parallelize the execution of acceptance specs if jest decides it is more efficient.
  4. Use the browser import and localUrl functions to drive the browser instance:
    await browser.url(localUrl())
    const result = await browser.getTitle()

About

A sample project for using NodeJS, WebdriverIO, Chromedriver to write browser based acceptance tests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published