protractor-xhr-interceptor-plugin
v0.1.4
Published
Protractor XHR/Fetch interceptor plugin
Downloads
4
Maintainers
Readme
protractor-xhr-interceptor-plugin
Introduction
This plugin was inspired by wdio-intercept-service and provide similar functionality but for protractor. Capture and assert HTTP ajax calls in protractortest.org
Installation
npm install protractor-xhr-interceptor-plugin -D
Usage
You can download sample project from sample
It should be as easy as adding protractor-xhr-interceptor-plugin to your protractor.conf.js
:
exports.config = {
plugins: [
package: 'protractor-xhr-interceptor-plugin'
]
};
Once initialized, some related functions are added to your browser instance.
Example
await browser.get(`https://angular.io`);
await browser.addInterceptor();
await browser.expectRequest('GET', 'generated/docs/docs.json', 200);
await element(by.xpath('//a[contains(.,"Get Started")]')).click();
await browser.assertRequests();