Skip to content

Instantly share code, notes, and snippets.

View DominikDary's full-sized avatar

Dominik Dary DominikDary

View GitHub Profile
@DominikDary
DominikDary / .irbrc
Created July 14, 2012 11:35
IRB Configuration to speed up the development of calabash-android mobile tests.
require 'rubygems'
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline",
"--prompt-mode",
"simple" ]
# 25 entries in the list
IRB.conf[:SAVE_HISTORY] = 50
@DominikDary
DominikDary / InspectCurrentDialog.java
Created July 14, 2012 21:45
Calabash-Android command to inspect the current dialog.
/*
* Copyright 2012 calabash-driver committers.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
@DominikDary
DominikDary / android_emu_start.sh
Created August 1, 2012 13:40 — forked from stackedsax/android_emu_start.sh
Script for starting up multiple android emulators per box
#!/bin/bash
#####
#
# This script creates android emulators on the fly.
#
# Please refer to the README for usage instructions.
#
####
@DominikDary
DominikDary / .irbrc
Created October 19, 2012 04:18
Calabash-Android IRB configuration for version >= 0.3
require 'rubygems'
require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline",
"--prompt-mode",
"simple" ]
# 25 entries in the list
IRB.conf[:SAVE_HISTORY] = 50
#! /bin/bash
#=====================================================================
# Selects an android device
# Copyright (C) 2012-2013 Diego Torres Milano. All rights reserved.
#=====================================================================
get_adb_devices()
{
adb devices 2>&1 | tail -n +2 | sed '/^$/d'
}
@DominikDary
DominikDary / PickerLargeTest.java
Created January 17, 2013 09:01
Calabash-Driver LargeTest related to the question in the calabash-android forum. https://groups.google.com/d/msg/calabash-android/Elm-HzlXULw/lME7ZwgGKfUJ
package de.dary.android.picker;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
CalabashDriver driver=new RemoteCalabashAndroidDriver(host, port, capabilities);
driver.findViewById("yourIdOfImage").longClick();
@Test
public void testShouldBeAbleToFindHiddenElementAndGetShownState() throws Exception {
Element textView =
findElementByXpath("//TextView[@name='id/visibleTextView']", driver.getPageSource());
Assert.assertEquals(textView.getAttribute("shown"), "false");
}
{
"desiredCapabilities":{
"screenSize":"320x480",
"emulator":true,
"locale":"en_US",
"androidTarget":"ANDROID16",
"aut":"io.selendroid.testapp:0.4-SNAPSHOT"
}
}
SelendroidCapabilities capa =
SelendroidCapabilities.emulator(
DeviceTargetPlatform.ANDROID16,
"io.selendroid.testapp:0.4.0");
WebDriver driver = new SelendroidDriver("http://localhost:5555/wd/hub", capa);
WebElement inputField = driver.findElement(By.id("my_text_field"));
Assert.assertEquals("true", inputField.getAttribute("enabled"));
inputField.sendKeys("Selendroid");
Assert.assertEquals("Selendroid", inputField.getText());