Skip to content

Instantly share code, notes, and snippets.

View leviwilson's full-sized avatar

Levi Wilson leviwilson

  • Northwoods
  • Colorado, USA
View GitHub Profile
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 / 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
@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 / 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 / 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 / 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 / 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 / codmash_abstract_2013.md
Last active March 30, 2018 21:03
Abstract for Codemash 2014: Automating Windows Applications with Ruby.

Codemash 2014 Pre-Compiler

Automating Windows Applications with Ruby

Abstract

When we think of writing automated tests with ruby and cucumber, Windows desktop applications are not the first thing that come to mind. If you have looked into writing acceptance tests for Windows applications (native, WinForms or WPF), chances are you have come across solutions such as SpecFlow or Raconteur, but what are the options if we want to drive our tests from ruby using cucumber or RSpec?

This pre-compiler session will take you through building an acceptance test suite using some ruby gems (mohawk, RAutomation and cucumber) that tap into the Microsoft UI Automation accessibility framework to automate native, WinForms and WPF applications.

Target Audience

@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 / 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