Skip to content

Commit

Permalink
Merge pull request soffes#59 from moredip/pr/frankified-again
Browse files Browse the repository at this point in the history
Frankified again - Pull Request soffes#52 remix
  • Loading branch information
soffes committed Aug 25, 2012
2 parents c4f1ad2 + 976d8eb commit af7bef0
Show file tree
Hide file tree
Showing 19 changed files with 233 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "Vendor/SSPullToRefresh"]
path = Vendor/SSPullToRefresh
url = https://github.com/samsoffes/sspulltorefresh.git
[submodule "Vendor/symbiote"]
path = Vendor/symbiote
url = https://github.com/moredip/symbiote.git
6 changes: 6 additions & 0 deletions Cheddar for iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1453,10 +1453,16 @@
);
INFOPLIST_FILE = "Resources/Cheddar-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(FRANK_LIBRARY_SEARCH_PATHS)",
);
OTHER_CFLAGS = "-DDEBUG";
OTHER_LDFLAGS = (
"$(inherited)",
"-all_load",
"-ObjC",
"$(FRANK_LDFLAGS)",
);
PRODUCT_NAME = Cheddar;
PROVISIONING_PROFILE = "";
Expand Down
1 change: 1 addition & 0 deletions Classes/CDIListsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ - (void)dealloc {
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *title = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nav-title"]];
title.accessibilityLabel = @"Cheddar";
title.frame = CGRectMake(0.0f, 0.0f, 116.0f, 21.0f);
self.navigationItem.titleView = title;
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Lists" style:UIBarButtonItemStyleBordered target:nil action:nil];
Expand Down
15 changes: 15 additions & 0 deletions Frank/features/overall_flow.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: High-level flow through the application

Background:
Given I launch the app

Scenario: list creation flow
Given I am on the Lists screen
When I choose to add a list called "Monkeys"
Then I should be on the Tasks screen for the "Monkeys" list
And I should be prompted for my first task

When I enter a task name of "Bonobo"
And I tap out of task entry mode
Then I should see a tasks list of:
|Bonobo|
20 changes: 20 additions & 0 deletions Frank/features/step_definitions/launch_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def app_path
ENV['APP_BUNDLE_PATH'] || (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH)
end

Given /^I launch the app$/ do
# latest sdk and iphone by default
launch_app app_path
end

Given /^I launch the app using iOS (\d\.\d)$/ do |sdk|
# You can grab a list of the installed SDK with sim_launcher
# > run sim_launcher from the command line
# > open a browser to http://localhost:8881/showsdks
# > use one of the sdk you see in parenthesis (e.g. 4.2)
launch_app app_path, sdk
end

Given /^I launch the app using iOS (\d\.\d) and the (iphone|ipad) simulator$/ do |sdk, version|
launch_app app_path, sdk, version
end
7 changes: 7 additions & 0 deletions Frank/features/step_definitions/list_screen_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Given /^I am on the Lists screen$/ do
ListScreen.new.wait_to_be_on_screen
end

When /^I choose to add a list called "(.*?)"$/ do |list_name|
ListScreen.new.choose_to_add_a_list( list_name )
end
18 changes: 18 additions & 0 deletions Frank/features/step_definitions/screens/list_screen.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class ListScreen
include Frank::Cucumber::FrankHelper

def wait_to_be_on_screen
# kind of a crappy way to tell if we're on the right screen, but it'll do for now
wait_for_element_to_exist( "view:'UINavigationBar' view marked:'Cheddar'" )
end

def choose_to_add_a_list(list_name = false)
touch "view:'UINavigationButton' marked:'plus'"
type_new_list_name(list_name) if list_name
end

def type_new_list_name( list_name )
type_into_keyboard( list_name )
end

end
37 changes: 37 additions & 0 deletions Frank/features/step_definitions/screens/tasks_screen.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class TasksScreen
include Frank::Cucumber::FrankHelper

def self.with
screen = self.new
screen.wait_to_be_on_screen
yield screen if block_given?
screen
end

def wait_to_be_on_screen
wait_for_element_to_exist( "view:'UINavigationItemButtonView' marked:'Lists'" )
end

def list_name_is(list_name)
element_exists( "view:'UINavigationItemView' marked:'#{list_name}'" )
end

def task_text_field_is_first_responder
results = frankly_map( "view:'CDIAddTaskView' view:'SSTextField'", 'isFirstResponder' )
results.length == 1 && results.first == true
end

def has_task_list_of expected_task_list
actual_task_list = frankly_map( "view:'CDITaskTableViewCell' view:'CDIAttributedLabel'", "text" )
actual_task_list.sort == expected_task_list.sort
end

def task_text_field_resign_first_responder
touch 'tableView'
end

def type_new_task_name( task_name )
type_into_keyboard( task_name )
end

end
33 changes: 33 additions & 0 deletions Frank/features/step_definitions/tasks_screen_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Then /^I should be on the Tasks screen for the "(.*?)" list$/ do |list_name|
TasksScreen.with do |screen|
wait_until{ screen.list_name_is(list_name) }
end
end

Then /^I should be prompted for my first task$/ do
TasksScreen.with do |screen|
wait_until{ screen.task_text_field_is_first_responder }
end
end

Then /^I should see a tasks list of:$/ do |table|
expected_task_list = table.raw.flatten
TasksScreen.with do |screen|
wait_until{ screen.has_task_list_of( expected_task_list ) }
end
end

When /^I enter a task name of "(.*?)"$/ do |task_name|
TasksScreen.with do |screen|
wait_until{ screen.task_text_field_is_first_responder }
screen.type_new_task_name( task_name )
end
end

When /^I tap out of task entry mode$/ do
TasksScreen.with do |screen|
if screen.task_text_field_is_first_responder
screen.task_text_field_resign_first_responder
end
end
end
8 changes: 8 additions & 0 deletions Frank/features/support/env.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'frank-cucumber'

# UIQuery is deprecated. Please use the shelley selector engine.
Frank::Cucumber::FrankHelper.use_shelley_from_now_on

# This constant must be set to the full, absolute path for your Frankified target's app bundle.
# See the "Given I launch the app" step definition in launch_steps.rb for more details
APP_BUNDLE_PATH = File.expand_path( '../../../frankified_build/Frankified.app', __FILE__ )
1 change: 1 addition & 0 deletions Frank/frank_static_resources.bundle
4 changes: 4 additions & 0 deletions Frank/frankify.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INSTALL_PATH = /./

FRANK_LDFLAGS = -all_load -ObjC -framework CFNetwork -framework Security -lShelley -lCocoaHTTPServer -lFrank
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = FRANKIFIED
Binary file added Frank/libCocoaHTTPServer.a
Binary file not shown.
Binary file added Frank/libFrank.a
Binary file not shown.
Binary file added Frank/libShelley.a
Binary file not shown.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

group :test do
gem "frank-cucumber", "~> 0.9.5.pre7"
end
57 changes: 57 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (3.2.7)
i18n (~> 0.6)
multi_json (~> 1.0)
builder (3.0.0)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
diff-lcs (1.1.3)
dnssd (2.0)
frank-cucumber (0.9.5.pre7)
cucumber
dnssd
i18n
json
plist
rspec (>= 2.0)
sim_launcher (= 0.3.8)
thor
xcodeproj
gherkin (2.11.1)
json (>= 1.4.6)
i18n (0.6.0)
json (1.7.4)
multi_json (1.3.6)
plist (3.1.0)
rack (1.4.1)
rack-protection (1.2.0)
rack
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
sim_launcher (0.3.8)
sinatra
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
thor (0.15.4)
tilt (1.3.3)
xcodeproj (0.3.1)
activesupport (~> 3.2.6)

PLATFORMS
ruby

DEPENDENCIES
frank-cucumber (~> 0.9.5.pre7)
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# let's be nice and not force people to install testing infrastructure if they don't want to
begin require 'cucumber/rake/task' rescue LoadError nil end

class String
def self.colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
Expand Down Expand Up @@ -56,3 +59,17 @@ task :'setup:private' do
# Done!
puts 'Done! You\'re ready to get started!'.green
end

if defined? Cucumber
desc 'build a Frankified version of the app for acceptance testing'
task 'acceptance_build' do
sh 'frank build'
end

Cucumber::Rake::Task.new(:acceptance_without_build, 'Run Frank acceptance tests') do |t|
t.cucumber_opts = "Frank/features"
end

desc "rebuild app and run acceptance tests. Use acceptance_without_build if you'd like to skip the rebuild part."
task 'acceptance' => %w{acceptance_build acceptance_without_build}
end
1 change: 1 addition & 0 deletions Vendor/symbiote
Submodule symbiote added at 2f022f

0 comments on commit af7bef0

Please sign in to comment.