testcentricity_web 0.5.7.2 → 0.5.8

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: 7faf72a16ef3d97239d41482e371fc058d9ef3a6
4
- data.tar.gz: 4cd7057f471425de8b0133901edfd13c5938acce
3
+ metadata.gz: 827f668182f61bf19480bb993ff1c452fd155982
4
+ data.tar.gz: 58564669674cf2fc3ddf62b1ffb5b5074a982b88
5
5
  SHA512:
6
- metadata.gz: a8fe539726416a107f76946c4eb0a42000bda0de53628d7737a0cebdb1a96c403b4f07767478cb237bc8cfcf95ba9f65a6c8309c071ddc9621494b8e2b41dd1a
7
- data.tar.gz: 86b41962f01be7144ebc390ff5f5eb23bdef1f176a19b6c9ca5f1807b760f93e8830b9e9e18568aa46f95544ca3ffd7bbc9f0074b0ee3aab80e5d2d0e5937290
6
+ metadata.gz: 11f086f65e4c2725c06957e42abff668674a2515a527f2d7876457adcd596ced605693430853aaff77fd658f9703a9b4d19e771987d49fcba025a2062d04e7e9
7
+ data.tar.gz: 73174e2dce406fbde1678af1d133c48e467ee93bcfd112be75a272582ec29bd79b0853b91e34e14cf78bc5a97fe104cbaea446c253debcdc1eceae3d89059ec5
data/README.md CHANGED
@@ -49,9 +49,7 @@ call methods in selenium-webdriver, you will also need to require the following
49
49
 
50
50
 
51
51
 
52
- ##Usage
53
-
54
- ### Page Objects
52
+ ## Page Objects
55
53
 
56
54
  The **Page Object Model** is a test automation pattern that aims to create an abstraction of your web app's User Interface that can be used
57
55
  in tests. A **Page Object** is an object that represents a single page in your AUT (Application Under Test). **Page Objects** encapsulate the
@@ -64,7 +62,7 @@ text field attributes, button captions, etc.), maintenance is performed in the *
64
62
  to update the affected feature file, scenarios, or step definitions.
65
63
 
66
64
 
67
- #### Defining a Page Object
65
+ ### Defining a Page Object
68
66
 
69
67
  Your **Page Object** class definitions should be contained within individual *.rb* files in the ***features/support/pages*** folder of your
70
68
  test automation project. You define new **Page Objects** as shown below:
@@ -83,7 +81,7 @@ test automation project. You define new **Page Objects** as shown below:
83
81
  end
84
82
 
85
83
 
86
- #### Adding UI Elements to your Page Object
84
+ ### Adding UI Elements to your Page Object
87
85
 
88
86
  **UI Elements** are added to your **Page Object** class definition as shown below:
89
87
 
@@ -108,7 +106,7 @@ below:
108
106
  login_page.login_button.click
109
107
 
110
108
 
111
- #### Adding Methods to your Page Object
109
+ ### Adding Methods to your Page Object
112
110
 
113
111
  It is good practice for your Cucumber step definitions to call high level methods in your your **Page Object** instead of directly accessing
114
112
  and interacting with a page object's UI elements. You can add high level methods to your **Page Object** class definition for interacting with
@@ -145,7 +143,7 @@ Once your **Page Objects** have been instantiated, you can call your methods as
145
143
 
146
144
 
147
145
 
148
- ### PageSection Objects
146
+ ## PageSection Objects
149
147
 
150
148
  A **PageSection Object** is a collection of **UI Elements** that may appear in multiple locations on a page, or on multiple pages in a web
151
149
  app. It is a collection of **UI Elements** that represent a conceptual area of functionality, like a navigation bar, a search capability,
@@ -154,7 +152,7 @@ or a menu. **UI Elements** and functional behavior are confined to the scope of
154
152
  A **PageSection Object** may contain other **PageSection Objects**.
155
153
 
156
154
 
157
- #### Defining a PageSection Object
155
+ ### Defining a PageSection Object
158
156
 
159
157
  Your **PageSection** class definitions should be contained within individual *.rb* files in the ***features/support/sections*** folder of
160
158
  your test automation project. You define new **PageSection Objects** as shown below:
@@ -164,7 +162,7 @@ your test automation project. You define new **PageSection Objects** as shown be
164
162
  end
165
163
 
166
164
 
167
- #### Adding UI Elements to your PageSection Object
165
+ ### Adding UI Elements to your PageSection Object
168
166
 
169
167
  **UI Elements** are added to your **PageSection** class definition as shown below:
170
168
 
@@ -177,7 +175,7 @@ your test automation project. You define new **PageSection Objects** as shown be
177
175
  end
178
176
 
