Skip to content
Advertisement

Tag: testing

Get tests running time with Jest

Is there any way to know how long my tests take without doing it programmatically with Jest? To be clear, I know that if I add a variable to get the current time before each test and then log this when my test completes I’ll get this information, but I want this automatically, maybe with some Jest configuration. Answer You

Cypress: Run all specs but create a loop without run specs

I have a problem with Cypress.io, here is my problem : I have 4 different test files here : integration/socle_full_ts_dev/1_register_user.spec.js integration/socle_full_ts_local/1_register_user_local.spec.js integration/socle_full_ts_local/2_login_user_local.spec.js integration/socle_full_ts_dev/2_login_user.spec.js And the problem that I meet is that when I want to launch all the tests at the same time it turns in a loop and does not get out of it. I checked the web to

Testcafe filter function

I have a filter function for Selector as following which accepts two parameters { subject: subject, from: from } as a dependencies object. But after running this function, I am getting an error ReferenceError: subject is not defined Can TestCafe team please help me with this? Answer In the case of the .filter method you need to rewrite your dependencies

How to test a bad request in cypress

I am testing logging in POST method in cypress with incorrect credentials. this returns 400 bad requests which I need to test. This is what I have: The request that was sent: This is the response I get: I’d like to know what is in the response or body Answer The answer to your question is in the error message:

How to mock window.navigator.language using jest

I am trying to mock the window.navigator.language attribute in the browser in my jest unit tests so I can test that the content on my page is using the correct language I have found people online using this: Object.defineProperty(window.navigator, ‘language’, {value: ‘es’, configurable: true}); I have set it right at the top of my test file and it is working

How to spy on a recursive function in JavaScript

Note: I’ve seen variations of this question asked in different ways and in reference to different testing tools. I thought it would useful to have the issue and solution clearly described. My tests are written using Sinon spies for readability and will run using Jest or Jasmine (and need only minor changes to run using Mocha and Chai), but the

Advertisement