Socket
Socket
Sign inDemoInstall

@ng-apimock/protractor-plugin

Package Overview
Dependencies
149
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ng-apimock/protractor-plugin

Protractor plugin for ng-apimock


Version published
Weekly downloads
595
decreased by-1.49%
Maintainers
2
Created
Weekly downloads
 

Changelog

Source

1.1.0 (2020-07-08)

Features

  • 🎸 make endpoints base path configurable (9a9cd21), closes #15

Readme

Source

ng-apimock/protractor-plugin npm Build Status Quality Gate Status Commitizen friendly semantic-release Dependabot Status dependency Status devDependency Status npm downloads

protractor plugin for @ng-apimock/core

Getting Started

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

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

Adds or updates the global variable.

setVariables(variables: {[key: string]: any;}): 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.

selectPreset(name: string): Promise;

Selects the mocks and variables in the selected state.

Keywords

FAQs

Last updated on 08 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc