Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 09:34
    sidharthv96 commented #18231
  • 09:33
    sidharthv96 closed #18231
  • 09:25
    Narretz commented #18231
  • 09:17
    derf-github edited #18232
  • 09:15
    derf-github edited #18232
  • 09:14
    derf-github edited #18232
  • 09:09
    derf-github edited #18232
  • 09:09
    derf-github edited #18232
  • 09:08
    derf-github edited #18232
  • 09:05
    lmiller1990 synchronize #18211
  • 09:05

    lmiller1990 on unified-desktop-gui

    fix some bugs and re-add broken… support launching CT update exports for Vite and 3 more (compare)

  • 09:02
    derf-github edited #18232
  • 09:02
    derf-github opened #18232
  • 08:44

    lmiller1990 on remove-decorators-updates

    allow ct to run (compare)

  • 08:38
    silasjoisten edited #18230
  • 08:37
    sidharthv96 opened #18231
  • 08:35
    silasjoisten opened #18230
  • 08:22
    matthew-nash-cko commented #17723
  • 08:07
    Narretz commented #18227
  • 08:01
    cypress-bot[bot] commented #18229
drivendragon
@drivendragon
how can I show ** instead of the actual password in my cypress.env.json file? or how can I encrypt just the password in that file? Anyone know? @bahmutov ? Thanks!
Clark Brown
@clarkedb
I'm trying to test a react app that often pushes to history (with react router) to change the URL without refreshing the entire page. However it looks like Cypress detects the url change and does a full reload which breaks some behavior and makes certain flows untestable. Does anyone know how to prevent the automatic reload Cypress does when the url changes? I've seen stuff about setting baseUrl in cypress.json, but that hasn't seemed to work and doesn't allow me to control across different environments / CI. Any ideas?
@clarkedb can you provide a reproduction?
drivendragon
@drivendragon
@bahmutov Yes, I do keep the password hidden in images, videos in CI, in repo. The only place it exists is in my cypress.env.json file which is only accessible on my local machine and Jenkins Agent, in which both machines have encryption running - the thing is, I'm still being asked to also encrypt the actual password in the cypress.env.json file. How does one do that? Thx!!!
Clark Brown
@clarkedb
@bahmutov By a reproduction do you mean a screen capture of what happens?
drivendragon
@drivendragon
Also, in a jenkinsfile what does the code look like to check if any cypress tests failed? I can't find the condition or syntax to check for any failures, in which in my pipeline, i'll send an automated email notification... Anyone have this? Thx! Here's what I am trying to do:

pipeline{
agent { label "auto_test_server" }
stages {
stage('Clone Git Repo'){
steps{
git 'https://testautomation_cypress_template.git'
}
}
stage('Install Dependencies'){
steps{
bat 'npm install'
}
}
stage('Run Smoke Tests'){
steps{
bat 'npm run test'
if (res != 0) {
emailext body: 'A Test EMail', recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Test'
}
}
}
stage('Publish HTML Report'){
steps{
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'cypress/reports/mochareports', reportFiles: 'report.html', reportName: 'HTML Report', reportTitles: ''])
}
}
}

}

}

andreroc
@andreroc_gitlab

Hello, I am trying to do code like this:

cy.get('[role=rowgroup].datagrid-row')
      .children()
      .find('[data-cy=error-cell]')
      .not(':contains(0)')
      .parents('[role=row]')
      ….

Sometimes, the not will return a zero set (which is fine). Unfortunately in Cypress, this causes an exception and that test dies. Is there a way to provide a parameter that allows me to have Cypress “break out” of processing if the set is now zero?

Gleb Bahmutov
@bahmutov
@drivendragon by grabbing it not from the env file, but from the process.env in the plugin file. You can also use as-a to conveniently read a file with ENV variables without checking it in
@clarkedb no, an actual application showing the problem with the Cypress test. Something like npm i + npx cypress open to show the test with the problem. You can strip all application code and just leave the behavior that is causing a problem
@andreroc_gitlab are you trying to write a conditional test?
2 replies
Coby Sher
@CobyPear
Hello. I'm using cypress for some integration tests (could be the wrong play from the start...) and I'm testing a method that fetches data. It uses axios and makes an api call based on the args passed in. I'm having trouble going 'in between' the request and response like it seems is available to do with cy.intercept(). I don't want to simply hit the url as with cy.intercept() because then I'm not testing the method. How, or can I 'intercept' the call made by this method? Thanks in advanced :)
Gleb Bahmutov
@bahmutov
@andreroc_gitlab I am not sure what you mean, but you can definitely test it and say "should('have.length.gte', 0)" for example and then deal with the list of items that might be empty
8 replies
vinayaktitti2015
@vinayaktitti2015

Hi All,

  1. How to handle a pop-up that is under iframe?

