Git Product home page Git Product logo

wdio-intercept-service's Introduction

WebdriverIO Intercept Service

🕸 Capture and assert HTTP ajax calls in webdriver.io

Tests Join the chat on Discord

This is a plugin for webdriver.io. If you don't know it yet, check it out, it's pretty cool.

Although selenium and webdriver are used for e2e and especially UI testing, you might want to assess HTTP requests done by your client code (e.g. when you don't have immediate UI feedback, like in metrics or tracking calls). With wdio-intercept-service you can intercept ajax HTTP calls initiated by some user action (e.g. a button press, etc.) and make assertions about the request and corresponding responses later.

There's one catch though: you can't intercept HTTP calls that are initiated on page load (like in most SPAs), as it requires some setup work that can only be done after the page is loaded (due to limitations in selenium). That means you can just capture requests that were initiated inside a test. If you're fine with that, this plugin might be for you, so read on.

Prerequisites

  • webdriver.io v5.x or newer.

Heads up! If you're still using webdriver.io v4, please use the v2.x branch of this plugin!

Installation

npm install wdio-intercept-service -D

Usage

Usage with WebDriver CLI

It should be as easy as adding wdio-intercept-service to your wdio.conf.js:

exports.config = {
  // ...
  services: ['intercept']
  // ...
};

and you're all set.

Usage with WebDriver Standalone

When using WebdriverIO Standalone, the before and beforeTest / beforeScenario functions need to be called manually.

import { remote } from 'webdriverio';
import WebdriverAjax from 'wdio-intercept-service'

const WDIO_OPTIONS = {
  port: 9515,
  path: '/',
  capabilities: {
    browserName: 'chrome'
  },
}

let browser;
const interceptServiceLauncher = WebdriverAjax();

beforeAll(async () => {
  browser = await remote(WDIO_OPTIONS)
  interceptServiceLauncher.before(null, null, browser)
})

beforeEach(async () => {
  interceptServiceLauncher.beforeTest()
})

afterAll(async () => {
  await client.deleteSession()
});

describe('', async () => {
  ... // See example usage
});

Once initialized, some related functions are added to your browser command chain (see API).

Quickstart

Example usage:

browser.url('http://foo.bar');
browser.setupInterceptor(); // capture ajax calls
browser.expectRequest('GET', '/api/foo', 200); // expect GET request to /api/foo with 200 statusCode
browser.expectRequest('POST', '/api/foo', 400); // expect POST request to /api/foo with 400 statusCode
browser.expectRequest('GET', /\/api\/foo/, 200); // can validate a URL with regex, too
browser.click('#button'); // button that initiates ajax request
browser.pause(1000); // maybe wait a bit until request is finished
browser.assertRequests(); // validate the requests

Get details about requests:

browser.url('http://foo.bar')
browser.setupInterceptor();
browser.click('#button')
browser.pause(1000);

var request = browser.getRequest(0);
assert.equal(request.method, 'GET');
assert.equal(request.response.headers['content-length'], '42');

Supported browsers

It should work with somewhat newer versions of all browsers. Please report an issue if it doesn't seem to work with yours.

API

Consult the TypeScript declaration file for the the full syntax of the custom commands added to the WebdriverIO browser object. In general, any method that takes an "options" object as a parameter can be called without that parameter to obtain the default behavior. These "optional options" objects are followed by ?: = {} and the default values inferred are described for each method.

Option Descriptions

This library offers a small amount of configuration when issuing commands. Configuration options that are used by multiple methods are described here (see each method definition to determine specific support).

  • orderBy ('START' | 'END'): This option controls the ordering of requests captured by the interceptor, when returned to your test. For backwards compatibility with existing versions of this library, the default ordering is 'END', which corresponds to when the request was completed. If you set the orderBy option to 'START', then the requests will be ordered according to the time that they were started.
  • includePending (boolean): This option controls whether not-yet-completed requests will be returned. For backwards compatibility with existing versions of this library, the default value is false, and only completed requests will be returned.

browser.setupInterceptor()

Captures ajax calls in the browser. You always have to call the setup function in order to assess requests later.

browser.disableInterceptor()

Prevents further capture of ajax calls in the browser. All captured request information is removed. Most users will not need to disable the interceptor, but if a test is particularly long-running or exceeds the session storage capacity, then disabling the interceptor can be helpful.

browser.excludeUrls(urlRegexes: (string | RegExp)[])

Excludes requests from certain urls from being recorded. It takes an array of strings or regular expressions. Before writing to storage, tests the url of the request against each string or regex. If it does, the request is not written to storage. Like disableInterceptor, this can be helpful if running into problems with session storage exceeding capacity.

browser.expectRequest(method: string, url: string, statusCode: number)

Make expectations about the ajax requests that are going to be initiated during the test. Can (and should) be chained. The order of the expectations should map to the order of the requests being made.

  • method (String): http method that is expected. Can be anything xhr.open() accepts as first argument.
  • url (String|RegExp): exact URL that is called in the request as a string or RegExp to match
  • statusCode (Number): expected status code of the response

browser.getExpectations()

Helper method. Returns all the expectations you've made up until that point

browser.resetExpectations()

Helper method. Resets all the expectations you've made up until that point

browser.assertRequests({ orderBy?: 'START' | 'END' }?: = {})

Call this method when all expected ajax requests are finished. It compares the expectations to the actual requests made and asserts the following:

  • Count of the requests that were made
  • The order of the requests
  • The method, the URL and the statusCode should match for every request made
  • The options object defaults to { orderBy: 'END' }, i.e. when the requests were completed, to be consistent with the behavior of v4.1.10 and earlier. When the orderBy option is set to 'START', the requests will be ordered by when they were initiated by the page.

browser.assertExpectedRequestsOnly({ inOrder?: boolean, orderBy?: 'START' | 'END' }?: = {})

Similar to browser.assertRequests, but validates only the requests you specify in your expectRequest directives, without having to map out all the network requests that might happen around that. If inOrder option is true (default), the requests are expected to be found in the same order as they were setup with expectRequest.

browser.getRequest(index: number, { includePending?: boolean, orderBy?: 'START' | 'END' }?: = {})

To make more sophisticated assertions about a specific request you can get details for a specific request. You have to provide the 0-based index of the request you want to access, in the order the requests were completed (default), or initiated (by passing the orderBy: 'START' option).

  • index (number): number of the request you want to access
  • options (object): Configuration options
  • options.includePending (boolean): Whether not-yet-completed requests should be returned. By default, this is false, to match the behavior of the library in v4.1.10 and earlier.
  • options.orderBy ('START' | 'END'): How the requests should be ordered. By default, this is 'END', to match the behavior of the library in v4.1.10 and earlier. If 'START', the requests will be ordered by the time of initiation, rather than the time of request completion. (Since a pending request has not yet completed, when ordering by 'END' all pending requests will come after all completed requests.)

Returns request object:

  • request.url: requested URL
  • request.method: used HTTP method
  • request.body: payload/body data used in request
  • request.headers: request http headers as JS object
  • request.pending: boolean flag for whether this request is complete (i.e. has a response property), or in-flight.
  • request.response: a JS object that is only present if the request is completed (i.e. request.pending === false), containing data about the response.
  • request.response?.headers: response http headers as JS object
  • request.response?.body: response body (will be parsed as JSON if possible)
  • request.response?.statusCode: response status code

A note on request.body: wdio-intercept-service will try to parse the request body as follows:

  • string: Just return the string ('value')
  • JSON: Parse the JSON object using JSON.parse() (({ key: value }))
  • FormData: Will output the FormData in the format { key: [value1, value2, ...] }
  • ArrayBuffer: Will try to convert the buffer to a string (experimental)
  • Anything else: Will use a brutal JSON.stringify() on your data. Good luck!

For the fetch API, we only support string and JSON data!

browser.getRequests({ includePending?: boolean, orderBy?: 'START' | 'END' }?: = {})

Get all captured requests as an array, supporting the same optional options as getRequest.

Returns array of request objects.

browser.hasPendingRequests()

A utility method that checks whether any HTTP requests are still pending. Can be used by tests to ensure all requests have completed within a reasonable amount of time, or to verify that a call to getRequests() or assertRequests() will include all of the desired HTTP requests.

Returns boolean

TypeScript support

This plugin provides its own TS types. Just point your tsconfig to the type extensions like mentioned here:

"compilerOptions": {
    // ..
    "types": ["node", "webdriverio", "wdio-intercept-service"]
},

Running the tests

Recent versions of Chrome and Firefox are required to run the tests locally. You may need to update the chromedriver and geckodriver dependencies to match the version installed on your system.

npm test

Contributing

I'm happy for every contribution. Just open an issue or directly file a PR.
Please note that this interceptor library is written to work with legacy browsers such as Internet Explorer. As such, any code used in lib/interceptor.js must at least be parseable by Internet Explorer's JavaScript runtime.

License

MIT

wdio-intercept-service's People

Contributors

abjerstedt avatar badisi avatar cdraycott avatar cesar-rivera avatar chmanie avatar christian-bromann avatar dependabot[bot] avatar dragosmc91 avatar esaari avatar gabrielnicolasavellaneda avatar gitter-badger avatar greenkeeper[bot] avatar jbebe avatar juenobueno avatar lildesert avatar louis-bompart avatar muhserks avatar renovate-bot avatar seadb avatar seanpoulter avatar stamoern avatar tehhowch avatar vrockai avatar wdio-bot avatar x3700x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wdio-intercept-service's Issues

Feature Request: allow querying for in-progress HTTP calls

Problem Statement

Based on a short review of the code, it appears that captured requests are only persisted to window[ns].requests or session storage when the HTTP call completes. Thus, test code that wants to assert on a possibly long-running request needs to wait for an arbitrary amount of time, which may invariably not be long enough due to temporary network issues, etc.

Feature Request

I think it would be useful to support a simple query method that indicates whether any requests are still in-flight, and thus won't be returned in response to browser.getRequests(), e.g. browser.hasPendingHttpRequests().

Other Notes

This query method could be used internally to support an optional config parameter to getRequests (default value of false, to preserve existing behavior), that waits for pending network activity to settle before returning the intercepted requests. Then test cases could easily obtain the full HTTP request log:

const allRequests = browser.getRequests({ waitForPendingRequests: true });
// consume requests locally

or via expectations:

browser.expectRequest('GET', 'https://mydomain.com/huge-exports/export-all-the-things.php', 200);
browser.$('button').click(); // Start the download!
browser.assertRequests({ waitForPendingRequests: true });

An in-range update of @wdio/sync is breaking the build 🚨

The devDependency @wdio/sync was updated from 5.7.13 to 5.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/sync is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 30 commits.

  • ae1004c v5.8.0
  • 3e59cee minor wording
  • 43e69c6 blog: add blog for react selector command (#3900)
  • 8f57958 wdio-sync: bump fibers version to 4 (#3898)
  • c52193d junit-reporter: fix log file names (#3892)
  • 27725a9 Fix unit tests when contributing on Windows 10 (#3891)
  • f715a76 fix appium protocols (#3886)
  • 9a16bf3 add docker service to cli wizard supported services
  • 27b8c86 Update JenkinsIntegration.md (#3885)
  • 45962bc wdio-local-runner: unpipe streams in the end (#3882)
  • 6e5d2a0 apply wdioLogLevel before starting workers (#3872)
  • cdb2856 Fix headless endpoint (#3876)
  • 57f3e8e Don't fail element command in IE (#3874)
  • d006047 Fixes to react$ and react$$ scripts (#3862)
  • 78ca355 wdio-logger: fix setting log level for subloggers and docs (#3871)

There are 30 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Support page changes

As seen in #1, the assessed request data does not survive a page change. This could be solved be using cookies or localStorage (depending on browser support).

intercept doc / files

It doesn't look like I'm able to intercept a downloaded file request. Is that possible? If not, it might make for a good feature.

An in-range update of @wdio/sync is breaking the build 🚨

The devDependency @wdio/sync was updated from 5.4.20 to 5.6.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/sync is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 9 commits.

  • 00bdd48 v5.6.0
  • e409aea update package list in readme (#3590)
  • c36d1f7 typescript promise commands (#3577)
  • 792f089 Adding outputDir to standalone (#3583)
  • 9e03559 webdriverio: extend wait command prefixes (#3548)
  • 422387e v5.5.0
  • 35ad8aa make metrics param in assertPerformance not required (#3587)
  • 2d01c70 Move reporter directory creation up (#3578)
  • afcec30 webdriverio: shadow$ and shadow$$ commands (#3586)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Unable to use getRequests

Hi,

maybe is not an issue but i'm not able to use GetRequests.
While trying to use it in that way:

var webdriverio = require('webdriverio');
var wdajax = require('webdriverajax');

wdajax.init(client);


client
    .init()
    .setViewportSize({width:1920,height:1080})
    .url('**myurl**')
   .setupInterceptor() // capture ajax calls 
    .waitForExist('//div[2]/div/header/div/div[3]/div/div/div[2]/div/form/div[1]/input',10000)
    .setValue('//div[2]/div/header/div/div[3]/div/div/div[2]/div/form/div[1]/input','yuser')
    .setValue('//div[2]/div/header/div/div[3]/div/div/div[2]/div/form/div[2]/input','mypassword')
    .click('//div[2]/div/header/div/div[3]/div/div/div[2]/div/form/input[5]')
    .pause(1000)
    .getRequests()
    .then(function(requests){console.log(requests);})
    .end();

it crashes with following error:

RuntimeError: window.__webdriverajax is undefined
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'probe_server-probe_server-2334910', ip: '172.17.0.9', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-c9', java.version: '1.7.0_79'
Driver info: driver.version: unknown
at execute(, ) - index.js:104:27

What I'm doing wrong?

Thanks,
Riccardo

An in-range update of @wdio/mocha-framework is breaking the build 🚨

The devDependency @wdio/mocha-framework was updated from 5.4.20 to 5.6.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/mocha-framework is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 9 commits.

  • 00bdd48 v5.6.0
  • e409aea update package list in readme (#3590)
  • c36d1f7 typescript promise commands (#3577)
  • 792f089 Adding outputDir to standalone (#3583)
  • 9e03559 webdriverio: extend wait command prefixes (#3548)
  • 422387e v5.5.0
  • 35ad8aa make metrics param in assertPerformance not required (#3587)
  • 2d01c70 Move reporter directory creation up (#3578)
  • afcec30 webdriverio: shadow$ and shadow$$ commands (#3586)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @wdio/local-runner is breaking the build 🚨

The devDependency @wdio/local-runner was updated from 5.5.0 to 5.6.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/local-runner is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 5 commits.

  • 00bdd48 v5.6.0
  • e409aea update package list in readme (#3590)
  • c36d1f7 typescript promise commands (#3577)
  • 792f089 Adding outputDir to standalone (#3583)
  • 9e03559 webdriverio: extend wait command prefixes (#3548)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

`fetch` support

The current implementation only hooks into the XMLHttpRequest object. Newer browsers have yet another way of doing XHR and that is the fetch API, which doesn't use the old XHR methods internally. So we need to intercept this new API as well.

How to intercept Graphql request?

Hello,
I need to intercept Grahpql requests to my tests, but this is fetch type, so the Intercept service isn't getting the request, is there any way to intercept this request?

the request is returning the result of this way
data: {values: {totalPages: 10,…}},…} data: {values: {totalPages: 10,…}} values: {totalPages: 10,…}

Thank You.

Not able to intercept requests

Hi, I am trying to use interceptor. Using chrome 83.0.4103.106.
browser.setupInterceptor();
...
browser.url(oDataUrl); //this request goes through fine and also getting the response.
browser.pause(5000);
..
var irequest = browser.getRequest(0); //but this request fails
Getting error here "Could not find request with index 0". getRequests() returns an empty array. Am I missing something. Kindly help.
Thanks

An in-range update of webdriverio is breaking the build 🚨

The devDependency webdriverio was updated from 5.11.5 to 5.11.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webdriverio is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 9 commits.

  • 8a10ff7 v5.11.6
  • ed3d504 Print link to Sauce Labs job details page when using Sauce Conn… (#4204)
  • 25b4463 clean up setTimeout implementation (#4211)
  • f63ca53 Fix type for webdriverio onPrepare parameter (#4189)
  • afcb6c4 Updated selectors documentation for element ID (#4117)
  • 2b793f8 Print data tables in spec reporter (#4201)
  • 88e4960 Fix overflow text is displayed (#4202)
  • 75c2223 updated missing patch in changelog
  • 05c049c update changelog

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Internet Explorer

I started using this service and it has been great. Thank you.
Is there any way it can be made to work on Internet Explorer too?
I get this error on IE11:
Error executing JavaScript
[internet explorer windows #1-0] javascript error: Error executing JavaScript
[internet explorer windows #1-0] at WebdriverAjax.setup at node_modules/wdio-intercept-service/index.js:41:22)
Appreciate any hints.

Local wdio test gives: javascript error: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.

Using Chromedriver.
Any browser settings needed or time delay needed?
I am not blocking any third party cookies

[chrome 87.0.4280.88 mac os x #0-0] JavaScript stack:
[chrome 87.0.4280.88 mac os x #0-0] Error: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.
[chrome 87.0.4280.88 mac os x #0-0] at setup (eval at executeAsyncScript (:556:26), :13:16)
[chrome 87.0.4280.88 mac os x #0-0] at eval (eval at executeAsyncScript (:556:26), :191:6)
[chrome 87.0.4280.88 mac os x #0-0] at eval (eval at executeAsyncScript (:556:26), :192:4)
[chrome 87.0.4280.88 mac os x #0-0] at executeAsyncScript (:556:47)
[chrome 87.0.4280.88 mac os x #0-0] at :571:29
[chrome 87.0.4280.88 mac os x #0-0] at callFunction (:450:22)
[chrome 87.0.4280.88 mac os x #0-0] at :464:23
[chrome 87.0.4280.88 mac os x #0-0] at :465:3
[chrome 87.0.4280.88 mac os x #0-0] (Session info: chrome=87.0.4280.88)
[chrome 87.0.4280.88 mac os x #0-0] at processTicksAndRejections (internal/process/task_queues.js:85:5)
[chrome 87.0.4280.88 mac os x #0-0] at WebdriverAjax.setup (/Users/ksubramanian3/Documents/projects/tracking-core/node_modules/wdio-intercept-service/index.js:41:22)
[chrome 87.0.4280.88 mac os x #0-0] at Browser.next [as setupInterceptor] (/Users/ksubramanian3/Documents/projects/tracking-core/node_modules/@wdio/utils/build/monad.js:95:33)
[chrome 87.0.4280.88 mac os x #0-0] at Context. (/Users/ksubramanian3/Documents/projects/tracking-core/tests/integration/tracking-core.selenium.js:199:13)

An in-range update of webdriverio is breaking the build 🚨

The devDependency webdriverio was updated from 5.7.9 to 5.7.12.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

webdriverio is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 15 commits.

  • c714129 v5.7.12
  • 2379d23 Ensure ms edge runs on w3c on Sauce (#3832)
  • f46c0fe wdio-cli: fix typo (#3828)
  • 4705847 fix addCommand in multiremote (#3825)
  • 19f2ff0 fix element property
  • 52d4c9d update video on front page
  • 849101a v5.7.11
  • 9351be3 Issue 3416: Support multiple errors in the Allure-reporter (#3746)
  • 217db81 Allow junit-reporter to work when a runner has multiple spec files per runner (#3818)
  • 3668cc9 allure-reporter: fix allure endStep and startStep (#3821)
  • 3e5f7c5 Add a couple features to boilerplate project (#3822)
  • 6fd8b41 add missing setup step
  • 7d32f2d v5.7.10
  • a182d96 wdio-cli: Print reporters after stdout (#3817)
  • 8756c00 install compass before deploying docs

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

error TS2339: Property 'setupInterceptor' does not exist on type 'BrowserObject'.

Hello,

It looks like the service is not working with typescript, is their a way to fix it ?

steps to reproduce :

# clone a typescript boilerplate
$ git clone [email protected]:jpolley/WebdriverIO_v5_TypeScript.git 
$ cd WebdriverIO_v5_TypeScript

# install dependencies
$ npm i 

# check this spec is working
$ npm test -- --spec dropdown.spec.ts 

# install intercept service
$ npm i --save-dev wdio-intercept-service

# add intercept to wdio conf, ie. `services: ['selenium-standalone', 'intercept']`
$ sed -i.bak -E "s/(services: \['selenium-standalone')\]/\1, 'intercept'\]/" wdio.conf.js
# add an intercept step to a spec ie. `return browser.url('/dropdown').setupInterceptor();`
$ sed -i.bak -E "s/(return browser.url\('/dropdown'\));/\1.setupInterceptor();/" src/pages/DropdownPage.ts

# run it, it's not working :(
$ npm test -- --spec dropdown.spec.ts 
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   '/usr/local/Cellar/node/12.8.0/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'test',
npm verb cli   '--',
npm verb cli   '--spec',
npm verb cli   'src/pages/DropdownPage.ts'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'pretest', 'test', 'posttest' ]
npm info lifecycle [email protected]~pretest: [email protected]
npm info lifecycle [email protected]~test: [email protected]

> [email protected] test /Users/user/WebdriverIO_v5_TypeScript
> wdio "--spec" "src/pages/DropdownPage.ts"


Execution of 1 spec files started at 2020-01-20T22:36:48.267Z

2020-01-20T22:36:48.269Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "selenium-standalone"
2020-01-20T22:36:48.304Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "intercept"
2020-01-20T22:36:48.306Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-01-20T22:36:49.568Z INFO @wdio/local-runner: Start worker 0-0 with arg: --spec,src/pages/DropdownPage.ts
[0-0] 2020-01-20T22:36:49.779Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - /src/pages/DropdownPage.ts
[0-0] 2020-01-20T22:36:49.947Z DEBUG @wdio/utils:initialiseServices: initialise wdio service "intercept"
[0-0] 2020-01-20T22:36:49.948Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2020-01-20T22:36:49.949Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-01-20T22:36:49.950Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session
[0-0] 2020-01-20T22:36:49.950Z INFO webdriver: DATA {
  capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
  desiredCapabilities: { browserName: 'chrome' }
}
[0-0] 2020-01-20T22:36:52.350Z ERROR @wdio/runner: TSError: ⨯ Unable to compile TypeScript:
src/pages/DropdownPage.ts(5,41): error TS2339: Property 'setupInterceptor' does not exist on type 'void'.

    at createTSError (/Users/user/WebdriverIO_v5_TypeScript/node_modules/ts-node/src/index.ts:261:12)
    at getOutput (/Users/user/WebdriverIO_v5_TypeScript/node_modules/ts-node/src/index.ts:367:40)
    at Object.compile (/Users/user/WebdriverIO_v5_TypeScript/node_modules/ts-node/src/index.ts:558:11)
    at Module.m._compile (/Users/user/WebdriverIO_v5_TypeScript/node_modules/ts-node/src/index.ts:439:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:879:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/user/WebdriverIO_v5_TypeScript/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:731:32)
    at Function.Module._load (internal/modules/cjs/loader.js:644:12)
    at Module.require (internal/modules/cjs/loader.js:771:19)
    at require (internal/modules/cjs/helpers.js:68:18)
[0-0] Error: ⨯ Unable to compile TypeScript:
src/pages/DropdownPage.ts(5,41): error TS2339: Property 'setupInterceptor' does not exist on type 'void'.

[0-0] 2020-01-20T22:36:52.373Z INFO webdriver: COMMAND deleteSession()
[0-0] 2020-01-20T22:36:52.373Z INFO webdriver: [DELETE] http://127.0.0.1:4444/wd/hub/session/f3c1a49088665b5cb89c5ce92b87383d
2020-01-20T22:36:52.553Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in chrome - /src/pages/DropdownPage.ts
2020-01-20T22:36:52.554Z INFO @wdio/cli:launcher: Run onComplete hook
2020-01-20T22:36:52.554Z INFO @wdio/selenium-standalone-service: shutting down all browsers

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:04 

2020-01-20T22:36:52.555Z INFO @wdio/local-runner: Shutting down spawned worker
2020-01-20T22:36:52.807Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2020-01-20T22:36:52.808Z INFO @wdio/local-runner: shutting down
npm verb lifecycle [email protected]~test: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~test: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/user/WebdriverIO_v5_TypeScript/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
npm verb lifecycle [email protected]~test: CWD: /Users/user/WebdriverIO_v5_TypeScript
npm info lifecycle [email protected]~test: Failed to exec test script
npm ERR! Test failed.  See above for more details.
npm verb exit [ 1, true ]
npm timing npm Completed in 5456ms
npm verb code 1

Thanks for any help.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

browser.getRequests() sample

It would be nice to have a sample code for how to call browser.getRequests()
When I tried, it said the return value is not an array.

Running Programmatically with intercept service

Hello,

I would like to know is that possible to run intercept service without wdio?

Since I want to dynamic config the proxy setting with different isntance, therefore i am looking a way to use intercept service without wdio.

Thank you.

An in-range update of @wdio/spec-reporter is breaking the build 🚨

The devDependency @wdio/spec-reporter was updated from 5.11.0 to 5.11.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/spec-reporter is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 43 commits.

  • 8a10ff7 v5.11.6
  • ed3d504 Print link to Sauce Labs job details page when using Sauce Conn… (#4204)
  • 25b4463 clean up setTimeout implementation (#4211)
  • f63ca53 Fix type for webdriverio onPrepare parameter (#4189)
  • afcb6c4 Updated selectors documentation for element ID (#4117)
  • 2b793f8 Print data tables in spec reporter (#4201)
  • 88e4960 Fix overflow text is displayed (#4202)
  • 75c2223 updated missing patch in changelog
  • 05c049c update changelog
  • 407a5d1 v5.11.5
  • 6e20f6a isSauce should not depend on hostname (#4194)
  • fd1bfd2 webdriver: support rebinding of context when invoking origFn in… (#4186)
  • 6e72209 update changelog
  • 2f94009 v5.11.4
  • be3d341 add --no-ci

There are 43 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @wdio/cli is breaking the build 🚨

The devDependency @wdio/cli was updated from 5.7.15 to 5.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 20 commits.

  • ae1004c v5.8.0
  • 3e59cee minor wording
  • 43e69c6 blog: add blog for react selector command (#3900)
  • 8f57958 wdio-sync: bump fibers version to 4 (#3898)
  • c52193d junit-reporter: fix log file names (#3892)
  • 27725a9 Fix unit tests when contributing on Windows 10 (#3891)
  • f715a76 fix appium protocols (#3886)
  • 9a16bf3 add docker service to cli wizard supported services
  • 27b8c86 Update JenkinsIntegration.md (#3885)
  • 45962bc wdio-local-runner: unpipe streams in the end (#3882)
  • 6e5d2a0 apply wdioLogLevel before starting workers (#3872)
  • cdb2856 Fix headless endpoint (#3876)
  • 57f3e8e Don't fail element command in IE (#3874)
  • d006047 Fixes to react$ and react$$ scripts (#3862)
  • 78ca355 wdio-logger: fix setting log level for subloggers and docs (#3871)

There are 20 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Integration with Gulp

How can i integrate this with my current gulp setup?
conf:

const Launcher = require('webdriverio/build/lib/launcher');
const path = require('path');
var wdajax = require('webdriverajax');
const wdio = new Launcher(path.join(__dirname, 'wdio.conf.js'));
...
gulp.task('e2e', () => {
  wdajax.init(wdio);
  return wdio.run(code => {
    process.exit(code);
  }, error => {
    console.error('Launcher failed to start the test', error.stacktrace);
    process.exit(1);
  });
});

I got this error:

[17:56:58] Using gulpfile ~/projects/adTag2/gulpfile.js
[17:56:58] Starting 'e2e'...
[17:56:58] 'e2e' errored after 397 μs
[17:56:58] Error: you can't use WebdriverAjax with this version of WebdriverIO
    at Object.plugin [as init] (/Users/marco/projects/adTag2/node_modules/webdriverajax/index.js:11:15)
    at Gulp.gulp.task (/Users/marco/projects/adTag2/gulpfile.js:170:10)
    at module.exports (/Users/marco/projects/adTag2/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/Users/marco/projects/adTag2/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/marco/projects/adTag2/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/Users/marco/projects/adTag2/node_modules/orchestrator/index.js:134:8)
    at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:592:11)

Although my version is higher than v3

Persisting the call data

Is there a way to persist the network calls after navigating to a new page?

I am doing a network call in the 'beforeunload' event and I want to check this call. But it is already in the new page and shows a count of zero.

no available function to read request data

Hi Cris,
Thanks for making this package, i'm currently trying to intercept my request payload, but i realized this tool only verifies detailed body on the response, not on the request. Can you give me some idea how I can do this? Thanks

wdio-intercept-service and multiremote project

Hello,
I'm using wdio-intercept-service in my wdio project and it's working great, but I see that I can't use it in the case of Multiremote : https://webdriver.io/docs/multiremote.html
browser.setupInterceptor() is working (if all browsers launched are compatible), but browser['chrome'].setupInterceptor() is giving me an error:

**browser.chrome.setupInterceptor is not a function**

But browser['chrome'] is ok for all WebdriverIO.BrowserObject methods like .url()...
So how can I make wdio-intercept-service works in a multiremote project ? Thanks !

An in-range update of @wdio/mocha-framework is breaking the build 🚨

The devDependency @wdio/mocha-framework was updated from 5.7.14 to 5.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/mocha-framework is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 24 commits.

  • ae1004c v5.8.0
  • 3e59cee minor wording
  • 43e69c6 blog: add blog for react selector command (#3900)
  • 8f57958 wdio-sync: bump fibers version to 4 (#3898)
  • c52193d junit-reporter: fix log file names (#3892)
  • 27725a9 Fix unit tests when contributing on Windows 10 (#3891)
  • f715a76 fix appium protocols (#3886)
  • 9a16bf3 add docker service to cli wizard supported services
  • 27b8c86 Update JenkinsIntegration.md (#3885)
  • 45962bc wdio-local-runner: unpipe streams in the end (#3882)
  • 6e5d2a0 apply wdioLogLevel before starting workers (#3872)
  • cdb2856 Fix headless endpoint (#3876)
  • 57f3e8e Don't fail element command in IE (#3874)
  • d006047 Fixes to react$ and react$$ scripts (#3862)
  • 78ca355 wdio-logger: fix setting log level for subloggers and docs (#3871)

There are 24 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Unable to intercept in IE and Edge

Same code with intercept browser.setupInterceptor() works for other browsers but not for IE and Edge

Is there any additional setting need to do for these browser? or intercept does not work for these?

IE error: [0-0] TypeError in "test name"
Cannot convert undefined or null to object

Edge error:[1-0] Error in "test name"
Could not find request with index 0

An in-range update of @wdio/cli is breaking the build 🚨

The devDependency @wdio/cli was updated from 5.5.0 to 5.6.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/cli is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 5 commits.

  • 00bdd48 v5.6.0
  • e409aea update package list in readme (#3590)
  • c36d1f7 typescript promise commands (#3577)
  • 792f089 Adding outputDir to standalone (#3583)
  • 9e03559 webdriverio: extend wait command prefixes (#3548)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

browser.setupInterceptor is not a function

"wdio-intercept-service": "^4.0.0", "webdriverajax": "^2.2.0", "webdriverio": "^5.18.7"

I have a simple test I'm using to try to test the intercept service. Thus far I've based it on the example here: https://webdriver.io/docs/wdio-intercept-service.html

describe('Test Intercept Service', () => {
     it('Intercept test', () => {
        browser.url('http://google.com');
        browser.setupInterceptor();
        var requests = browser.getRequests();
        console.log(requests);
    })
})

When I run the test, I get this error: browser.setupInterceptor is not a function
I've done the best basic troubleshooting I can, as I'm fairly new to JS and WDIO. I've made sure it's using the right version of node, done a yarn install again and tried a few different combinations including putting it in a a browser.call statement.

Can Not Get it To Work with webdriver.io NPM

Hey, for some reason my code returns this error:

TypeError: client.init(...).url(...).setupInterceptor is not a function

Here's my code:

var webdriverio = require('webdriverio');
var webdriverajax = require('webdriverajax');
var request = require('request');
var request = require('request').defaults({ jar: true });
var options = {
    desiredCapabilities: {
        browserName: 'chrome',
        logLevel: 'verbose'
    },
    plugins: {
        webdriverajax: {}
    }
};

var client = webdriverio.remote(options);
var trackInfo;
var songs = [];


client
    .init()
    .url('https://xxxx.com')
    .setupInterceptor()
    .expectRequest('GET', '/serve/source', 200)
    .getRequest(0)
    .then(function(data) {
        console.log(data);
    })
    .pause(5000)
    .click('#track-list > .first a.play')
    .pause(3000)
    .execute(function () {
        return window.playList['tracks'][0];
    }).then(function (data) {
        songs.push(data.value);
    })
    .end()

Is it meant to be run in another way?

Couldn't initialize service

Hello,
I'm using Codeceptjs along with wdio. I wanted to try out the intercept service but I get the following error when setting up intercept in services array for wdio plugin:


Could not load plugin wdio from module './plugin/wdio':
Couldn't initialize service wdio-intercept from wdio plugin config.
It should be available either in '@wdio/wdio-intercept-service' package

No support for "Options" http method type

I am trying to verify that a specific xhr request only happens once. I am making a POST request across domains, which means it sends an OPTIONS request first. When I look at the requests that are returned from browser.getRequests(), I see two requests, but the method on both of them is POST, when the method on the first request should be OPTIONS. Additionally, the response code seems to be the same on both requests, but for OPTIONS our server sends a 204, and for the actual POST, our server sends a 200.

I'd like to be able to see which one is the OPTIONS and which one is the POST, so I can filter out the OPTIONS request in this case.

An in-range update of @wdio/local-runner is breaking the build 🚨

The devDependency @wdio/local-runner was updated from 5.7.15 to 5.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@wdio/local-runner is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 20 commits.

  • ae1004c v5.8.0
  • 3e59cee minor wording
  • 43e69c6 blog: add blog for react selector command (#3900)
  • 8f57958 wdio-sync: bump fibers version to 4 (#3898)
  • c52193d junit-reporter: fix log file names (#3892)
  • 27725a9 Fix unit tests when contributing on Windows 10 (#3891)
  • f715a76 fix appium protocols (#3886)
  • 9a16bf3 add docker service to cli wizard supported services
  • 27b8c86 Update JenkinsIntegration.md (#3885)
  • 45962bc wdio-local-runner: unpipe streams in the end (#3882)
  • 6e5d2a0 apply wdioLogLevel before starting workers (#3872)
  • cdb2856 Fix headless endpoint (#3876)
  • 57f3e8e Don't fail element command in IE (#3874)
  • d006047 Fixes to react$ and react$$ scripts (#3862)
  • 78ca355 wdio-logger: fix setting log level for subloggers and docs (#3871)

There are 20 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

browser.setupInterceptor is not a function

Was hoping to implement this to read request headers, so tried out the example code and got this error:
browser.setupInterceptor is not a function
running chrome
TypeError: browser.setupInterceptor is not a function at Context.<anonymous> (/Users/.../test/analytics.js:14:13) at Promise.F (/usr/local/lib/node_modules/wdio-mocha-framework/node_modules/core-js/library/modules/_export.js:35:28)

Here's the relevant set up details:
"node": "^6.10"
"selenium-standalone": "^6.12.0",
"webdriverajax": "^2.1.0",
"webdriverio": "^4.9.11",

browser.url("https://mywebapp.com/");
browser.setupInterceptor();
browser.click("body > main > section:nth-child(1) > div > a");
browser.waitForVisible("#id-to-get");
var request = browser.getRequest(0);

Any suggestions on how to get this working? If it works this plugin could be a lifesaver. :)

First network call

When using the sequence:
browser.url(url);
browser.setupInterceptor();

would it miss the first network call, if it happens quickly.
Is there a way to put in setupInterceptor before opening the url?

Any workaround when XHR uses Fetch

Installed this plugin(3.0.0-beta.1) with webdriverio(4.6) and tried to access the XHR requests but getting empty response array

browser.setupInterceptor();
browser.click('//div[@class="src-containers-App-App-appContent"]/div/div/button');
browser.pause(1000);
var request = browser.getRequests();
console.log(request); //we are getting empty requests

I think this will be the issue - any workaround for this

xhr

"Unknown error: Cannot read property '0' of undefined" when using console.log(browser.getRequest(0))

Hey, I installed webdriverajax via npm (it installs "webdriverajax": "^2.1.0" by default), I have "webdriverio": "^4.8.0".
When I try to run a code like below:

it('3.1.1 - should create a new person with required data:', function () {
            PeopleCreateNewPage.open();
            PeopleCreateNewPage.newFirstName.setValue(context.new_person_first_name);
            PeopleCreateNewPage.newLastName.setValue(context.new_person_last_name);
            browser.setupInterceptor();
            browser.submitForm("#person_edit_form");
            browser.pause(5000);
            console.log(browser.getRequest(0));

it returns me an error: unknown error: Cannot read property '0' of undefined I also tried to use browser.getRequests() without any index and then I see the Could not find request with index undefined error, I am not sure what is an issue? Could you please take a look at that? Thank you.

wdio test runner fails

I think your work is great.
I was able to run the manual test and liked what you did.
But when I try to run the wdio test-runner, while standalone Selenium Server
is up and running, and wdio.conf.js has the plugin registered:
plugins: {
webdriverajax:{}
},
I run 'node_modules/.bin/wdio wdio.conf.js'
and get "ERROR: browser.url(...).setupInterceptor is not a function".

Any help is appreciated.

Proposal: Use performance API to initialize the data of the interceptor.

Hi, this might be out of the scope of this project in all honesty, however, I think it might help this plugin to be even more ubiquitous for network capture in the WebdriverIO ecosystem.

The basic principle is quite simple:
When the user setup the interceptor, using the Performance API, get all the events related to the network.
From what I can see here, the following entry types should suffice:

  • frame
  • navigation
  • resource

This would however certainly qualified as a breaking change. Therefore, if that's not the default behaviour that the plugin wants to use moving forward, this feature should be behind an option on the setupInterceptor function. However, I do think that it's a better default behaviour than the current one, but an option could still be exposed to allow users to upgrade to the next major update to disable this new behaviour, allowing a more frictionless update.

URL is overridden if init object was used in fetch method

This line overrides the url field if an init object was passed to the fetch function:
https://github.com/chmanie/wdio-intercept-service/blame/master/lib/interceptor.js#L53

According to docs the init.url option doesn't exist:
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch

It looks to me the line overriding the url should be removed. With current state, I cannot get accessed URLs when using the browser.getRequests() function.

Can not find V2.x version in official npm registry

Nowadays I try to use WebDriverIO V4 and wdio-intercept-service to do some web auto test. I noticed that WebDriverIO V4 only support wdio-intercept-service V2.x but i can not find the V2.x in official npm registry. Cound you please upload some 2.x version to it ? Thanks a lot, appreciate!

getRequests() not fetching all requests

Hi,

I'm using getRequests() to validate some requests with specific params but sometimes, promise does not grab what I want.

Sample:

        browser
        .setupInterceptor()
        .click(id)
        .pause(1000)
        .getRequests().then(function(requests){ // tests  }

Even with a larger pause, requests lacks.
Inspecting my front-end site, all requests are made quickly. At a blink of an eye.

Do you have any idea ?

do we have any example to initilize the serivce ?

Hi
I am failed to integrate this in my project. Can someone have any example ? I am following the README but failed to start this.
getting below error
browser.setupInterceptor is not a function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.