179
177
 
180
- #### Adding Methods to your PageSection Object
178
+ ### Adding Methods to your PageSection Object
181
179
 
182
180
  You can add high level methods to your **PageSection** class definition, as shown below:
183
181
 
@@ -195,7 +193,7 @@ You can add high level methods to your **PageSection** class definition, as show
195
193
  end
196
194
 
197
195
 
198
- #### Adding PageSection Objects to your Page Object
196
+ ### Adding PageSection Objects to your Page Object
199
197
 
200
198
  You add a **PageSection Object** to its associated **Page Object** as shown below:
201
199
 
@@ -214,7 +212,7 @@ Once your **Page Object** has been instantiated, you can call its **PageSection*
214
212
 
215
213
 
216
214
 
217
- ###Instantiating your Page Objects
215
+ ## Instantiating your Page Objects
218
216
 
219
217
  Before you can call the methods in your **Page Objects** and **PageSection Objects**, you must instantiate the **Page Objects** of your
220
218
  web application, as well as create instance variables which can be used when calling a **Page Objects** methods from your step definitions.
@@ -244,7 +242,7 @@ The **WorldPages** module above can be defined in your *env.rb* file, or you can
244
242
  While this approach is effective for small web applications with only a few pages (and hence few **Page Objects**), it quickly becomes
245
243
  cumbersome to manage if your web application has dozens of **Page Objects** that need to be instantiated and managed.
246
244
 
247
- #### Using the PageManager
245
+ ### Using the PageManager
248
246
 
249
247
  The **PageManager** class provides methods for supporting the instantiation and management of **Page Objects**. In the code example below,
250
248
  the **page_objects** method contains a hash table of your **Page Object** instance variables and their associated **Page Object** classes
@@ -279,7 +277,7 @@ executed:
279
277
 
280
278
 
281
279
 
282
- ### Connecting to a Web Browser
280
+ ## Connecting to a Web Browser
283
281
 
284
282
  The ***WebDriverConnect.initialize_web_driver*** method configures the appropriate selenium-webdriver capabilities required to establish a
285
283
  connection with a target web browser, and sets the base host URL of the web site you are running your tests against
@@ -289,7 +287,7 @@ Variables**are used to specify the target local or remote web browser, and the v
289
287
  the connection.
290
288
 
291
289
 
292
- #### Locally hosted desktop web browser
290
+ ### Locally hosted desktop web browser
293
291
 
294
292
  For locally hosted desktop web browsers, the **WEB_BROWSER** Environment Variable must be set to one of the values from the table below:
295
293
 
@@ -303,7 +301,7 @@ edge | Windows 10 only
303
301
  poltergeist | OS X or Windows
304
302
 
305
303
 
306
- #### Locally hosted emulated mobile web browser
304
+ ### Locally hosted emulated mobile web browser
307
305
 
308
306
  You can also run your tests against emulated mobile device browsers within a locally hosted instance of the Firefox desktop browser. You may
309
307
  even specify the emulated device's screen orientation. For locally hosted emulated mobile web browsers, the **WEB_BROWSER** Environment Variable
@@ -324,13 +322,13 @@ android_tablet |
324
322
  To specify the emulated device's screen orientation, you set the **ORIENTATION** Environment Variable to either ***portrait*** or ***landscape***.
325
323
 
326
324
 
327
- #### Remotely hosted desktop and mobile web browsers
325
+ ### Remotely hosted desktop and mobile web browsers
328
326
 
329
327
  You can run your automated tests against remotely hosted desktop and mobile web browsers using the BrowserStack, CrossBrowserTesting, or
330
328
  Sauce Labs services.
331
329
 
332
330
 
333
- ##### Remote desktop browsers on the BrowserStack service
331
+ #### Remote desktop browsers on the BrowserStack service
334
332
 
335
333
  For remotely hosted desktop web browsers on the BrowserStack service, the following **Environment Variables** must be set as described in
336
334
  the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities#capabilities-browserstack) for information regarding the specific capabilities.
@@ -348,7 +346,7 @@ BS_LOCAL | Must be ***true*** if you are testing against internal/local servers
348
346
  RESOLUTION | Refer to supported screen ***resolution*** capability in chart
349
347
 
350
348
 
351
- ##### Remote mobile browsers on the BrowserStack service
349
+ #### Remote mobile browsers on the BrowserStack service
352
350
 
353
351
  For remotely hosted mobile web browsers on the BrowserStack service, the following **Environment Variables** must be set as described in
354
352
  the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities#capabilities-browserstack) for information regarding the specific capabilities.
@@ -366,7 +364,7 @@ ORIENTATION | set to ***portrait*** or ***landscape***
366
364
 