Note: I have switched to iframe to find the locator but React modal is not accessible.

Used: cy.window() as well but not working

cy.window().then((win) => {
      cy.stub(win, "open").as("childWindow");
    });

2.Another use-case: How to handle child-window and tab at the same time?

Scenario:

  1. click on the button will open the child window and tab
  2. switch to the window and click it

Error: @childwindow have not been called once

alina-thorzen
@alina-thorzen
hello, any good way to work in cypress with dictionary ? What I mean with that is a place where you can have selectors that you use in many different tests. Like for example the login button: If you have 20 tests all clicking on the login button, it would be good to have the login button (or its selector) defined in a dictionary/library/somewhere and used in all 20 tests. So when there is a change of the login button, you just change it in 1 place and not go through all the tests
Gleb Bahmutov
@bahmutov
@alina-thorzen sure, you can do that, it is just JavaScript
2 replies
StephenS
@S-Stephen
Hello, I'm having issues using Cypress with mat-table. I can see elements in the table but .get() does not find them. These table rows are generated during the test and appear in the table. The .get() does find the row if they are in the table already. I'm also getting 'cy.click() failed because this element is detached from the DOM.' messages. Is this something to do with how mat-table is rendering? can Cypress cope with these elements if so how?
Gleb Bahmutov
@bahmutov
drivendragon
@drivendragon
@bahmutov do you have any videos that demonstrate the process.env in the plugin file or he as-a? I've read over the pages, but it's not clicking - a video works best in my learning. Much appreciated either way. Thank you.
Gleb Bahmutov
@bahmutov
Screen Shot 2021-09-23 at 08.26.22.png
@drivendragon the very top link is a video, no?
Yurii Yasinitskyi
@yasinitskyi
image.png
@bahmutov how do I add screenshots which are nested in subfolders?
I am trying to have embed screenshots within my mochawesome report, however as you may know depens how your test are structured (in folder with subfolders) the same structure will have screenshot directory. The path which you can see in screenshot will only look for screenshots (ie folder of spec name which contains respective screenshots) in first level of nesting, however will ignore any other subfolders within screenshots folder. How do I make program check all subfolders for presence of needed screenshot?
Yurii Yasinitskyi
@yasinitskyi
@bahmutov I was trying to do something like that but failed, I guess I cannot build up good path
image.png
StephenS
@S-Stephen
@bahmutov - thanks.
Dhamo
@dhamo-pk
Did anyone know how to invoke UI function/command in cypress on a specific element? Details here https://stackoverflow.com/questions/69285100
Gleb Bahmutov
@bahmutov
@yasinitskyi well, I don't use mochawesome reporter, so never hit this problem
@dhamo-pk what is this method centerOn? Where is this coming from?
2 replies
Reinis Ivanovs
@slikts
Is there an example of a Cypress plugin that adds some custom UI to the test runner? Like by injecting it into the page, for example
Reinis Ivanovs
@slikts
That's great, thank you
My specific use case is that I want to toggle visual tests (with Applitools) on and off from the UI
Reinis Ivanovs
@slikts
It'd be really neat if it was possible to play back Cypress runs in the test runner instead of a video
Gleb Bahmutov
@bahmutov
@slikts it would be
Jonathan Higger
@jjhiggz
I'm having a real tough time getting cypress component testing to work with react, SCSS , typescript and bootstrap. Here is the absolute closest I've got to it working. Does anybody know of a project that has that setup, where I can checkout the config files.
I should clarify that the only thing right now that isn't working is SCSS. As soon as I introduced that I went down the rabbit hole of how to set up a preprocessor plugin and was really struggling
Benny Meade
@bennymeade
@bahmutov I'm successfully using the technique in your blog https://www.cypress.io/blog/2020/04/01/streaming-test-results/ to log attributes.state, attributes.title, attributes.duration but how can I send a unique parameter from the test (dynamically created from json) to be logged as an attribute too? i.e. is it possible to set an environment variable within a test?
Benny Meade
@bennymeade
As any additional attributes I add just return a value of 'undefined':
dispatching event to  cypressListener /tmp/app.cypressListener  :  test:after:run , {
  country: undefined,
  title: 'STAGE - https://stage.company.com.',
  state: 'passed',
  duration: 3500
}
Gleb Bahmutov
@bahmutov
@bennymeade not sure what you mean, hope you can figure it out
raymond95
@raymond95:minds.com
[m]
Hi
Samundra
@dhakalsamundra
Is using the for loop inside the cypress is the ill-advised? Is each is better than the for loop?
Gleb Bahmutov
@bahmutov
@dhakalsamundra if it works, then it works
Screen Shot 2021-09-24 at 06.32.18.png
I have added scraping my videos from "Cypress Tips & Tricks" youtube channel to the page https://cypress.tips/search - now you really can find any Cypress answer