testcentricity_web 4.1.8 → 4.1.9
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/.gitignore +1 -0
- data/.rspec +2 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -0
- data/README.md +11 -12
- data/Rakefile +93 -64
- data/config/cucumber.yml +1 -0
- data/config/locales/en-US.yml +56 -0
- data/{docker-compose-v3.yml → docker-compose.yml} +2 -2
- data/features/basic_form_page_css.feature +16 -1
- data/features/custom_controls.feature +29 -0
- data/features/media_players.feature +3 -20
- data/features/step_definitions/generic_steps.rb.rb +15 -0
- data/features/support/env.rb +3 -2
- data/features/support/hooks.rb +8 -3
- data/features/support/pages/base_test_page.rb +1 -1
- data/features/support/pages/basic_css_form_page.rb +1 -0
- data/features/support/pages/basic_form_page.rb +45 -9
- data/features/support/pages/basic_xpath_form_page.rb +1 -0
- data/features/support/pages/custom_controls_page.rb +250 -0
- data/features/support/pages/indexed_sections_page.rb +44 -0
- data/features/support/pages/media_test_page.rb +10 -11
- data/features/support/sections/header_nav.rb +10 -1
- data/features/support/sections/product_card.rb +39 -0
- data/lib/testcentricity_web/browser_helper.rb +0 -6
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +1 -1
- data/lib/testcentricity_web/web_core/page_section.rb +1 -1
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +44 -44
- data/lib/testcentricity_web/web_elements/checkbox.rb +50 -19
- data/lib/testcentricity_web/web_elements/media.rb +1 -1
- data/lib/testcentricity_web/web_elements/radio.rb +50 -19
- data/lib/testcentricity_web/web_elements/select_list.rb +12 -12
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +3 -3
- data/spec/fixtures/page_object.rb +22 -0
- data/spec/fixtures/section_object.rb +21 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/testcentricity_web/browser_spec.rb +41 -0
- data/spec/testcentricity_web/elements/audio_spec.rb +68 -0
- data/spec/testcentricity_web/elements/button_spec.rb +18 -0
- data/spec/testcentricity_web/elements/checkbox_spec.rb +33 -0
- data/spec/testcentricity_web/elements/file_field_spec.rb +13 -0
- data/spec/testcentricity_web/elements/image_spec.rb +33 -0
- data/spec/testcentricity_web/elements/label_spec.rb +18 -0
- data/spec/testcentricity_web/elements/link_spec.rb +23 -0
- data/spec/testcentricity_web/elements/list_spec.rb +13 -0
- data/spec/testcentricity_web/elements/radio_spec.rb +28 -0
- data/spec/testcentricity_web/elements/ui_element_spec.rb +125 -0
- data/spec/testcentricity_web/elements/video_spec.rb +68 -0
- data/spec/testcentricity_web/helper_specs/object_helpers_spec.rb +39 -0
- data/spec/testcentricity_web/helper_specs/string_helpers_spec.rb +49 -0
- data/spec/testcentricity_web/page_object_spec.rb +90 -0
- data/spec/testcentricity_web/section_object_spec.rb +72 -0
- data/spec/testcentricity_web/version_spec.rb +7 -0
- data/spec/testcentricity_web/webdriver_connect/grid_webdriver_spec.rb +72 -0
- data/spec/testcentricity_web/webdriver_connect/local_webdriver_spec.rb +86 -0
- data/spec/testcentricity_web/webdriver_connect/mobile_webdriver_spec.rb +65 -0
- data/test_site/basic_test_page.html +2 -2
- data/test_site/chosen-sprite.png +0 -0
- data/test_site/chosen-sprite@2x.png +0 -0
- data/test_site/chosen.css +496 -0
- data/test_site/chosen.jquery.js +1359 -0
- data/test_site/chosen.jquery.min.js +3 -0
- data/test_site/chosen.min.css +11 -0
- data/test_site/chosen.proto.js +1399 -0
- data/test_site/chosen.proto.min.js +3 -0
- data/test_site/composer.json +36 -0
- data/test_site/custom_controls_page.html +572 -1
- data/test_site/docsupport/chosen.png +0 -0
- data/test_site/docsupport/init.js +11 -0
- data/test_site/docsupport/init.proto.js +16 -0
- data/test_site/docsupport/jquery-1.12.4.min.js +5 -0
- data/test_site/docsupport/jquery-3.2.1.min.js +4 -0
- data/test_site/docsupport/oss-credit.png +0 -0
- data/test_site/docsupport/prism.css +108 -0
- data/test_site/docsupport/prism.js +9 -0
- data/test_site/docsupport/prototype-1.7.0.0.js +6082 -0
- data/test_site/docsupport/style.css +219 -0
- data/test_site/images/Blouse_Black.jpg +0 -0
- data/test_site/images/Printed_Dress.jpg +0 -0
- data/test_site/images/T-shirt.jpg +0 -0
- data/test_site/images/jeans3.jpg +0 -0
- data/test_site/indexed_sections_page.html +158 -1
- data/test_site/media/bbc_scotland_report.mp3 +0 -0
- data/test_site/media_page.html +2 -2
- data/testcentricity_web.gemspec +14 -8
- metadata +158 -13
- data/Gemfile.lock +0 -170
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::Link, required: true do
|
|
4
|
+
subject(:css_link) { described_class.new(:test_label, self, 'a#css_label', :page) }
|
|
5
|
+
|
|
6
|
+
it 'returns class' do
|
|
7
|
+
expect(css_link.class).to eql TestCentricity::Link
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'registers with type link' do
|
|
11
|
+
expect(css_link.get_object_type).to eql :link
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'returns href' do
|
|
15
|
+
allow(css_link).to receive(:href).and_return('href')
|
|
16
|
+
expect(css_link.href).to eql 'href'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should click the link' do
|
|
20
|
+
expect(css_link).to receive(:click)
|
|
21
|
+
css_link.click
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::List, required: true do
|
|
4
|
+
subject(:css_list) { described_class.new(:test_list, self, 'ul#css_list', :page) }
|
|
5
|
+
|
|
6
|
+
it 'returns class' do
|
|
7
|
+
expect(css_list.class).to eql TestCentricity::List
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'registers with type list' do
|
|
11
|
+
expect(css_list.get_object_type).to eql :list
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::Radio, required: true do
|
|
4
|
+
subject(:css_radio) { described_class.new(:test_radio, self, 'input#css_radio', :page) }
|
|
5
|
+
|
|
6
|
+
it 'returns class' do
|
|
7
|
+
expect(css_radio.class).to eql TestCentricity::Radio
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'registers with type radio' do
|
|
11
|
+
expect(css_radio.get_object_type).to eql :radio
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should select the radio' do
|
|
15
|
+
expect(css_radio).to receive(:select)
|
|
16
|
+
css_radio.select
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should unselect the radio' do
|
|
20
|
+
expect(css_radio).to receive(:unselect)
|
|
21
|
+
css_radio.unselect
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'should know if radio is selected' do
|
|
25
|
+
allow(css_radio).to receive(:selected?).and_return(true)
|
|
26
|
+
expect(css_radio.selected?).to eq(true)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::UIElement, required: true do
|
|
4
|
+
subject(:css_element) { described_class.new(:css_test_element, self, 'button#css_button', :page) }
|
|
5
|
+
subject(:xpath_element) { described_class.new(:xpath_test_element, self, "//button[@id='xpath_button']", :page) }
|
|
6
|
+
|
|
7
|
+
it 'returns class' do
|
|
8
|
+
expect(css_element.class).to eql described_class
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'returns css locator type' do
|
|
12
|
+
expect(css_element.get_locator_type).to eql :css
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'returns xpath locator type' do
|
|
16
|
+
expect(xpath_element.get_locator_type).to eql :xpath
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'returns name' do
|
|
20
|
+
expect(css_element.get_name).to eql :css_test_element
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'returns locator' do
|
|
24
|
+
expect(css_element.get_locator).to eql 'button#css_button'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'returns css locator type' do
|
|
28
|
+
expect(css_element.get_locator_type).to eql :css
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'should click the element' do
|
|
32
|
+
allow(css_element).to receive(:click)
|
|
33
|
+
css_element.click
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'should double click the element' do
|
|
37
|
+
allow(css_element).to receive(:double_click)
|
|
38
|
+
css_element.double_click
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'should right click the element' do
|
|
42
|
+
allow(css_element).to receive(:right_click)
|
|
43
|
+
css_element.right_click
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'should click the element at specified offset' do
|
|
47
|
+
allow(css_element).to receive(:click_at)
|
|
48
|
+
css_element.click_at(10, 10)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should hover over the element' do
|
|
52
|
+
allow(css_element).to receive(:hover)
|
|
53
|
+
css_element.hover
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'should hover over the element at specified offset' do
|
|
57
|
+
allow(css_element).to receive(:hover_at)
|
|
58
|
+
css_element.hover_at(10, 15)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it 'should drag the element by specified offset' do
|
|
62
|
+
allow(css_element).to receive(:drag_by)
|
|
63
|
+
css_element.drag_by(20, 15)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'should know if element is visible' do
|
|
67
|
+
allow(css_element).to receive(:visible?).and_return(false)
|
|
68
|
+
expect(css_element.visible?).to eq(false)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'should know if element is hidden' do
|
|
72
|
+
allow(css_element).to receive(:hidden?).and_return(true)
|
|
73
|
+
expect(css_element.hidden?).to eq(true)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'should know if element exists' do
|
|
77
|
+
allow(css_element).to receive(:exists?).and_return(true)
|
|
78
|
+
expect(css_element.exists?).to be true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'should know if element is disabled' do
|
|
82
|
+
allow(css_element).to receive(:enabled?).and_return(true)
|
|
83
|
+
expect(css_element.enabled?).to eq(true)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'should know if element is disabled' do
|
|
87
|
+
allow(css_element).to receive(:disabled?).and_return(true)
|
|
88
|
+
expect(css_element.disabled?).to eq(true)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'should know if element is obscured' do
|
|
92
|
+
allow(css_element).to receive(:obscured?).and_return(true)
|
|
93
|
+
expect(css_element.obscured?).to eq(true)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'should know if element is focused' do
|
|
97
|
+
allow(css_element).to receive(:focused?).and_return(true)
|
|
98
|
+
expect(css_element.focused?).to eq(true)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'should know if element is displayed' do
|
|
102
|
+
allow(css_element).to receive(:displayed?).and_return(true)
|
|
103
|
+
expect(css_element.displayed?).to eq(true)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it 'should know if element is required' do
|
|
107
|
+
allow(css_element).to receive(:required?).and_return(true)
|
|
108
|
+
expect(css_element.required?).to eq(true)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'should send keys' do
|
|
112
|
+
allow(css_element).to receive(:send_keys).with('foo bar')
|
|
113
|
+
css_element.send_keys('foo bar')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it 'should right highlight the element' do
|
|
117
|
+
allow(css_element).to receive(:highlight)
|
|
118
|
+
css_element.highlight(2)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it 'should right unhighlight the element' do
|
|
122
|
+
allow(css_element).to receive(:unhighlight)
|
|
123
|
+
css_element.unhighlight
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::Video, required: true do
|
|
4
|
+
subject(:css_video) { described_class.new(:test_video, self, 'video#css_video', :page) }
|
|
5
|
+
|
|
6
|
+
it 'returns class' do
|
|
7
|
+
expect(css_video.class).to eql TestCentricity::Video
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'registers with type video' do
|
|
11
|
+
expect(css_video.get_object_type).to eql :video
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'returns autoplay' do
|
|
15
|
+
allow(css_video).to receive(:autoplay?).and_return(false)
|
|
16
|
+
expect(css_video.autoplay?).to eql false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'returns controls' do
|
|
20
|
+
allow(css_video).to receive(:controls?).and_return(true)
|
|
21
|
+
expect(css_video.controls?).to eql true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'returns ended' do
|
|
25
|
+
allow(css_video).to receive(:ended?).and_return(true)
|
|
26
|
+
expect(css_video.ended?).to eql true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'returns loop' do
|
|
30
|
+
allow(css_video).to receive(:loop?).and_return(false)
|
|
31
|
+
expect(css_video.loop?).to eql false
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'returns muted' do
|
|
35
|
+
allow(css_video).to receive(:muted?).and_return(false)
|
|
36
|
+
expect(css_video.muted?).to eql false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'returns paused' do
|
|
40
|
+
allow(css_video).to receive(:paused?).and_return(true)
|
|
41
|
+
expect(css_video.paused?).to eql true
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'returns seeking' do
|
|
45
|
+
allow(css_video).to receive(:seeking?).and_return(false)
|
|
46
|
+
expect(css_video.seeking?).to eql false
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'should play the video' do
|
|
50
|
+
expect(css_video).to receive(:play)
|
|
51
|
+
css_video.play
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'should pause the video' do
|
|
55
|
+
expect(css_video).to receive(:pause)
|
|
56
|
+
css_video.pause
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'should mute the video' do
|
|
60
|
+
expect(css_video).to receive(:mute)
|
|
61
|
+
css_video.mute
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'should unmute the video' do
|
|
65
|
+
expect(css_video).to receive(:unmute)
|
|
66
|
+
css_video.unmute
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe Object, required: true do
|
|
4
|
+
it 'returns true when blank' do
|
|
5
|
+
[nil, {}, ''].each do |value|
|
|
6
|
+
expect(value.blank?).to eql true
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'returns false when not blank' do
|
|
11
|
+
[0, 42, 'fred', ['Fred', 21], {a: 42}].each do |value|
|
|
12
|
+
expect(value.blank?).to eql false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'returns true when present' do
|
|
17
|
+
[0, 42, 'fred', ['Fred', 21], {a: 42}].each do |value|
|
|
18
|
+
expect(value.present?).to eql true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns false when not present' do
|
|
23
|
+
[nil, {}, ''].each do |value|
|
|
24
|
+
expect(value.present?).to eql false
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'returns true when Boolean' do
|
|
29
|
+
[!nil?, nil?, 2 + 2 == 4].each do |value|
|
|
30
|
+
expect(value.boolean?).to eql true
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'returns false when not a Boolean' do
|
|
35
|
+
[4, 'Ethel', [1, 'a']].each do |value|
|
|
36
|
+
expect(value.boolean?).to eql false
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe String, required: true do
|
|
4
|
+
it 'returns string between' do
|
|
5
|
+
expect('The rain in Spain'.string_between('The ', ' Spain')).to eql 'rain in'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'returns title case' do
|
|
9
|
+
expect('The rain in Spain'.titlecase).to eql 'The Rain In Spain'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'returns boolean value when true' do
|
|
13
|
+
%w[true t yes y x 1].each do |value|
|
|
14
|
+
expect(value.to_bool).to eql true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'returns boolean value when false' do
|
|
19
|
+
%w[false f no n 0].each do |value|
|
|
20
|
+
expect(value.to_bool).to eql false
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'returns true when Integer' do
|
|
25
|
+
%w[26 3 10345].each do |value|
|
|
26
|
+
expect(value.is_int?).to eql true
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'returns false when not an Integer' do
|
|
31
|
+
%w[271.234 0.1234 Fred].each do |value|
|
|
32
|
+
expect(value.is_int?).to eql false
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'returns true when Float' do
|
|
37
|
+
%w[271.234 0.1234 21.4].each do |value|
|
|
38
|
+
expect(value.is_float?).to eql true
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'returns formatted date' do
|
|
43
|
+
expect('04/06/2022'.format_date_time('%A, %d %b %Y')).to eql 'Saturday, 04 Jun 2022'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'returns translated formatted date' do
|
|
47
|
+
expect('04/06/2022'.format_date_time(:abbrev)).to eql 'Jun 04, 2022'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::PageObject, required: true do
|
|
4
|
+
before :context do
|
|
5
|
+
@test_page = TestPage.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
context 'page object traits' do
|
|
9
|
+
it 'returns page name' do
|
|
10
|
+
expect(@test_page.page_name).to eq('Basic Test Page')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'returns page url' do
|
|
14
|
+
expect(@test_page.page_url).to eq('/basic_test_page.html')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'returns page locator' do
|
|
18
|
+
expect(@test_page.page_locator).to eq('form#HTMLFormElements')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'determines if page is secure' do
|
|
22
|
+
allow(@test_page).to receive(:secure?).and_return(false)
|
|
23
|
+
expect(@test_page.secure?).to eq(false)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should display the title of the page' do
|
|
27
|
+
allow(@test_page).to receive(:title).and_return('I am the title of a page')
|
|
28
|
+
expect(@test_page.title).to eql 'I am the title of a page'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'determines if page is secure' do
|
|
32
|
+
allow(@test_page).to receive(:secure?).and_return(false)
|
|
33
|
+
expect(@test_page.secure?).to eq(false)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it 'responds to open_portal' do
|
|
37
|
+
expect(@test_page).to respond_to(:open_portal)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'responds to load_page' do
|
|
41
|
+
expect(@test_page).to respond_to(:load_page)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'responds to verify_page_exists' do
|
|
45
|
+
expect(@test_page).to respond_to(:verify_page_exists)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'responds to exists?' do
|
|
49
|
+
expect(@test_page).to respond_to(:exists?)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context 'page object with UI elements' do
|
|
54
|
+
it 'responds to element' do
|
|
55
|
+
expect(@test_page).to respond_to(:element1)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'responds to button' do
|
|
59
|
+
expect(@test_page).to respond_to(:button1)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'responds to textfield' do
|
|
63
|
+
expect(@test_page).to respond_to(:field1)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'responds to link' do
|
|
67
|
+
expect(@test_page).to respond_to(:link1)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'responds to range' do
|
|
71
|
+
expect(@test_page).to respond_to(:range1)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'responds to image' do
|
|
75
|
+
expect(@test_page).to respond_to(:image1)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'responds to radio' do
|
|
79
|
+
expect(@test_page).to respond_to(:radio1)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'responds to checkbox' do
|
|
83
|
+
expect(@test_page).to respond_to(:check1)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'responds to section' do
|
|
87
|
+
expect(@test_page).to respond_to(:section1)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::PageSection, required: true do
|
|
4
|
+
before :context do
|
|
5
|
+
@test_page = TestPage.new
|
|
6
|
+
@test_section = @test_page.section1
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
context 'section object traits' do
|
|
10
|
+
it 'returns section name' do
|
|
11
|
+
expect(@test_section.section_name).to eq('Basic Test Section')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'returns section locator' do
|
|
15
|
+
expect(@test_section.get_locator).to eq('div#section')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'returns class' do
|
|
19
|
+
expect(@test_section.class).to eql TestSection
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns css locator type' do
|
|
23
|
+
expect(@test_section.get_locator_type).to eql :css
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'registers with type section' do
|
|
27
|
+
expect(@test_section.get_object_type).to eql :section
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'returns parent list object' do
|
|
31
|
+
expect(@test_section.get_parent_list).to eql nil
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'section object with UI elements' do
|
|
36
|
+
it 'responds to element' do
|
|
37
|
+
expect(@test_section).to respond_to(:element1)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'responds to button' do
|
|
41
|
+
expect(@test_section).to respond_to(:button1)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'responds to textfield' do
|
|
45
|
+
expect(@test_section).to respond_to(:field1)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'responds to link' do
|
|
49
|
+
expect(@test_section).to respond_to(:link1)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'responds to range' do
|
|
53
|
+
expect(@test_section).to respond_to(:range1)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'responds to image' do
|
|
57
|
+
expect(@test_section).to respond_to(:image1)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'responds to radio' do
|
|
61
|
+
expect(@test_section).to respond_to(:radio1)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'responds to checkbox' do
|
|
65
|
+
expect(@test_section).to respond_to(:check1)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'responds to section' do
|
|
69
|
+
expect(@test_section).to respond_to(:section2)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::WebDriverConnect, grid: true do
|
|
4
|
+
before(:context) do
|
|
5
|
+
# instantiate remote test environment
|
|
6
|
+
@environs ||= EnvironData
|
|
7
|
+
@environs.find_environ('REMOTE', :yaml)
|
|
8
|
+
ENV['SELENIUM'] = 'remote'
|
|
9
|
+
endpoint = 'http://localhost:4444/wd/hub'
|
|
10
|
+
ENV['REMOTE_ENDPOINT'] = endpoint
|
|
11
|
+
# wait for Dockerized Selenium grid to be running
|
|
12
|
+
20.downto(0) do |interval|
|
|
13
|
+
begin
|
|
14
|
+
response = HTTParty.get("#{endpoint}/status")
|
|
15
|
+
break if response.body.include?('Selenium Grid ready')
|
|
16
|
+
rescue
|
|
17
|
+
if interval == 0
|
|
18
|
+
raise 'Selenium Grid is not running.'
|
|
19
|
+
else
|
|
20
|
+
sleep(1)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context 'grid web browser instances' do
|
|
27
|
+
it 'connects to a grid hosted Firefox browser' do
|
|
28
|
+
ENV['WEB_BROWSER'] = 'firefox'
|
|
29
|
+
WebDriverConnect.initialize_web_driver
|
|
30
|
+
verify_grid_browser(browser = :firefox, platform = :desktop)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'connects to a grid hosted Chrome browser' do
|
|
34
|
+
ENV['WEB_BROWSER'] = 'chrome'
|
|
35
|
+
WebDriverConnect.initialize_web_driver
|
|
36
|
+
Browsers.suppress_js_leave_page_modal
|
|
37
|
+
verify_grid_browser(browser = :chrome, platform = :desktop)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'connects to a grid hosted Edge browser' do
|
|
41
|
+
ENV['WEB_BROWSER'] = 'edge'
|
|
42
|
+
WebDriverConnect.initialize_web_driver
|
|
43
|
+
Browsers.suppress_js_alerts
|
|
44
|
+
verify_grid_browser(browser = :edge, platform = :desktop)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'connects to a grid hosted emulated mobile web browser' do
|
|
48
|
+
ENV['WEB_BROWSER'] = 'ipad_pro_12_9'
|
|
49
|
+
ENV['HOST_BROWSER'] = 'chrome'
|
|
50
|
+
ENV['ORIENTATION'] = 'portrait'
|
|
51
|
+
WebDriverConnect.initialize_web_driver
|
|
52
|
+
Browsers.set_device_orientation('landscape')
|
|
53
|
+
verify_grid_browser(browser = :ipad_pro_12_9, platform = :mobile)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
after(:each) do
|
|
58
|
+
$server.stop if Environ.driver == :appium && $server.running?
|
|
59
|
+
Capybara.current_session.quit
|
|
60
|
+
Environ.session_state = :quit
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def verify_grid_browser(browser, platform)
|
|
64
|
+
expect(Environ.browser).to eq(browser)
|
|
65
|
+
expect(Environ.platform).to eq(platform)
|
|
66
|
+
expect(Environ.headless).to eq(false)
|
|
67
|
+
expect(Environ.session_state).to eq(:running)
|
|
68
|
+
expect(Environ.driver).to eq(:webdriver)
|
|
69
|
+
expect(Environ.device).to eq(:web)
|
|
70
|
+
expect(Environ.grid).to eq(:selenium_grid)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe TestCentricity::WebDriverConnect, required: true do
|
|
4
|
+
before(:context) do
|
|
5
|
+
# instantiate local test environment
|
|
6
|
+
@environs ||= EnvironData
|
|
7
|
+
@environs.find_environ('LOCAL', :yaml)
|
|
8
|
+
ENV['SELENIUM'] = ''
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
context 'local web browser instances' do
|
|
12
|
+
it 'connects to a local Firefox browser' do
|
|
13
|
+
ENV['WEB_BROWSER'] = 'firefox'
|
|
14
|
+
WebDriverConnect.initialize_web_driver
|
|
15
|
+
verify_local_browser(browser = :firefox, platform = :desktop, headless = false)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'connects to a local Safari browser' do
|
|
19
|
+
ENV['WEB_BROWSER'] = 'safari'
|
|
20
|
+
WebDriverConnect.initialize_web_driver
|
|
21
|
+
verify_local_browser(browser = :safari, platform = :desktop, headless = false)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'connects to a local Chrome browser' do
|
|
25
|
+
ENV['WEB_BROWSER'] = 'chrome'
|
|
26
|
+
WebDriverConnect.initialize_web_driver
|
|
27
|
+
Browsers.suppress_js_leave_page_modal
|
|
28
|
+
verify_local_browser(browser = :chrome, platform = :desktop, headless = false)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'connects to a local Edge browser' do
|
|
32
|
+
ENV['WEB_BROWSER'] = 'edge'
|
|
33
|
+
WebDriverConnect.initialize_web_driver
|
|
34
|
+
Browsers.suppress_js_alerts
|
|
35
|
+
verify_local_browser(browser = :edge, platform = :desktop, headless = false)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'connects to a local emulated mobile web browser' do
|
|
39
|
+
ENV['WEB_BROWSER'] = 'ipad_pro_12_9'
|
|
40
|
+
ENV['HOST_BROWSER'] = 'chrome'
|
|
41
|
+
ENV['ORIENTATION'] = 'portrait'
|
|
42
|
+
WebDriverConnect.initialize_web_driver
|
|
43
|
+
Browsers.set_device_orientation('landscape')
|
|
44
|
+
verify_local_browser(browser = :ipad_pro_12_9, platform = :mobile, headless = false)
|
|
45
|
+
expect(Environ.browser_size).to eq([1366, 1024])
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context 'local headless browser instances' do
|
|
50
|
+
it 'connects to a local headless Chrome browser' do
|
|
51
|
+
ENV['WEB_BROWSER'] = 'chrome_headless'
|
|
52
|
+
WebDriverConnect.initialize_web_driver
|
|
53
|
+
Browsers.maximize_browser
|
|
54
|
+
verify_local_browser(browser = :chrome_headless, platform = :desktop, headless = true)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'connects to a local headless Edge browser' do
|
|
58
|
+
ENV['WEB_BROWSER'] = 'edge_headless'
|
|
59
|
+
WebDriverConnect.initialize_web_driver
|
|
60
|
+
Browsers.refresh_browser
|
|
61
|
+
verify_local_browser(browser = :edge_headless, platform = :desktop, headless = true)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'connects to a local headless Firefox browser' do
|
|
65
|
+
ENV['WEB_BROWSER'] = 'firefox_headless'
|
|
66
|
+
WebDriverConnect.initialize_web_driver
|
|
67
|
+
Browsers.delete_all_cookies
|
|
68
|
+
verify_local_browser(browser = :firefox_headless, platform = :desktop, headless = true)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
after(:each) do
|
|
73
|
+
Capybara.current_session.quit
|
|
74
|
+
Environ.session_state = :quit
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def verify_local_browser(browser, platform, headless)
|
|
78
|
+
expect(Environ.browser).to eq(browser)
|
|
79
|
+
expect(Environ.platform).to eq(platform)
|
|
80
|
+
expect(Environ.headless).to eq(headless)
|
|
81
|
+
expect(Environ.session_state).to eq(:running)
|
|
82
|
+
expect(Environ.driver).to eq(:webdriver)
|
|
83
|
+
expect(Environ.device).to eq(:web)
|
|
84
|
+
expect(Environ.is_web?).to eq(true)
|
|
85
|
+
end
|
|
86
|
+
end
|