Webdriverio service

npm Build Status

This plugin connects to @ng-apimock/core middelware and makes the all its features available in the tests.

Requirements

see Ng-apimock requirements

Installing using npm / yarn

npm install wdio-ng-apimock-service --save-dev

or

yarn add wdio-ng-apimock-service --dev

Usage

Once the plugin has been installed, you can add it as a plugin to your protractor.conf.js

exports.config = {
services: [['ng-apimock']]
};

Plugin configuration

You can override the global name in the configuration. The plugin will now be available on a global scope under that name.

exports.config = {
services: [['ng-apimock', {
globalName: 'client' // optional option (defaults to ngApimock)
}]]
};

Using in tests

Import the base client which contains the interface

import { Client } from '@ng-apimock/base-client';
declare const client: Client; // the name of the constant should match the global name:

Now you can use it.

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

API

See API