https://cypress.io logo
Join Discord
Powered by
# help
  • n

    narrow-artist-87113

    10/07/2022, 11:30 AM
    It doesn't run all tests but reports as done, any intuition on why it might be happening?
  • n

    narrow-artist-87113

    10/07/2022, 11:32 AM
    Please mute for better experience 😐
  • m

    mysterious-kitchen-59722

    10/07/2022, 1:48 PM
    Any input?
  • m

    mysterious-kitchen-59722

    10/07/2022, 1:48 PM
    What's the reason of performance regression while running on CICD ( docker? ) any solution? ( cypress 9.7)
  • w

    white-activity-68996

    10/07/2022, 1:57 PM
    Hi, how to close the print dialog in cypress, I have tried code in this link https://stackoverflow.com/questions/58549877/how-can-i-close-a-open-print-window-in-cypress-using-javascript-function @mysterious-kitchen-59722 @narrow-artist-87113 @stale-optician-85950 @narrow-minister-71622 @abundant-lifeguard-9043 @shy-winter-53144 @bored-school-78265 @flaky-raincoat-53097 @gifted-umbrella-24016 @freezing-piano-2792
  • s

    square-pager-46841

    10/07/2022, 4:47 PM
    Hello, when using an all typescript project, and having issues with types. Should the types be added in the ../support/e2e.ts file or in another types files created for the job?
  • m

    mysterious-belgium-25713

    10/07/2022, 5:23 PM
    I have normally a seperate types files where i extend the cypress namespace
  • i

    incalculable-pager-85339

    10/07/2022, 6:39 PM
    Hey everyone, I need a hand. Something strange is happening with my for loop. Im just trying to go through indexes in a JSON body returned by .request. Im going through them on each loop with an if. if body.name = x grab the id, otherwise do nothing with that index. ... .then((res) => { for(let i = 0; i <= res.length; i++) { if( res[i].name == "STRING") { Do some stuff } This (above) gives an error: Cannot read properties of undefined (reading 'name') but if I remove [i] from the if and replace it with [0] it works perfectly. Why is this happening? It seems like it doesnt like the let i but if I console log i it returns the value I expect.
  • s

    stale-optician-85950

    10/07/2022, 7:43 PM
    I've just run the code example in that Stackoverflow link https://stackoverflow.com/a/72979717 and it is working (i.e. my Chrome print preview window was blocked from loading). So either your scenario is slightly different, in which case you should provide the URL you are working on, or you need to try again with the answers already provided.
  • w

    white-activity-68996

    10/07/2022, 10:05 PM
    @stale-optician-85950 The main issue is to close the print preview dialog, I am also able to run that script in --headed mode, however the script does not help to close that. In --headless mode, it just ran fine.
  • n

    narrow-artist-87113

    10/08/2022, 4:45 AM
    Does anyone have any idea on how to choose selector for element that have only class that too keeps dynamically changing!
  • n

    narrow-artist-87113

    10/08/2022, 4:47 AM
    For example, here if you see class is '.jss136', after couple of refresh it will change to any other dynamically generated string
  • l

    late-monitor-15915

    10/08/2022, 5:18 AM
    Is also the text inside of that div dynamically changing?
  • n

    narrow-artist-87113

    10/08/2022, 5:55 AM
    No the text is not changing, but the reason that i am not using "Connect" is that there are several "Connect" in the screen so my target "Connect" will not be identified!
  • l

    late-monitor-15915

    10/08/2022, 6:33 AM
    All “Connect” are inside of div? Im thinking about something like cy.get(“selector”).within(() => { cy.contains(“Connect”)}) or maybe better cy.get(“:contains(Connect)”).last() I know its not ideal solution 👀
  • n

    narrow-artist-87113

    10/08/2022, 8:20 AM
    Two connect are in particular div
  • n

    narrow-artist-87113

    10/08/2022, 8:23 AM
    In div with class=jss95, we have "Connect with repository" class=jss92, we have "Connect" button
  • n

    narrow-artist-87113

    10/08/2022, 8:23 AM
    But that is the thing they are using dynamically generated classes!
  • m

    mysterious-belgium-25713

    10/08/2022, 11:12 AM
    Is this a site that is being developed by your company. If so i would force to have locators you can use. My way of working with my dev teams is we beforehand discuss how the UI will look and also what elements we find important for testing. These elements get a special tag/Id in which we use during our testing.
  • m

    mysterious-belgium-25713

    10/08/2022, 11:13 AM
    What you could try is do a cy.contains(your repo name).parent() to see if you get the top element and then chain .within()
  • m

    mysterious-belgium-25713

    10/08/2022, 11:14 AM
    so cy.contains().parent().within(()=>{})
  • n

    narrow-artist-87113

    10/08/2022, 11:19 AM
    Okay, i will try it, thank you very much @mysterious-belgium-25713
  • f

    flaky-raincoat-53097

    10/08/2022, 2:31 PM
    good morning guys! @here first I want to thank for your help last time. Now I'm still in troubles. I continue testing the same url https://www.businessinsider.com/ikea-nyc-store-planning-studio-tour-2019-4 and now I have a couple blockers a little different. 1- I need to test the “save” button functionality, but when I click it, it opens a popup login child-window. I try this to manipulate that emergent window, but I'm quite wrong:
  • f

    flaky-raincoat-53097

    10/08/2022, 2:31 PM
    this is what it opens:
  • f

    flaky-raincoat-53097

    10/08/2022, 2:32 PM
    2- I'm trying to test "email" button functionality but in this case I just don't know what to do, because it opens an OS, Windows emails menu like this:
  • f

    flaky-raincoat-53097

    10/08/2022, 2:33 PM
    and the last one, I need to write a test that iterates over each story at https://www.businessinsider.com/latest and asserts that each URL returns a 200 response.
  • f

    flaky-raincoat-53097

    10/08/2022, 2:34 PM
    I could click in each news url, using each, but I just can't assert that the response is 200 code. this is what I tried but I know that I'm a little lost.
  • f

    flaky-raincoat-53097

    10/08/2022, 2:35 PM
    thanks for your help in advance
  • s

    stale-optician-85950

    10/08/2022, 8:48 PM
    Firstly you should set
    Cypress.on('uncaught:exception', () => false);
    in your
    cypress/support/e2e.ts
    file. 1 ) The problem with your application is that it's riddled with cookies and requests, even when I reject any additional cookies your application still drops approximately 70 cookies. So when you are trying to click the save button, the application requests have not all been completed. As Cypress is moving onto the next
    click save
    step, your application is not ready for it. So you need to wait for all the troublesome requests to finish. I have selected a couple of the requests that look to take longest but you will need to study the behaviour of your application in Dev Tools > Network to be in control here. I also added
    setCookie
    to block the cookie banner from appearing. Please note the comments I have added to the test code:
    Copy code
    describe('Test application', () => {
      it('Validate save button', () => {
        // prepare the requests list
        cy.intercept('https://cdn.privacy-mgmt.com/**').as('content');
        cy.intercept('**/consent-status?*').as('contentStatus');
        // stop the cookie banner from appearing by setting the cookie
        cy.setCookie('consentUUID', '57261086-58c8-4b80-9c02-647d417b9861_12');
        // wait for the requests to finish
        cy.visit('https://www.businessinsider.com/ikea-nyc-store-planning-studio-tour-2019-4');
        cy.wait('@contentStatus');
        cy.get('[title="Save Article"]').click();
        // login form has appeared and now you can enter credentials
        cy.get('[class*="authentication-wrapper-login"]').within(() => {
          cy.get('[type="email"]').type('myemail@gmail.com');
          cy.get('[type="password"]').type('Password123');
          cy.get('[class="dialog-base-button-bar"] [data-event-label="login"]').click();
        });
      });
    });
  • f

    flaky-raincoat-53097

    10/08/2022, 9:00 PM
    @stale-optician-85950 thanks for your support!! I really appreciate this. Thanks for your analysis . Now I have a global idea regarding this. I'm wondering if you have any thoughts regarding the other 2 issues? If you don't mind..
1...166167168...252Latest