Category "testing"

How to mock a 'request' node module for testing in jest

I am new to writing test cases in jest and i wanted to test 'mark' function and want to mock 'request' node module. let's say this file's name is app.js and tes

Mocking server side requests for end to end testing by cypress

I am using Cypress for end to end tests. To test my payment process I need to mock the request of my back end(express) to bank for transaction. So when the cypr

Testing react component that uses Context - change state of component under test

I want to test the following React component import React, { useContext, useState } from "react"; import { IntlProvider } from "react-intl"; export const Conte

How to conditionally mock error responses with msw

The UI I'm working on is rendered differently based on the response received. I would like to test the UI when a 4xx and 5xx responses are received. My api hand

Flutter tests - Having two Integration tests in a same group ()

I'm trying to run two tests in a same group in one test file. If I split them into two separate test files, they are working fine. But if I add them in a group,

Database updates not readable while PHPunit WebTestCase (Symfony 5.1)

I have a problem asserting updates made by a form are really written in the database. I explain, I first do a create test (testCreateLactationForm), very simila

In Rspec, how do I set the VCR record mode in the feature description?

I have a test that uses VCR like this: describe 'Do something with an api', feature: true, js: true, vcr: true do end I want to set this vcr recording to the op

Jest Runner won't allow me to debug tests just skips test each time

skipped test When pressing debug on the test it just skips it. It works for other tests in different repositories that I have, but for this specific one it does

Bitbucket pipeline Your system is missing the dependency: Xvfb

I'm trying to add cypress to the bitbucket pipeline but it tells me that I need to install Xvfb and I don't know how to keep going. This is my bitbucket.pipelin

Angular Jasmine testing - substring remove from number

I have some difficulties in unit testing a function. I'm new in these things and I don't know what I can do. I have to those 2 if. Any advice? Thank you.

Angular testing async function generate error - 1 periodic timer(s) still in the queue

I'm trying to test that two async functions. The problem is that one of the functions is called every 10 seconds automatically. I tried to use tick() or flush()

How can I connect twice to db in Cypress tests?

I need to connect to my db (Postgres) twice during autotest - at the beginning to truncate and at the end to select a new note from the table. I tried to do it

Click with waitForEvents cause Timeout error when using Gauge and Taiko

I'm using Gauge and Taiko (v1.3.2). Gauge version: 1.4.3 Commit Hash: f98dd40 Plugins: html-report (4.1.4) js (2.4.0) screenshot (0.1.0) I have a form that ha

When running Swing application with the Spring Framework, Unit tests do not work

I am developing a project through the spring framework. I am using JUnit to run unit tests, swing for the GUI. When I run the system, the GUI opens and I can ac

VSCode: how to interrupt a running Python test?

I'm using VSCode Test Explorer to run my Python unit tests. There was a bug in my code and my tested method never finishes. How do I interrupt my test? I can't

How to use mocks in tests with Adonis 5 (adonisjs/fold package)?

I have an API built with Adonis 5 (core version 5.4.0). The tests are made with Adonis' own runner, japa (version 3.1.1). As per the Adonis documentation, I bui

How to test specific hSpec property using `--match` and cabal

I have a bunch of test modules and I can run a specific one using cabal test. cabal test Module.Name.Here The module contains many tests and one of them fails

How to assign new value to a ModelForm field which form edits user data, to test if the data will be edited Django test TestCase

I'm testing Django forms handling and trying to test a ModelForm, which form edits the user's data. I tried to write the test in several ways, but each one thro

Browser is crashing in CI after updating chrome to 100. I see error ERR_INSUFFICIENT_RESOURCES in the browser log. We are using webdriverIO v6

Browser is crashing while running tests in CI after updating chrome to 100. I see error ERR_INSUFFICIENT_RESOURCES in the browser wdio log. We are using webdriv

Testing Reactive Forms in Angular with Karma

I am testing a function that has a reference to a form in it (this.form), so when I try to test it I am wondering how I can mock that form so the function has a