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

    nice-manchester-42957

    07/18/2022, 8:18 PM
    I am trying to implement custom behavior, so I need to get the data in the event object.
  • a

    able-monkey-72947

    07/18/2022, 8:20 PM
    I have a custom command in my tests to record requests, here's a few bits of it that might help you -
    Copy code
    cy.intercept(cyInterceptArgs, request => {
      request.on('before:response', response => {
        // using env is super odd, but this is how to mix sync / async cy.task / cy.command code
        // https://filiphric.com/working-with-api-response-data-in-cypress
        Cypress.env('response', response)
      })
    
      request.continue()
    }).as(url)
    Then further down after some
    fsReadFile
    logic,
    Copy code
    const response = Cypress.env('response') || null
    if (file.shouldRecord && response) {
      cy.writeFile(filePath, response)
    }
    You can save the request/event data into the
    Cypress.env('response')
    , then access it later.
  • a

    able-monkey-72947

    07/18/2022, 8:22 PM
    I guess the most relevant bit to what you said is
    request.on('before:response', response => {...})
  • n

    nice-manchester-42957

    07/18/2022, 8:24 PM
    neat, thanks!
  • a

    able-monkey-72947

    07/18/2022, 8:24 PM
    no problem, I hope that works!
  • b

    boundless-optician-46591

    07/19/2022, 2:17 AM
    Hi All, I am trying to run a oracle update query in cypress, I could see the rows affected changes in cypress but in Database the changes is not updated. Can anyone please help me out in this?
  • b

    brainy-account-24503

    07/19/2022, 6:27 AM
    Hi, I'm trying to create a custom command, but the command is not getting fired or recognized. support/commands.js:
    Cypress.Commands.add('myCommand', () => {console.log("fired"})
    support/index.js: (According to documentation this should not be necessary)
    import './commands.js';
    If I do the above the command is not recognized. If I add the import to support/e2e.js then it's recognized but is not firing. Anything I'm missing?
  • m

    mammoth-electrician-64243

    07/19/2022, 8:17 AM
    I start cypress with
    cypress run --browser
    . In my
    setupNodeEvents
    I define launch arguments. I see these in the console via a
    console.log
    . However when chrome is opened by browser it seems this is ignored. I can see this by the result shown for the page. If I open the page normaly in chrome launched via the command bellow I get a message I made for you're on mobile. Chrome via command line
    C:\Program Files\Google\Chrome\Application\chrome.exe" --use-mobile-user-agent --user-agent="Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36"
    . Code for `before:browser:launch`:```if (oConfig.oStartup.strBrowser === 'chrome') { if (oConfig.oStartup.bTestMobile) { launchOptions.args.push('--use-mobile-user-agent --user-agent="' + oConfig.oStartup.strMobileAgent + '"'); } else if (oConfig.oStartup.bTestTablet) { launchOptions.args.push('--use-mobile-user-agent --user-agent="' + oConfig.oStartup.strTabletAgent + '"'); } return launchOptions }``` Console log shows it is added to the arguments
    '--use-mobile-user-agent --user-agent="Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36"'
    . EDIT: Got it working, you must do one argument per line, so do 2
    args.push
    in this case
  • f

    few-telephone-44543

    07/19/2022, 8:32 AM
    Are you sure the database connection is working? How does your cypress config look?
  • w

    wooden-teacher-96595

    07/19/2022, 10:23 AM
    has anyone set up testing with rabbitmq in their suite?
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:09 AM
    Hellos!! I am doing a PoC using Cypress for my application
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:10 AM
    my application includes iFrames.....When I click a submit button in iFrame, a new table suppose to be loaded within iframe
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:10 AM
    but the application is getting logged out after clicking the submit button
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:11 AM
    Can anyone help me with this issue
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:12 AM
    i notice that the application is getting logged out while the iframe is reloaded..
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:12 AM
    your help would be appreciated
  • c

    careful-computer-31749

    07/19/2022, 12:01 PM
    Hello !! I am doing electron testing in cypress . Please tell me how to mock electron webcontents send .
  • w

    white-gpu-56286

    07/19/2022, 12:10 PM
    I think you're just missing the closing parenthesis of console.log()
  • b

    brainy-account-24503

    07/19/2022, 12:22 PM
    thanks!
  • q

    quiet-orange-53857

    07/19/2022, 1:47 PM
    I'm testing a list of h5, when there are no items in the list I want it to go to the else but it stops the test reporting an assertion error. is there a command to check this h5 without interrupting by assert?
  • g

    gray-kilobyte-89541

    07/19/2022, 1:53 PM
    conditional testing, see https://glebbahmutov.com/cypress-examples/recipes/conditional-testing.html
  • q

    quiet-orange-53857

    07/19/2022, 2:05 PM
    Thank you!!!
  • b

    brash-ghost-16880

    07/19/2022, 2:15 PM
    I am trying to use a file download option in cypress. So in the website which i click the export button it downloads a pdf file. In cypress i have installed the download file plugin and then added the required code in command.js ( require('cypress-downloadfile/lib/downloadFileCommand')) and in config.js ( const {downloadFile} = require('cypress-downloadfile/lib/addPlugin') module.exports = (on, config) => { on('task', {downloadFile}) } ) now in the test file when i click on the button i should see the file downloaded in the download folder right? or i am missing something? right now i can see that the pdf file is opened in new windows but there is no file download.
  • a

    adorable-stone-42197

    07/19/2022, 4:39 PM
    Hello guys, did someone configure test to run on multiple environments on jenkins pipeline? Now my test running only on development stage but we want to include on stagging and production? I have configure for stage , how to add to run on jenkins?
  • b

    boundless-optician-46591

    07/20/2022, 3:26 AM
    @few-telephone-44543 yes, because i am able to retrieve values successfully for select query. for update query alone i am having this issue. not sure why its happening.
  • f

    few-telephone-44543

    07/20/2022, 6:39 AM
    It will help if you can share your code. Otherwise it will be difficult to help. Is that an option?
  • g

    glamorous-forest-41164

    07/20/2022, 10:09 AM
    Hello Guys, I am stuck with an issue in the Cypress, that seems to be a BUG to me but I still can't figure out what it really is. If anyone can help me, I will be very thankful. That's the errors when we execute the test. The build generates multiple vendor bundles, which is fine in that particular scenario. But cypress could not load those bundles.
  • g

    glamorous-forest-41164

    07/20/2022, 10:15 AM
    If try to load that particular bundle independently via > http://localhost:59259/__cypress/tests?p=vendors-node_modules_chainsafe_bls_lib_constants_js-node_modules_chainsafe_bls_lib_functional-78cdc1.with_bls_dep.test.ts.js It throws following error.
  • g

    glamorous-forest-41164

    07/20/2022, 10:16 AM
    To load that bundle it's looking into the actual src directories, rather into the runtime build folder inside
    /Users/nazar/Library/Application Support/Cypress/cy/production/projects/cypress-mocha-bls-test-fd979bc015b928f839f67a025adcb272/bundles/test/unit
    Anyone have any idea, is it some configuration related issue or some a bug?
  • h

    handsome-dress-30825

    07/20/2022, 11:59 AM
    hey guys, has anyone experiences frequent "Oh Snap" crashes while executing e2e tests using Cypress version 10.3.0 or above?
1...727374...192Latest