Testing your jquery mobile application with cucumber - part 2
As we know jQuery Mobile uses alot of javascript. This mean that our page will change realy often. JM adds a lot of classes to our dom elements. I assure that the best way to test this is writing separate steps for those which occurs frequently in ours mobile scenarios. Let’s look at this example:
(Note that as I writing this I am using rails 3.1.2 + cucumber 1.1.2)
Here we set Before and After @mobile tag. It’s important to set default driver to rack_test - selenium is much slower and we don’t realy need this in ours desktop version tests.
It’s time for some tests and steps for them. Note that for files which contain’s mobile tests we use @mobile tag.
We are ready to run tests!
cucumber features/mobile_welcome.feature
Now your firefox(by default)/whatever browser interprets javascript :)