web-object 0.4 → 0.5

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
- SHA1:
3
- metadata.gz: 8eae72fe16cf8d5395d86ba7cf83f07647ad9ea6
4
- data.tar.gz: '038bdd6033856b97ee0c8a06b1ca60350bc9107a'
2
+ SHA256:
3
+ metadata.gz: b6bc163b8bfd817dd11f71e18855f808e4f41cbdda5b3863f9d550138540919e
4
+ data.tar.gz: cde989774f512ec5c9e39258010027a995e08244baf03539205bfd792cd38c43
5
5
  SHA512:
6
- metadata.gz: af376321aad8c7ad1bc2cd691060a17cd2a26cce3e441536320ccc3c09373e4f8447dfb8e3f8b32b6489f26e20dbfd02b04ede340bce1ba079d6f7ecd94b5a9f
7
- data.tar.gz: 668e9197b50b0191d6b40d9c67ddc544a29b1e60fdb4d35bed31b6a4087693c330ba041708ee8d0fefa3d49da5bac2f73d072f86a946cd2e966ca39654c0c050
6
+ metadata.gz: 5ec9c7831732943d58a7a77dbc86a2b0d58432f94cec052f2f5c4acfd550d971e973d5fb5cce42ecf23231edc1ff2713ecc0179b1b2eb269afda7e9974f99e94
7
+ data.tar.gz: 6e7c73fda1b76bfcac63ed9961d620c9f9cfae0075577985762b68d61a9cafe087779bb44e7aa32695871deeae46a0b448b67778fb5911c9e6bce76f6dd7334b
data/README.md CHANGED
@@ -5,7 +5,10 @@ Now what does original webdriver flavor is, it simply means, no additional wrapp
5
5
  Hence just create page-objects and start using basic webdriver commands on it.
6
6
 
7
7
  Moral of the story, elements created using web-object gem will be objects of WebElement class and one can perform all webdriver
8
- commands on it like send_keys, click, displayed? .. and so on...
8
+ commands on it like send_keys, click, displayed? .. and so on...
9
+
10
+ WebObject gem is completely compatible with Appium and can also be used for ruby-appium frameworks, to sound a little more mobile-like, WebObject class has an alias called **AppObject** to be used instead PageObjects in case of Mobile frameworks..
11
+
9
12
 
10
13
  ## Table of Contents
