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

    some-photographer-65085

    07/30/2021, 1:24 PM
    for a form
  • s

    some-photographer-65085

    07/30/2021, 1:24 PM
    but the second it dont get it and connect to the server
  • s

    some-photographer-65085

    07/30/2021, 1:25 PM
    that's my prolem 😦
  • a

    ancient-wire-34126

    07/30/2021, 1:38 PM
    Remember that intercepts need to be declared in reverse order. So your last defined intercept will be used first. But if you can show some code I could take a look
  • a

    ancient-wire-34126

    07/30/2021, 3:56 PM
    Ugh, whenever I login to Cognito programatically, it only works for one test. As soon as another test starts everything is gone. Is there any way around it? I think Cypress blows away my localStorage after each test
  • a

    ancient-wire-34126

    07/30/2021, 4:53 PM
    https://github.com/cypress-io/cypress/issues/461#issuecomment-325402086 helps, brutal...
  • a

    ancient-wire-34126

    07/30/2021, 5:01 PM
    I would think this only makes sense if it would run before each spec file, not before each test. If you're testing different functionality on the same page you don't want to re-login every time for example. This plugin seems worth trying though: https://github.com/javierbrea/cypress-localstorage-commands
  • s

    some-photographer-65085

    07/30/2021, 5:12 PM
    my problem its, that cypress says that i need to reaload after intercept
  • s

    some-photographer-65085

    07/30/2021, 5:12 PM
    but in my form it couldn't be
  • w

    wonderful-match-15836

    07/30/2021, 5:15 PM
    I'm so curious about this. If you don't get it resolved today with TheDutchCoder, I am available for a call this weekend if you like. My wife speaks Spanish so maybe between that and seeing your test in action we could get to the bottom of it together.
  • s

    some-photographer-65085

    07/30/2021, 5:20 PM
    yeah, its interesting and pretty corious issue, and i think its a normal use case for a test. but i dont know how to solve it, because i try to intercept the call , for no to do the call to the server and i dont know how, i am new also using cypress and developing.
  • s

    some-photographer-65085

    07/30/2021, 5:21 PM
    I appreciate it so much
  • s

    some-photographer-65085

    07/30/2021, 5:21 PM
    this is part of my code @User
  • s

    some-photographer-65085

    07/30/2021, 5:23 PM
    I have been reading the cypress documentation for graphql callings
  • s

    some-photographer-65085

    07/30/2021, 5:44 PM
    @User@User
  • a

    ancient-wire-34126

    07/30/2021, 5:46 PM
    I'm not 100% sure what you're trying to do. calling a cy.visit will move away from the page/reload.
  • s

    some-photographer-65085

    07/30/2021, 5:48 PM
    yeah,
  • s

    some-photographer-65085

    07/30/2021, 5:51 PM
    i need that the request dont connect to the server and cannot create the box
  • s

    some-photographer-65085

    07/30/2021, 5:53 PM
    I try what you said, call intercept from the last one to the first
  • w

    wonderful-match-15836

    07/30/2021, 6:02 PM
    Also, trying moving them all up to the top of the
    it
    block - it doesn't matter how early you declare them, so maybe that will get ahead of the request you are trying to stub. The reverse-order matters if you are using intercept for the same endpoint over and over, but it looks like you are doing it on 2 separate endpoints so that should be fine. If I am getting what you mean, hitting enter on the "scan a new location" field triggers the request you are trying to intercept, so you would need to declare the intercept before that happens. Which is fine.
  • s

    some-photographer-65085

    07/30/2021, 6:11 PM
    well, actually I am only using one graphql ep for all the callings,
  • s

    some-photographer-65085

    07/30/2021, 6:12 PM
    only change the operation name
  • s

    some-photographer-65085

    07/30/2021, 6:12 PM
    I have been also declare the callings of the intercepts in the momment that they need to be used and neither works
  • s

    some-photographer-65085

    07/30/2021, 6:13 PM
    yeah, your are right here
  • s

    some-photographer-65085

    07/30/2021, 6:13 PM
    If I am getting what you mean, hitting enter on the "scan a new location" field triggers the request you are trying to intercept,
  • s

    some-photographer-65085

    07/30/2021, 6:13 PM
    ok I will do it
  • s

    some-photographer-65085

    07/30/2021, 6:16 PM
    no, it did not work
  • s

    some-photographer-65085

    07/30/2021, 6:37 PM
    cypress doc
  • s

    some-photographer-65085

    07/30/2021, 6:37 PM
    The req.reply() function can be used to send a stub response for an intercepted request. By passing a string, object, or StaticResponse to req.reply(), the request can be preventing from reaching the destination server.
  • s

    some-photographer-65085

    07/30/2021, 6:38 PM
    but it did not stop it
1...181920...192Latest