Skip to content

Instantly share code, notes, and snippets.

View leviwilson's full-sized avatar

Levi Wilson leviwilson

  • Northwoods
  • Colorado, USA
View GitHub Profile
@leviwilson
leviwilson / example_list_accessor.rb
Created January 31, 2013 22:21
example augmented list accessor
def list(name, locator)
define_method("click_#{name}_with_text") do |which_text|
platform.click_list_item_with_text(which_text)
end
end
class Notes
list(:notes, :id => "notesGridId")
end
@leviwilson
leviwilson / TestRunner.rb
Created March 18, 2013 14:58
Custom app path in Robolectric 2.0
public CustomTestRunner(Class<?> testClass) throws InitializationError {
super(RobolectricContext.bootstrap(CustomTestRunner.class, testClass, new Factory() {
@Override
public RobolectricContext create() {
return new RobolectricContext() {
@Override
protected AndroidManifest createAppManifest() {
return new AndroidManifest(new File("../YourAppDirectory"));
}
};
@leviwilson
leviwilson / save_ssh.bat
Created March 26, 2013 17:16
Generates a batch file to do ssh-add so you do not have to continually enter your git password.
ssh-agent | sed -n 's/\(\b.\+\)=\(.*\); export.*/set \1\=\2/p' > %TEMP%\store_ssh.bat && echo ssh-add >> %TEMP%\store_ssh.bat
%TEMP%\\store_ssh.bat
@leviwilson
leviwilson / DynamicAssemblyResolver.cpp
Last active December 15, 2015 13:58
Dynamic assembly resolver in MC++
#include "StdAfx.h"
#include "DynamicAssemblyResolver.h"
void DynamicAssemblyResolver::PrivatePath::set(String^ path) {
_PrivatePath = path;
AppDomain::CurrentDomain->AssemblyResolve += gcnew ResolveEventHandler(Resolve);
}
Assembly^ DynamicAssemblyResolver::Resolve(Object^ sender, ResolveEventArgs^ args)
{
@leviwilson
leviwilson / build.xml
Created April 19, 2013 14:52
Override android integration test target
<project>
...
<target name="levi-test" depends="-test-project-check">
<property name="test.runner" value="android.test.InstrumentationTestRunner" />
<run-tests-helper>
<extra-instrument-args>
<arg value="-r" />
</extra-instrument-args>
</run-tests-helper>
@leviwilson
leviwilson / example.feature
Created April 22, 2013 16:20
Example to illustrate that RubyMine does not display error information if it happens in a cucumber hook
Feature: Illustrating that RubyMine eats error output in hooks
Scenario: Some scenario that should fail
When I so something that will fail
Then this step will never execute
@leviwilson
leviwilson / submodule_problem
Created May 4, 2013 16:33
Submodule problem
lwilson@levis-macbook leviwilson $ cd gametel/
lwilson@levis-macbook gametel (master) $ git submodule update --init --recursive
Submodule 'webview_sample' (git@github.com:cheezy/Androidwebviewsampleapp.git) registered for path 'webview_sample'
Cloning into 'webview_sample'...
remote: Counting objects: 92, done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 92 (delta 16), reused 90 (delta 14)
Receiving objects: 100% (92/92), 60.76 KiB, done.
Resolving deltas: 100% (16/16), done.
fatal: reference is not a tree: 2f1fa3c2748dde3e8aa8cb5f0d38bbb24932f55f
@leviwilson
leviwilson / action_bar_example.rb
Created May 13, 2013 02:04
An example of how to call down into Solo::clickOnActionBarItem(int) using Gametel.
class SomeScreen
include Gametel
def click_menu_item(which)
platform.chain_calls do |d|
# get the id of the menu item, store it in @@id@@
d.id_from_name which, :target => :Brazenhead, :variable => '@@id@@'
# give the @@id@@ back to Robotium to click on the menu option
d.click_on_action_bar_item '@@id@@', :target => :Robotium
end
class AddReserves
include Mohawk
select_list(:appointment_type, :id => 'whatever')
def any_checked?
appointment_type_options.any? &method(:checked?)
end
def checked?(which_type)
@leviwilson
leviwilson / multiple_page_navigation_example.rb
Last active December 17, 2015 20:49
Using gametel / mohawk within the same test suite
require 'page_navigation'
module Gametel
module Navigation
include PageNavigation
def on(cls, &block)
p "Gametel::PageNavigation - #{cls}"
end
end
end