How to run TestCafe tests with throttling connection? - testing

I need to check functionality if a file is uploading longer then 1 minute.
To check it with manual testing I use Chrome Dev Tools to set Throttling "Slow 3G".
But I can't figure out how to do it with TestCafe.

TestCafe does not have an API to set the throttling. However, TestCafe uses Chrome DevTools Protocol internally so you can get access to internal CDP methods.
Please refer to the following links to get started:
Chrome DevTools Protocol
chrome-remote-interface package
chrome-remote-interface repo
Please also take a look at the following example which shows how to enable file downloading in chrome headless.
I think you need to combine this example with the CDP Network.emulateNetworkConditions method.
Please refer to this article https://chromedevtools.github.io/devtools-protocol/tot/Network#method-emulateNetworkConditions

Related

Testcafe which remote browser did my test run in?

I use a custom browser provider - saucelabs - I'd like my custom reporter to know in which remote browser it ran so I can properly correlate the saucelabs video with a failed test.
This obviously is only an issue with concurrency > 1 :)
If a test fails which remote browser was it run in???
thanks!!
Mark
The reportTestDone method of a reporter plugin is called after a test is done in all browsers. If testRunInfo.errs array is empty, it means that the test passed in all browsers. If it is non-empty, every item has a userAgent property, telling in which browser the error occurred.
So, if you need a list of browsers in which the test fails, you could use something like this: _.chain(testRunInfo.errs).map('userAgent').uniq().value().
I didn't find this in the official documentation, though.

running selenium tests via jmeter on blazemeter remotely

We have a jmeter test that launches selenium scripts using the chrome driver config plugin which runs with the Web Driver Sampler, with which we are uploading our own chrome driver. The driver wont be allowed to work though, we keep getting
java.lang.IllegalStateException: The driver is not executable: /tmp/artifacts/chromedriver
we need a way to chmod +x the driver or something similar. is there a way to do this?
Blazemeter support said
JMeter's Webdriver plugin has been deprecated and is not supported on BlazeMeter
but I don't see anything deprecating the webdriver plugin from jmeter The repo and main website seem updated and active.
https://github.com/undera/jmeter-plugins-webdriver
https://jmeter-plugins.org/wiki/WebDriverSampler/?utm_source=jmeter&utm_medium=helplink&utm_campaign=WebDriverSampler
TL/DR: Can we run a selenium test from within a jmeter test using a <com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler on blazemeter? what are the steps to do so?
I hit this exact issue, this is probably too late for you but I thought it would be useful to answer for someone else in the future.
According to this Blazemeter Post titled:
"Using Selenium with JMeter's WebDriver Sampler"
"To launch the WebDriver test in the cloud with more concurrent users on BlazeMeter, use Firefox, which is the only currently supported browser for use with WebDriver. Create a new test and upload your JMX file to run it."
So in summary, only firefox is supported, not chrome within Blazemeter.
I work on a lot of BlazeMeter's documentation and can verify the previous answer -- the Webdriver plugin for JMeter is no longer supported on BlazeMeter.
That's not to say you can't get it to work -- you might -- but it's not supported (i.e. the support team can't assist with any problems that arise with it).
Some added context: We know folks in the plugin development community, which is how we learned the plugin is "deprecated" in the sense that there's not much in the way of future development for it going forward. You're right though - it's not documented anywhere, unfortunately. I can't speak to why that is on the plugin side, but that's why it is no longer supported on the BlazeMeter side.
The other reason it's no longer supported is that we recently introduced a new feature to replace it, our "GUI Functional Test" feature in BlazeMeter, which lets you run Selenium tests either through our BlazeMeter UI or from your own IDE, then watch a recording of what happened in the browser afterward. We have a set of guides covering the topic, starting here:
https://guide.blazemeter.com/hc/en-us/articles/360000700158
We also introduced a means to run a Selenium test alongside a JMeter test, via what we call our End User Experience Monitoring feature, detailed here:
https://guide.blazemeter.com/hc/en-us/articles/360000262118
(That blog post referenced above is a very old one that unfortunately no longer applies today. I regrettably don't work on the blog side of the house, so I don't have the authority to update that one myself.)
Lastly, please let me know if there's any pain points in our docs that we can fix. I've been putting a lot of work into improving and expanding our existing documentation, so feedback is always welcome.

Relaxing Microsoft Edge CSP while running tests (webdriver) (Content-Security-policy)

I'm trying to relax Microsoft Edge CSP while running a test using proctractor (webdriver, chromedriver).
So the solution can be either
flag like "--disable-csp" which dose not exist according to my search results.
setting for webdriver/protractor to do so.
load an extension that dose that ( Like in chrome
Relaxing Chrome's CSP while running tests (webdriver) (Content-Security-policy))
I could not find any solution but to setup a proxy that filters the header.
any ideas?
I figured the best approach would be to use the solution from the same question for Chrome and just to convert the Chrome extension to a Microsoft-Edge one.
Follow the linked question to the point you got.
Convert the Chrome extension to an Edge extension using this tool
Use the extensionPath option to load the extension the.

Use the remote debugging protocol in the Chromium based Opera

I use the Google Chrome remote debugging protocol to get benchmarking information of the page loading process with Google Chrome. I would like to switch to Opera which should offer the same functionality now that it runs on Chromium.
I started Opera with the cli parameters "--remote-debugging-port=9222 --enable-benchmarking --enable-net-benchmarking" similar to starting Google Chrome. I discovered that benchmarking seams not to be started in Opera - the chrome.benchmarking object is not visible to JavaScript.
I didn't find any documentation on the cli parameters for Opera, neither how to work with the remote debugging protocol in Opera.
Does anybody know how benchmarking can be enabled and/or the remote debugging protocol works in Opera?
Maybe you don't need this anymore, but I did today.
For some reason (maybe it's by design, but I didn't bother to check), you can't really start two separate instances of Chropera. Therefore, you first have to exit opera (from the menu to save your session).
Then, find your installation directory, and start Opera with the params:
C:\PROGRA~2\OperaNew\31.0.1889.174>opera --remote-debugging-port=9222 "http://www.opera.com"
(Maybe you can use launcher.exe, but I didn't bother checking)
Then, using another browser, visit http://localhost:9222. Maybe you can use the same one, but again, I didn't bother checking.
Now it's just the same as the Chrom(e|ium) protocol.
Hope that helps somebody.

How to disable local storage feature in Selenium?

I want to test the code that must run when the browser does not have / does not allow me to use the local storage feature. Is there any way to mock this behavior on Selenium side?
Take a look at this question and the answers:
How can I browse with localstorage disabled?
It's not specifically about selenium, but it tells you how to configure the browsers to disable local storage; using that, you should be able to run selenium with a browser using that configuration.