reporterHelper

Report Generator helper functions. Helps add context to the generated HTML reports of the test results.

NOTE: These methods only work inside tests!

Source:

Methods

(static) logMessage(message, parseAsMarkdownopt) → {string}

Source:

Logs a message within the current mocha test, with optional Markdown support (defaults to 'off').

Example
// only works inside tests!
it('should log some messages', async function () {
  // no markdown
  reporterHelper.logMessage('Something important you should know!')

  // with markdown
  reporterHelper.logMessage('Something **important** _you_ should know!', true)
})
Parameters:
Name Type Attributes Description
message string

the message (or Markdown) to be displayed in the html-report

parseAsMarkdown boolean <optional>

if provided and true, will parse the provide message as markdown

Returns:

the processed string that will be used in the report

Type
string

(static) takeScreenshot(messageopt, parseAsMarkdownopt)

Source:

Takes a screenshot with optional message (including Markdown support) and adds to the active mocha test.

Returned Promise resolves when the screenshot has been taken and compressed to reduce file size.

Example
describe('STEP 1 - check google.com title', () => {
  it('should have the right title', async function () {
    await browser.url('https://google.com')
    const title = await browser.getTitle()
    await reporterHelper.takeScreenshot('Page load screenshot.')
    chai.expect(title).to.strictlyEqual('Google')
  })
})
Parameters:
Name Type Attributes Description
message string <optional>

the message (or Markdown) to be displayed in the html-report

parseAsMarkdown boolean <optional>

if provided and true, will parse the provide message as markdown

Returns:
Type
Promise
Yields:
undefined