This sample project demonstrates how to use Express, WebdriverIO, Chrome, and Jest to write browser-based acceptance specs.
- Drop in the
acceptance_spec_helper
module into your project located currently in thespec/acceptance
directory - Import it into each of the acceptance spec suites:
import { setupEnvironment, browser, localUrl } from './acceptance_spec_helper'
- Before any test code such as a
describe
suite, add a call to thesetupEnvironment
function:It will set up all thesetupEnvironment() // rest of the test suite
before/after
calls. When those are called during test execution it will start and stop theexpress
server,chromedriver
, andwebdriverio
. It'll also use theget-port
library to parallelize the execution of acceptance specs ifjest
decides it is more efficient. - Use the
browser
import andlocalUrl
functions to drive the browser instance:await browser.url(localUrl()) const result = await browser.getTitle()