testcentricity_web 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b43c7fa50ebd4748cb7c42e2b4d32ae8c9a1902
4
- data.tar.gz: b16771ced634538e990cd53cb705bce053762773
3
+ metadata.gz: 61e91b322162b010ad329c4d01554103d0559720
4
+ data.tar.gz: ae8e3ebeaf73a86954a799f2964bf2eebddb696f
5
5
  SHA512:
6
- metadata.gz: ce05f8063d3fa03ac9c207b7d302bb00728e79ef1a9f9c678991d19a390799cf700ffc645a7a023c1ecb4f5902afa52988e600f174281d81085ef07f9e71280d
7
- data.tar.gz: a17eba2a4f283d94de0dff989aa8b1901e4175594ee32acca924354c9f89760777031d3eb7aa3016c76a46c0d76e46453abbf153f397d87f23abbbc90a001aa1
6
+ metadata.gz: 872622ca866ac84142eb6e8f11e67b294045d8ddfb084313be14d632df076f6b5b96e11e8354c0d934e2f4195420335c2ebda2decbcb71aeb25616386cacaea4
7
+ data.tar.gz: 1cee663516b6f4cac6cf36c9e63d2f0d918cb50386225bf1c06ec53862e8352bc1cd5ad4f8c4f2e38fd32a79ada4c0148d496eb9dfca806d098784baeb9aeef0
data/README.md CHANGED
@@ -3,12 +3,12 @@
3
3
  The TestCentricity™ core generic framework for desktop and responsive mobile web site testing implements a Page Object
4
4
  and Data Object Model DSL, for use with Capybara and selenium-webdriver. It supports testing against locally hosted
5
5
  desktop browsers (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated mobile browsers (using Firefox), or
6
- on cloud hosted browsers using the BrowserStack, Sauce Labs, or CrossBrowserTesting services.
6
+ on cloud hosted desktop or mobile web browsers using the BrowserStack, Sauce Labs, or CrossBrowserTesting services.
7
7
 
8
8
 
9
9
  ## Installation
10
10
 
11
- Add this line to your application's Gemfile:
11
+ Add this line to your automation project's Gemfile:
12
12
 
13
13
  gem 'testcentricity_web'
14
14
 
@@ -22,14 +22,26 @@ Or install it yourself as:
22
22
 
23
23
 
24
24
  ## Setup
25
+ ###Using Cucumber
25
26
 
26
- If you are using Cucumber, you must require the following in your env.rb file:
27
+ If you are using Cucumber, you need to require the following in your *env.rb* file:
27
28
 
29
+ require 'capybara'
28
30
  require 'capybara/cucumber'
29
31
  require 'testcentricity_web'
30
32
 
31
- If you choose to not connect to WebDriver using the ***WebDriverConnect.initialize_web_driver*** method, or if you need to
32
- directly call methods in selenium-webdriver, you will also need to require the following in your env.rb file:
33
+ ###Using RSpec
34
+
35
+ If you are using RSpec instead, you need to require the following in your *env.rb* file:
36
+
37
+ require 'capybara'
38
+ require 'capybara/rspec'
39
+ require 'testcentricity_web'
40
+
41
+ ###Selenium WebDriver
42
+
43
+ If you choose to not connect to selenium-webdriver using the ***WebDriverConnect.initialize_web_driver*** method, or if you need to
44
+ directly call methods in selenium-webdriver, you will also need to require the following in your *env.rb* file:
33
45
 
34
46
  require 'selenium-webdriver'
35
47
 
@@ -37,13 +49,100 @@ directly call methods in selenium-webdriver, you will also need to require the f
37
49
 
38
50
  ## Usage
39
51
 
40
- TODO: Write usage instructions here
52
+ ###Defining a Page Object
53
+
54
+ You define new **Page Objects** as shown below:
55
+
56
+ class LoginPage < TestCentricity::PageObject
57
+ trait(:page_name) { 'Login' }
58
+ trait(:page_url) { "/sign_in" }
59
+ trait(:page_locator) { "//body[@class='login-body']" }
60
+ end
61
+
62
+
63
+ class HomePage < TestCentricity::PageObject
64
+ trait(:page_name) { 'Home' }
65
+ trait(:page_url) { "/dashboard" }
66
+ trait(:page_locator) { "//body[@class='dashboard']" }
67
+ end
68
+
69
+
70
+ ###Adding UI Elements to your Page Object
71
+
72
+ Your Page Object's **UI Elements** are added as shown below:
73
+
74
+ class LoginPage < TestCentricity::PageObject
75
+ trait(:page_name) { 'Login' }
76
+ trait(:page_url) { "/sign_in" }
77
+ trait(:page_locator) { "//body[@class='login-body']" }
78
+
79
+ # Login page UI elements
80
+ textfield :user_id_field, "userName"
81
+ textfield :password_field, "password"
82
+ button :login_button, "//input[@id='submit_button']"
83
+ checkbox :remember_checkbox, "rememberUser']"
84
+ label :error_message_label, 'div#statusBar.login-error'
85
+ end
86
+
41
87
 
88
+ ###Instantiating your Page Objects
42
89
 
90
+ There are several ways to instantiate your **Page Objects**. One common implementation is shown below:
43
91
 
92
+ module WorldPages
93
+ def login_page
94
+ @login_page ||= LoginPage.new
95
+ end
96
+
97
+ def home_page
98
+ @home_page ||= HomePage.new
99
+ end
100
+ end
101
+
102
+ Once instantiated, you can interact with the **UI Elements** in your **Page Objects**. An example is shown below:
103
+
104
+ login_page.user_id_field.set('snicklefritz')
105
+ login_page.password_field.set('Pa55w0rd')
106
+ login_page.login_button.click
107
+
108
+
109
+ ###Adding Methods to your Page Object
110
+
111
+ You can add high level methods for interacting with the UI to hide implementation details, as shown below:
112
+
113
+ class LoginPage < TestCentricity::PageObject
114
+ trait(:page_name) { 'Login' }
115
+ trait(:page_url) { "/sign_in" }
116
+ trait(:page_locator) { "//body[@class='login-body']" }
117
+
118
+ # Login page UI elements
119
+ textfield :user_id_field, "userName"
120
+ textfield :password_field, "password"
121
+ button :login_button, "//input[@id='submit_button']"
122
+ checkbox :remember_checkbox, "rememberUser']"
123
+ label :error_message_label, 'div#statusBar.login-error'
124
+
125
+ def login(user_id, password)
126
+ user_id_field.set(user_id)
127
+ password_field.set(password)
128
+ login_button.click
129
+ end
130
+
131
+ def remember_me(state)
132
+ remember_checkbox.set_checkbox_state(state)
133
+ end
134
+ end
135
+
136
+
137
+ Once instantiated, you can call your methods as shown below:
138
+
139
+ login_page.remember_me(true)
140
+ login_page.user_id_field.set('snicklefritz', 'Pa55w0rd')
141
+
142
+
44
143
  ## Copyright and License
45
144
 
46
- TestCentricity (tm) Framework is Copyright (c) 2014-2016, Tony Mrozinski.
145
+ TestCentricity(tm) Framework is Copyright (c) 2014-2016, Tony Mrozinski.
47
146
  All rights reserved.
48
147
 
49
148
 
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler