Chrome extension testing - google-chrome

Does anyone have experience with Chrome extension testing?
For example:
I want to create an extension that uses the
popup browser action, and automate a test case that checks the
behavior of the popup when clicked.[chromium issue]
Perhaps you could use selenium (it would be really great if this is possible).

Have you considered using a general purpose GUI-testing tool? If you are looking for a free, basic solution, check out Sikuli. There is a bunch of similar tools out there.

I've gotten some mileage using protractor to navigate to the url for the popup and running tests on it as if it were a regular page.

Related

Creating a chrome extension with web application features

I just started learning how to build a basic chrome extension. I see many chrome extensions which have extensive functionality like a full fledged web app. For example, when I click on a particular chrome extension, it opens a new tab with a URL chrome-extension://gibberish/filename.html. This page functions like a complete web app. Here is an example chrome extension which does image compression:
From my research, it looks like a combination of chrome extension development bundled with NodeJs. But, I am unable to find enough information about this to find a course to learn myself. If I had to develop a similar application, where do I start? Can any web application be transformed into a chrome extension or is there a specific way to go about it?
Any guidance will be much appreciated. Thanks in advance.

Google Chrome extensions interaction with Native Client Applications

Is it possible to write a Chrome Extension that will interact with a Native Client application?
I use Irssi through the NaCl Secure Shell application, and I would like to write an extension that simply looks for plain URLs and makes them clickable links.
I'm seeing some strange behavior with extensions and NaCl applications, so I wanted to know if this is something that is even possible.
Additionally, if anyone has a more elegant solution to this, please don't hesitate to let me know.
Thanks!
The fact that the NaCl Secure Shell app uses Native Client under the hood shouldn't matter; the page is rendered using standard HTML.
The documentation for Chrome Extensions here says you should be able to inject content scripts into pages with the chrome-extension scheme. I tried it, but it doesn't work. It seems the documentation is incorrect. See http://crbug.com/153245.
As far as I can tell, it is not possible to modify an extension this way. It is possible to communicate with other extensions/apps (see here), but it seems that the application must expose an API to communicate with.
Secure Shell supports clicking links now via Ctrl+Click. it will support OSC+8 in a future release.

Possible to mirror iOS Safari Debug Console on a Mac, PC, or other device?

All,
I'm working on an HTML-based web app (i.e., not native app) targeted for iPhones.
I typically use Safari's Debug Console to track down JavaScript errors; it's pretty handy.
However, when I'm working on some complex JavaScript function - it's incredibly tedious to switch back and forth between the web app and the console window. Also, there are times when I'd like to see BOTH the window and the app at the same time, so I could see console messages WHILE I'm interacting with the app.
So - is it possible to "mirror" the Debug Console to another device, or too a Mac or PC?
In other words - I'd like to be able to use a web app (or web page) on my iPhone, and have the output from console.log() (or .warn() or .error() or .info()) show up in a window on my development machine.
Adobe has something called Shadow (http://labs.adobe.com/technologies/shadow/) that looks like it does something close:
AdobeĀ® Shadow is a new inspection and preview tool that allows
front-end web developers and designers to work faster and more
efficiently by streamlining the preview process, making it easier to
customize websites for mobile devices.
... but it's not quite what I'm looking for. (At least, it doesn't sound like it from the description).
Sorry in advance - I'm pretty new to this type of development, so I'm probably unaware of some tool that everyone else knows.
Either way - thanks for any pointers.
jsconsole.com can do this. Read http://jsconsole.com/remote-debugging.html for more info.
http://youtu.be/Y219Ziuipvc shows you how to do it.
weinre does exactly what you're wanting. Their docs are reasonably thorough so I'll let them tell what you need to do to get it running.
PhoneGap actually offer a mobile web app debugging tool that is powered by weinre and is a cinch to set up so you might want to check that out first.

How can I develop a Google Chrome extension without constantly repacking it?

I remember reading about a way to develop a Google Chrome extension without constantly repacking it. In Firefox this is done by creating a soft link between the extensions directory and where your development directory is. I've forgotten the method to do this with Google Chrome and can't seem to find it when searching.
Also, if you know the answer to this question you've probably done some Chrome extension development, so I'll ask (as a bonus), what are the most valuable tools for developing a chrome extension - the ones that just make your life so much easier?
ps: The developer tools look nice. How can I log things inside a script (console.log?) and where do I see that output? Doesn't seem to be showing up here:
Enable developer mode on chrome://settings/extensions and hit load unpacked extension.
The most valuable tool for me is the build in developer tools.

Using Java/Python libraries in programming Firefox/Chrome Extensions

I have an idea of studying user behavior on the browser, for which I intend to make a Chrome/Firefox extension to study the behavior dynamically. I have some predefined libraries in Java and Python to analyze the results, which will be impossible to program in plain JavaScript.
Now for my question: is it possible to use third party libraries, especially those of Python or Java like plain function calls?
I have a vague idea about something like Java XPCOM or PyXPCOM for Firefox. However, for a beginner, it all looks so scary. I started making Add-On for Firefox, but got lost somewhere in the huge API.
I found Programming Chrome extensions easier than Firefox, but I couldn't come across something similar to XPCOM in Chrome.
How can I decide which one to go for?
Chrome - seems easy but I am not sure of its power.
Firefox - Seems powerful, but is it really possible to use any Java/Python Library?
Additionally, I came across this link that may be useful: How does someone use thirdparty libraries to be included in Firefox addons/extensions?
But seems like it mostly talks about C++ and XPCOM.
I have a vague idea about something like Java XPCOM or PyXPCOM for Firefox. But for a beginner, it all looks so scary.
I am not a beginner and JavaXPCOM/PyXPCOM are very scary (in addition to being barely maintained). As Firefox goes, it should be much easier to wrap your Java/Python library in an application and run it as an external process: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIProcess. Note that you cannot get data back (other than an exit code) so the application should write it to a file that you can then read in your Firefox extension. Not very elegant but it has the advantage of being doable.
As to Chrome, its extensions run in a sandbox and using Java or Python isn't possible. Only option is adding an NPAPI plugin to your extension. It is binary code meaning that it could do anything.
When writing Chrome extensions, you're limited to JavaScript unless you choose to use an NPAPI plugin, which lets you do pretty much anything, but is not recommended.
The other approach you could take is to implement your Java or Python code on the server and make requests from the chrome extension's JavaScript.