This sample project demonstrates how to use Express, WebdriverIO, Chrome, and Jest to write browser-based acceptance specs.
- Drop in the
acceptance_spec_helpermodule into your project located currently in thespec/acceptancedirectory - Import it into each of the acceptance spec suites:
import{setupEnvironment,browser,localUrl}from'./acceptance_spec_helper'
- Before any test code such as a
describesuite, add a call to thesetupEnvironmentfunction:It will set up all thesetupEnvironment()// rest of the test suite
before/aftercalls. When those are called during test execution it will start and stop theexpressserver,chromedriver, andwebdriverio. It'll also use theget-portlibrary to parallelize the execution of acceptance specs ifjestdecides it is more efficient. - Use the
browserimport andlocalUrlfunctions to drive the browser instance:awaitbrowser.url(localUrl())constresult=awaitbrowser.getTitle()