Skip to content

Commit dfbc851

Browse files
author
Carlos Atencio
committed
Updating README with information on plugins
1 parent 467a3a3 commit dfbc851

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,38 @@ If there is a need to add or remove mocks during test execution, please use the
205205

206206
These will dynamically modify your current set of mocks, and any new request that happens after that will work with the updated set of mocks. Please note that these functions only work by adding or removing mocks using inline objects. As of now, it is not possible to add or remove mocks using mock files.
207207

208+
### Plugins
209+
210+
Plugins can be used to extend the matching functionality of protractor-http-mock. These are separate from protractor plugins.
211+
212+
A plugin can be defined as either an NPM package or a function.
213+
214+
They can be declared in your protractor configuration to be consumed by all your tests:
215+
216+
baseUrl: 'http://localhost:8000/',
217+
specs: [
218+
'spec/*.spec.js'
219+
],
220+
httpMockPlugins: {
221+
default: ['protractor-http-mock-sample-plugin']
222+
}
223+
224+
or in each individual test:
225+
226+
mock([
227+
//mocks go here
228+
], [
229+
{
230+
match: function(mockRequest, requestConfig){
231+
...
232+
}
233+
}
234+
]);
235+
236+
Note that in both your protractor configuration and tests, a plugin can be declared as either an npm package name, or definining the object inline.
237+
238+
See this [sample plugin](https://github.com/atecarlos/protractor-http-mock-sample-plugin) for more information.
239+
208240
### Examples
209241
Included in the code base is an extensive list examples on how to use all the features of this plugin. Please take a look if you have any questions.
210242

0 commit comments

Comments
 (0)