11
14
  - [Installation](#install)
@@ -135,10 +138,11 @@ Eg of error handling as mentioned above:
135
138
 
136
139
 
137
140
  ## <a name="usage"></a> Usage :eyes:
138
- Now as we saw how to create page objects, lets see how to put it to practical use.
141
+ Now as we saw how to create page objects, lets see how to put it to practical use.
139
142
 
143
+ **Web Usage**
140
144
  ```
141
- class Login < WebObject
145
+ class LoginPage < WebObject
142
146
  element :login_email, {:id => "email"}
143
147
  element :login_password, {:css => "#pwd"}
144
148
  element :login_button, {:xpath => "//button[@id='signin']"}
@@ -155,7 +159,16 @@ class Login < WebObject
155
159
  end
156
160
  end
157
161
  ```
158
-
162
+
163
+ **App or Mobile Usage**
164
+ ```
165
+ class LoginScreen < AppObject
166
+ element :username_field, {accessibility_id: "username"}
167
+ element :password_field, {predicate: 'name=="password"'}
168
+ element :login_button, {class_chain: "**/XCUIElementTypeButton[`value=='Log In'`]"}
169
+ end
170
+ ```
171
+
159
172
  ## <a name="webconditions"></a> WebConditions :eyes:
160
173
  Always envied the fancy ExpectedConditions class which Java and Python has where they smoothly pass a condition within the WebDriver explicit wait object... And when it comes to Ruby, you need to go through a painfully lenghty procudere of creating your own method or fallback to other framweworks like Capybara or Watir loosing the original WebDriver flavor.
161
174
 
@@ -183,7 +196,11 @@ Full list of WebConditions and [documentation](https://github.com/krupani/web-ob
183
196
  ## <a name="alias"></a> Aliases :eyes:
184
197
  There is an option to use PageObject class instead of WebObject.
185
198
  Eg:
186
- ``` class LoginPage < PageObject ```
199
+ ``` class LoginPage < PageObject ```
200
+
201
+ There is an option to use AppObject class instead of WebObject to sound more mobile-like for appium frameworks.
202
+ Eg:
203
+ ``` class DashboardScreen < AppObject ```
187
204
 
188
205
  Also for elements as mentioned above
189
206
  for `element` there is an option to use `find` (for capybara flavor loving people)
@@ -28,4 +28,5 @@ class WebObject
28
28
 
29
29
  end
30
30
 
31
- PageObject = WebObject
31
+ PageObject = WebObject
32
+ AppObject = WebObject
@@ -18,9 +18,9 @@ module Element
18
18
  wait = Selenium::WebDriver::Wait.new(:timeout => 0.5)
19
19
  begin
20
20
  wait.until { @driver.find_element(locator) }
21
- rescue Selenium::WebDriver::Error::TimeOutError
21
+ rescue Selenium::WebDriver::Error::TimeoutError
22
22
  if error
23
- raise "Could not find element using '#{locator.first.key}=#{locator.first.key}' strategy"
23
+ raise "Could not find element using '#{locator.first.first}=#{locator.first.last}' strategy"
24
24
  else
25
25
  return false
26
26
  end
@@ -19,9 +19,9 @@ module Elements
19
19
  begin
20
20
  wait.until { !@driver.find_elements(locator).empty? }
21
21
  @driver.find_elements(locator)
22
- rescue Selenium::WebDriver::Error::TimeOutError
22
+ rescue Selenium::WebDriver::Error::TimeoutError
23
23
  if error
24
- raise "Could not find any elements using '#{locator.first.key}=#{locator.first.key}' strategy"
24
+ raise "Could not find any elements using '#{locator.first.first}=#{locator.first.last}' strategy"
25
25
  else
26
26
  return []
27
27
  end
@@ -1 +1 @@
1
- 0.4
1
+ 0.5
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web-object
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaushal Rupani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-29 00:00:00.000000000 Z
11
+ date: 2019-06-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Helps in generating page object style framework using original webdriver
14
14
  flavor
@@ -49,7 +49,7 @@ files:
49
49
  - lib/web-object/element.rb
50
50
  - lib/web-object/elements.rb
51
51
  - lib/web-object/version
52
- homepage: https://github.com/krupani/web_object
52
+ homepage: https://github.com/krupani/web-object
53
53
  licenses:
54
54
  - MIT
55
55
  metadata: {}
@@ -68,27 +68,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubyforge_project:
72
- rubygems_version: 2.6.12
71
+ rubygems_version: 3.0.3
73
72
  signing_key:
74
73
  specification_version: 4
75
74
  summary: Page Objects in Original WebDriver flavor + Vast list of Expected Conditions
76
75
  and WebDriver Utilities
77
76
  test_files:
78
- - features/pages/web_object_form_page.rb
79
- - features/scenarios/alert.feature
80
- - features/scenarios/element_interaction.feature
81
- - features/scenarios/element_property.feature
77
+ - features/support/env.rb
78
+ - features/support/hooks.rb
82
79
  - features/scenarios/text.feature
83
- - features/scenarios/title.feature
80
+ - features/scenarios/element_property.feature
84
81
  - features/scenarios/url.feature
85
- - features/step_definitions/alert_steps.rb
82
+ - features/scenarios/title.feature
83
+ - features/scenarios/alert.feature
84
+ - features/scenarios/element_interaction.feature
86
85
  - features/step_definitions/element_interaction_steps.rb
87
- - features/step_definitions/element_property_steps.rb
86
+ - features/step_definitions/alert_steps.rb
88
87
  - features/step_definitions/text_steps.rb
89
- - features/step_definitions/title_steps.rb
90
88
  - features/step_definitions/url_steps.rb
91
- - features/support/env.rb
92
- - features/support/hooks.rb
89
+ - features/step_definitions/element_property_steps.rb
90
+ - features/step_definitions/title_steps.rb
91
+ - features/pages/web_object_form_page.rb
93
92
  - cucumber.yml
94
93
  - Rakefile