Questions tagged [cypress]

Cypress is an innovative JavaScript-based web testing framework and assertion library that integrates multiple functionalities into one package. It offers automatic waits, request mocking, and request stubbing to enhance the testing experience.

Exploring the unique scrolling attributes of Cypress: `get` method and relative positioning

Whenever Cypress' cy.get method is called, the page automatically scrolls so that the chosen element is displayed at the top of the webpage. This becomes problematic when there is a sticky toolbar with 'position: relative' on top of it, as it often hides ...

Cypress: Sorting tests with tags

With 100 test cases that belong to smoke, regression, or both categories, I am looking for a way to filter them as Cypress itself doesn't have a tagging mechanism. Any suggestions on how to approach this? I've already attempted https://www.npmjs.com/pack ...

acquire the JWToken using Cypress and establish it as the header for subsequent requests

While attempting to test an Express web application I developed, the first step is authentication to retrieve a JWT token. The token retrieval process works fine, but when trying to set the header for subsequent requests, it doesn't seem to work. This pie ...

Inline styling for a Cypress test on an Angular component within an SVG markup

Testing out this SVG for a specific purpose, without needing to explain why. Running some tests on it! <svg class="custom-background" width="1864" height="441" style="background: linear-gradient(to right, rgb(255, 255, ...

Problem with NPM caching

Using Jenkins to execute test cases based on Cypress, I followed the kitchen sink example provided by Cypress on their GitHub repository here. However, when running this in a Jenkins job, an error occurred. The error message displayed: NPM WARN prepare re ...

Prepare fixtures for commands in Cypress before executing the hook

