Tests and runners form the backbone of this testing platform.
Background
See this doc for background on how this fits into the testing platform as a whole.
For help running your first test, see this doc.
Global Helper Modules
There are four helper modules, always provided globally to all tests:
- proxyHelper - mitmproxy helper (for network capture / rewrites)
- reportHelper - Interact with the reports (logging messages, taking screenshots)
- traceHelper - Interact with the AudienceStream Trace, including checking the current Visitor Profile, ending the Visit, etc.
- hashHelper - Helper with various hash functions
Other globals available to tests
WDIO-related
-
browser
- provided by WDIO (documentation augmented with custom commands in addition to the standard API. Currently using v7 -
browser.waitForTraffic()
- Custom, uses mutationObserver to wait for a specified period of DOM stability (or max wait time).Example
// all arguments are options, defaults shown await browser.waitForTraffic({ stabilityLength: 3000, maxTime: 20000 })
-
browser.getCookieByName(cookieName)
- Custom, just makes it easier to get a specific cookie than the standard API by itself.Example
let utagMainValue = await browser.getCookieByName('utag_main')
Testing/Assertion Related
describe
- provided by Mochait
- provided by Mochachai
- chai as a global, supports various styles, examples show 'expect' style (throughchai.expect
to avoid noisy collisions with theexpect
module included in wdio v6 and up)
Service-related
If enableTrace
is true
in your runner CONFIG file:
traceId
- the current AudienceStream Trace ID, used to end the tracetraceAccount
- the configured Tealium CDH account which was used for the traceIdtraceProfile
- the configured Tealium CDH profile which was used for the traceId
If using enableProxy
is true
in your runner CONFIG file:
NOTE The STEP {number} pattern (see this doc) is important if you're using enableProxy
for network request capture - that's used to recognize when it's time to start a new 'bucket' for the network requests.
describe
is a Mocha 'suite'. Suites contain one or more tests.it
is a Mocha 'test'. Tests generally contain at least one assertion, and can contain many.chai.expect(title).to.equal('Google')
- this is (obviously) Chai, in Expect style.