cy.visit crashes without meaningfull messages - cypress

I'm new to cypress and I want to create tests for a rather oldfashioned website which is unfortunatelly not available on the internet.
When I perform a simple call to the website cypress crashes:
cy.visit('http://10.0.0.6:8080/dmc')
The message I get within the chromium instance is: "Whoops, there is no test to run. Choose a test to run from the desktop application."
Shortly before I get this message, I see some messages in red in the left chromium task-runner-pannel (sorry for not knowing the correct term). But the timespan is too short to read it.
So my questions are, any ideas why cypress is crashing? I know this may gonna be a tough one since the website is not accessable.
Can I find these "red-messages" somewhere else? eg a logfile?
BR,
Richard

Related

Firefox seems to fail on registering a ServiceWorker for Push Notifications?

Firefox seems to fail on registering a ServiceWorker for Push Notifications, with an error "InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable", but the code works in Chrome and Edge, and appears to be compliant with the examples online and the spec.
I've thrown an example up on one of my test sites, https://wiegandtech.net/ - visiting it in Chrome will prompt for permission and then opt-in successfully, sending the info to the server. But Firefox prompts, doesn't complete the registration, and doesn't fire any error or throw anything into the console. When I try to debug, it seems to never return from navigator.serviceWorker.ready.then call - I debug in and reg is undefined, even though the promise says it shouldn't be. I can find no reason why this is failing. I do see in Fiddler that FF gets the worker file, so it appears to be starting the call, but never finishing? The worker is valid JavaScript, as far as I can tell. Does anyone have any documentation on how Firefox's implementation is different from Chrome's/the spec?
Firefox requires the ServiceWorker's URL to end in .js - I was using an ASP.Net site and returning javascript but through my own controller. When I just give it the URL for the .js file itself, it now works. Would file a bug, but too non-trivial to setup a site given that ServiceWorkers require a real life site to troubleshoot, and their source code doesn't appear to be on github.

CRM online plugin fails to execute the same way as when debugged

I've just finished writing a plugin for crm online, and am now running into a curious problem.
When I run the plugin through the debugger I get the expected results, but when I let the plugin run on its own it fails to run as expected.
In this plugin, I'm listening to the create event for new queueitems and I'm checking to see if the queueitm is an email. Everything up to this point is running as expected, however when after getting an email I check to see if the email has an attachment and here's when things start deviating. Through the debugger I can see the attachment file, but on its own, the plugin can't find the attachment. This is very odd to me because I can see the email in the queue and there's definitely an attachment there.
What would cause this to happen, why does it happen and is this a common problem?
Bit of guess.
There is a timing issue, when you debug and that timing issue isn't apparent because you have artificially slowed the application down.
I'm guessing your plugin is sync, and things are happening like this.
In Execution
Email created.
Thread starts to add attachment to email.
Your plugin runs, and finds no attachment.
Thread adds attachment and finishes.
In Debugging
Email created.
Thread starts to add attachment to email.
Your plugin runs, and goes to breakpoint.
Thread adds attachment and finishes.
You inspect the property and find the attachment.
Given that the email and email attachment are separate database tables this seems like a good shout, CRM may be making the two create calls separately.
Ways to test this theory
Make your plugin async.
Add a Thread.Sleep into your code (no more than 2 minutes, a minute should be fine).
Find another place or step to register your plugin.
Stick a plugin on the email attachment create which throws an exception to see what order things happen in.
If my theory turns out to be true, the best resolution is to probably find another way to register your plugin.

Chromecast sample sender application CastHelloText-chrome ends with error when trying to get session

