Questions tagged [cypress-custom-commands]
111 questions
0
votes
2 answers
how can I make cy.each() operate with my array in Cypress?
I have fixture file named alerts-escalation-param.params.json where I store operations with their fixture path file ,then I have a function command getOperationData that get the operation data to use it in the test cases just by calling the…

Youssef
- 1
- 1
0
votes
1 answer
Cypress command terminal error: is not assignable to parameter of type keyof Chainable
The Cypress e2e tests run but I do get an error related to Cypress.Commands.add('loginAs'.
My commands are stored in the folders: cypress/support/commands.ts and seem to be used by my e2e tests. So not sure why I get this error.
I get the following…

AngularM
- 15,982
- 28
- 94
- 169
0
votes
1 answer
How to return value from for loop in .then function in Cypress
//command.ts
Cypress.Commands.add("getRunID"): any => {
return cy.getData().then((response: any) => {
var JsonResponse: any = response.body;
var id: any = [];
for (var i = 0; i < JsonResponse.Items.length; i++) {
id[i]…

Sagarika
- 31
- 7
0
votes
2 answers
How to increment and return contents of a JSON file for field input using Cypress custom commands
I could use some help with explaining to me how custom commands in cypress work. I am currently writing a function that reads a json file and increments the contents by 1 and want to return it to the test spec so it could be typed into a field.…

Cameron
- 1
0
votes
1 answer
creating a cypress command that will get button and add infinite cypress action based on user input
I want to create a cypress custom command that based on user arguments will add cypress action and chain them together
Now I have something like this:
Cypress.Commands.add(
'selectButton',
(text: string, ...actionType: ButtonActionTypes[]) => {
…

shivetay
- 315
- 4
- 14
0
votes
0 answers
Cypress custom commands are not working with badeball/cypress-cucumber-preprocessor
When using badeball/cypress-cucumber-preprocessor for Cypress BDD. I am not able to use the custom commands placed inside cypress support folder.
Following is the error I am getting on console
[WARNING] Ignoring this import because…

Aditya Bhardwaj
- 1
- 1
0
votes
1 answer
Extending Cypress.config with own properties using Typescript
I'm trying to extend Cypress config adding my own property in this way:
Cypress.Commands.overwrite('getUser', (originalFn: any) => {
const overwriteOptions = {
accountPath: `accounts/${options.accountPath}`,
};
return…

Maciek
- 31
- 3
0
votes
2 answers
Cypress: Passing the param into npm script when run by CL
I tryna pass the param param1 and param2 when I run the script by command Line.
Here code in test.cy.js
it('Clean data', () => {
const param1 = process.env.npm_config_param1;
const param2 = process.env.npm_config_param2;
…

HNhu
- 99
- 5
0
votes
0 answers
Error: Can't walk dependency graph: Cannot find module - When running Cypress with Typescript and Page Objects
While creating a new command file where I also tried to work it with the Page Object model and tried to import page object file into the command file and then tried to run it - the Cypress has an error of -
Error: Can't walk dependency graph: Cannot…

Atish Meshram
- 1
- 2
0
votes
0 answers
JavaScript Cypress : Array keys/values are not printing in console output
I'm trying to get the values of nested array object like below,
cy.readFile("excelfile_path", null).then(fulldata => {
var content = fulldata
console.log(Object.values(content));
})
Console…

istaman
- 1
- 4
0
votes
0 answers
Cypress Opening (Linux) issue
When i run "npx cypress open" command in terminal it shows me this error
Command was killed with SIGTRAP (Debugger breakpoint): /home/tk-lpt-0573/.cache/Cypress/12.9.0/Cypress/Cypress --no-sandbox --smoke-test --ping=994
Tried to open cypress…

Asad Atiq
- 3
- 4
0
votes
0 answers
How to access static variable from test file
Page File:
class DriveGridPage
{
static driveName = FileStoreCommonComponent.randomStringGenerator(5)
}
export default new DriveGridPage()
Test File:
import DriveGridPage from "../../pom/app_modules/drive/drive_grid_page"
it("Create New…

Mainur Rahman
- 9
- 4
0
votes
0 answers
How to perform parallel execution on different browsers in cypress for different test suites
I have two commands in package.json >
"Leeds_TestSuiteChrome": "npx cypress run --spec cypress/e2e/LE_Site_TestSuite --headed --browser chrome --record --key keynumber",
"WS_TestSuiteEdge": "npx cypress run --spec cypress/e2e/WS_Site_TestSuite…

Trushita Gadkari
- 11
- 1
0
votes
1 answer
Cypress Typescript passing optional command parameters
I'm new to Cypress and Typescript and wondering if someone could point me into the right direction.
I'm creating a custom commands like this:
declare namespace Cypress {
interface Chainable {
customerDetails(
fullName?:…

robogo83
- 37
- 3
0
votes
2 answers
Cypress: wrap chained commands in one
I use this long line to check the selected value on any list on my page (using Ember power-select which is not a but a complex set of ), selector being the parent so I can target the list I want, and trimming being there so I can chain a…

edhel
- 183
- 10