I am using Testcafe and it does not have direct support to access Chrome Dev Tools. My Aim is to cut the network so that I can see the error dialog in the website. This is the code that I have written. TestCafe opens at a different url Here is the URL: http://192.168.0.123:52678/someRandomStringHere/https://abcdefgh.com/abcdefgh/
I am unable to configure the parameters for this url. FYI, the port number changes, it is not fixed. Can someone please help me with this.
//Performing some actions using Testcafe here
let config = {
offline: true,
latency: 100,
downloadThroughput: 750 * 1024 / 8,
uploadThroughput: 250 * 1024 / 8
};
const CDP = require('chrome-remote-interface');
const client = await CDP();
const {Network} = client;
await Promise.all([
Network.enable()
]);
Network.emulateNetworkConditions(config);
//Checking if the error is present or not in website after cutting the network
Please take a loot at a similar question: How to run TestCafe tests with throttling connection?
Moreover, in the TestCafe repository, we have a test that emulates Network throttling: https://github.com/DevExpress/testcafe/blob/61f3703d50ef8cc64331d09659837c52a9aae862/test/functional/fixtures/regression/gh-3929/testcafe-fixtures/index.js :