https://cypress.io logo
Join Discord
Powered by
# e2e-testing
  • c

    colossal-farmer-50435

    08/10/2022, 2:06 PM
    I want to know how to execute api calls through
    cy.request
    where I need to send files (multipart/form-data)?
  • g

    glamorous-country-57678

    08/11/2022, 1:08 AM
    Is using a proxy between the webapp and a server to capture the requests and responses something that should be done using cypress or is that not necessary because cy.intercept() could be used instead
  • s

    salmon-horse-6473

    08/11/2022, 7:47 AM
    I have set up the experimental feature cy.origin by enabling experimentalSessionAndOrigin : true, "chromeWebSecurity": false, and try to hit a authentication web-page , but it seems to detect the cross-origin aspect and does not load. Do I miss anything there ? cy.origin('https://sandbox.orcid.org', { args: { href } }, ({ href }) => { console.log(href) cy.visit(href) })
  • c

    clever-house-82088

    08/11/2022, 8:42 AM
    Hi everyone! I’m using Cypress with Cucumber and I recently changed my cypress.json in cypress.config.ts and the old property “testFiles” became specPattern, but it doesn’t work like the old becouse in the recap tests of cypress:run i get only the file name. I need to show the path and the file name, but I don’t find any options. Someone have same suggests? Thank you all!
  • a

    acceptable-hamburger-48790

    08/11/2022, 9:36 AM
    Any request going from browser can be intercepted using cy.intercept() so i guess all you need is this intercept command. So give it a go and let us know your experience.
  • b

    brash-ghost-16880

    08/11/2022, 9:44 AM
    Any idea on how to test pdf in new window? so my system is when i click on the button a pdf is opened in the new window. All i need to check is that the pdf has 2 pages of content. till now i know how to get the new windows item. but how do i check the pdf format and page numbers in the new windows?
  • a

    acceptable-hamburger-48790

    08/11/2022, 9:45 AM
    As Cypress doesnt switch to new tab, my suggestion would be to download the pdf and then check the contents
  • b

    brash-ghost-16880

    08/11/2022, 9:47 AM
    how do i download the file that is opened in new window? I guess it should be done in the react part? or there is a way to download from cypress?
  • a

    acceptable-hamburger-48790

    08/11/2022, 9:48 AM
    The button or link you click will have the URL for the pdf, extract that and using this plugin https://www.npmjs.com/package/cypress-downloadfile
  • b

    brash-ghost-16880

    08/11/2022, 10:45 AM
    do you have any example on how to make api call then? Because when i click the button it creates a graphql mutation call and then backend generates the file and return the file as byte format. so its not a direct download link. Do you have any example like that?
  • a

    acceptable-hamburger-48790

    08/11/2022, 10:55 AM
    This might help you https://medium.com/@gurudatt.sa26/cypress-how-to-intercept-a-graphql-request-for-a-specific-operation-f9de5cae5705
  • a

    acceptable-hamburger-48790

    08/11/2022, 10:58 AM
    the graphql response might have the url link - which you can extract and save it in session
  • h

    high-raincoat-69564

    08/11/2022, 11:53 AM
    @brash-ghost-16880 the level of assertion is a tradeoff - of "how accurate you want to be in your assertions"? Maybe it is enough just to: - click - intercept the request is done with correct arguments - intercept the response is successful (optional)
  • h

    happy-dinner-13480

    08/11/2022, 12:14 PM
    I have an issue with Intercept:
    Copy code
    javascript
    it('Save the business rule', () => {
        cy.intercept({ method: 'POST', url: `${Cypress.env('API_URL')}/api/v1/company/*/businessRule?cache_buster=*` }).as('businessRule');
        cy.el('btnSaveBusinessRule').click();
        cy.get('@businessRule').should((response: any) => {
            cy.wait(50).then(() => {
                expect(response.response.statusCode).to.eq(200);
            });
        });
    });
    response.response.statusCode
    gives the error
    cannot read undefined of statusCode
    . For some reason the
    response
    object is empty unless I add a
    wait
    like I did above.
  • a

    acceptable-hamburger-48790

    08/11/2022, 12:15 PM
    cy.get('@businessRule').should((response: any) - this is wrong - Can you change this to cy.wait('@businessRule')
  • h

    happy-dinner-13480

    08/11/2022, 12:17 PM
    oops! yea that was it, with the
    get
    it doesn't
    wait
    for the POST to be complete?
  • a

    acceptable-hamburger-48790

    08/11/2022, 12:17 PM
    yes it wont. So always use cy.wait for waiting for the intercept call
  • h

    happy-dinner-13480

    08/11/2022, 12:21 PM
    sorry, just another small question if you don't mind:
    cy.wait('@businessRule').should()
    or
    cy.wait('@businessRule').then()
    they both work, but does it matter which syntax is used?
  • a

    acceptable-hamburger-48790

    08/11/2022, 12:23 PM
    i use then - the difference between should and then is the retry capability of previous chained command
  • p

    polite-policeman-65273

    08/11/2022, 1:55 PM
    MY CYPRESS tests pass locally but are hanging on circleCI. I am getting this error:
    Too long with no output (exceeded 10m0s): context deadline exceeded
    I went through official cypress docs and issues but found only this one: https://github.com/cypress-io/cypress/issues/21110 regrettably, it was put into the backlog by the cypress team maybe Gleb or someone from the team could comment or point to the direction on how to approach the problem. Thanks
  • h

    high-raincoat-69564

    08/11/2022, 2:29 PM
    @polite-policeman-65273 so is your testsuite is really big and it is reasonable to assume >10m? If so, you can increase this param in CircleCI with
    no_output_timeout: 15m
    If the testsuite is small, maybe the app itself hangs and blocks browser? check "resources" tab on CircleCI fopr CPU/RAM
  • a

    acceptable-solstice-90676

    08/11/2022, 2:30 PM
    Hello everyone, when I run cypress in head mode, it randomly crashes, I haven't identified any pattern, has anyone had this issue?
  • c

    cold-van-45410

    08/11/2022, 3:01 PM
    Hi team
  • c

    cold-van-45410

    08/11/2022, 3:01 PM
    can anyone tell me How to check broken link using cypress?
  • p

    polite-policeman-65273

    08/11/2022, 3:25 PM
    Tests started to hang after
    --env USERNAME=$USERNAME, PASSWORD=$PASSWORD
    flag was added to CMD in Dockerfile
  • g

    gray-kilobyte-89541

    08/11/2022, 4:29 PM
    Something like this https://glebbahmutov.com/blog/crawl-using-cypress/ that you can find from https://cypress.tips/search
  • c

    cold-van-45410

    08/11/2022, 5:20 PM
    Thanks @gray-kilobyte-89541
  • g

    glamorous-country-57678

    08/11/2022, 5:36 PM
    Hello, I am having trouble with logging in a user. When navigating to the login in page, typing in text, and then clicking the 'Sign In' page, my test throws an uncaught:exception. The full error after clicking 'Sign In' is:
    Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.6.2)
    . My intercept for this request is: `cy.intercept('POST',
    ${ethProvider}*
    , { fixture: 'ethProvider.json', }).as('ethProvider')` My guess is that my fixture data is not correct or I am not mocking the response properly. Here is a full view of cypress GUI:
  • m

    microscopic-crowd-9149

    08/11/2022, 6:50 PM
    any idea here
  • l

    lemon-piano-67942

    08/12/2022, 7:57 AM
    Hi everyone, Is there a way to run something before each describe but not before each it. So I have a main describe with sub describes in it and I would like to do something before each sub describe but I wouldn't like to use before inside of these describes because it is code duplication. Do anybody has idea?
1...798081...192Latest