Open mokone91 opened 7 years ago
Confirmed. This is also happening to me as well.
Hi, I also confirm the issue and I'm investingating it in the moment.
I think it's related to https://github.com/electron/electron/issues/1731 but it seems highly unusual that testcafe would be ending the nightmare session instead of just changing the URL.
We've found that Nightmare performs some modifications with native dialogs (including beforeUnload) in their preload.js script. It breaks TestCafe behavior in some cases. We will find a way to fix it
I have also encountered this problem. My app need to store token into localStorage. But the localStorage is clear after navigate to other page.
@AlexanderMoskovkin : have you fixed it?
I'm going to fix it in the next release (about 3-4 weeks likely).
@AndreyBelym Have you fixed it? If you don't have time, you can give me the guideline to do it?
Hello @tuanquynet, unfortunately I haven't had time to work out this. It will be really awesome if you handle this.
The default preload script needs to be modified. Mocks on beforeunload
, unload
events and on alert
, prompt
, confirm
functions must be deleted, TestCafe have it's own mock to deal with this events and functions. Then the customized script should be passed to Nightmare in the provider code.
@AndreyBelym Ok, Let me try.
@AlexanderMoskovkin Have you fixed it?
@AndreyBelym, @AlexanderMoskovkin : I have figured out the root cause. The problem come from nightmare at this line https://github.com/segmentio/nightmare/blob/master/lib/preload.js#L13 It work for me if I comment out the block of code from line 13 to 18. I will ask author of nightmare if we can remove that block of code.
any fix for this issue
Hi,
I use testcafe-browser-provider-nightmare for headless testing on staging env, and seems nightmare lose localStorage data when navigateTo() method is called.
My project use it to store auth token, so if i try to navigate somewhere using navigateTo - i get anonymous user.
Thanks!