CFSelenium Now Compatible With ColdFusion 7 and 8

CFML , ColdFusion , Selenium No Comments »

A few weeks ago, Bob Silverberg released his latest open-source project, CFSelenium.  For those who don't know about the project, a little background:  Selenium is a tool suite for testing web pages.  The most well-known member of the Selenium product family is Selenium IDE, a Firefox plugin that lets you record the actions performed on a web page (or a series of connected web pages) and the results of those actions.  You can then use the recording (stored as a series of commands) to redo those steps whenever you need to test the page or pages after making changes.  Another member of the Selenium product family is Selenium Server (formerly called Selenium-RC), which is a small, Java-based server that can run scripts comprised of Selenium commands in multiple browsers, allowing you to conduct the same kinds of tests recorded by Selenium IDE in browsers other than Firefox:  a great way to test web page functionality across multiple browsers.

In creating CFSelenium, Bob made it possible (easy, in fact) to create and run Selenium Server scripts using ColdFusion 9, and created a plugin for Selenium IDE that would output the recording statements in CFSelenium format within MXUnit test case functions.

Bob wrote CFSelenium in ColdFusion 9-compatible cfscript, and after he announced the project a few folks inquired about the possibility of having a version written in tag-based CFML.  On somewhat of a whim, I decided to take on that task, and ended up with a tag-based version of Bob's original selenium.cfc file that is compatible with both ColdFusion 7 and ColdFusion 8, as well as a few test files that run against the tag-based version.

Bob has now incorporated my tag-based version and my test files into the CFSelenium project, and we've agreed that I will maintain the tag-based version while he maintains the CF9 script verison.  You can download CFSelenium from either RIAForge (http://cfselenium.riaforge.org/) or from GitHub (https://github.com/bobsilverberg/CFSelenium).  For more about Selenium in general, I'd suggest reading Bob's blog post announcing CFSelenium as well as the Selenium website.

So if you're a developer whose responsibilities include cross-browser testing of your web pages, you should really check out CFSelenium.

CFQuickDocs Lookup Extension for ColdFusion Builder Updated

ColdFusion Builder No Comments »

After using ColdFusion Builder 2's new option that allows extension UIs to appear in an Eclipse view window (rather than a modal window) to create my CF Builder 2 Shortcut Keys extension, I decided to revisit the CFQuickDocs Lookup extension I built for the original ColdFusion Builder.  I've made a couple of improvements:

  • Like my shortcut keys extension, it now opens up the CFQuickDocs site in an Eclipse view instead of a modal window, which makes it a lot more useful as a reference guide since you can go back and forth between it and the editor window and it stays open until you close it or quit Eclipse.

  • You can now call up the extension in two ways.

    • As before, you can right-click in the Navigator view, choose "Open CFQuickDocs" from the context menu, and type in the tag/function you want to look up in the dialog box.

    • If the tag/function is already in your code in the editor view, you can highlight it and right-click to bring up the "Open CFQuickDocs" option in the editor context view to look it up.

  • The extension auto-detects what version of ColdFusion you're running on your local machine in order to pull up the correct set of documentation on the CFQuickDocs site (ColdFusion 7, 8, or 9). This should be particularly useful to those developers still running 7 or 8 since the CFML language documentation built into ColdFusion Builder focuses on ColdFusion 9.

I'll conclude by thanking Jake Munson for creating and maintaining the CFQuickDocs website, which has been a valuable resource for me over the years.

Things To Know About Creating Multiple jQuery UI Datepicker Widgets on the Fly

JavaScript , jQuery No Comments »

The first time I created a UI where users could create new jQuery UI Datepicker widgets on the web page as needed, I thought about blogging about some of the "gotchas" I ran into trying to do that, but never got around to it.

But after today, when I had to relearn those lessons, I figured I should write something down.  :)

