jackpine / biketag-ios

http://biketag.jackpine.me
1 stars 1 forks source link

Write a passing Calabash cucumber #44

Closed jmoody closed 9 years ago

jmoody commented 9 years ago

Motivation

Now that the interactions with the BikeTag API are mocked, I can write a passing cucumber.

Xcode 6.3.2 touched the Main storyboard. I thought about not committing those changes, but it kept reverting so I opted to commit them.

This project does not use briar, so I grabbed the useful ids, labels, and text calabash console methods.

>     ids #=> all accessibilityIdentifiers
>  labels #=> all accessibilityLabels
>    text #=> all text

Test

$ git clone -t origin/feature/a-passing-calabash-cucumber
$ bundle
$ make app
$ be run-loop simctl install --app ./BikeTag.app
$ be cucumber -t @wip

Console

$ git clone -t origin/feature/a-passing-calabash-cucumber
$ bundle
$ be calabash-ios console
> make_app # makes and installs a new app on the iOS Simulator
> start_test_server_in_background
> ids
> labels
> text
michaelkirk commented 9 years ago

please remove the xcodeproj changes unless you have something meaningful to commit there - I've got another branch with meaningful changes there and would love to avoid conflict if it's all the same to you.

michaelkirk commented 9 years ago

Oh! I see. You added an accessibility identifier in the storyboard. I misunderstood your earlier comment. Leave those changes in.

jmoody commented 9 years ago

@michaelkirk Yeah, I added the identifier and in the process Xcode touched the file.

I can drop those other changes in the bat of an eye. I was not super comfortable committing them, but Xcode was insistent...

michaelkirk commented 9 years ago

I'm seeing something a bit strange here... it seems like cumber is not launching the most recent app built by running make app

Given that Config/Debug/Settings.plist is configured to pull from the fake api And I build the app in xcode Then I see the simulator start up And I see the current spot pulled from the fake API (as expected) When I run be cucumber -t @wip Then I see the simulator start up And I see the current spot is pulled from the fake API (as expected) (And the test passes)

So that's all well and good. But out of curiosity, I want to run the cukes against the real server...

When I change Config/Debug/Settings.plist to pull from the REAL api And I run make app And I run be cucumber -t @wip Then I see the simulator launch And I see the current spot is STILL pulled from the fake API (not expected) (And the test passes)

When I rebuild in xcode And I run be cucumber -t @wip Then I see the simulator launch And I see the current spot is pulled from the REAL api (as expected) (And The test passes)

So, it seems like cucumber is not running the app built by make app. Am I missing something?

jmoody commented 9 years ago

@michaelkirk

Yeah, that was the next behavior I was going to fix.

Starting in Xcode 6, the instruments process does not re-install apps on the simulator. If the app exists on the simulator, instruments merely launches it. We call this a stale binary.

The solution is to:

$ make app
$ be run-loop simctl install --app ./BikeTag.app --force
$ be cucumber -t @wip

The console method make_app does a make and re-install.

michaelkirk commented 9 years ago

Got it. Cool man!