One of my main tasks is to load the fixtures file only once and ensure it is accessible across all project files. To achieve this, I created a fixtures.js file with the following content: let fixturesData; export const loadFixturesData = () => { cy ...

Cypress: Conducting Test with Custom Timezone Setting on Windows

My testing environment was set up to run in UTC time zone. I utilized cy.clock() to initialize a date-time in UTC format, which the Web App will then display as the current browser date-time in UTC. In order to achieve this, I ensured TZ=UTC in my environ ...

Ways to resolve issue with a build script that is missing when deploying Cypress in GitHub Actions

I recently attempted to implement a GitHub action to run Cypress tests on my app. Here is the configuration of my workflow file: name: Cypress Tests on: [push] jobs: cypress-run: runs-on: ubuntu-latest defaults: run: working-dire ...

No elements can be located within the iframe as per Cypress's search

I've been attempting to access elements within an iframe using the guidance provided in this article here, but I'm facing an issue where Cypress is unable to locate anything within the iframe. Below is a snippet of my test code: describe('s ...

What is the reason for calling Proxy on nested elements?

Trying to organize Cypress methods into a helper object using getters. The idea is to use it like this: todoApp.todoPage.todoApp.main.rows.row .first().should('have.text', 'Pay electric bill'); todoApp.todoPage.todoApp.main.rows.ro ...

What steps should I take to resolve a plugin error specifically related to index.js while using Cypress?

I am encountering an error in Cypress A plugin has thrown the following error, causing our tests to stop running due to a plugin crash. Please verify your plugins file (/home/dev2/Desktop/kavitaSeffcon/CypressProject/cypress/plugins/index.js) Error: ENOE ...

Exploring the use of Docker and Jenkins for accessing and running local system files and folders within Jenkins environment

Is there a way to access and execute local system folders/files within a Jenkins image that is installed in a Docker desktop container? I need assistance finding a method to access and run local files/folders within the Jenkins image in the Docker desktop ...

Unable to minimize or hide the ace editor widget with Cypress

Today marks the beginning of my journey into posting on this platform, and I am eager to get it right. In my current project using Cypress for writing integration tests, I encountered a challenge while attempting to click on an Ace editor widget within a ...

Testing the attribute value of the React Material UI Drawer Component using Cypress

Looking at this MUI implementation inside my react component: <Box sx={{ display: 'flex' }}> <Drawer name="permDrawer" open={openSideDrawer} style={{ zIndex: -1000 }} variant="permane ...

The combination of Cypress and Istanbul is failing to produce any code coverage reports

I am currently working on a VueJS app and testing it with Cypress. One of my main objectives is to gather code coverage information. After running tests in Cypress, I am able to generate a .nyc_output/out.json file that shows how many times specific lines ...

Intellisense in VS Code is failing to work properly in a TypeScript project built with Next.js and using Jest and Cypress. However, despite this issue,

I'm in the process of setting up a brand new repository to kick off a fresh project using Next.js with TypeScript. I've integrated Jest and Cypress successfully, as all my tests are passing without any issues. However, my VSCode is still flagging ...

Using 'cy.get' to locate elements in Cypress tutorial

Is there a way to search for one element, and if it's not found, search for another element? cy.get(@firstElement).or(@secondElement).click() Can I use a function similar to || in conditions for this scenario? ...

How can I save variable values to a text file or Excel file using Cypress.io?

Is there a way to write the values of a variable on a Text or Excel sheet? I have a variable called tex that stores string values, and I want to output these values onto text files or an Excel sheet if possible. beforeEach(() => { cy.visit('https:/ ...

Having trouble launching Cypress on my Mac - stating that it cannot find Cypress

Despite searching through multiple answers on S.O, none of them have solved my issue. To better explain my question, I've created a video. You can view it here Everything was working perfectly just yesterday, so what could have possibly gone wrong? ...

The Nx end-to-end Cypress runner ensures that values from the cypress.env.json file do not overwrite the same entries in the cypress.json environment object

Having encountered an issue with my Nx powered angular project, I am facing a situation where the values provided in a cypress.env.json file are not overriding the corresponding entries in the env object of the cypress.json configuration file. This is a n ...

Unable to locate the root element for mounting the component in Cypress with React

I am currently testing my react app, which was created using create-react-app, with the help of cypress. Unfortunately, I encountered an error that looks like this: https://i.stack.imgur.com/xlwbo.png The error seems to be related to trying to fetch an ...

Is it possible to extract the value in JavaScript, add it, and then return the result after a for loop in Cypress automation?

checkActiveInterfaces() { var totalSum = 0; var counter; for (counter = 1; counter <= 5; counter++) { cy.xpath(`(//*[name()='g' and @class ='highcharts-label highcharts-data-label highcharts-data-label-color-undefined ...

Assigning a data-cy value to the mui textInput helper is essential for targeting

My goal is to assign the cypress data-cy attribute as a helper text for a Material-UI TextField. I successfully adjusted the style of this helper text by providing a custom style property to FormHelperTextProps: FormHelperTextProps={{ sty ...

Tips for fixing a type error in javascript/cypress

While learning cypress and javascript, I encountered this type error: TypeError: _testElements.default.selectionRow is not a function I have thoroughly reviewed the documentation for cypress but cannot seem to find any errors in my code. I'm hoping ...

Utilizing data attributes in E2E testing for optimal results

We have decided to transition from using tag and classname selectors to data attributes in Cypress for our E2E testing. This change is intended to make the selectors more robust and less prone to breaking. Specifically, Cypress recommends using data-cy, d ...

How can we use Cypress to check if we are at the final slide in the presentation?

I am facing a challenge with multiple slideshow files that contain varying numbers of slides. Some have 10 slides, while others have 80 slides. My goal is to test every slide by using the forward and backward arrow buttons for navigation. Currently, I am c ...

Cypress encountering occasional issues with Material UI dropdown functionality

I have experimented with various methods, but it doesn't consistently work. While it is able to locate the element and click on it, it often fails to populate the dropdown input field with the desired value. This poses a challenge for continuing the test a ...

What is the best way to utilize Bitbucket pipeline repository variables in an npm run script?

Is there a way to pass a Bitbucket repository variable into my Cypress.io test script that is run with npm run in a pipeline? While my pipeline and tests are functioning properly, I find myself unable to incorporate a Bitbucket variable directly into my t ...

What are some effective ways to integrate flow in Cypress testing?

Exploring the integration of Flow into a React application tested with Cypress involves using a web preprocessor plugin with a flow preset. Firstly, the preprocessor is coded in ./cypress/plugin/index.js: const webpack = require('@cypress/webpack-pre ...

Utilizing custom parameter types for Cypress Cucumber preprocessor with TypeScript

I have been using cypress-cucumber-preprocessor with cypress and typescript. While exploring the custom parameter types feature, I came across a possibility to define custom parameter types in my step definitions file. However, I am facing challenges when ...

Tips on including a CDN stylesheet into the Cypress component test runner

Within my vue-cli project, I have successfully set up the cypress component test runner by following the official documentation available at . However, I am facing an issue with using icon fonts that are loaded into my app via CDN links (specifically fonta ...

Problem with selecting dates in rangepicker

Having trouble with my recursion code for selecting dates in a rangepicker: recurse( () => cy.get('.mantine-DatePicker-yearsListCell').invoke('text'), (n) => { if (!n.includes(year)) { //if year not found click on first ...

Frequently, cypress encounters difficulty accessing the /auth page and struggles to locate the necessary id or class

When trying to navigate to the /auth path and log in with Cypress, I am using the following code: Cypress.Commands.add('login', (email, password) => { cy.get('.auth').find('.login').should(($login) => { expect($login).to.contain('auth.welcome') ...

Utilizing styled-components or personalized components alongside cypress

Cypress selector made simple: just use cy.get('.myComp') and it will select <input className="myComp" />. But when it comes to styled-components... Perhaps we have to resort to using custom attributes like cy-data or cy-testid. Sadly, it seems there ...

Testing the appearance of a React Snackbar using Cypress

My React web application communicates errors to users through the Snackbar component. While Snackbars typically do not automatically hide for accessibility reasons, I need them to hide after a certain amount of time using the autoHideDuration parameter (in ...

An unusual token occurred during the webpack compilation error in the Cypress test runner

I encountered an unexpected error during Webpack compilation while attempting to import a component into my cypress test spec Currently, I am using React version 17.0.0 and React-dom v17.0.0 What could possibly be the reason behind this issue? Take a lo ...

Setting up Cypress's Electron browser for managing downloads

Is it possible to modify the Electron browser's configuration from within Cypress, in order to fix issues like download prompts not being detected? There is an issue with Cypress where it cannot detect download prompts, but there seems to be a potential s ...

What is the process for testing OTP login functionality using Cypress?

Is there a way to conduct end-to-end testing for OTP login? I have implemented OTP login functionality and now want to create a Cypress test that simulates a user entering the OTP received via email. How can I write a test for this when the OTP changes ev ...

Is it possible to loop through each row in a table using Cypress and execute the same actions on every iteration?

I have a frontend built with html/typescript that features a table of variable length containing action buttons in one of the columns. I am looking to create a Cypress test that will click on the first button of the first row, carry out a specific task, an ...

Cypress Issue: Exceeded 5000ms Waiting for `cy.wait()`...No Network Request Detected

I recently decided to dive into building a React app using Vite, Chakra-UI, and TypeScript, incorporating Cypress for testing. The main objective was to expand my knowledge on these technologies. Interestingly enough, this marks my first experience with Cy ...

Choose an option from a Material UI Listbox with Autocomplete feature using Cypress

This specific element is crucial for the functionality of the application. <input aria-invalid="false" autocomplete="off" placeholder="Category" type="text" class="MuiOutlinedInput-input MuiInputBase-input ...

Updating a variable in a React project using Cypress

Within my React project, there is a boolean value retrieved from the useGate hook provided by Statsig. This value can either be true or false. If the value is true, specific data is substituted with custom values. If it's false, the data remains unchanged ...

In Cypress, I am trying to specifically choose only numerical values from a dropdown menu. However, the list contains a mix of alphanumeric and numeric values

Looking to streamline: This is my code: cy.get('[role=presentation]') cy.get('[role=row]').find('td') .get('[role=gridcell]').eq(9).click().wait(2000) cy.get('[role=listbox]').get('[role=option]') cy.contains('[role=option]', 'Numeric').click() If ...

Encountering an Issue with Dynamic Imports in Cypress Tests Using Typescript: Error Loading Chunk 1

I've been experimenting with dynamic imports in my Cypress tests, for example using inputModule = await import('../../__tests__/testCases/baseInput'); However, I encountered an issue with the following error message: ChunkLoadError: Loading ...

Dayjs is failing to retrieve the current system time

Hey everyone, I'm facing an issue with using Dayjs() and format to retrieve the current time in a specific format while running my Cypress tests. Despite using the correct code, I keep getting an old timestamp as the output: const presentDateTime = dayjs() ...

Ways to manage drag and drop functionality within Cypress when traditional Cypress techniques are not effective

I need help with the drag and drop function in Cypress. I have tried three different methods but none of them seem to work. I have included my code below, which is not functioning as expected. Does anyone have any suggestions on what might work better in t ...

Azure pipeline: Command Line error: Bash exited with code '1'

While attempting to run my Cypress test using Azure Pipeline, I encountered the following problem: YAML file: # To configure triggers for Azure CI see # https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=azure-devops&tabs=yaml ...

What is causing pre-defined variables to act unexpectedly in Cypress?

Encountering unexpected results while pre-defining element variables and using them later in Cypress 10 with Cucumber. Let's take a look at this login test: Given("I'm logged in as Default user", () => { cy.visit('/'); let us ...

Running a locally installed npm package using npx: A step-by-step guide

My folder structure contains the locally installed Cypress module: cypress-test-project node_modules cypress tests.spec.js In an informative article, it was mentioned that npx allows for easy execution of both globally and locally installed pack ...

Cypress - Locate and interact with a button containing specific text

Utilizing material-ui as my go-to css framework, I'm seeking to target a button that includes specific text. Here is my current code: cy.get('button').contains('Edit Claim').should('be.disabled'); The issue arises because the material ui button component ...

To prevent the installation of redundant packages, it is important to establish distinct dependencies for test, production, and integration tests in Next.js and Cypress. This will ensure that

At the moment, I am facing a lengthy installation process due to Cypress being included in my dev dependencies. This causes delays when building the docker image: # Install dependencies only when needed FROM node:14.8.0-alpine3.12 AS deps # Check https://g ...

How to store an imported JSON file in a variable using TypeScript

I am facing a challenge with a JSON file that stores crucial data in the following format { "login": { "email": "Email", "firstName": "First name", "lastName": "Last name", ...

Logging in with Next Auth to a Keycloak account during testing in Cypress

Trying to create e2e tests with Cypress for my NextJs Application. Currently using Next Auth to log into my keycloak account via OAuth and displaying certain nav bar elements based on keycloak roles. To test this, I set up a test realm with test users. How ...

Cypress live reload not working

I am experiencing an issue with my component library that runs Cypress. Initially, the tests run successfully, but once I make changes to a file, the tests start failing permanently. The error message displayed on the page is: Cannot GET /__cypress/src/in ...

Tips for fixing the issue of "The Cypress npm package is present, but the Cypress binary is not found."

I encountered an issue while attempting to install Cypress within a GitLab CI runner, resulting in the following error message: The cypress npm package is installed, but the Cypress binary is missing. We expected the binary to be installed here: /root/.ca ...

I dialed the network once, only to find it entangled in a tangle during the test

Below is the snippet of my testing code: context('event page', () => { before(() => { cy.visit('/event'); }); it('create banner', () => { cy.intercept('GET', '/events').as('events'); cy.wait('@events').then(int ...

Tips for resolving the issue of cypress automatically opening a new tab

Recently, I've encountered an issue while using Cypress to perform a test on my website. Every time I click on a button, it redirects me to a new tab, disrupting the flow of my test with Cypress. Despite trying to remove the "target" attribute using t ...

Combining the JSON code coverage reports generated by both Cypress and Karma does not yield an accurate outcome

In my angular project, I am testing it using the built-in unit testing tool (karma) and Cypress. My goal is to combine the code coverage reports from both tests. I have successfully set up the coverage configurations and merged the outputs using `nyc merg ...

Utilizing Cypress with Electron: A Guide to File System Operations

I have been utilizing Cypress to run tests on my Electron application. Due to Cypress operating in browser mode, the FS module is not compatible. As a result, I am encountering this error: Error in mounted hook: "TypeError: fs.existsSync is not a func ...

What is the best way to manage a debounced event emitter in Cypress using RxJs debounceTime?

My task involves creating tests for a web page containing a list of items and a search-filter feature. The search-filter functions by filtering the list of items based on the input entered into its text field. Whenever the value in the text field changes, ...

Click on a specific image in a table using Cypress with a specific source URL

I need help with a query for Cypress regarding a table of items, each item having active (blue) and not active (black) images. How can I set up this query? Below is an image of the table list: https://i.stack.imgur.com/74qzb.png And here is the HTML code ...

Running a Vue.js application on your local machine and executing Cypress tests against it in sequence via an npm script'ĂȘtre

Recently, I have been faced with the challenge of setting up and running a local Vue.js app on localhost:3000 and then executing Cypress tests against it. Within my package.json file, I have included some npm scripts which are necessary for this process: ...

The restriction of running to just one file is ineffective

I recently installed Cypress and was exploring its functionalities. Executing npm run cy-run to run all test files turned out to be time-consuming and confusing, especially since I had not yet added any of my own tests. The default examples from the Cypre ...

Testing Vue Component with Cypress revealed that the function getActivePinia was triggered without an active Pinia instance

Below are the code snippets I'm working with: Test.vue <template> <button v-show="store.common == 'hi'" @click="func"> hello world </button> </template> <script setup> import {mainStore} from './i ...

Checking the image loading functionality with Cypress

I am interested in testing Cypress to verify that an image is successfully loaded onto a page. Here is a snippet of my source code: import React from "react"; export default class Product extends React.Component { render() { return ( <div ...

Having difficulty ensuring DayJs is accessible for all Cypress tests

Currently embarking on a new Cypress project, I find myself dealing with an application heavily focused on calendars, requiring frequent manipulations of dates. I'm facing an issue where I need to make DayJs globally available throughout the entire projec ...

data-cy appears in the DOM structure, yet remains unseen

I'm seeking some clarity on how to effectively use Cypress. While writing end-to-end tests, I encountered a failed test due to the element not being visible. A helpful answer I found assisted me in resolving this issue by clicking an element that was ...

Discovering the specific value from a fixture file in Cypress

When I receive a JSON Response, how can I extract the "id" value based on a Username search? For instance, how can I retrieve the response with an "id" value of 1 when searching for the name "Leanne Graham"? It is important to note that the response valu ...

Error encountered: Unsolicited rejection with message "invalid configuration key requested during Cypress update process via NPM"

I am attempting to upgrade Cypress to the latest version using the command provided below: npm install --save-dev <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b68727b796e78784b382539253b">[email protected]</a> ...

Problem with updating Cypress e2e tests following recent package upgrades

My current project involved updating all the packages to their latest versions. Prior to the update, all end-to-end tests were functioning correctly without any issues. After completing the update, the product itself compiles and runs as expected without ...

Reinitializing the database with Cypress (postgresql)

When populating the database, I intentionally do it partially for certain tests. However, after completing all tests, I would like to reset the database in order to avoid any complications that may arise during the next populate process. How can I efficien ...

How to set up and utilize an npm (Node.js) module on a Windows 2008 server

Looking for some guidance - how can I fix this issue? Everything is running smoothly on my Windows 7 laptop, but encountering errors on the Windows 2008 server. Here's what's set up: 1. ASP.NET Core App and NodeServices being used on Windows Ser ...

Exploring the possibilities of utilizing classes in testing scenarios with Vue, Cypress, and Cucumber

I am currently working on setting up e2e tests using Cypress and Cucumber for my project. The application is built with Vue CLI 4.1.1, and I have added the package cypress-cucumber-preprocessor (V1.19.0) via NPM. Update: After extensive research and tes ...

Stop the loop in cypress

We have a certain situation as outlined below loop through all name elements on the webpage if(name.text() matches expName) { name.click() break out of the loop } else { createName() } How can I achieve this in Cypress? Using return false doesn't seem to ...

Discovering how to navigate to a link within a web table using Cypress has been a challenge, as I keep receiving the error message stating that the element is not visible due to its CSS property being

Trying to click on the first enabled link in the 'Action' column of a web table has been proving difficult. In the example given, the first two rows do not have an enabled link, so the goal is to click on '8.5 AccountH' https://i.stack.imgur.com/gbYvY.png ...