0.1.4 • Published 3 years ago

protractor-xhr-interceptor-plugin v0.1.4

Weekly downloads
14
License
MIT
Repository
github
Last release
3 years ago

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();