Here's what I've observed about creating new (multiple) Datepicker widgets on the fly:

  • Cloning a text field that already has the Datepicker applied to it won't work.  You're better off either cloning a "plain" text input element (<input type="text">) or creating one from scratch when you need it.

  • If there's any chance that you're going to end up with multiple Datepicker widgets on the page, you need to make sure that each Datepicker-powered text element ends up with a unique value in the "id" attribute.  Otherwise, the user will click on a date on the pop-up calendar for the most recently-added Datepicker widget, but it'll change the text box value of the first Datepicker widget you added!

    One way to address this is to add a global numeric variable at the top of your Javascript block, increment it every time you want to add a new Datepicker, and combine the current value of that variable with some text and assign that as the id of the text element you're about to add as a Datepicker.

  • Do not invoke the datepicker() function (the function that turns the text field into a Datepicker widget) on the new text input element until after it has been added to the page:  clone or create your text input first, place it in the page using prepend(), append(), whatever, and then invoke the datepicker() function on it.

  • If you need to remove one of the Datepicker widgets, use the datepicker("destroy") method on it.

ColdFusion Builder 2 Extension That List Keyboard Shortcuts in an Eclipse View Panel

ColdFusion Builder 2 Comments »

Last night, I posted a simple ColdFusion Builder 2 extension that, when activated, creates an Eclipse view that lists all of the defaut Builder-specific keyboard shortcuts in the current ColdFusion Builder 2 beta.  You can get it from RIAForge at http://cfbshortcutkeys.riaforge.org/.

I created this extension using Sagar Ganatra's list of CF Builder 2 keyboard shortcuts and by looking at how Ray Camden altered the VarScoper extension to display in an Eclipse view (see http://www.adobe.com/devnet/coldfusion/articles/cfb2-extensions.html).  The ability to display extension UIs in an Eclipse view (a movable windowed component, like the built-in Navigator or Outline views) rather than a modal window is a wonderful enhancement in Builder 2.

A few notes about the extension:

  • When you open the extension view, you have to click on either the Windows or Mac link to display the proper shortcut list (although the only difference in the shortcuts is that you use either the Ctrl key or the Cmd key).  If there's a way to detect the user's OS automatically, I haven't found it yet (cgi.http_user_agent wasn't useful in this regard).

  • It is a static list of the shortcut defaults as they are shipped in Builder 2.  If you change one of these shortcuts in your preferences, the change WILL NOT be reflected in the list.  I looked around to see if the default keyboard shorcuts were stored in a readable file somewhere that the extension could examine and parse, but it looks like that isn't the case:  user-defined and user-modified shortcuts are written to certain configuration files, but the default shortcuts are not exposed in that manner (if someone knows differently, speak up).

  • However, the advantage to it being a static list is that you can go ahead and customize the list in your copy of the extension.  If you pay attention to where the extension files are copied to when you install the extension, it's easy enough to go to that location, find the extension folder, and edit the index.cfm file in the extension.  It's a simple file, so it's easy to edit.

Hopefully this extension will be useful to folks who are trying to learn the new shortcuts, as you can use it to put the list right next to your editor window as you work.

UPDATE: per Sam Farmer's suggestion in the comments (thanks, Sam!), I've updated the shortcut to do OS detection using the os.name variable value in the server scope.

Twitter-Style Summary of Today's ColdFusion Builder 2 Sneak Peek Preso

ColdFusion Builder 1 Comment »

Thanks to a timely reminder on Twitter by both Henry Ho and Ray Camden, I tuned into the Connect preso given by Josh Adams today on some of the features coming in ColdFusion Builder 2, and got to watch all but ten minutes of it (when I had to take a client call).

Soon after the preso was over, John Farrar sent out a tweet asking about what was covered in the preso. I ended up responding to him with several Twitter DMs, which I thought I'd share:

  • Smarter code assist for one, see

  • Ability to download and install RIAForge-hosted CF Builder extensions right from a list on CFBuilder startup page in IDE.

  • Ability to define a code formatting style. Example: set style such that when you hit enter after a <cfloop> tag, next line auto-indent

  • Code block shortcuts: put cursor in </cfloop>, hit key combo to either jump to matching <cfloop> or highlight whole <cfloop>

  • Persistent code folding: you fold up block of code in file, close then reopen file, and editor will refold that block after a moment.

  • Smart autosuggest: put "a" in var, start typing math function. When IDE suggests vars for function, ignores var with inappropriate data.

  • Smarter tag autocomplete: start typing <cfloop>, select item from attribute choices, will add required collection attribute.