#rohan_code

1 messages · Page 1 of 1 (latest)

earnest shellBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1343996936763609193

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

magic estuary
#

I also get the following client-side error when running inside a Cypress test: IntegrationError: lightbox Element didn't mount normally. I don't think I see this error outside Cypress

rustic phoenix
#

Hi! I don't think that error is a Stripe error.

#

I don't think that CashApp supports Cyprus?

magic estuary
#

Sorry, not Cyprus the country—Cypress the testing framework

rustic phoenix
#

Bahahaha

#

Weeeeeee

#

That's what I get for switching to farming for a few years. 😂

#

Unfortunately I'm totally unfamiliar with Cypress the testing framework - I have reasonably good familiarity with the tree though - so I'm not sure I (or my colleagues) will be of much help with this.

Remind me: what's the outcome you're looking for that you're not seeing exactly?

magic estuary
#

hahaha

#

I'm trying to get the cashapp flow tested in cypress, but Cypress doesn't handle stuff opening in new tabs well, so I'm trying to simulate the mobile flow, which should open the payment simluator in the same tab

#

so I'm trying to figure out how to get Stripe to think we're in mobile, so it opens the redirect

rustic phoenix
#

That might actually be a different tab on a mobile device - the really really old version of Checkout was.

magic estuary
#

hm, okay. let me try it on my mobile device, one sec

#

I've been doing it in the desktop simulator

earnest shellBOT
magic estuary
#

yeah, it looks like it works on my phone

#

so how can I mock the user agent to get it to work on desktop inside Cypress?

unkempt trellis
#

ok catching up on this thread - it sounds like your question is how do you mock the user agent to mobile for testing purposes?

magic estuary
#

yes, exactly, within a cypress test specifically

#

(sorry, I know this is a little outside the usual ambit, just wondering if y'all had seen something like this done before)

unkempt trellis
#

hmmmm. yeah, like my colleague suggested earlier i don't know if this is something we'll be able to help you with since it's pretty specific to cypress

magic estuary
#

do you know how the stripe client detects whether it's on mobile for the app redirect? maybe I can work backwards from t here

unkempt trellis
#

i have used cypress as a testing framework (in a past job) but i haven't had to deal with mocking user agents specifically. so the best i could do is co-google with you and go stack overflow spelunking 😛

magic estuary
#

haha

unkempt trellis
#

that is a good question, let me see if i can figure that out

magic estuary
#

sweet, ty

#

I'm also getting this weird "lightbox Element didn't mount normally" without any other context, so if you know what that is / where t hat's coming from, that'd be really helpful haha

unkempt trellis
#

do you have any example request IDs from this?

magic estuary
#

let me check

unkempt trellis
#

i can try to look some up too. wondering if i can just check what user agent header we're seeing

#

actually i just realized i don't have your account ID. so yeah a request ID would be helpful

magic estuary
#

ope one sec

#

let me grab the req id

unkempt trellis
#

i can get it from there actually

magic estuary
#

cool cool

unkempt trellis
#

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.137 Safari/537.36

magic estuary
#

oh wack

#

hm

unkempt trellis
#

so yeah i think the user agent isn't being overwritten. when i was first googling this i read that user agent stuff in cypress can be a little finicky so i bet that's related

magic estuary
#

do you know how it grabs the user agent? navigator.userAgent is set correctly when I debug

#

in theory

#

let me double-check

#
Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1
#

^this is from navigator.userAgent

unkempt trellis
#

hmm ok

#

let me see if this is something other people on my team have run into in the past

magic estuary
#

amazing, thank you so much!

unkempt trellis
#

ok no luck so far

magic estuary
#

let me try that now!

#

yeah, that does seem to work

unkempt trellis
#

ok cool

#

do you have a request ID from that? or a payment intent, either works

#

just so i can sanity check it

#

but yeah this is leading me to think that this is a cypress specific question / problem

magic estuary
#

ye one sec

#

pi_3QwTMQIlR9VWnEGJ2T6fGH7G

earnest shellBOT
unkempt trellis
#

ok yep! i'm seeing Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1 on that one

#

so the good news is changing the user agent works, the bad news is that means it's something cypress specific that's going on here so we probably can't help you any further

magic estuary
#

hm, okay cool

#

one more question about this

#

is there a programmatic way of confirming / capturing an async payment?

azure mango
#

👋 solanum had to step away but I can help

magic estuary
#

hey hanzo!

#

all good

azure mango
#

is there a programmatic way of confirming / capturing an async payment?
you mean purely server-side?

magic estuary
#

yeah, exactly

#

like the programmatic equivalent of clicking "Authorize test payment" in the simulator UX

azure mango
#

Unfortunately, no.. I don't believe we have any automated way to simulate redirect based payment methods.

We typically recommend making a test payment in test mode and using that response to mock out your automated tests.

magic estuary
#

hm, okay. in this case, because I'm using stripe.js, what exactly should I be mocking for an end-to-end test? we have mocks for unit tests, but in this case I'm trying to get as close to real user behavior as possible

azure mango
#

Hmm instead of hitting Stripe's API endpoint, you could hit your own endpoint that returns a mocked json?

magic estuary
#

what endpoint does confirmCashappPayment hit?

azure mango
magic estuary
#

hm, okay. the problem is that when I mock that, the confirmCashappPayment function still loads the QR code UX in an iframe, instead of redirecting to the simulator page (like it does on mobile)

#

can I override that behavior somehow?

azure mango
#

Don't think so, I think that's just the default

magic estuary
#

hmm, okay

#

one more thing: do you know what this error means? IntegrationError: lightbox Element didn't mount normally.

#

there doesn't appear to be any additional context, and it only happens inside the cypress runner

azure mango
#

Not sure. Possibly some Stripe.js error about it detecting some abnormality with Elements object (given it's running in test suite env)

magic estuary
#

alright, cool. got it to work, thanks so much!