Random musings

    Writing the first calabash test

    10 Mar 2015

    Going through the stages of writing my first calabash test. Firstly I went to my project folder, and opened the following file /features/login.feature.

    read more (2 minutes)

    How to write a unit test for your jQuery plugin

    09 Mar 2015

    I think alot of people think that javascript is untestable, even less write tests for the jQuery plugins.

    This is a real shame, as there are libraries out there like qUnit that allow test classes to be written for your javascript plugins.

    Firstly let’s set up your environment.
    read more (5 minutes)

    Alpha Channels in GIMP

    08 Mar 2015

    I have recently been asked to cut some photos up for a friend and put the subjects into new photos.

    This is a common request that is often though of as easy. Sadly it’s not that straightforward, but one I’ve been known to do in Photoshop using Alpha Channels.
    read more (3 minutes)

    Starting out with Calibash

    07 Mar 2015

    We are about to release a new version of one of our mobile apps at work, and until now we have had no budget for QA. I am however just about to enter in a conversation with a team that is actively running calabash. I decided that it was important to try it out. I decided to invest my evening into getting the project setup with calabash, and following are the results of that experimentation.

    Start by installing calabash gem

    I fire up my bash script (by dragging the folder I am working on to terminal) and run the following…

    $ gem install calabash-cucumber

    D’oh - I get a permission error - I need to use the correct version of ruby installed on my computer rather than the locked down old version that apple provides. Luckily I already have RVM, so….

    $ rvm use 2.1.2
    $ gem install calabash-cucumber

    This takes about 15mins on a dodgy internet connection. Now I have everything I need.

    $ calabash-ios setup

    This outputs the following…

    Checking if Xcode is running...
    Found Project: Scrapbook
    Found several *.pbxproj files in dir Scrapbook.xcodeproj.
    Found: project.pbxproj
    We don't yet support this. Please setup calabash manually.

    Oh - I’ve done something wrong :(. I decide that these ‘several’ projects all look like some sort of helpful backup that xcode is doing on my behalf, but I read online these aren’t necessary and should not be checked in with the solution, so I decide to delete them.

    I Right Mouse on my xcodeproj and “Show package contents”, and then just remove these strange pbxproj BASE, BACKUP, LOCAL, REMOTE files using finder.

    Run the command again…

    $ calabash-ios setup

    I get the following warnings

    The domain/default pair of (/Users/digiguru/Library/Application Support/iPhone Simulator/6.1/Library/Preferences/com.apple.Accessibility.plist, ApplicationAccessibilityEnabled) does not exist

    (nad then repeated again for 6.1, 7.0.3, 7.1, and 7.1-64). I assume this is old emulators that aren’t working in Xcode 6+ so I decide to ignore them for now.

    However below these warnings I also get the following…

    ----------Setup done----------
    Please validate by running the -cal target
    from Xcode.
    When starting the iOS Simulator using the
    new -cal target, you should see:
      "Started LPHTTP server on port 37265"
    in the application log in Xcode.

    Hmm - I guess it’s time to open xcode.

    Open up the project - hmm pods aren’t there as this has been a fresh checkout, so I close xcode and run pod install

    $ pod install

    Now re-open xcode and have a look - I have a new scheme. Originally there was my app “Scrapbook”, but now I have a second “Scrapbook-cal”. I open this scheme and hit RUN!

    Indeed when it’s running the debugger logs the following…

    Creating the server: <LPHTTPServer: 0x7fbc98555600>
    Calabash iOS server version: CALABASH VERSION: 0.13.0
    Started LPHTTP server on port 37265

    Looks good. Time to generate the default test….

    $ calabash-ios gen

    I get a nice approval that everything is working, re-run the app in simulator and then do..

    $ cucumber

    This didn’t work :(

    Unable to auto detect APP_BUNDLE_PATH.
      Have you built your app for simulator?
      Searched dir: /Users/digiguru/Library/Developer/Xcode/DerivedData/Scrapbook-cxpdqqgzvhnwdpdjcafrfpyqpozg/Build/Products

    Instead of finding the project there, I attempt to find it manually. To hack the APP_BUNDLE_PATH I read you can run a line. Originally I think I’ve found it here…


    I’m sure someone smarter than me can figure out the right way of doing this, but I decide to hack it as follows…

    *** WARNING! Do not do this - I later found out I was in the wrong location...
    $ export APP_BUNDLE_PATH="/digiguru/Library/Developer/CoreSimulator/Devices/EB826B69-7054-446D-A681-3A85E0F6BC9D/data/Applications/27481CF3-2B7C-4D6C-9B62-9A78C729718B/My Wedding.app"
    $ cucmber

    This stopped or crashed the simulator, and I got errors.

    plist '/digiguru/Library/Developer/CoreSimulator/Devices/EB826B69-7054-446D-A681-3A85E0F6BC9D/data/Applications/27481CF3-2B7C-4D6C-9B62-9A78C729718B/My Wedding.app/Info.plist' does not exist - could not read (RuntimeError)

    I do some more digging and find that I was in the wrong directory entirely. Now I try the following…

    $ export APP_BUNDLE_PATH="/Users/digiguru/Library/Developer/Xcode/DerivedData/Scrapbook-dzdljgesgcsjepftybotvqlbttmt/Build/Products/Debug-iphonesimulator/My Wedding.app"
    $ cucumber

    The iOS simulator starts up. I watch as the commands start to run without any input.

    The tests complete, and I even get a screenshot in the project’s root directory. I have run my first calabash test! Tomorrow I intend to write my first custom test.

    (3 minutes)

    Don't Break the Chain

    06 Mar 2015

    Self improvement is something I’m always looking at. Over the start of the yea I have given myself a tak every month. For the first month I decided that I would drink No Alcohol.
    read more (3 minutes)