Skip to main content

Protractor plugin

npm Build Status
@ng-apimock/protractor-plugin is the protractor plugin for @ng-apimock/core.

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


see Ng-apimock requirements

Installing using npm / yarn

npm install @ng-apimock/protractor-plugin --save-dev


yarn add @ng-apimock/protractor-plugin --dev


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

exports.config = {
plugins: [{
package: '@ng-apimock/protractor-plugin'

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 = {
plugins: [{
package: '@ng-apimock/protractor-plugin',
options: {
globalName: 'client' // 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'));