@codeceptjs/helper

Base class for CodeceptJS helpers

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@codeceptjs/helper
212.0.15 months ago2 years agoMinified + gzip package size for @codeceptjs/helper in KB

Readme

CodeceptJS Helper
Base class for all CodeceptJS helpers. This class has been moved into a separate package to allow other helpers to be extended from it, without requiring main codeceptjs package.

Installation

npm i @codeceptjs/helper --save

Usage

Create CodeceptJS helper as described in documentation.
const Helper = require('@codeceptjs/helper');

class MyHelper extends Helper {
  // implement custom helper here
}

API

Table of Contents

-   [Parameters](#parameters)
-   [\_validateConfig](#_validateconfig)
    -   [Parameters](#parameters-1)
-   [\_setConfig](#_setconfig)
    -   [Parameters](#parameters-2)
-   [\_init](#_init)
-   [\_before](#_before)
    -   [Parameters](#parameters-3)
-   [\_after](#_after)
-   [\_test](#_test)
    -   [Parameters](#parameters-4)
-   [\_passed](#_passed)
    -   [Parameters](#parameters-5)
-   [\_failed](#_failed)
    -   [Parameters](#parameters-6)
-   [\_beforeStep](#_beforestep)
    -   [Parameters](#parameters-7)
-   [\_afterStep](#_afterstep)
    -   [Parameters](#parameters-8)
-   [\_beforeSuite](#_beforesuite)
    -   [Parameters](#parameters-9)
-   [\_afterSuite](#_aftersuite)
    -   [Parameters](#parameters-10)
-   [\_finishTest](#_finishtest)
    -   [Parameters](#parameters-11)
-   [\_useTo](#_useto)
    -   [Parameters](#parameters-12)
-   [helpers](#helpers)
-   [debug](#debug)
    -   [Parameters](#parameters-13)
-   [debugSection](#debugsection)
    -   [Parameters](#parameters-14)
-   [\_config](#_config)

Helper

Abstract class. Helpers abstracts test execution backends.
Methods of Helper class will be available in tests in I object. They provide user-friendly abstracted actions over NodeJS libraries.
Hooks (methods starting with _) can be used to setup/teardown, or handle execution flow.
Methods are expected to return a value in order to be wrapped in promise.

Parameters

  • config any

\validateConfig

Abstract method to validate config
Parameters
  • config any

Returns any

\setConfig

Sets config for current test
Parameters
  • opts any

\init

Hook executed before all tests

\before

Hook executed before each test.
Parameters
  • test Mocha.Test

\after

Hook executed after each test

\test

Hook provides a test details Executed in the very beginning of a test
Parameters
  • test Mocha.Test

\passed

Hook executed after each passed test
Parameters
  • test Mocha.Test

\failed

Hook executed after each failed test
Parameters
  • test Mocha.Test

\beforeStep

Hook executed before each step
Parameters
  • step CodeceptJS.Step

\afterStep

Hook executed after each step
Parameters
  • step CodeceptJS.Step

\beforeSuite

Hook executed before each suite
Parameters
  • suite Mocha.Suite

\afterSuite

Hook executed after each suite
Parameters
  • suite Mocha.Suite

\finishTest

Hook executed after all tests are executed
Parameters
  • suite Mocha.Suite

\useTo

Abstract method to provide common interface to accessing helpers internals inside a test.
Parameters
  • description
    fn

helpers

Access another configured helper: this.helpers['AnotherHelper']
Type: any

debug

Print debug message to console (outputs only in debug mode)
Parameters

debugSection

Parameters

\config

Abstract method to provide required config options
Returns any