ng-apimock / protractor-plugin

protractor client for @ng-apimock/core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to activate the mocks in Angular

arcovoltaico opened this issue · comments

I'm trying to implement your library, can't wait to use it :-)
On my Angular 9

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

Then on protractor.conf.js I have added the plugin :

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

On my e2e test

import {Client} from '@ng-apimock/base-client';
declare const ngApimock: Client;

And inside the it () block

 ngApimock.selectScenario('login-mock, 'successful');
element(by.id('loginBtn')).click();

BUT I am missing how to link the library to my successful scenario inside

ngApimock.processor.process won’t work as processor is not available in ngApiMock.
getMocks() and other methods are, but I can't find how to use it (in case needed).
Or am I missing to set an option on protractor.conf.js ?

Thanks so much

hi @arcovoltaico,

you can either use the docker image to start @ng-apimock/core or start it manually.

here is an example on how you can use it with protractor