Skip to content

Instantly share code, notes, and snippets.

View jmoody's full-sized avatar

Joshua Moody jmoody

  • Germany
View GitHub Profile
@jmoody
jmoody / another_example.txt
Created January 14, 2014 12:52
examples of calabash x-platform directory structure and file naming
/features]: moody$ tree
.
├── android
│   ├── helpers
│   │   └── utils_android.rb
│   ├── pages
│   │   ├── main_page_android.rb
│   │   ├── posts_page_android.rb
│   │   ├── welcome_page_android.rb
def transition_to_conversation_page(opts={})
default_opts = {:auth_method => :backdoor,
:user => TestUser.new}
opts = default_opts.merge(opts)
unless opts[:auth_method] == :backdoor
pending 'ATM the only way to authenticate is via the backdoor'
end
user = authenticate_as_test_user opts
@jmoody
jmoody / utils_ios.rb
Created January 15, 2014 11:28
example of ruby module and cucumber world
# this might be too deep a module
# 3 is usually the max depth, but in x-platform
# i like to mirror the directory structure
# you can do what ever you like
module YourProjectName
module iOS
module Helpers
module Utils
def global_error_messages_view_selector
@jmoody
jmoody / x-platform-cucumber.yml
Created January 22, 2014 14:07
basic x-platform calabash cucumber.yml
<%
date = Time.now.strftime('%Y-%m-%d-%H%M-%S')
default_report = "./reports/calabash-#{date}.html"
# get device information
xamarin_dir = "#{ENV['HOME']}/.xamarin"
# iphone 4S iOS 6
neptune_dir = "#{xamarin_dir}/devices/neptune"
# tag your Scenario or you feature
# @authenticated
# Scenario: buy a bunch of stuff on ebay with mom's credit card
# Then I instant buy the "Star Wars Action Figure Deluxe Set"
#
# @authenticated
# Feature: favorite cat videos
# this will not work, because calabash does not have control of your app
# so do _not_ do this!
@jmoody
jmoody / dot_xamrin_dir.txt
Last active August 29, 2015 13:55
an example of a ~/.xamarin directory
[stern:~/.xamarin]: moody$ tree
.
├── devices
│   ├── android_phone -> r2d2
│   ├── android_tablet -> marvin
│   ├── earp
│   │   ├── ip
│   │   └── udid
│   ├── ipad -> venus
│   ├── iphone -> neptune
@jmoody
jmoody / Gemfile
Created February 8, 2014 17:56
Gemfile that demonstrates a way to use bundler + local, non-version controlled files to enforce local branch checks
# the idea here to rely on .calabash-gem and .briar-gem files
# that are not under version control to set the path and branch.
#
# we want bundler to force local branch checks so calabash and briar
# maintainers are allows aware of what branch they are working from.
#
# non-maintainers can simply use the Gemfile as-is.
#
# maintainers should configure bundler to check that they are working against
# the correct branch.
@jmoody
jmoody / 01_launch_sample.rb
Created March 9, 2014 17:26
cucumber Before hook for forcing iPhone app emulated on an iPad
Before do |scenario|
@calabash_launcher = Calabash::Cucumber::Launcher.new
unless @calabash_launcher.calabash_no_launch?
@calabash_launcher.relaunch
@calabash_launcher.calabash_notify(self)
if ios7?
ensure_ipad_emulation_1x
end
end
end
@jmoody
jmoody / touch_and_hold.rb
Created March 11, 2014 23:11
example of using UIAutomation + calabash to perform a touch and hold gesture
def uia_handle_target_command(cmd, *query_args)
args = query_args.map do |part|
if part.is_a?(String)
"#{escape_uia_string(part)}"
else
"#{escape_uia_string(part.to_edn)}"
end
end
command = %Q[target.#{cmd}(#{args.join(', ')})]
@jmoody
jmoody / env.sh
Created March 13, 2014 14:41
list of calabash-ios ENV vars
# a raw list created by:
# $ find . -name *.rb -type f -exec grep ENV {} \; -print > ~/tmp/calabash-vars.txt
# and then hand extracting
# * probably some duplicates
# * some of these are deprecated
# * some should be deprecated
# * some should never be set outside of gem/server development
CALABASH_IRBRC
IRBRC