1.0.15 • Published 5 years ago

@ng-apimock/webdriverio-plugin v1.0.15

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

webdriverio-plugin CircleCI dependency Status devDependency Status

webdriver plugin for @ng-apimock/core

Usage

This plugin connects to ng-apimock and makes the plugin functions available within the tests.

Enable this plugin in your config file:

exports.config = {
    plugins: {
       '@ng-apimock/webdriverio-plugin': {
           globalName: 'ngApimockWebdriverioPlugin' // optional option (defaults to ngApimock)  
       } 
    }
};

After registering the plugin, you can use it in your tests by calling it like this:

describe('Some test', () => {
    it('does something', async () => 
        await ngApimock.selectScenario('my-mock-name', 'some-scenario'));
});

Available plugin functions

The following functions are available. Each plugin function returns a promise.

selectScenario(name: string, scenario: string): Promise;

Selects the given scenario (when calling this function without a scenario or with 'passThrough' as scenario name, the call will be passed through to the actual backend).

delayResponse(mockName: string, delay: number): Promise;

Sets the delay time in milliseconds for the mock. This makes sure the response is delayed. The delay set here overrides the delay defined in the response mock.

echoRequest(name: string, echo: boolean): Promise;

Sets the indicator which enables / disables the request logging.

setVariable(key: string, value: string): Promise;

Adds or updates the global variable.

setVariables(variables: {key: string: string;}): Promise;

Adds or updates the global variables ie. {'some':'value', 'another': 'value'}.

deleteVariable(key: string): Promise;

Deletes the global variable.

resetMocksToDefault(): Promise;

Resets all the mocks to the default state.

setMocksToPassThrough(): Promise;

Sets all the mocks to pass through.

setPreset(name: string): Promise;

Sets the mocks and variables in the selected state.

1.0.15

5 years ago

1.0.14

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago