0.0
The project is in a healthy, maintained state
Sparkling watir takes heavy inspiration from tap watir and is a mobile adaptation of watir
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.4.14
~> 13.0.6
~> 3.11.0
~> 1.27

Runtime

~> 7.1.0
 Project Readme

SparklingWatir

Watir for testing your Mobile Devices. Powered by Appium. This project is a revamp of Tap watir.

All the inspiration from this project is taken from Tap Watir, so all the credit goes to the original creators and contributors

If you don't know the watir project here is the link to the project

This project is still in an alpha stage and under active development.

Installation

Add this line to your application's Gemfile:

gem 'sparkling_watir'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sparkling_watir

If you want to run the tests on iOS just create a simulator that is an iPhone 8 with os 15.5 or you can change the capabilities in spec/config/caps, and you can download the testing app here

All the credit for the testing app goes to Jonathan Lipps.

If you want to switch between android and iOS capabilties just run:

$ rake platform[android] or rake platform[ios]

Initialize driver

You can initialize the driver with the following code:

app = SparklingWatir::App.new(caps: opts)

The capabilities should include the server url

Gestures

You can use the following gestures:

Tap: Tap on an element

app.tap on: button

Double tap: Double tap on an element

app.double_tap on: button

Long press: Press for a minimum of 0.5 seconds on an element

app.long_press on: button

Swipe: Swipes to an element, there are 4 direction available: :up, :down, :left, :right

app.swipe to: button, direction: :up

Scroll: Scrolls until it finds an element, you need to pass a scrollable view to scroll into, there are 4 direction available: :up, :down, :left, :right. The default duration is 30 seconds.

app.scroll into: scrollable_view, for: element, direction: :down, duration: 40

More gestures coming soon

Element

You can use the following methods on an element:

wd: Get the driver from the element

element.wd

exists?: Returns true if element exists, else false

element.exists?

present?: Returns true if element is present, else false

element.present?

enabled?: Returns true if element is enabled, else false

element.enabled?

coordinates: Returns a hash with x and y coordinates

element.coordinates

size: Returns a hash with width and height values

element.size

bounds: Returns a hash with x and y values representing bounds

element.bounds

center: Returns a hash with x and y values representing center

element.center

attribute(attribute_name): Returns the attribute value

element.attribute('className')

text: Returns the text of the element

element.text

Waits

You can use the following waits:

wait_until: Waits until a condition is true

element.wait_until(&:present?)

wait_while: Waits while a condition is true

element.wait_while(&:present?)

Screenshot

You can use the following screenshot methods:

save: Saves a screenshot at the given path

app.screenshot.save("screenshot.png")

png: This method represents the screenshot as a PNG image string.

app.screenshot.png

base64: Returns a string representing the screenshot as a Base64 encoded string

app-screenshot.base64

License

The gem is available as open source under the terms of the MIT License.