Skip to content

Instantly share code, notes, and snippets.

Joshua Moody jmoody

Block or report user

Report or block jmoody

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jmoody
jmoody / permissions.rb
Created Sep 19, 2016
Wait for photo rollo
View permissions.rb
When(/^I touch the Photos row$/) do
expect_action_label_ready_for_next_alert
tap_row("photos")
end
Then(/^I see the Photos alert$/) do
if uia_available?
# Impossible to wait for the alert because it is automatically dismissed
else
# With DeviceAgent, we can wait for the alert. It is the next query or
@jmoody
jmoody / README.md
Last active Mar 18, 2016
Two ways to handle the "Some App wants to use your current location" alert
View README.md

The problem is that this kind of UIAlert appears before Instruments can take control of the app.

In most cases, applications that ask for location services, access to contacts, access to photos, etc, are violating the Mobile HIG guidelines.

from the HIG

Ask permission at app startup only if your app can’t perform its primary function without the user’s data.

People will not be bothered by this if it’s obvious that the main function of your app depends on knowing their personal information.

@jmoody
jmoody / README.md
Created Jun 26, 2015
Calabash iOS: Comprehensive exploration of programmatically changing a UITextField's auto-correct, capitalization, and spell-check settings
View README.md

Tested on iOS 8 Simulators with all the Keyboard settings "On" (default state).

Partially tested on iOS 7.

  1. You can turn auto-correct on or off.
  2. Changing the capitalization has no effect.
  3. Changing the spell-check settings has no effect.

Any state changes need to be made before the keyboard is presented.

View 01_launch.rb
# 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 / x-platform-cucumber.yml
Created Jan 22, 2014
basic x-platform calabash cucumber.yml
View x-platform-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"
@jmoody
jmoody / utils_ios.rb
Created Jan 15, 2014
example of ruby module and cucumber world
View utils_ios.rb
# 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
View gist:8421140
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 / another_example.txt
Created Jan 14, 2014
examples of calabash x-platform directory structure and file naming
View another_example.txt
/features]: moody$ tree
.
├── android
│   ├── helpers
│   │   └── utils_android.rb
│   ├── pages
│   │   ├── main_page_android.rb
│   │   ├── posts_page_android.rb
│   │   ├── welcome_page_android.rb
View gist:8337047
def non_location_items
all_items = query("view:'MKAnnotationView'")
location_items = query("view:'MKModernUserLocationView'")
all_items.delete_if { |item| location_items.include?(item) }
end
def touch_first_non_location
desc = non_location_items.first['description'].split(';').first
touch("view:'MKAnnotationView' {description BEGINSWITH '#{desc}'}")
sleep(0.4)
You can’t perform that action at this time.