367
365
 
368
366
 
369
- ##### Remote desktop browsers on the CrossBrowserTesting service
367
+ #### Remote desktop browsers on the CrossBrowserTesting service
370
368
 
371
369
  For remotely hosted desktop web browsers on the CrossBrowserTesting service, the following **Environment Variables** must be set as described in
372
370
  the table below. Use the Configuration Wizard on the [Start a Selenium Test page](https://app.crossbrowsertesting.com/selenium/run) to obtain information regarding the specific capabilities.
@@ -381,7 +379,7 @@ CB_BROWSER | Refer to ***browser_api_name*** capability in the sample script of
381
379
  RESOLUTION | Refer to supported ***screen_resolution*** capability in the sample script of the Wizard
382
380
 
383
381
 
384
- ##### Remote mobile browsers on the CrossBrowserTesting service
382
+ #### Remote mobile browsers on the CrossBrowserTesting service
385
383
 
386
384
  For remotely hosted mobile web browsers on the CrossBrowserTesting service, the following **Environment Variables** must be set as described in
387
385
  the table below. Use the Configuration Wizard on the [Start a Selenium Test page](https://app.crossbrowsertesting.com/selenium/run) to obtain information regarding the specific capabilities.
@@ -397,7 +395,7 @@ RESOLUTION | Refer to supported ***screen_resolution*** capability in the sample
397
395
 
398
396
 
399
397
 
400
- ##### Remote desktop browsers on the Sauce Labs service
398
+ #### Remote desktop browsers on the Sauce Labs service
401
399
 
402
400
  For remotely hosted desktop web browsers on the Sauce Labs service, the following **Environment Variables** must be set as described in
403
401
  the table below. Use the Selenium API on the [Platform Configurator page](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/) to obtain information regarding the specific capabilities.
@@ -413,7 +411,7 @@ SL_VERSION | Refer to ***version*** capability in the Copy Code section of the P
413
411
  RESOLUTION | Refer to supported ***screenResolution*** capability in the Copy Code section of the Platform Configurator page
414
412
 
415
413
 
416
- ##### Remote mobile browsers on the Sauce Labs service
414
+ #### Remote mobile browsers on the Sauce Labs service
417
415
 
418
416
  For remotely hosted mobile web browsers on the Sauce Labs service, the following **Environment Variables** must be set as described in
419
417
  the table below. Use the Selenium API on the [Platform Configurator page](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/) to obtain information regarding the specific capabilities.
@@ -432,12 +430,13 @@ ORIENTATION | Refer to ***deviceOrientation*** capability in the Copy Code secti
432
430
 
433
431
 
434
432
 
435
- #### Using Browser specific Profiles in cucumber.yml
433
+ ### Using Browser specific Profiles in cucumber.yml
436
434
 
437
435
  While you can set **Environment Variables** in the command line when invoking Cucumber, a preferred method of specifying and managing target
438
436
  web browsers is to create browser specific **Profiles** that set the appropriate **Environment Variables** for each target browser in your
439
437
  ***cucumber.yml*** file. Below is a list of Cucumber **Profiles** for supported locally and remotely hosted desktop and mobile web browsers
440
- (put these in in your ***cucumber.yml*** file):
438
+ (put these in in your ***cucumber.yml*** file). Before you can use the BrowserStack, CrossBrowserTesting, or Sauce Labs services, you will
439
+ need to replace the placeholder text with your user account and authorization code for the cloud service(s) that you intend to connect with.
441
440
 
442
441
  <% desktop = "--tags ~@wip --tags ~@failing --tags @desktop --require features" %>
443
442
  <% mobile = "--tags ~@wip --tags ~@failing --tags @mobile --require features" %>
@@ -1,5 +1,11 @@
1
1
  module TestCentricity
2
2
  class UIElement
3
+ # Set the check state of a Siebel OUI JCheckBox object.
4
+ #
5
+ # @param state [Boolean] true = checked / false = unchecked
6
+ # @example
7
+ # remember_me_checkbox.set_checkbox_state(true)
8
+ #
3
9
  def set_siebel_checkbox_state(state)
4
10
  obj, _ = find_element
5
11
  object_not_found_exception(obj, 'Siebel checkbox')
@@ -8,12 +14,24 @@ module TestCentricity
8
14
  obj.click unless expected == obj.checked?
9
15
  end
10
16
 
17
+ # Select the specified option in a Siebel OUI select box object.
18
+ #
19
+ # @param option [String] text of option to select
20
+ # @example
21
+ # country_select.choose_option('Cayman Islands')
22
+ #
11
23
  def choose_siebel_option(option)
12
24
  Capybara.wait_on_first_by_default = true
13
25
  invoke_siebel_popup
14
26
  first(:xpath, "//li[@class='ui-menu-item']", :exact => true, :match => :prefer_exact,text: option).click
15
27
  end
16
28
 
29
+ # Return array of strings of all options in a Siebel OUI select box object.
30
+ #
31
+ # @return [Array]
32
+ # @example
33
+ # all_countries = country_select.get_options
34
+ #
17
35
  def get_siebel_options
18
36
  invoke_siebel_popup
19
37
  sleep(0.5)
@@ -209,6 +209,12 @@ module TestCentricity
209
209
  obj.checked?
210
210
  end
211
211
 
212
+ # Set the check state of a checkbox object.
213
+ #
214
+ # @param state [Boolean] true = checked / false = unchecked
215
+ # @example
216
+ # remember_me_checkbox.set_checkbox_state(true)
217
+ #
212
218
  def set_checkbox_state(state)
213
219
  obj, _ = find_element
214
220
  object_not_found_exception(obj, 'Checkbox')
@@ -321,6 +327,13 @@ module TestCentricity
321
327
  Capybara.ignore_hidden_elements = true
322
328
  end
323
329
 
330
+ # Select the specified option in a select box object.
331
+ # Supports standard HTML select objects and Chosen select objects.
332
+ #
333
+ # @param option [String] text of option to select
334
+ # @example
335
+ # province_select.choose_option('Nova Scotia')
336
+ #
324
337
  def choose_option(option)
325
338
  obj, _ = find_element
326
339
  object_not_found_exception(obj, nil)
@@ -344,16 +357,45 @@ module TestCentricity
344
357
  end
345
358
  end
346
359
 
360
+ # Return array of strings of all options in a select box object.
361
+ # Supports standard HTML select objects and Chosen select objects.
362
+ #
363
+ # @return [Array]
364
+ # @example
365
+ # all_colors = color_select.get_options
366
+ #
347
367
  def get_options
348
368
  obj, _ = find_element
349
369
  object_not_found_exception(obj, nil)
350
- obj.all('option').collect(&:text)
370
+ if first(:css, 'li.active-result')
371
+ obj.all('li.active-result').collect(&:text)
372
+ else
373
+ obj.all('option').collect(&:text)
374
+ end
351
375
  end
352
376
 
377
+ def verify_options(expected, enqueue = false)
378
+ actual = get_options
379
+ enqueue ?
380
+ ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{@locator}") :
381
+ assert_equal(expected, actual, "Expected list of options in list #{@locator} to be #{expected} but found #{actual}")
382
+ end
383
+
384
+ # Return text of first selected option in a select box object.
385
+ # Supports standard HTML select objects and Chosen select objects.
386
+ #
387
+ # @return [String]
388
+ # @example
389
+ # current_color = color_select.get_selected_option
390
+ #
353
391
  def get_selected_option
354
392
  obj, _ = find_element
355
393
  object_not_found_exception(obj, nil)
356
- obj.first('option[selected]').text
394
+ if first(:css, 'li.active-result')
395
+ obj.first("//li[contains(@class, 'result-selected')]").text
396
+ else
397
+ obj.first('option[selected]').text
398
+ end
357
399
  end
358
400
 
359
401
  # Return number of rows in a table object.
@@ -483,6 +525,14 @@ module TestCentricity
483
525
  value
484
526
  end
485
527
 
528
+ # Return text contained in specified cell of a table object.
529
+ #
530
+ # @param row [Integer] row number
531
+ # @param column [Integer] column number
532
+ # @return [String] value of table cell
533
+ # @example
534
+ # list_table.get_table_cell(4, 5)
535
+ #
486
536
  def get_table_cell(row, column)
487
537
  row_count = get_row_count
488
538
  raise "Row #{row} exceeds number of rows (#{row_count}) in table #{@locator}" if row > row_count
@@ -509,6 +559,14 @@ module TestCentricity
509
559
  assert_equal(expected.strip, actual.strip, "Expected #{@locator} row #{row}/column #{column} to display '#{expected}' but found '#{actual}'")
510
560
  end
511
561
 
562
+ # Set the value of the specified cell in a table object.
563
+ #
564
+ # @param row [Integer] row number
565
+ # @param column [Integer] column number
566
+ # @param value [String] text to set
567
+ # @example
568
+ # list_table.set_table_cell(3, 1, 'Ontario')
569
+ #
512
570
  def set_table_cell(row, column, value)
513
571
  row_count = get_row_count
514
572
  raise "Row #{row} exceeds number of rows (#{row_count}) in table #{@locator}" if row > row_count
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '0.5.7.2'
2
+ VERSION = '0.5.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7.2
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski