Testing CoffeeScript apps with Selenium
This blog entry describes how to write functional tests for CoffeeScript web apps using Selenium. By way of example I’ll describe how I added Selenium tests to the Routeless Backbone Contacts tutorial app and automated it’s execution with a Cakefile.
The source is on Github, the tests described in this post are at the 3.0 tag.
Unit testing frameworks such as QUnit work well for testing libraries, APIs and computational logic but fall short when it comes to testing user interface intensive browser applications, this is where Selenium comes in. The Selenium IDE provides an easy way to functionally test an application user interface in a real browser with exactly the same mouse and keyboard input that a user would enter.
At it’s core “Selenium automates browsers” with a macro-like scripting language called Selenese and a Firefox IDE for recording and playing Selenese scripts. Selenium tests the actual user interface so you record your tests after the user interface has been implemented.
The primary purpose of functional user interface tests is to catch future user interface regressions. The likelihood of user interface regressions at each release increases with the size of the application.
Selenese
Selenese is the Selenium IDE scripting language, it is surprisingly powerful:
- Variables can be stored and manipulated.
- You can run JavaScript snippets with the runScript and waitForCondition commands.
- The Selenese native format is an HTML table but it can also be exported to languages with Selenium binding (Python, Java, C#).
Requisites
To use the Selenium IDE you will need to install:
- The Firefox web browser.
- The Selenium IDE. Once installed you open the IDE with the Firefox Tools->Selenium IDE menu command.
- I also installed the Highlight Elements IDE plugin.
This post is based on Firefox 7.0.1 (Ubuntu) with Selenium IDE 1.3.0.
Creating a test
Creating a Selenese test script is a two step process:
- Record a sequence of user interface interactions (mouse and keyboard inputs).
- Add asserts and verifications to the test sequence. This is the step that transforms the browser automation sequence into a test.
The Selenium IDE documentation also explains how to run, save and edit tests.
Here’s the test for the tutorial application.
Note: To run the tests you will need to open the application in a web server (file based URLs won’t work). I use the Mongoose web server for app testing.
Mongoose web server
The Mongoose web server is a neat little configurationless cross-platform web server that’s ideal for testing web apps.
To install Mongoose on Linux:
Unpack and make the source distribution:
tar -xzf mongoose-3.0.tgz cd mongoose make linux
Copy the mongoose executable to somewhere in your PATH.
To use:
Change to your app directory.
Run mongoose:
mongoose [-i <index-files>]
Open your browser at localhost:8080, if an index file exists it will be displayed else you’ll be presented with a file browser interface.
Running tests from the command-line
There’s no easy way to open the Selenium IDE and get it to execute a test from the command-line (at least I couldn’t find one), but you can export the tests to Python (or Java or C#) and then run them from the command-line. Apparently a JavaScript driver is in the works but not here yet, so I opted for Python.
I like being able to run Python tests from the command-line but I prefer developing the tests using the IDE. Keeping both in sync can be a challenge but being able to copy commands from the Selenium IDE to the Python source is a real help (set the IDE Options->Clipboard Format->Python 2 (WebDriver) option and you will be able to copy-and-paste IDE commands as Python code).
In addition to the Selenium IDE you will need to install the Python bindings for Selenium:
sudo pip install selenium
Now export the test from the Selenium IDE to a Python test file using the IDE File->Export Test Case As->Python 2 (WebDriver) menu command.
The exported Python scripts make use of the Python unit testing framework.
Export anomalies and omissions
The export of Selenese to Python is not perfect, here are some of the manual edits I had to do:
Replace:
# ERROR: Caught exception [ERROR: Unsupported command [getConfirmation]]
with this:driver.switch_to_alert().accept()
. See also the Selenium FAQ.Moved the focus from the search box to fire the search box change event (used click command as focus is not supported by Python WebDriver API):
driver.find_element_by_css_selector("input.search").send_keys("sm") driver.find_element_by_name("name").click() # Fire search 'change' event.
See Dynamic UI controls below.
Here’s the Python test for the tutorial.
Dynamic user interface controls
Incremental search boxes and auto-completing drop-down lists typically emit keystroke events (up/down/press) to dynamically update other elements in response to user keyboard entry. The Selenese type command will not work in this situation.
- The typeKeys command is designed for these situations but I was unable to get it to work.
- Nor did the fireEvent command on keyup work.
The only reliable work-around I could find for testing the incremental Search was to add the change event to the search box and use:
driver.find_element_by_css_selector("input.search").send_keys("sm")
driver.find_element_by_name("name").click()
The click command moves the focus from the search box to trigger a search box DOM change event.
Setup and Teardown
At the start of testing you will typically create test fixtures to put the application in a known state. For data oriented apps this means means populating the database with fixed data, the Routeless Backbone Contacts application has built-in Clear All and Import Data commands that serve this purpose.
Built-in data fixture commands are not normally part of an application but there’s no reason not to implement hidden or debug only fixture commands. Alternatively, if you have moved exclusively to Python scripts for Selenium testing then, you could setup and teardown fixtures in the traditional fashion using Python unittest class and module fixtures.
Cakefile automation
The Routeless Backbone Contacts application is written in CoffeeScript so it made sense to automate the tests with a Cakefile. Because cake runs under Node.js you have a wealth of modules available.
The tutorial Cakefile implements two tasks:
cake server
Start the Mongoose server.
cake test
Run the Python Selenium test.
Cakefile
{exec,spawn} = require 'child_process'
task 'server', 'Start mongoose server', ->
console.log 'starting mongoose web server...'
server = spawn 'mongoose', [],
customFds: [process.stdin, process.stdout, process.stderr]
process.exit()
task 'test', 'Run tests', ->
console.log 'starting mongoose web server...'
server = spawn 'mongoose'
console.log 'starting tests...'
exec 'python test/test.py', (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
server.kill() # and exit cake.


Users will rate each priority listed based on how much they value it. Each priority is represented by a circle and should have an icon assigned.
They can then see how different mechanisms will impact their priorities and read text about how each priority is affected by each mechanism.
Each general mechanism can have a number of specific actions. For example a mechanism 'Build more roads' could have these actions assigned:
When playing the game, users are given a fixed number of coins and asked to choose how they would allocate them. Each action is assigned a certain number of coins to indicate relative expense. Some may cost nothing.
Each column represents a particular number of coins. Add new action columns to represent a different number of coins.
In addition to cost, each action is given a multiplier to indicate how effective it is in achieving the goals of the mechanism. This multiplier is applied to the scores for each priority (both positive and negative).


3idroid
FEE RECEIPT
Receipt Number: aaa
Date: aaaa
Received From :
Received From :
Received From :
For Payment :
Payment Received In :
- Cash
- Cheque
- Online
Received By:
Authorized Signaturoy
Receipt Number: aaa
Date: aaaa
Received From :
Received From :
Received From :
For Payment :
Payment Received In :
Received By:
Authorized Signaturoy


Prague
Learn more about Prague and the conference venues! To make your stay as comfortable as possible, we prepared a couple of useful tips for you.
General Information
Is Prague safe? Petty theft is a problem, especially in major tourist areas in Prague. Pickpocketing is common at busy places and on public transport. Except for that, Prague is extremely safe compared to other European capital cities.
If anything goes wrong call the emergency number 112.
Is Prague friendly? It is, just remember that people might not be used to speaking foreign languages. Saying “nerozumeem” is the simplest way of telling them you don’t understand Czech.
How should I move around the town? Prague has an excellent system of public transport, which includes three lines of metro trains, trams, buses and ferries. If you're into biking, check local bikesharing Rekola or global ofo service. While Uber is available in Prague, the Liftago app provides a very similar experience.
With a Czech SIM card, you can use SMS tickets, otherwise you need to buy paper ones in yellow ticket machines. During the conference you should be okay with regular 30 min tickets for 24 CZK. Zone P includes everything you need, even the airport area.
At night, there is a different, limited system of public transport and metro is completely out of order. The last train leaves just after midnight. Trams and buses operate through the whole night. Depending on your route, it still might be okay to take public transport, but calling Uber or Liftago is usually less tiring.
Venues
MeetFactory (main venue)
The main conference venue is MeetFactory, a cultural hub founded by a famous Czech sculptor David Černý. It’s a unique, industrial space squeezed between a motorway and an active railroad.
How to get there: From the city center, take trams 4, 5, 12 or 20 to Lihovar. Follow the sidewalk to the right, cross over the bridge, turn at the first right and keep walking straight. Seems complicated? Just follow our navigation from the tram stop.
Address: Ke Sklárně 3213/15, Praha 5
GPS: 50.0532481N, 14.4082011E
Around venue: If you’re into hiking, be sure to check out an excellent restaurant Na kopci ($$$) on the top of a nearby hill. Serbian restaurant Jelica ($$) is also highly recommendable.
FIT ČVUT (workshops)
Workshops will be held at the Faculty of Information Technology of the Czech Technical University in Prague.
How to get there: take green metro A to Dejvická and then walk the Technická St. Another option is to arrive at Thákurova stop (many trams and buses) and walk the Thákurova St.
Address: Thákurova 9, Praha 6
GPS: 50.1050400N, 14.3896428E
Around venue: For food, pay a visit to AvantGarde ($$$) or to Bistro Santinka ($$). A rather short walk towards the Hradčanská metro stop can take you to a world of hip bistros and coffee places (Místo, Café Záhorský, a Table!).
Alternative activites
Prague is a very lively place, especially in June. During the conference days there will be multiple alternative activities you can attend:
- 25th May - 2nd June: Fringe festival a heady mix of theatre, comedy, music, dance, storytelling and good times at venues across the Malá Strana district of Prague - the annual Fringe Festival extravaganza is an experience you will never forget.
- 27th May - 2nd June: Khamoro festival Khamoro (which means sun in the Roma language) is the largest and most famous professional Roma festival in the world. The festival, which has been organized by the NGO Slovo 21 in Prague since 1999, regularly organizes unique Roma band concerts consisting of groups from all over the world, as well as putting on exhibitions, film events, dance workshops, specialized seminars and conferences.
Looking for something else? You can check a live list concerts, festivals, exhibitions and more on GoOut.net (English). Not all activities are listed on GoOut as it serves as a ticket seller, so for a more comprehensive list check Radio1 site for June 1st, June 2nd and June 3rd. (Unfortunately in Czech only; here are some words in Czech you might need to understand: Koncerty = Concerts, Tančírny = Dancehalls, Filmy = Movies, Galerie = Galleries, Divadla = Theatres, Festivaly = Festivals.)
Honest Guide to Prague
When it comes to mainstream tourism, Prague can be full of traps. Watching the Honest Guide is not only the easiest way for you to avoid them and to get the most useful tips about just anything, but it’s also fun to watch!
How to get to Prague?
Flight
Fly to PRG, Vaclav Havel Airport. To get to the city, use
- Uber or Liftago.
- Airport Express bus to the main railway station (50 CZK). It’s fast and convenient. Be sure to have change, because unfortunately, the bus driver may not board you otherwise.
- public transport buses to Zličín (yellow B metro line) or Nádraží Veleslavín (green A metro line) terminals.
Train
- There are direct trains to Prague from many destinations all around Europe. Use the DB train search to see what’s possible.
- The main train station is called “Praha hlavní nádraží” or “Praha hl. n.”.
Bus
- There are direct buses to Prague from many destinations all around Europe.
- Main carriers: RegioJet, LeoExpress, Tourbus, EuroLines, FlixBus.
- The main bus station is called “autobusové nádraží Florenc” or just “Florenc”.
Car
- Check out Czech driving regulations.
- Highway sticker costs 310 CZK (10 days) and can be bought at any gas station.
- D1 highway segment Prague–Brno is under complete reconstruction. Expect detours and traffic jams. (Bus companies constantly monitor the situation and have strategies to avoid delays.)
Accommodation tips
Both Airbnb and Booking.com are at your service in Prague. For adventurous minds, there’s always also CouchSurfing.
Look for accommodation around Anděl or Smíchovské nádraží to get the best connection with both the conference venue and the rest of the city. Both places have access to the yellow metro B as well as bus/tram connections to the venue.
The Czech Republic
Never been to the Czech Republic? Here’s some practical info:
- We pay with CZK (abbr. Kč, “koruna”). ATMs are omnipresent. There are money exchange booths in the city center, which offer better deals than banks and no fees, but be cautious which you choose. The exchange rate is approx. 1 EUR = 25 CZK. Cards are accepted in chains and larger places, but not so often in smaller shops, coffee places, pubs. It’s useful to carry around some cash.
- We speak Czech and understand Slovak perfectly. English should be well understood, especially among younger generations. German can work as a fallback, as well as any other Slavic language.
- While June is usually sunny and can bring very warm days to Prague, it’s good to be also ready for chilly, rainy days. It can be 30°C with clear blue sky as well as 15°C with heavy, London-like rain.
- We use 230 V electric plugs, type E power sockets.


Login an logout the system
Before you can use the SimpleEPT, you must login in to the system first.
The functions you have depend on the roles you have in the system.
So you may see different navigation menu in the left side when you login with different id.
Login the system
Open your favorite browser (IE, or Firefox or Chrome etc), type the following url in the address bar:
http://www.simplecompli.com/ept/index.html
(replace the www.simplecompli.com with your own domain name, ept with your own context name)
You will see the login dialog, as follows:
Type username and password, and then click on Login button
Logout the system
Click the Log out link to log out of the system.
If the user idles for 10 minutes, a warning dialog will pop up informing the user that the session will timeout within 5 minutes.
Click the Yes button to stay connected or the No button to log off right away.
The system will log off after 5 minutes if no action is taken.
General Tips
- Select any menu item in the left side navigation menu to open a new tab in the center panel.
If the tab has already been opened, it will be selected
- Tables: Select the header column of the table to sort the data on the column (if the column is sort-able).
Right click the table header column to show a popup menu, allowing the user to hide/show the columns.
- Select a row (by click on the row) in the table to update the details panel in the south side of the page.
- If the table is updatable, double click on the select row to open a new tab,
allowing user to update/delete the record in the center panel.
If the tab has already been opened, it will be selected
- When the user is in the Create New Tab or Update/Delete Tab, other tabs are disable.
The user has to click the Cancel, Create or Save button to switch to other tabs.
- Any changes(add/modify/delete) will also be recorded in the respective history table
and can be retrieved via respective history function.
- The search and search result can be in the same tab or separate tabs; this is configurable.


--- # jekyll prompt ---
This profile sets expectations for use of the AllergyIntolerance resource to record allergies/adverse events associated with a patient within the DAF FHIR IG. This profile identifies which core elements, extensions, vocabularies and value sets must be Supported by DAF actors. For the definition of Supported please refer to DAF FHIR IG. The data elements identified by the profile are based on ONC 2014 Edition S&CC and DAF use cases. The mappings between the ONC 2014 Edition S&CC data elements and DAF data elements are captured in the table below, where the first column identifies the ONC 2014 Edition S&CC data element name, the second column maps the ONC 2014 Edition S&CC data elements to DAF data elements which are derived from ONC 2014 Edition S&CC standards and DAF use cases and lastly the third column identifies the mapping to FHIR resources and attributes.
The DAF-AllergyIntolerance profile mapping to Meaningful Use data elements and FHIR Resources are as shown below.For an overview of how the DAF profiles and data elements were derived from ONC 2014 Edition S&CC please refer to DAF FHIR IG data mapping section.
| Meaningful Use Data Element Name | Mapping to Priority DAF Data Elements | FHIR Resource Mapping |
|---|---|---|
| Medication Allergies | ||
| Allergy Substance | AllergyIntolerance.code | |
| Allergy/Adverse Event Type | AllergyIntolerance.category | |
| Allergy Status | AllergyIntolerance.status | |
| Allergy Reaction | AllergyIntolerance.reaction.manifestation | |
| Allergy Severity | AllergyIntolerance.reaction.severity | |
| Allergy Intolerance Reaction Duration | AllergyIntolerance.reaction.duration | |
| Allergy Intolerance Occurrence Date | AllergyIntolerance.reaction.onset |
This profile relies on the following other profiles:
| Profiles: | |
| DAF-AllergyIntolerance | Defines constraints and extensions on the AllergyIntolerance resource for use in querying and retrieving allergy information. |
The full list of supported search parameters are can be accessed at DAF Requestor conformance expectations and DAF Responder conformance expectations.
The following are example usage scenarios for the DAF-AllergyIntolerance profile:
Implementers need to be mindful of the following during their implementation
Representing No Known Allergies: No Known Allergies will be represented using the DAF-AllergyIntolerance profile with appropriate negation code in AllergyIntolerence.code.
See DAF FHIR IG for implementation guidance common to all profiles.


To convert a value to another number system
-
On the View menu, click Scientific.
-
Enter the number you want to convert.
-
Click the number system you want to convert to.
Notes
- When you convert a decimal number that contains decimal places to another number system, the number is shortened to an integer.
- Numbers converted from hexadecimal, octal, or binary to decimal appear as integers.


Polyjuice potion is a complicated elixir that even skilled witches and wizards have trouble brewing.
If made correctly, it allows the drinker to assume another person’s appearance for 1 hour, regardless of differences in age
or gender
Warning
Used for changing into other human appearances ONLY. If animal DNA is used, seek medical attention immediately!
Ingredients
You will need the following ingredients to brew this potion:
Fluxweed
Knotgrass
Lacewing flies
Leeches
Bicorn horn
Boomslang skin
Bit of person you want to turn into (hair, fingernail, etc)
*Note - Fluxweed and knotgrass are similar in appearance, but fluxweed is a lighter green.
How to Brew - Part 1
Brewing polyjuice potion is a complicated process. Make sure to follow directions!
1. Add 3 bundles of fluxweed to the cauldron.
2. Add 2 bundles of knotgrass to the cauldron.
3. Stir 3 times, clockwise.
4. Wave your wand over the cauldron.
5. Leave to brew and return in 60 minutes
6. Add 4 leeches to the cauldron.
7. Add 1 cup of lacewings to the mortar.
8. Crush to a fine powder.
9. Add 2 cups of crushed lacewings to the cauldron.
10. Heat mixture for 30 seconds on a low heat.
11. Wave your wand over the cauldron to complete part 1.
You must wait at least 18 hours before continuing to part 2
How to Brew - Part 2
1. Add 3 cups of shredded boomslang skin to the cauldron.
2. Add 1 cup of bicorn horn to the mortar.
3. Crush to a fine powder.
4. Add 1 cup of a crushed bicorn horn to your cauldron.
5. Heat for 20 seconds on a high heat.
6. Wave your wand over the cauldron.
7. Leave to brew and return in 25 hours.
8. Add 1 tablespoon of lacewings to the cauldron.
9. Stir 3 times anti-clockwise.
10. Add bit of the person to the cauldron.
11. Wave your wand to complete the potion!
Practice Round!
Drag the ingredients in order for part 1 into the cauldron in order
(was trying to make Javascript functios that detectected if right order and would delete image when put by cauldron)
Sources
Harry Potter information from Harry Potter and the Chamber of Secrets by JK Rowling and
Pottermore.com by JK Rowling


Modal with default options
This is basic toggletype accordion
{{ closeResult }}
Component as Content
You can pass an existing component as content of the modal window.
Modal With Options
You can pass an existing component as content of the modal window.
Stacked modals New
One fine body…


App Store Connect server-to-server notifications improved to aid devs
Source: iMore
What you need to know
- App Store Connect server-to-server notifications have been expanded.
- Developers will now be told when a subscription fails due to a billing error.
- They'll also receive information about the last 100 IAPs, too.
Apple has today updated (via 9to5Mac) its App Store Connect server-to-server notifications to give developers improved information on why a user's subscription has failed. They'll also be told when the issue has been rectified, too.
As part of the change developers will also now receive a unified receipt covering the last 100 in-app purchases to have been made.
Server-to-server notifications from the App Store let you receive real-time updates in a subscription's status, so you can provide customized experiences for your subscribers. New notifications are now available when a subscription renewal fails due to a billing issue and when a billing issue is resolved by the App Store. In addition, a unified receipt containing information about the latest 100 in-app purchase transactions is now included with the notification. If you've already enabled server-to-server notifications in App Store Connect, you'll automatically receive the new notifications and unified receipt for these subscription events.
All developers with server-to-server notifications enabled will automatically receive the new real-time subscription notifications with no additional work required on their part.
These changes will likely be well received by developers who were previously kept in the dark when a subscription renewal failed. Notifications about failed in-apppurchases due to billing issues could potentially be very useful for those dealing with customer support requests, for example.
We may earn a commission for purchases using our links. Learn more.


{%- assign page_title = page.title -%}
{%- assign accordion_collection = site.accordions | where: "accordion_page", page_title | sort: "order" -%}
{%- for item in accordion_collection -%}
{%- if item.alternate_id -%}
{%- assign this_accordion_id = item.alternate_id -%}
{%- else -%}
{%- comment -%}
In the liquid `assign` below, the second `| remove: '—'` statement is
an em-dash character that will look like another hyphen (monospace code editor font.)
{%- endcomment -%}
{%- assign this_accordion_id = item.card_heading | downcase | remove: '-' | remove: '—' | remove: '—' | replace: '&', 'and' | replace: ' ', '-' | remove: "'" | replace: "/", "-" | replace: 'é', 'e' | remove: '’' | remove: '0' | remove: '1' | remove: '2' | remove: '3' | remove: '4' | remove: '5' | remove: '6' | remove: '7' | remove: '8' | remove: '9' | remove: '?' | remove: '!' | remove: '#' | remove: '$' | remove: '.' | remove: ',' | remove: '(' | remove: ')' | remove: '®' | remove: '©' -%}
{%- endif -%}
{% endfor %}