Skip to content

Instantly share code, notes, and snippets.

View jmoody's full-sized avatar

Joshua Moody jmoody

  • Germany
View GitHub Profile
@jmoody
jmoody / rbenv-install-with-options.sh
Last active October 26, 2016 13:38
Script for compiling a ruby with readline and OpenSSL support using rbenv and homebrew
#!/usr/bin/env bash
# Do not name this file 'rbenv-install' - that is an rbenv terminal command.
# Put this file in your PATH (e.g. ~/bin/)
#
# Usage:
# rbenv-install-with-options.sh 2.3.1
RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" \
rbenv install "${1}"
@jmoody
jmoody / permissions.rb
Created September 19, 2016 14:51
Wait for photo rollo
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 March 18, 2016 19:59
Two ways to handle the "Some App wants to use your current location" alert

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 June 26, 2015 11:21
Calabash iOS: Comprehensive exploration of programmatically changing a UITextField's auto-correct, capitalization, and spell-check settings

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.

got 8 from server
# 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 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"
@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
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 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