Better failure report in Jasmine headless webkit - jasmine

I've got a simple TypeError: 'undefined' is not an object failure when running a test in Jasmine headless webkit. But there is no hint in which file or line the error occurs. Is there a way to get a clearer failure message?

You can use the --runner-out flag to save the HTML from the test. Open this in a browser and you will see the full stacktrace.
jasmine-headless-webkit --runner-out ~/Desktop/jasmine-out.html

Try debug in Firebug (Firefox) or Google Chrome. Just press F12 and go to scripts pane. I suggest firebug. If that not help you can post your code here or, better, at http://jsfiddle.net

Related

Website Vitals: Oops! Something went wrong

Hello I am testing my website and I have an score of about 80-90/100 if I look it with Chrome Lighthouse Extension. But in web.dev/measure and https://pagespeed.web.dev
The report returns an error. There is no error in console and there is no indication on what error is. I opened network inspector to see what web.dev was returning and this is what it said:
Lighthouse returned error: NO_FCP. The page did not paint any content. Please ensure you keep the browser window in the foreground during the load and try again. (NO_FCP)
But this is not true, the website loads fast, and works if I check it with the CLI or the Chrome Extension.
Any ideas on how can I debug this to find what is causing this error?
Thanks

Web application written with Processing, using processing.js: how to debug?

I'm a newby in HTML, while I've some skill with Processing language.
I'm writing an application in Processing which I want to visualise in a local webpage.
I've a basic index.html, which upload my sketch and the file processing.js.
It works.
My problem is that sometimes, an application which runs with no proiblem using the Processing IDE, does not run in the webpage. I assume there are still some bugs in the porting from Processing to JavaScript.
What I would like to know is: is there some way to debug the webpage I try to visualise?
Just to seek "where" the webpage remains stuck! In this way I could bypass the problem!
For now, I'm using Firefox for html visualisation.
Thanks a lot, Valerio
Ops solved! I downloaded FireBug, an add-on for Firefox implementing a debugger.
Then I launched the debugger. It showed me immediately the error.
For curious people:
I declared an ArrayList called "foo_list", containing object "foo":
ArrayList<foo>foo_list
The above line does not produce any error in the Processing IDE.
However processing.js complains with it, the debugger displayng
the following message:
ReferenceError: ArrayListfoo_list" is not defined
The solution is to insert a blank space:
ArrayList<foo> foo_list;
This works! Maybe the error given to the parser
from Processing to JavaScript!
Bye!

Selenium Firefox 19 CSS Menu Click Not Working

Using Selenium, with an earlier combo of the webdriver (2.28.0) and Firefox (pre-19), the following code worked.
driver.get("http://www.haemonetics.com/en");
driver.findElement(By.linkText("LOGIN")).click();
driver.findElement(By.linkText("Haemonetics")).click();
With webdriver 2.31.0 and Firefox 19.0.2 the code does not work and I receive a NoSuchElementException for the second findElement.
I tried using xpath which doesn't work for Firefox but does work for Chrome and IE, which are part of the same test suite.
Any thoughts or another way to accomplish the same thing? I would prefer to use the same code for the mentioned browsers.
Not sure if it was a typo on your part, but it should be "find_element" instead of "findelement", at least it's so in 2.31 to my knowledge.
Try
driver.find_element_by_link_text("LOGIN")
if that doesn't work, post your HTML code so we can possibly construct a working Xpath.

Finding xPath in IE Dev tools similar to $x(xPathString) console function in Firebug

I am using with great success the $x console function in Firebug
usually i write in Firebug's console:
$x("//div/whatever my xpath string is")
Then i execute my console function and i get a result.
Does anybody know a similar function that can be used in IE Developer Tools?
http://code.google.com/p/fire-ie-selenium/ - Are you looking for some thing like this?

How do you log to Firebug from an extension?

I'm writing an extension for Firefox, and I need to log some data to Firebug's console. Within the scope of my addon, "console" is undefined, and "window.content.console" is also undefined. So how do I log to the console?
Since you're not writing Javascript that executes within a window, console is not defined.
So you need to reference the Firebug extension first:
Firebug.Console.log(str);
To log to the console from inside a firefox extension’s javascript:
Application.console.log("Hello from my Firefox Extension!");
As far as I know you can only do that if you are creating a JetPack Add-on. Normal debugging is done with Venkman from Mozilla at http://www.mozilla.org/projects/venkman/
Firebug console is associated with a particular page, so it wouldn't be very convenient even if you managed to log messages there. Did you try Chromebug? I didn't use it, but I would expect to find a similar console for extensions to use there.
You could also use the regular Error Console, although you won't get all the niceties Firebug's console provides. You could install Console^2 https://addons.mozilla.org/en-US/firefox/addon/1815 to make using the Error Console a little less painful.
If in your extension you have access to the content Window object, you can unwrap it, and call the console methods directly:
window.wrappedJSObject.console.log('something important');
There are contexts in which even the Firebug object is unknown, like if you're trying to call it from a sidebar... in which case you have to go all the way back to the original window to get the firebug object:
var Firebug = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow).Firebug;
You can then from within your sidebar call Firebug like so:
Firebug.Console.log("foo");
This is documented here: https://developer.mozilla.org/en/Code_snippets/Sidebar

Resources