watir 6.13.0 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +141 -0
- data/.travis.yml +6 -0
- data/CHANGES.md +12 -0
- data/Gemfile +4 -10
- data/README.md +64 -49
- data/Rakefile +28 -16
- data/lib/watir.rb +13 -15
- data/lib/watir/adjacent.rb +15 -13
- data/lib/watir/after_hooks.rb +8 -10
- data/lib/watir/alert.rb +7 -8
- data/lib/watir/aliases.rb +2 -2
- data/lib/watir/attribute_helper.rb +18 -20
- data/lib/watir/browser.rb +42 -75
- data/lib/watir/capabilities.rb +19 -10
- data/lib/watir/cell_container.rb +0 -2
- data/lib/watir/container.rb +4 -4
- data/lib/watir/cookies.rb +7 -8
- data/lib/watir/element_collection.rb +37 -22
- data/lib/watir/elements/area.rb +0 -2
- data/lib/watir/elements/button.rb +1 -3
- data/lib/watir/elements/cell.rb +0 -1
- data/lib/watir/elements/checkbox.rb +5 -7
- data/lib/watir/elements/date_field.rb +5 -9
- data/lib/watir/elements/date_time_field.rb +6 -10
- data/lib/watir/elements/dlist.rb +2 -4
- data/lib/watir/elements/element.rb +201 -99
- data/lib/watir/elements/file_field.rb +3 -4
- data/lib/watir/elements/font.rb +2 -4
- data/lib/watir/elements/form.rb +0 -2
- data/lib/watir/elements/hidden.rb +3 -4
- data/lib/watir/elements/html_elements.rb +24 -76
- data/lib/watir/elements/iframe.rb +57 -71
- data/lib/watir/elements/image.rb +3 -4
- data/lib/watir/elements/input.rb +0 -2
- data/lib/watir/elements/link.rb +2 -5
- data/lib/watir/elements/list.rb +4 -4
- data/lib/watir/elements/option.rb +3 -6
- data/lib/watir/elements/radio.rb +4 -6
- data/lib/watir/elements/row.rb +0 -1
- data/lib/watir/elements/select.rb +41 -43
- data/lib/watir/elements/svg_elements.rb +0 -116
- data/lib/watir/elements/table.rb +1 -2
- data/lib/watir/elements/table_cell.rb +2 -3
- data/lib/watir/elements/text_field.rb +4 -6
- data/lib/watir/exception.rb +0 -1
- data/lib/watir/extensions/nokogiri.rb +2 -4
- data/lib/watir/generator.rb +3 -3
- data/lib/watir/generator/base.rb +10 -10
- data/lib/watir/generator/base/generator.rb +26 -29
- data/lib/watir/generator/base/idl_sorter.rb +34 -32
- data/lib/watir/generator/base/spec_extractor.rb +132 -114
- data/lib/watir/generator/base/util.rb +1 -3
- data/lib/watir/generator/base/visitor.rb +140 -140
- data/lib/watir/generator/html.rb +4 -4
- data/lib/watir/generator/html/generator.rb +2 -4
- data/lib/watir/generator/html/spec_extractor.rb +33 -33
- data/lib/watir/generator/html/visitor.rb +14 -14
- data/lib/watir/generator/svg.rb +3 -3
- data/lib/watir/generator/svg/generator.rb +1 -3
- data/lib/watir/generator/svg/spec_extractor.rb +35 -35
- data/lib/watir/generator/svg/visitor.rb +14 -14
- data/lib/watir/has_window.rb +2 -4
- data/lib/watir/js_execution.rb +7 -9
- data/lib/watir/js_snippets.rb +3 -3
- data/lib/watir/js_snippets/attributeValues.js +11 -0
- data/lib/watir/legacy_wait.rb +7 -12
- data/lib/watir/locators.rb +9 -11
- data/lib/watir/locators/button/locator.rb +2 -3
- data/lib/watir/locators/button/selector_builder.rb +9 -9
- data/lib/watir/locators/button/selector_builder/xpath.rb +1 -1
- data/lib/watir/locators/button/validator.rb +2 -2
- data/lib/watir/locators/cell/locator.rb +0 -2
- data/lib/watir/locators/cell/selector_builder.rb +3 -5
- data/lib/watir/locators/element/locator.rb +85 -64
- data/lib/watir/locators/element/selector_builder.rb +40 -38
- data/lib/watir/locators/element/selector_builder/xpath.rb +20 -18
- data/lib/watir/locators/element/validator.rb +1 -1
- data/lib/watir/locators/row/locator.rb +0 -2
- data/lib/watir/locators/row/selector_builder.rb +6 -9
- data/lib/watir/locators/text_area/selector_builder.rb +1 -1
- data/lib/watir/locators/text_field/locator.rb +1 -3
- data/lib/watir/locators/text_field/selector_builder.rb +5 -5
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +1 -1
- data/lib/watir/locators/text_field/validator.rb +3 -2
- data/lib/watir/logger.rb +11 -21
- data/lib/watir/navigation.rb +49 -0
- data/lib/watir/radio_set.rb +17 -18
- data/lib/watir/row_container.rb +3 -5
- data/lib/watir/screenshot.rb +2 -4
- data/lib/watir/user_editable.rb +13 -8
- data/lib/watir/version.rb +3 -0
- data/lib/watir/wait.rb +56 -55
- data/lib/watir/wait/timer.rb +1 -3
- data/lib/watir/window.rb +36 -45
- data/lib/watir/xpath_support.rb +1 -3
- data/lib/watirspec.rb +11 -11
- data/lib/watirspec/guards.rb +10 -7
- data/lib/watirspec/implementation.rb +3 -4
- data/lib/watirspec/rake_tasks.rb +30 -29
- data/lib/watirspec/remote_server.rb +3 -3
- data/lib/watirspec/runner.rb +1 -2
- data/lib/watirspec/server.rb +3 -0
- data/lib/watirspec/server/app.rb +14 -6
- data/spec/implementation_spec.rb +9 -9
- data/spec/locator_spec_helper.rb +3 -4
- data/spec/spec_helper.rb +3 -7
- data/spec/unit/container_spec.rb +9 -10
- data/spec/unit/element_locator_spec.rb +224 -219
- data/spec/unit/logger_spec.rb +4 -4
- data/spec/unit/unit_helper.rb +0 -2
- data/spec/unit/wait_spec.rb +26 -28
- data/spec/watirspec/adjacent_spec.rb +130 -130
- data/spec/watirspec/after_hooks_spec.rb +63 -63
- data/spec/watirspec/alert_spec.rb +6 -6
- data/spec/watirspec/attributes_spec.rb +6 -6
- data/spec/watirspec/browser_spec.rb +161 -162
- data/spec/watirspec/click_spec.rb +9 -9
- data/spec/watirspec/cookies_spec.rb +15 -14
- data/spec/watirspec/drag_and_drop_spec.rb +15 -16
- data/spec/watirspec/element_hidden_spec.rb +19 -21
- data/spec/watirspec/elements/area_spec.rb +18 -21
- data/spec/watirspec/elements/areas_spec.rb +13 -15
- data/spec/watirspec/elements/button_spec.rb +96 -99
- data/spec/watirspec/elements/buttons_spec.rb +17 -19
- data/spec/watirspec/elements/checkbox_spec.rb +102 -100
- data/spec/watirspec/elements/checkboxes_spec.rb +13 -15
- data/spec/watirspec/elements/collections_spec.rb +35 -37
- data/spec/watirspec/elements/date_field_spec.rb +46 -47
- data/spec/watirspec/elements/date_fields_spec.rb +13 -15
- data/spec/watirspec/elements/date_time_field_spec.rb +62 -57
- data/spec/watirspec/elements/date_time_fields_spec.rb +14 -15
- data/spec/watirspec/elements/dd_spec.rb +46 -48
- data/spec/watirspec/elements/dds_spec.rb +13 -15
- data/spec/watirspec/elements/del_spec.rb +27 -28
- data/spec/watirspec/elements/dels_spec.rb +13 -15
- data/spec/watirspec/elements/div_spec.rb +89 -91
- data/spec/watirspec/elements/divs_spec.rb +17 -19
- data/spec/watirspec/elements/dl_spec.rb +52 -54
- data/spec/watirspec/elements/dls_spec.rb +13 -15
- data/spec/watirspec/elements/dt_spec.rb +46 -48
- data/spec/watirspec/elements/dts_spec.rb +13 -15
- data/spec/watirspec/elements/element_spec.rb +240 -189
- data/spec/watirspec/elements/elements_spec.rb +16 -16
- data/spec/watirspec/elements/em_spec.rb +38 -40
- data/spec/watirspec/elements/ems_spec.rb +13 -15
- data/spec/watirspec/elements/filefield_spec.rb +45 -46
- data/spec/watirspec/elements/filefields_spec.rb +13 -15
- data/spec/watirspec/elements/font_spec.rb +11 -13
- data/spec/watirspec/elements/form_spec.rb +13 -15
- data/spec/watirspec/elements/forms_spec.rb +13 -15
- data/spec/watirspec/elements/frame_spec.rb +48 -50
- data/spec/watirspec/elements/frames_spec.rb +13 -15
- data/spec/watirspec/elements/hidden_spec.rb +23 -25
- data/spec/watirspec/elements/hiddens_spec.rb +13 -15
- data/spec/watirspec/elements/hn_spec.rb +22 -24
- data/spec/watirspec/elements/hns_spec.rb +13 -13
- data/spec/watirspec/elements/iframe_spec.rb +106 -74
- data/spec/watirspec/elements/iframes_spec.rb +16 -18
- data/spec/watirspec/elements/image_spec.rb +30 -32
- data/spec/watirspec/elements/images_spec.rb +13 -15
- data/spec/watirspec/elements/input_spec.rb +4 -5
- data/spec/watirspec/elements/ins_spec.rb +27 -29
- data/spec/watirspec/elements/inses_spec.rb +13 -15
- data/spec/watirspec/elements/label_spec.rb +17 -19
- data/spec/watirspec/elements/labels_spec.rb +13 -15
- data/spec/watirspec/elements/li_spec.rb +23 -25
- data/spec/watirspec/elements/link_spec.rb +45 -48
- data/spec/watirspec/elements/links_spec.rb +14 -16
- data/spec/watirspec/elements/lis_spec.rb +13 -15
- data/spec/watirspec/elements/list_spec.rb +14 -15
- data/spec/watirspec/elements/map_spec.rb +19 -20
- data/spec/watirspec/elements/maps_spec.rb +13 -15
- data/spec/watirspec/elements/meta_spec.rb +10 -10
- data/spec/watirspec/elements/metas_spec.rb +13 -15
- data/spec/watirspec/elements/ol_spec.rb +20 -21
- data/spec/watirspec/elements/ols_spec.rb +13 -15
- data/spec/watirspec/elements/option_spec.rb +63 -63
- data/spec/watirspec/elements/p_spec.rb +27 -26
- data/spec/watirspec/elements/pre_spec.rb +24 -25
- data/spec/watirspec/elements/pres_spec.rb +13 -15
- data/spec/watirspec/elements/ps_spec.rb +13 -15
- data/spec/watirspec/elements/radio_spec.rb +96 -97
- data/spec/watirspec/elements/radios_spec.rb +13 -15
- data/spec/watirspec/elements/select_list_spec.rb +244 -237
- data/spec/watirspec/elements/select_lists_spec.rb +15 -16
- data/spec/watirspec/elements/span_spec.rb +32 -31
- data/spec/watirspec/elements/spans_spec.rb +13 -15
- data/spec/watirspec/elements/strong_spec.rb +23 -24
- data/spec/watirspec/elements/strongs_spec.rb +13 -15
- data/spec/watirspec/elements/table_nesting_spec.rb +15 -14
- data/spec/watirspec/elements/table_spec.rb +61 -62
- data/spec/watirspec/elements/tables_spec.rb +15 -17
- data/spec/watirspec/elements/tbody_spec.rb +25 -26
- data/spec/watirspec/elements/tbodys_spec.rb +17 -19
- data/spec/watirspec/elements/td_spec.rb +20 -22
- data/spec/watirspec/elements/tds_spec.rb +9 -11
- data/spec/watirspec/elements/text_field_spec.rb +55 -56
- data/spec/watirspec/elements/text_fields_spec.rb +15 -16
- data/spec/watirspec/elements/textarea_spec.rb +2 -2
- data/spec/watirspec/elements/textareas_spec.rb +1 -1
- data/spec/watirspec/elements/tfoot_spec.rb +22 -23
- data/spec/watirspec/elements/tfoots_spec.rb +19 -19
- data/spec/watirspec/elements/thead_spec.rb +21 -23
- data/spec/watirspec/elements/theads_spec.rb +19 -19
- data/spec/watirspec/elements/tr_spec.rb +20 -22
- data/spec/watirspec/elements/trs_spec.rb +17 -19
- data/spec/watirspec/elements/ul_spec.rb +17 -19
- data/spec/watirspec/elements/uls_spec.rb +13 -14
- data/spec/watirspec/html/data_attributes.html +1 -0
- data/spec/watirspec/radio_set_spec.rb +100 -99
- data/spec/watirspec/relaxed_locate_spec.rb +19 -43
- data/spec/watirspec/screenshot_spec.rb +4 -4
- data/spec/watirspec/special_chars_spec.rb +2 -4
- data/spec/watirspec/support/rspec_matchers.rb +85 -22
- data/spec/watirspec/user_editable_spec.rb +84 -85
- data/spec/watirspec/wait_spec.rb +74 -95
- data/spec/watirspec/window_switching_spec.rb +131 -132
- data/spec/watirspec_helper.rb +12 -9
- data/support/travis.sh +4 -0
- data/support/version_differ.rb +12 -13
- data/watir.gemspec +29 -22
- metadata +76 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a6cd2d994ac6819dcc74e5b15639de4061bf1fe
|
|
4
|
+
data.tar.gz: f713658a590057181b64c8cfb26e2c278c02fdda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c55e3c6cb644323b2e1e4dfe0b1488a9c0a53733d88022f4986e55cfb6ee0ad5b4b64c5604f096df2d702d86f4d2393012f6ad507468e88fad4be89c10fbbee1
|
|
7
|
+
data.tar.gz: 07f6e39aa359c8c89b2dc012a7ce6ef4a4c17b68645ef827aed01bb03cf130217e94c69eb0fadc5d41826708fe672c443b73c80e54613f7e08ca81c2f1bbad04
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Offense count: 144
|
|
2
|
+
# Cop supports --auto-correct.
|
|
3
|
+
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
|
4
|
+
Layout/EmptyLineBetweenDefs:
|
|
5
|
+
Exclude:
|
|
6
|
+
- 'lib/watir/elements/html_elements.rb'
|
|
7
|
+
- 'lib/watir/elements/svg_elements.rb'
|
|
8
|
+
|
|
9
|
+
# Offense count: 2
|
|
10
|
+
# Cop supports --auto-correct.
|
|
11
|
+
Layout/EmptyLines:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'lib/watir/elements/html_elements.rb'
|
|
14
|
+
- 'lib/watir/elements/svg_elements.rb'
|
|
15
|
+
|
|
16
|
+
# Offense count: 2
|
|
17
|
+
# Cop supports --auto-correct.
|
|
18
|
+
# Configuration parameters: EnforcedStyle.
|
|
19
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
|
20
|
+
Layout/EmptyLinesAroundModuleBody:
|
|
21
|
+
Exclude:
|
|
22
|
+
- 'lib/watir/elements/html_elements.rb'
|
|
23
|
+
- 'lib/watir/elements/svg_elements.rb'
|
|
24
|
+
|
|
25
|
+
# Offense count: 85
|
|
26
|
+
# Cop supports --auto-correct.
|
|
27
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
|
28
|
+
# SupportedStyles: space, no_space, compact
|
|
29
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
|
30
|
+
Layout/SpaceInsideHashLiteralBraces:
|
|
31
|
+
EnforcedStyle: no_space
|
|
32
|
+
|
|
33
|
+
# Offense count: 1
|
|
34
|
+
Lint/HandleExceptions:
|
|
35
|
+
Exclude:
|
|
36
|
+
- 'lib/watirspec.rb'
|
|
37
|
+
|
|
38
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
39
|
+
# ExcludedMethods: refine
|
|
40
|
+
Metrics/BlockLength:
|
|
41
|
+
Exclude:
|
|
42
|
+
- 'spec/**/*'
|
|
43
|
+
- 'support/doctest_helper.rb'
|
|
44
|
+
- 'watir.gemspec'
|
|
45
|
+
- 'Rakefile'
|
|
46
|
+
|
|
47
|
+
## Configuration parameters: CountComments.
|
|
48
|
+
Metrics/ModuleLength:
|
|
49
|
+
Exclude:
|
|
50
|
+
- 'lib/watir/elements/html_elements.rb'
|
|
51
|
+
- 'lib/watir/elements/svg_elements.rb'
|
|
52
|
+
|
|
53
|
+
# Configuration parameters: CountComments.
|
|
54
|
+
Metrics/MethodLength:
|
|
55
|
+
Max: 18
|
|
56
|
+
|
|
57
|
+
# Configuration parameters: CountComments.
|
|
58
|
+
Metrics/ClassLength:
|
|
59
|
+
Max: 116
|
|
60
|
+
Exclude:
|
|
61
|
+
- 'lib/watir/locators/element/locator.rb'
|
|
62
|
+
- 'lib/watir/browser.rb'
|
|
63
|
+
- 'lib/watir/elements/element.rb'
|
|
64
|
+
- 'lib/watir/elements/select.rb'
|
|
65
|
+
|
|
66
|
+
Metrics/PerceivedComplexity:
|
|
67
|
+
Max: 9
|
|
68
|
+
|
|
69
|
+
Metrics/CyclomaticComplexity:
|
|
70
|
+
Max: 9
|
|
71
|
+
|
|
72
|
+
# Offense count: 28
|
|
73
|
+
Metrics/AbcSize:
|
|
74
|
+
Max: 22
|
|
75
|
+
Exclude:
|
|
76
|
+
- 'lib/watir/locators/element/selector_builder.rb'
|
|
77
|
+
- 'lib/watir/generator/base/generator.rb'
|
|
78
|
+
|
|
79
|
+
# TODO: fix with Watir 7
|
|
80
|
+
# Configuration parameters: CountKeywordArgs.
|
|
81
|
+
Metrics/ParameterLists:
|
|
82
|
+
Exclude:
|
|
83
|
+
- 'lib/watir/wait.rb'
|
|
84
|
+
|
|
85
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
86
|
+
# URISchemes: http, https
|
|
87
|
+
Metrics/LineLength:
|
|
88
|
+
Max: 120
|
|
89
|
+
|
|
90
|
+
# Cop supports --auto-correct.
|
|
91
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
|
|
92
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining
|
|
93
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
94
|
+
# FunctionalMethods: let, let!, subject, watch
|
|
95
|
+
# IgnoredMethods: lambda, proc, it
|
|
96
|
+
Style/BlockDelimiters:
|
|
97
|
+
EnforcedStyle: braces_for_chaining
|
|
98
|
+
|
|
99
|
+
Style/CommentedKeyword:
|
|
100
|
+
Enabled: false
|
|
101
|
+
|
|
102
|
+
Style/DoubleNegation:
|
|
103
|
+
Enabled: false
|
|
104
|
+
|
|
105
|
+
## Configuration parameters: AllowedVariables.
|
|
106
|
+
Style/GlobalVars:
|
|
107
|
+
AllowedVariables:
|
|
108
|
+
- $browser
|
|
109
|
+
|
|
110
|
+
### Cop supports --auto-correct.
|
|
111
|
+
### Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
112
|
+
## SupportedStyles: single_quotes, double_quotes
|
|
113
|
+
Style/StringLiterals:
|
|
114
|
+
Exclude:
|
|
115
|
+
- 'lib/watir/elements/html_elements.rb'
|
|
116
|
+
- 'lib/watir/elements/svg_elements.rb'
|
|
117
|
+
|
|
118
|
+
Style/MethodCallWithoutArgsParentheses:
|
|
119
|
+
Enabled: false
|
|
120
|
+
|
|
121
|
+
# TODO: I can't tell if this applies
|
|
122
|
+
## Configuration parameters: EnforcedStyle.
|
|
123
|
+
## SupportedStyles: annotated, template, unannotated
|
|
124
|
+
Style/FormatStringToken:
|
|
125
|
+
Exclude:
|
|
126
|
+
- 'lib/watir/browser.rb'
|
|
127
|
+
- 'lib/watir/locators/text_field/selector_builder.rb'
|
|
128
|
+
- 'lib/watir/window.rb'
|
|
129
|
+
|
|
130
|
+
Style/Documentation:
|
|
131
|
+
Enabled: false
|
|
132
|
+
|
|
133
|
+
# Cop supports --auto-correct.
|
|
134
|
+
# Configuration parameters: EnforcedStyle.
|
|
135
|
+
# SupportedStyles: when_needed, always, never
|
|
136
|
+
Style/FrozenStringLiteralComment:
|
|
137
|
+
Enabled: false
|
|
138
|
+
|
|
139
|
+
Naming/FileName:
|
|
140
|
+
Exclude:
|
|
141
|
+
- 'lib/watir-webdriver.rb'
|
data/.travis.yml
CHANGED
|
@@ -71,6 +71,12 @@ matrix:
|
|
|
71
71
|
- env: RAKE_TASK=spec:chrome HEADLESS=true
|
|
72
72
|
<<: *five
|
|
73
73
|
<<: *chrome
|
|
74
|
+
- env: RAKE_TASK=spec:stats
|
|
75
|
+
<<: *five
|
|
76
|
+
<<: *chrome
|
|
74
77
|
- env: RAKE_TASK=yard:doctest
|
|
75
78
|
<<: *five
|
|
76
79
|
<<: *chrome
|
|
80
|
+
- env: RAKE_TASK=rubocop
|
|
81
|
+
<<: *three
|
|
82
|
+
<<: *chrome
|
data/CHANGES.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
### 6.14.0 (2018-09-13)
|
|
2
|
+
|
|
3
|
+
* HTML Element attribute support updated to HTML 5.2
|
|
4
|
+
* `#wait_until_present` and `#wait_while_present` accept custom message arguments (thanks Jakub Samek)
|
|
5
|
+
* Added `Element#located?` method
|
|
6
|
+
* Fix bug preventing collections from waiting for a parent element (#759)
|
|
7
|
+
* Fix bug preventing collection elements from being cached
|
|
8
|
+
* Update code style in accordance with Rubocop settings
|
|
9
|
+
* Add `Element#attribute_list` and `Element#attribute_values` (thanks Lakshya Kapoor)
|
|
10
|
+
* Fix bug preventing location of elements based on how XPath deals with default namespaces
|
|
11
|
+
* Ruby 2.2 and below are no longer supported.
|
|
12
|
+
|
|
1
13
|
### 6.13.0 (2018-09-02)
|
|
2
14
|
|
|
3
15
|
* Allow wait methods to wait for values of any attribute
|
data/Gemfile
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
source
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
2
|
|
|
3
|
-
unless ENV['TRAVIS']
|
|
4
|
-
gem "simplecov", ">= 0.3.5", platform: :ruby_19
|
|
5
|
-
end
|
|
3
|
+
gem 'simplecov', '>= 0.3.5', platform: :ruby_19 unless ENV['TRAVIS']
|
|
6
4
|
|
|
7
|
-
if ENV['LOCAL_WEBIDL']
|
|
8
|
-
gem 'webidl', path: File.expand_path('../webidl')
|
|
9
|
-
end
|
|
5
|
+
gem 'webidl', path: File.expand_path('../webidl') if ENV['LOCAL_WEBIDL']
|
|
10
6
|
|
|
11
|
-
if ENV['LOCAL_SELENIUM']
|
|
12
|
-
gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb')
|
|
13
|
-
end
|
|
7
|
+
gem 'selenium-webdriver', path: File.expand_path('../selenium/build/rb') if ENV['LOCAL_SELENIUM']
|
|
14
8
|
|
|
15
9
|
# Specify your gem's dependencies in watir.gemspec
|
|
16
10
|
gemspec
|
data/README.md
CHANGED
|
@@ -6,50 +6,33 @@ Watir Powered By Selenium!
|
|
|
6
6
|
[](https://travis-ci.org/watir/watir)
|
|
7
7
|
[](https://ci.appveyor.com/project/p0deje/watir)
|
|
8
8
|
[](https://codeclimate.com/github/watir/watir)
|
|
9
|
-
[](https://gemnasium.com/watir/watir)
|
|
10
9
|
[](https://coveralls.io/r/watir/watir)
|
|
11
10
|
|
|
12
|
-
## Example
|
|
13
|
-
|
|
14
|
-
```ruby
|
|
15
|
-
require 'watir'
|
|
16
|
-
|
|
17
|
-
browser = Watir::Browser.new
|
|
18
|
-
|
|
19
|
-
browser.goto 'watir.com'
|
|
20
|
-
browser.link(text: 'Guides').click
|
|
21
|
-
|
|
22
|
-
puts browser.title
|
|
23
|
-
# => 'Guides – Watir Project'
|
|
24
|
-
browser.close
|
|
25
|
-
```
|
|
26
|
-
|
|
27
11
|
## Using Watir
|
|
28
12
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
If you are interested in contributing to the project or the ecosystem, continue reading this README.
|
|
13
|
+
This README is for people interested in writing code for Watir or gems in the Watir ecosystem
|
|
14
|
+
that leverage private-api Watir code.
|
|
32
15
|
|
|
33
|
-
|
|
16
|
+
For our users, everything you'll need is on the [Watir website](http://watir.com):
|
|
17
|
+
examples, news, guides, additional resources, support information and more.
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
This is done by extracting the IDL parts from the spec and processing them with the WebIDL gem (link below).
|
|
37
|
-
Currently supported specifications are:
|
|
19
|
+
## Procedure for Patches/Pull Requests
|
|
38
20
|
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
* Fork the project.
|
|
22
|
+
* Clone onto your local machine.
|
|
23
|
+
* Create a new feature branch (bonus points for good names).
|
|
24
|
+
* Make your feature addition or bug fix.
|
|
25
|
+
* Add tests for it. This is important so we don't unintentionally break it in a future version.
|
|
26
|
+
* Commit, do not change Rakefile, gemspec, or CHANGES files, we'll take care of that on release.
|
|
27
|
+
* Make sure it is passing doctests.
|
|
28
|
+
* Make sure it is passing rubocop.
|
|
29
|
+
* Push to your forked repository.
|
|
30
|
+
* Send a pull request.
|
|
47
31
|
|
|
48
|
-
|
|
32
|
+
## Developing Extensions
|
|
49
33
|
|
|
50
|
-
When developing
|
|
51
|
-
|
|
52
|
-
your gem depends on Watir, you should do next:
|
|
34
|
+
When developing a gem intended to be used with Watir, you can run your code with WatirSpec
|
|
35
|
+
to make sure that requiring your code does not break something else in Watir.
|
|
53
36
|
|
|
54
37
|
First, add WatirSpec Rake tasks to your gem:
|
|
55
38
|
|
|
@@ -65,30 +48,62 @@ Second, initialize WatirSpec for your gem:
|
|
|
65
48
|
$ bundle exec rake watirspec:init
|
|
66
49
|
```
|
|
67
50
|
|
|
68
|
-
|
|
51
|
+
This command will walk you through how to customize your code.
|
|
52
|
+
|
|
53
|
+
## Automatic Element Generation
|
|
54
|
+
|
|
55
|
+
The majority of element methods Watir provides is autogenerated from specifications.
|
|
56
|
+
This is done by extracting the IDL parts from the spec and processing them with the
|
|
57
|
+
[WebIDL gem](https://github.com/jarib/webidl).
|
|
58
|
+
|
|
59
|
+
Generated elements are currently based on the following specifications:
|
|
60
|
+
|
|
61
|
+
* [HTML](https://www.w3.org/TR/2017/REC-html52-20171214/) (`lib/watir/elements/html_elements.rb`)
|
|
62
|
+
* [SVG](https://www.w3.org/TR/2018/CR-SVG2-20180807/) (`lib/watir/elements/svg_elements.rb`)
|
|
63
|
+
|
|
64
|
+
To run:
|
|
65
|
+
```bash
|
|
66
|
+
$ bundle exec rake html:update
|
|
67
|
+
$ bundle exec rake svg:update
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Specs
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
#### Travis CI
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
Watir specs are run on [Travis CI](https://travis-ci.org/watir/watir).
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
Watir code is tested with 2.3, 2.4 and 2.5 versions in multiple browsers and with multiple configurations.
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
#### Doctests
|
|
79
|
+
|
|
80
|
+
Watir uses [yard-doctest](https://github.com/p0deje/yard-doctest) to directly test
|
|
81
|
+
our documentation examples.
|
|
77
82
|
|
|
78
83
|
```bash
|
|
84
|
+
mkdir ~/.yard
|
|
85
|
+
bundle exec yard config -a autoload_plugins yard-doctest
|
|
79
86
|
rake yard:doctest
|
|
80
87
|
```
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
#### Coveralls
|
|
83
90
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
Watir code is run through [Coveralls](https://coveralls.io/github/watir/watir) to encourage PRs
|
|
92
|
+
to ensure all paths in their code have tests associated with them.
|
|
93
|
+
|
|
94
|
+
#### Rubocop
|
|
95
|
+
|
|
96
|
+
Watir is using [Rubocop](https://github.com/rubocop-hq/rubocop) to ensure a consistent style across the
|
|
97
|
+
code base. It is run with our minimum supported Ruby version (2.3)
|
|
98
|
+
We have some [established exceptions](https://github.com/watir/watir/blob/master/.rubocop.yml)
|
|
99
|
+
that might need to be tweaked for new code submissions. This can be addressed in the PR as necessary.
|
|
100
|
+
|
|
101
|
+
#### Statistics
|
|
102
|
+
|
|
103
|
+
Element specs are run with
|
|
104
|
+
[Selenium Statistics gem](https://github.com/titusfortner/selenium_statistics)
|
|
105
|
+
to verify that changes to the code do not dramatically decrease the performance based
|
|
106
|
+
on wire calls.
|
|
92
107
|
|
|
93
108
|
## Copyright
|
|
94
109
|
|
data/Rakefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path(
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
|
2
2
|
|
|
3
3
|
require 'bundler'
|
|
4
4
|
Bundler::GemHelper.install_tasks
|
|
@@ -9,33 +9,39 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
|
9
9
|
spec.pattern = 'spec/**/*_spec.rb'
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
require 'rubocop/rake_task'
|
|
13
|
+
|
|
14
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
15
|
+
t.options = ['--display-cop-names']
|
|
16
|
+
end
|
|
17
|
+
|
|
12
18
|
namespace :spec do
|
|
13
19
|
RSpec::Core::RakeTask.new(:html) do |spec|
|
|
14
|
-
spec.rspec_opts = "--format html --out #{ENV[
|
|
20
|
+
spec.rspec_opts = "--format html --out #{ENV['SPEC_REPORT'] || 'specs.html'}"
|
|
15
21
|
spec.pattern = 'spec/**/*_spec.rb'
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
24
|
|
|
19
25
|
{
|
|
20
|
-
html: 'https://www.w3.org/TR/
|
|
26
|
+
html: 'https://www.w3.org/TR/html52/single-page.html',
|
|
21
27
|
svg: 'http://www.w3.org/TR/SVG2/single-page.html'
|
|
22
28
|
}.each do |type, spec_uri|
|
|
23
29
|
namespace type do
|
|
24
30
|
spec_path = "support/#{type}.html"
|
|
25
31
|
|
|
26
32
|
task generator_lib: :lib do
|
|
27
|
-
require
|
|
33
|
+
require 'watir/generator'
|
|
28
34
|
end
|
|
29
35
|
|
|
30
36
|
desc "Download #{type.upcase} spec from #{spec_uri}"
|
|
31
37
|
task :download do
|
|
32
|
-
require
|
|
38
|
+
require 'open-uri'
|
|
33
39
|
mv spec_path, "#{spec_path}.old" if File.exist?(spec_path)
|
|
34
40
|
downloaded_bytes = 0
|
|
35
41
|
|
|
36
|
-
File.open(spec_path,
|
|
42
|
+
File.open(spec_path, 'w') do |io|
|
|
37
43
|
io << "<!-- downloaded from #{spec_uri} on #{Time.now} -->\n"
|
|
38
|
-
io << data = open(spec_uri).read
|
|
44
|
+
io << data = URI.open(spec_uri).read
|
|
39
45
|
downloaded_bytes = data.bytesize
|
|
40
46
|
end
|
|
41
47
|
|
|
@@ -54,7 +60,7 @@ end
|
|
|
54
60
|
|
|
55
61
|
if extractor.errors.any?
|
|
56
62
|
puts "\n\n<======================= ERRORS =======================>\n\n"
|
|
57
|
-
puts extractor.errors.join("\n" +
|
|
63
|
+
puts extractor.errors.join("\n" + '=' * 80 + "\n")
|
|
58
64
|
end
|
|
59
65
|
end
|
|
60
66
|
|
|
@@ -63,13 +69,11 @@ end
|
|
|
63
69
|
old_file = "lib/watir/elements/#{type}_elements.rb"
|
|
64
70
|
generator = Watir::Generator.const_get(type.upcase).new
|
|
65
71
|
|
|
66
|
-
File.open("#{old_file}.new",
|
|
72
|
+
File.open("#{old_file}.new", 'w') do |file|
|
|
67
73
|
generator.generate(spec_path, file)
|
|
68
74
|
end
|
|
69
75
|
|
|
70
|
-
if File.exist?(old_file)
|
|
71
|
-
system "diff -Naut #{old_file} #{old_file}.new | less"
|
|
72
|
-
end
|
|
76
|
+
system "diff -Naut #{old_file} #{old_file}.new | less" if File.exist?(old_file)
|
|
73
77
|
end
|
|
74
78
|
|
|
75
79
|
desc "Move #{type}.rb.new to #{type}.rb"
|
|
@@ -79,7 +83,7 @@ end
|
|
|
79
83
|
end
|
|
80
84
|
|
|
81
85
|
desc "download spec -> generate -> #{type}.rb"
|
|
82
|
-
task update: [
|
|
86
|
+
task update: %i[download generate overwrite]
|
|
83
87
|
end
|
|
84
88
|
end
|
|
85
89
|
|
|
@@ -120,7 +124,7 @@ namespace :spec do
|
|
|
120
124
|
require 'selenium-webdriver'
|
|
121
125
|
|
|
122
126
|
desc 'Run specs in all browsers'
|
|
123
|
-
task all_browsers: [
|
|
127
|
+
task all_browsers: %i[browsers remote_browsers]
|
|
124
128
|
|
|
125
129
|
desc 'Run specs locally for all browsers'
|
|
126
130
|
task browsers: [:chrome,
|
|
@@ -136,7 +140,7 @@ namespace :spec do
|
|
|
136
140
|
(:remote_ie if Selenium::WebDriver::Platform.windows?),
|
|
137
141
|
(:remote_edge if Selenium::WebDriver::Platform.windows?)].compact
|
|
138
142
|
|
|
139
|
-
%w
|
|
143
|
+
%w[firefox chrome safari ie edge].each do |browser|
|
|
140
144
|
desc "Run specs in #{browser}"
|
|
141
145
|
task browser do
|
|
142
146
|
ENV['WATIR_BROWSER'] = browser
|
|
@@ -146,8 +150,16 @@ namespace :spec do
|
|
|
146
150
|
desc "Run specs in Remote #{browser}"
|
|
147
151
|
task "remote_#{browser}" do
|
|
148
152
|
ENV['WATIR_BROWSER'] = browser
|
|
149
|
-
ENV[
|
|
153
|
+
ENV['USE_REMOTE'] = 'true'
|
|
150
154
|
Rake::Task[:spec].execute
|
|
151
155
|
end
|
|
152
156
|
end
|
|
157
|
+
|
|
158
|
+
desc 'Run element location specs and report wire calls'
|
|
159
|
+
RSpec::Core::RakeTask.new(:stats) do |spec|
|
|
160
|
+
ENV['SELENIUM_STATS'] = 'true'
|
|
161
|
+
spec.pattern = 'spec/**/**_spec.rb'
|
|
162
|
+
spec.exclude_pattern = '**/window_switching_spec.rb, **/browser_spec.rb, **/after_hooks_spec.rb, ' \
|
|
163
|
+
'**/alert_spec.rb, **/wait_spec.rb, **/screenshot_spec.rb'
|
|
164
|
+
end
|
|
153
165
|
end
|