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

    bitter-hair-56607

    01/21/2022, 9:46 AM
    hello, do you have any recommendations for file upload without the html attribute being , but rather being element?
  • h

    handsome-cartoon-58565

    01/22/2022, 7:41 PM
    Nesting commands - promise error
    w
    • 2
    • 4
  • h

    handsome-cartoon-58565

    01/23/2022, 5:58 PM
    why do you want to use other element than specific input for file upload?
  • h

    handsome-cartoon-58565

    01/23/2022, 5:59 PM
    you can hide the input and programmatically trigger it as user interacts with the div
  • p

    powerful-crayon-15587

    01/24/2022, 10:41 AM
    Hello guys is there a way to export a variable with a string into another it function? I've tried to export and import it but it didn't work with module.exports. I always got undefined.
  • h

    handsome-cartoon-58565

    01/24/2022, 12:25 PM
    what exactly do you mean? and show the code of what you have tried
  • h

    handsome-cartoon-58565

    01/24/2022, 12:25 PM
    you can import something from a module to your spec file
  • h

    handsome-cartoon-58565

    01/24/2022, 12:25 PM
    you can also share value within spec context via alias or
    this
    (if it's inside non-arrow function)
  • p

    powerful-crayon-15587

    01/24/2022, 12:34 PM
    I'm gonna send you pics in dms
  • h

    handsome-cartoon-58565

    01/24/2022, 12:35 PM
    i'd prefer to help you here
  • p

    powerful-crayon-15587

    01/24/2022, 12:41 PM
    I've tried this
  • h

    handsome-cartoon-58565

    01/24/2022, 12:42 PM
    and what's the result?
  • p

    powerful-crayon-15587

    01/24/2022, 12:43 PM
    when I cy.log the imported variable it gives me undefined but I need the string
  • h

    handsome-cartoon-58565

    01/24/2022, 12:44 PM
    what if you just log
    this
    ?
  • h

    handsome-cartoon-58565

    01/24/2022, 12:44 PM
    is there the
    text
    property?
  • p

    powerful-crayon-15587

    01/24/2022, 12:44 PM
    yea I tried logging this but that doesn't work either
  • h

    handsome-cartoon-58565

    01/24/2022, 12:45 PM
    but what does
    console.log(this)
    log?
  • p

    powerful-crayon-15587

    01/24/2022, 12:45 PM
    hold on I'm gonna try that
  • h

    handsome-cartoon-58565

    01/24/2022, 12:45 PM
    also, why do you export something from
    it
    ?
  • p

    powerful-crayon-15587

    01/24/2022, 12:46 PM
    I thought its ok to do that (I'm new to cypress)
  • h

    handsome-cartoon-58565

    01/24/2022, 12:47 PM
    if you want to have some helper function then use Commands API https://docs.cypress.io/api/cypress-api/custom-commands
  • h

    handsome-cartoon-58565

    01/24/2022, 12:47 PM
    you can have reusable function as Command
  • p

    powerful-crayon-15587

    01/24/2022, 12:47 PM
    ok thx
  • a

    adventurous-dream-20049

    01/24/2022, 4:14 PM
    I'm not sure I understand your question. Can you provide a code block for reference and tell me a little more about your use case?
  • g

    glamorous-monkey-67605

    01/24/2022, 4:30 PM
    Hi I'm using Cypress to test our app on Production (against best practices) and we're running into an issue where we've implemented logic to have our app open a new tab to the page instead of redirecting if we find out its embedded. When we run cypress headless or using a testrunner, the test steps run to login and instead of redirecting our app to a specific page, it opens that page by design. My question is how do i disable this behavior on the app if i know Cypress is the one requesting the app? Is there a user agent that Cypress sets when it makes requests to the app that i can then use in our code to detect and disable that behavior?
  • h

    handsome-cartoon-58565

    01/24/2022, 5:01 PM
    https://discord.com/channels/755913899261296641/763105090679865354/934533240625197137 bump
  • w

    wonderful-match-15836

    01/25/2022, 12:32 PM
    Hi, you can check for
    window.Cypress
    in your code if you want to do anything specific when Cypress is present
  • b

    bitter-hair-56607

    01/26/2022, 2:30 PM
    neverminded, I think I was checking the wrong element. Thanks anyway.
    a
    • 2
    • 1
  • a

    adventurous-dream-20049

    01/26/2022, 4:42 PM
    Input vs Div
  • a

    adventurous-dream-20049

    01/31/2022, 11:41 PM
    Wanted to circle back to say this has been resolved with v9.4.0. See our Changelog here: https://docs.cypress.io/guides/references/changelog#9-4-1
1...464748...252Latest