Questions tagged [cypress-custom-commands]

111 questions
0
votes
2 answers

How to resolve cypress error when installing first time

Error: Cannot find module 'cypress-xpath' from 'D:\Automation Code\Cypress\cypress-ui-automation\cypress\support' at D:\Automation Code\Cypress\cypress-ui-automation\node_modules\browser-resolve\node_modules\resolve\lib\async.js:46:17 at process…
0
votes
2 answers

Right way to document a custom command with then-functionality

Full Typescript Cypress project. I get the following error when trying to use the following custom command in this way: Usage: cy.restGetUserId(userEmail).then(userId => { //do something with userId }); Custom…
0
votes
1 answer

cy.spy() or cy.stub() is not working for new tab opened with different domain name

After clicking an image in my application a new tab is getting opened with different domain URL, but I am getting below error Code - cy.window().then((win) => { cy.spy(win,…
Mitu
  • 1
0
votes
0 answers

ERROR:gpu_init.cc(446)] Passthrough is not supported, GL is disabled, ANGLE is

while opening the cypress I am facing (Passthrough is not supported, GL is disabled, ANGLE is ) this issue, for opening cypress I have tried npx cypress open. And this error appears . I have tried delete package from user/appdata/ roaming/ cypress.…
0
votes
2 answers

how to extract numeric value out of text ,along with converting it into number in Cypress

hi folks as i am new into this cypress and UI automation I need your help in resolving current scenario i have a grid like this i have created a custom command in support\commands.js below is my code which take OrderID as parameter and read the…
0
votes
1 answer

How to use commands.js returned value in test.cy.js file

I am accessing my Gmail account by command loginByGoogleApi under commands.js, then getting the requested email body and pulling the required data from the body, and saving it in a const variable code >> now I want to .type the pulled email data…
Paras Verma
  • 25
  • 1
  • 3
0
votes
2 answers

Adding custom functions for Synpress/Cypress Project

I want to add custom functions to a synpress project. (Synpress is a wrapper around Cypress which allows interaction with Metamask). Note there is a question: Cypress custom command is not recognized when invoked but even though I read through this…
0
votes
2 answers

Receiving null value when trying to pass Cypress selector to custom cypress command

I am trying to add a custom command to my Cypress framework to check if elements are enabled/disabled. Here is my attempted custom command in commands.js: Cypress.Commands.add('isEnabled', (element) => { element.invoke('attr',…
user9847788
  • 2,135
  • 5
  • 31
  • 79
0
votes
1 answer

How to pop up a customize message when get() function fails to locate element in cypress

In cypress I'm able to pop up a assert message when get() is good and contain() or ep() fails with custom overwrite should command. But not able to figure if get() fails to locate element. Can we overwrite the get()…
Pain
  • 1
0
votes
1 answer

How to add custom command to Cypress / Typescript test framework?

I am trying to add a custom command to my Cypress,Cucumber,Typescript test framework, but am getting the following errors: I get this error in the spec.ts file: Property 'seedLocalStorage' does not exist on type 'cy & EventEmitter'. I get this error…
user9847788
  • 2,135
  • 5
  • 31
  • 79
0
votes
1 answer

Cypress custom command doesn't enter into the catch statement when focus() function fails

I try to enter into the catch statement when the 'focus()' command fails but without a result. Here is my custom command code: Cypress.Commands.add('element', (selector: string) => { try { cy .get(selector) …
Ivan Markov
  • 129
  • 4
  • 15
0
votes
0 answers

unable to invoke Cypress custom commands in test files

I am working on managing the session cookie for each test case by setting it in beforeEach() and afterEach() block. Using the below custom session command in C:\cypress\support\commands.js Cypress.Commands.add('saveSessionStorage', () => { …
0
votes
1 answer

Cypress: Custom command returns array: How loop to run test suite?

Problem: Trying to call tests within an array of items returned from a Cypress custom command. Approaches attempted using npm package mocha-each and another test using the forEach function. Custom Command: I created a custom Cypress command that…
0
votes
0 answers

cypress - issues passing value to custom command

I have used custom commands with success & also ones that I send parameters to for signIn, etc; however, I have been having problems with a more complex use case & see that my passed value is not making it into the custom command cy.request body. If…
knr
  • 11
  • 4
-1
votes
1 answer

Cypress does not find fixtures for my test even when defined in cypress/fixtures

My tests store fixtures in cypress/fixtures but Cypress in unable to find them. Here is the project structure. I am using version 12.14.0 of cypress __tests__ cypress e2e mySpec.ts fixtures …
BreenDeen
  • 623
  • 1
  • 13
  • 42