I have problem with launching Google-Cast application similar to sample CastHelloText-chrome. I slightly modified example code for my specific purposes. The goal for creating this application is to send and show image data directly in Chromecast device.
Particularly the difference between official sample and my code is in message format and its content, sent by sender application. Sender application took png image coded by base64 and send through message bus with custom namespace. Receiver application get this message and use this as data source for html object <img>.
Error appears when I do this steps:
Reload sender page, checking console if any device found.
Send the form by just pushing enter on input box (text is ignored).
Now a popup from Chromecast extension shows. Next there are two scenarios:
3a) I confirm casting to device by choosing one from the list, then I get this error message in console:
onError: {"code":"channel_error","description":"Error: Timeout","details":null}
3b) I just click somewhere else, I get this error:
onError: {"code":"cancel","description":"User closed popup menu","details":null}
Both of errors are caused by calling function chrome.cast.requestSession in chromehellotext.html at line 161, but what's really wrong I don't know.
When I step sender script I realize that function sessionListener is never called. I know that something go wrong when code try to call chrome.cast.requestSession, where described error raises. So I need help if I missed about right way to use Google-Cast API or If this problem has something to do with networking issues.
Receiver application is registered on Google Cast SDK Developer Console and I'm testing on registered device with some serial number. I'm using Google Chrome in version 42.0.2300.2 canary (64-bit) and Chrome version 40.0.2214.111 (current stable I suppose). For testing I also tried to turn off Windows Firewall entirely but with no luck.
Edit:
There were some syntactic errors that caused error message described above.
It seems like you are trying to use the data/control channel to send an image; please don't do that; that channel is not meant to be used for large data communications; in fact it cannot send anything which approaches or exceeds 64k. If your goal is to send images from your local machine, you would need to run a local web server on your local machine and serve images through the web server.
For and easiest tutorial you can have a look to this tutorial.
It is well explained in this tutorial.
Chromecast Sender application
There is no need to maintain session by yourself.
just add button and enjoy casting
mCastManager.addMediaRouterButton(mediaRoutebtn);
I found a source of my problem. There was something wrong in receiver code - syntactic and runtime errors, so I must admit that my code wasn't functional. Now its working in terms of launching application and getting session.
Unfortunate thing is that the error message generated by Chromecast extension didn't match the actual error - at least it was a bit confusing when I didn't know what's really happening on receiver side without ability to debug the code.

How to continue a Cucumber step after an unpredictable modal dialog pops up?

I have a Ruby and Watir-webdriver -based Cucumber test suite for a web application and that web application relies on a service to provide some of its data through a sort of search.
There's a lot of data in this external service and sometimes the search will take a long time. When this happens, a modal dialog pops up on the web application. We really can't predict when that will happen and it isn't very practical to throw in browser.alert.ok calls throughout all of my step definitions.
So far, we've been handling the issue with an After hook that simply drops and restarts the browser. This saves the test suite during our full runs, but it doesn't help the test in question.
Long story short, I'd like a way to simply catch the Selenium::WebDriver::Error::UnhandledAlertError exception (the associated message is "Modal dialog present") whenever it pops up in a step, recognize what's happening (probably by matching the exception type and text, then matching the modal dialog text), and continue the step from the line we were at when the exception caused the interruption. Any thoughts?
I think you just need something like:
step /^some code$/ do
begin
#Your actual step
end
rescue
browser.alert.ok
next
end
I encountered a similar problem in my project, where I used to get random fatal error dialogs.
The approach I followed is to handle the dialog in AfterStep hook. Since in cucumber every step is atomic, after every step I verify whether the fatal error dialog is present. If it is there then click OK and proceed with the execution.
Hope this helps for you.

Chrome XmlHttpRequest Hanging

When I make a XmlHttpRequest (via jQuery's $.ajax) to a particular URL, my Chrome consistently hangs every time with a status on the request of 'Pending'.
After that Chrome must be closed ie. forcibly from Task Manager, and it exhibits general signs of mayhem such as the Cookies and Scripts tabs being empty when they were full of normal looking data immediately prior.
This is odd because (a) my coworkers, running a seemingly identical everything, have no such problems; (b) I have been using Chrome to run this code (our company's JavaScript app) for many months and this just started happening for no apparent reason.
I checked out the Apache logs, they appear to be processing the request normally and to completion, but Chrome never sees the reply, apparently.
A couple of other clarifications: prior to the failure, the same Chrome and Apache return a truckload of JS and image files normally, eg., things seem to be fine right up until they aren't. The request is not particularly large (a few hundred bytes in and out) or complex in any obvious way.
If anybody can give me some hints of where to look, I'd be grateful!
I'm experiencing similar behavior with slightly different symptoms. My ajax requests work fine, every second request up to 6 requests, then they all start failing (same url as when working, same payload, etc), but in my case they're not even hitting the server, just stuck in "Pending" in Inspector.
I dont have an answer for you, but to help debug, have you tried chromes net-internals?
Point your browser at:
chrome://net-internals/#sockets
and/or
chrome://net-internals/#events
I see my requests in #sockets go into "active", but never come back, and in #events I can see that the request stalls after the HOST_RESOLVER_IMPL_REQUEST stage.
I'm thinking it could be a resource issue caused by not properly ending the request, but thats just pure speculation.

Resources