mdasberg / ng-apimock

Node plugin that provides the ability to use scenario based api mocking: for local development for protractor testing
MIT License
99 stars 26 forks source link

Feature: update scenarios in Protractor with 1 call #15

Open wswebcreation opened 7 years ago

wswebcreation commented 7 years ago

Current: When ng-apimock is used within protractor tests and multiple scenario's need to be selected multiple calls to ngApimock.selectScenario('mock.name', 'mock.scenario') need to be created

Desired situation: It would be nice that there is a new method called for example selectMultipleScenario(object) that can do something like this (this is how we implemented it in our project)

interface Mocking {
    name: string;
    scenario: string;;
}

export interface MockingData extends Array<Mocking> {
}

/**
 * Load provided Mockdata in ng-Apimock
 */
export async function loadMockdata(mockData: MockingData) {
    for (let mock of mockData) {
        await ngApimock.selectScenario(mock.name, mock.scenario);
    }
}