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

    mammoth-fall-22117

    05/08/2022, 2:06 PM
    You are amazing πŸ™‚ Thank you!
  • t

    thankful-insurance-51131

    05/09/2022, 6:56 AM
    im trying to reach an input that is nested inside of 2 iframes. (not able to change touch that code) Cy seems to be able to find the second iframe inside the first one, however the input is not accessible via .find(). Thinking it might be selectors i 3x checked them. (using input[tpye=tel] just to see if it works atm) Not sure how to approach this issue, would love some help. Let me know if there is any further information I can provide, (im prty new to this).
  • m

    mammoth-fall-22117

    05/09/2022, 10:09 AM
    Can you please share the piece of code you are using to retrieve that element? You can obfuscate the ids/names.
  • t

    thankful-insurance-51131

    05/09/2022, 12:49 PM
    ty, hope it helps
  • t

    thankful-insurance-51131

    05/09/2022, 12:57 PM
    the cy.iframe is provided by the npm package "cypress-iframe"
  • p

    powerful-orange-86819

    05/09/2022, 2:38 PM
    are the iframes in the same domain? Cypress currently doesn't support cross domain iframes (something that i dont like at all)
  • m

    mammoth-fall-22117

    05/09/2022, 3:59 PM
    It already does. Please check

    https://www.youtube.com/watch?v=XMJP07Ft1nA&list=PLP9o9QNnQuAYYRpJzDNWpeuOVTwxmIxcI&index=2&ab_channel=glebbahmutovβ–Ύ

  • m

    mammoth-fall-22117

    05/09/2022, 4:00 PM
    I think you should use cy.get() for the field you would like to pass input to.
    t
    p
    e
    • 4
    • 36
  • g

    gifted-boots-63851

    05/09/2022, 4:15 PM
    hi, how to call async function in a custom cypress command? I did something like this:
    Copy code
    ts
    Cypress.Commands.add('foo', () => {
      Cypress.log('foo', ...)
      return someLoginFunctionWithHTTPCall()
    })
    When I call this method
    cy.foo()
    , the network call is made successfully, but cypress is "stuck", it wont go to the next step
  • m

    magnificent-finland-58048

    05/09/2022, 4:18 PM
    do logging like they do in the real world app https://github.com/cypress-io/cypress-realworld-app/blob/develop/cypress/support/commands.ts#L42
  • m

    magnificent-finland-58048

    05/09/2022, 4:19 PM
    There is no async in Cypress. Cypress has a declarative chaining syntax that pipes inputs and outputs. Most of the time, you do not even need to deal with the values going through the chain. Async/await makes it much easier to unwrap values, but Commands are not Promises, using await on a Cypress chain will not work as expected. This is a very conscious and important design decision that gives Cypress a fluid, functional programming inspired, observable-stream-like api that many begin to prefer over what they have been used to.
  • m

    mammoth-fall-22117

    05/09/2022, 4:20 PM
    Can't he use cy.intercept() and cy.wait()?
  • m

    magnificent-finland-58048

    05/09/2022, 4:21 PM
    it might be as easy as Cypress.Commands.add('foo', () => { cy.log('foo', ...) return someLoginFunctionWithHTTPCall() })
  • g

    gifted-boots-63851

    05/09/2022, 4:21 PM
    well I believe it's more related to the network call, if I change to :
    Copy code
    ts
    Cypress.Commands.add('foo', async () => {
      Cypress.log('foo', ...)
      await someLoginFunctionWithHTTPCall()
      Cypress.log('done', ...)
    })
    done
    is not displayed, so we could believe that the issue is because of my custom function the thing is my
    someLoginFunctionWithHTTPCall
    is
    firebase.signInWithEmailAndPassword
  • m

    magnificent-finland-58048

    05/09/2022, 4:21 PM
    no await
  • m

    magnificent-finland-58048

    05/09/2022, 4:21 PM
    try this
  • m

    magnificent-finland-58048

    05/09/2022, 4:21 PM
    Cypress.Commands.add('foo', () => { cy.log('foo', ...) cy.someLoginFunctionWithHTTPCall() cy.log('done') })
  • m

    magnificent-finland-58048

    05/09/2022, 4:22 PM
    you can try that middle fn as a fn vs command
  • g

    gifted-boots-63851

    05/09/2022, 4:25 PM
    I would move my firebase call in its own command:
    Copy code
    ts
    Cypress.Commands.add('firebaseLogin',  () => {
      return firebase.signIn(...)
    })
    and call the command from another one?
    Copy code
    ts
    Cypress.Commands.add('login',  () => {
      return cy.firebaseLogin()
    })
  • m

    magnificent-finland-58048

    05/09/2022, 4:26 PM
    should be perfectly fine
  • m

    magnificent-finland-58048

    05/09/2022, 4:26 PM
    you might find working examples that apply to what you want here https://github.com/muratkeremozcan/cypress-crud-api-test
  • m

    magnificent-finland-58048

    05/09/2022, 4:27 PM
    lots of log examples there
  • g

    gifted-boots-63851

    05/09/2022, 4:27 PM
    I'll test, but I cannot understand why it would work this way, rather than having one command that would call my firebase fn πŸ€”
  • g

    gifted-boots-63851

    05/09/2022, 4:27 PM
    thanks for the help tho
  • g

    gifted-boots-63851

    05/09/2022, 4:31 PM
    it's still stuck on that login call command, even if the HTTP call is successful I give up for today, will check this tomorrow! thanks again for your help πŸ‘
  • m

    magnificent-finland-58048

    05/09/2022, 4:35 PM
    if you have a sample repo to share, we could just pull it, and help you make it work
  • g

    gifted-boots-63851

    05/09/2022, 6:34 PM
    you're right that would be simpler, I'll try to make one when I have time
  • g

    gifted-boots-63851

    05/09/2022, 7:17 PM
    well, of course when I try to replicate my issue, I do not have it anymore and it works without any issue, nice i am doomed when it comes to work with cypress
  • m

    magnificent-finland-58048

    05/09/2022, 7:45 PM
    it's like going to the doctor and they tell you everything is fine the way I go about anything is to try to first make it work in a stupid simple example, then replicate that internally where there may be many factors and gotchas impacting it that simple example, the control group, will always help compare & contrast for the purpose of getting to bottom of a failure
  • r

    rough-sugar-96535

    05/09/2022, 9:35 PM
    I get type errors when doing something like cy.get('[name="email"]'.type(Cypress.config('paidUsername')) How can I use Cypress.config in this way with TypeScript?
1...404142...192Latest