Skip to content

snasirca/node-acceptance-testing-sample

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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