GithubHelp home page GithubHelp logo

mohawk's Introduction

Mohawk

Build Status Coverage Status

A gem to assist in building page-object like structures for testing Windows applications.

Installation

Runtime Environment

In order for mohawk to work, you need to have the .NET 4.0 Framework as well as the C++ Runtime Redistributable.

Ruby Environment

Add this line to your application's Gemfile:

gem 'mohawk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mohawk

Example

Defining a screen

require 'mohawk'

class LoginScreen
  include Mohawk
  window(:title => /Login/)

  text(:username, :id => "UserNameField")
  text(:password, :id => "PasswordField")
  
  button(:login, :value => "Login")
end

Using the Page-Object

World(Mohawk::Navigation)

on(LoginScreen) do |screen|
  screen.username = "levi"
  screen.password = "secret"
  screen.login
end

Accessors

Window

window

The window accessor defines how to locate the top-level window that you would like to use for your screen. Valid locators are dictated by the RAutomation::Window class.

parent

There are times where you need to define the root parent window for your screen, but it happens to be within a child window of a top-level window. The parent accessor allows you to specify further within window, and that will be used as the root of all other searches.

Controls

Control accessors are used to define various controls within your page object. Valid locators are dictated by the RAutomation::Control class.

text

The text accessor is used to define an edit text control within your screen. Given text(:user_name, id: 'txtUserName'), you will get the following methods:

  • :user_name - gets the value
  • :user_name= - sets the value
  • :clear_user_name - clears the value
  • :enter_user_name - types the given value (useful for masked text fields)
  • :user_name_view - the raw RAutomation view

button

The button accessor is used to define a button control within your screen. Given button(:ok, value: 'OK'), you will get the following methods:

  • :ok - clicks the button
  • :ok_value - returns the text value of the button
  • :ok_view - the raw RAutomation view

combo_box

aliases
  • :combobox
  • :dropdown / :drop_down
  • :select_list

The combo_box accessor is used to define a control that implements the SelectList pattern, such as a ComboBox, ListBox, etc. Given combo_box(:city, id: 'cbCities'), you will get the following methods:

  • :city - returns the currently selected item
  • :clear_city - clears the item by either index, value or RegEx
  • :city_selections - returns the currently selected options
  • :city= / :select_city - sets the selected item by index, value or RegEx
  • :city_options - returns the list of available options
  • :city_view - the raw RAutomation view

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

mohawk's People

Contributors

leviwilson avatar jacob-ewald avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.