Can we selectively execute certain tests in Cypress using support/index.js?

I need to selectively run certain tests from a pool of 50 test files located in the integration folder. Specifically, I only want 10 of them to execute. In an attempt to achieve this, I am trying to configure the selection process within the support/index.js file as shown below:

import './commands'

import '../integration/login.spec.js'

import '../integration/admin.spec.js'

import '../integration/customer.spec.js'

My goal is to have only the specified files (login.spec.js, admin.spec.js, and customer.spec.js) visible on the Cypress test runner, while hiding all other test files. However, the code snippet provided above is not producing the desired results.

Answer №1

Skip using the support/index.js, instead, create a fake spec and execute it

// my-essential-tests.spec.js

import './login.spec.js' 
import './admin.spec.js' 
import './customer.spec.js'
// and more

Answer №2

As mentioned by @Fody in a previous answer, incorporating an additional dummy spec file approach can be effective.

Therefore, providing a comprehensive explanation of this method in cypress 10.0.3 on Windows OS

Suppose the following is your script folder structure:

cypress
  e2e
    small-Run
      theDummytest.cy.js
    Module-A
      test-Module-A.cy.js
    Module-B
      SubModule-BB
        test-SubModule-BB.cy.js

This is how you can implement the dummy test file approach:

import '../Module-A/test-Module-A.cy.js'
import '../Module-B/SubModule-BB/test-SubModule-BB.cy.js'

In your CLI/CI command line interface, use the following line to execute selective script tests:

npx cypress run --spec cypress\e2e\small-Run\*.cy.js

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the steps to incorporate @svgr/webpack into turbopack within a next.js project?

I'm encountering an issue with turbopack and @svgr/webpack in my project. According to the documentation, they should work together but it's not cooperating. When I run the project without using --turbo (turbopack), everything functions as expec ...

Ways to resolve unfulfilled peer dependency issues within an exponent project

Having started with a basic exponent starter project and following their tutorial to incorporate an Apollo client, I encountered multiple peer dependency issues. How can I resolve this? Do I need to specify certain versions of Apollo client? Where is the c ...

Hexo not found in local directory

Attempting to set up Hexo on my server, I followed these steps: [root@VM_150_20_centos ~]# yum install -y nodejs [root@VM_150_20_centos ~]# npm install -g hexo-cli [root@VM_150_20_centos ~]# hexo init blog [root@VM_150_20_centos ~]# cd blog [root@VM_150_2 ...

Passing ngModel from controller to directive in AngularJS

I'm currently working on a project that involves a controller with an attribute directive nested inside of it. This directive requires access to the ngModel of its parent controller. For more context, feel free to check out this Plunkr. Issue at Han ...

What steps should I take to create an npm package that is globally installable?

I'm having trouble creating a npm package that can be installed globally. When I publish the package, it doesn't work as expected for global installation. How can I fix this issue? I attempted to clone grunt-cli from Github to test if it can be ...

What steps are involved in a server utilizing Next.js to create a complete document for transmission to the client?

Understanding Next.js has been quite challenging for me. I am struggling to grasp how it operates on the server and how the server is able to implement server side rendering with the files generated by Next.js during the build process. I have a good under ...

JavaScript's native innerHTML function is unable to access the content generated by Vue

I have been struggling with extracting the content from a specific div element in my HTML code. <div id="output" ref="output_data"> <h1>{{ information }}</h1> </div> I attempted to retrieve the contents using ...

Updating the chosen option using jQuery

Is there a way to change the currently selected option using jQuery? <select name="nameSelect" id="idSelect"> <option value="0">Text0</option> <option value="1">Text1</option> <option value="2" selected>Text ...

What is the best way to run code once a callback function has completed its task?

I am looking for a way to execute line(s) of code after every callback function has finished processing. Currently, I am utilizing the rcon package to send a rcon command to a Half-Life Dedicated Server (HLDS) hosting Counter Strike 1.6 server and receive ...

Update the content of a bootstrap modal dialog following a successful upload

As part of a new service, I am modifying data in a database using a bootstrap modal dialog. However, I'm facing an issue where the name of a recently uploaded file is not appearing in the modal dialog body until I close and reopen it. Is there a way t ...

You do not have the authorization to access this content

I have been working on a Laravel web application to upload images into a data table and allow users to download the uploaded image on click. Initially, everything was working fine until I made changes in the code from return '{!! Html::link('ima ...

Configuring .env files for both production and development environments in Node.js

As I observed, there were various approaches to setting up environments in NodeJS - some seemed straightforward while others appeared more intricate. Is it possible to utilize package.json scripts to manage environment variables? If so, what is the best p ...

The information being sent from Angular is not being successfully transmitted to the XAM

Here is my Angular service post method: getUserDetails(username , password) { alert(password); return this.http.post<myData>("http://localhost/test/api/auth.php", { username, password }); } This is the structure of my PHP file: <?php ...

Encountering difficulties in compiling Dynamic HTML with the $compile function

I'm attempting to incorporate dynamic HTML into my code with the following lines: var el = $compile('<a ng-controller=\"tableController\" ng-click=\"open\">...ReadMore</a>')($scope); But I'm encounterin ...

Ways to stop Google Places API from generating outcomes from a particular country

After carefully reviewing the entire documentation at https://developers.google.com/maps/documentation/javascript/reference/places-service#LocationRestriction, I am still unable to find a solution to my problem. I have successfully limited Google autocomp ...

Efficiently assign multiple attributes using a single d3 function

Hey everyone! I'm currently working with SVG lines and have come across an example object that looks like this: { _id: 5, coordinates:{ x1: 100, y1: 100, x2: 500, y2: 500, } Now, imagine I have an array of these obje ...

Tips for eliminating redundancy in $scope manipulation code within multiple controllers using angularJS

Apologies if this question seems trivial, but I am just getting started with angularJS. I have created two controllers: seekerController and wizardController... Within the wizardController, there is a Scope object called chat, which is being manipulated ...

Navigating around potential type errors when passing data for chart.js can be challenging. Here are some strategies to

I'm currently working on an application that includes a chart, and I'm facing an issue while trying to populate the chart with data from my store. The error occurs when I attempt to pass the chartData object through props to the data property of ...

Choosing specific content from a different div in JavaScript based on the line number

I have a question regarding two div elements, div1 and div2. I am trying to develop a function where in div2, I can specify the line number of div1 and display the relevant content from that specific line. Currently, I have created a function that successf ...

Troubleshooting minified JavaScript in live environment

Trying to wrap my head around AngularJS and Grunt. In my GruntFile.js, I have set up two grunt tasks for development and production. In production, I am using uglification to combine multiple js files into one. I am in need of some advice or tips on how t ...