screen-object 1.0.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 +7 -0
- data/.rspec +2 -0
- data/ChangeLog +7 -0
- data/Gemfile +9 -0
- data/Rakefile +28 -0
- data/cucumber.yml +4 -0
- data/features/button.feature +28 -0
- data/features/checkbox.feature +11 -0
- data/features/navigation.feature +10 -0
- data/features/step_definitions/button_step.rb +46 -0
- data/features/step_definitions/checkbox_step.rb +12 -0
- data/features/step_definitions/navigation_steps.rb +14 -0
- data/features/step_definitions/table_step.rb +5 -0
- data/features/step_definitions/textfield_step.rb +5 -0
- data/features/support/appium.txt +9 -0
- data/features/support/appium_ios.txt +11 -0
- data/features/support/env.rb +30 -0
- data/features/support/screen.rb +79 -0
- data/features/support/screens/buttons_screen.rb +8 -0
- data/features/support/screens/landing_screen.rb +6 -0
- data/features/support/screens/main_screen.rb +6 -0
- data/features/table.feature +11 -0
- data/features/textfield.feature +10 -0
- data/lib/screen-object.rb +161 -0
- data/lib/screen-object/.DS_Store +0 -0
- data/lib/screen-object/accessors.rb +457 -0
- data/lib/screen-object/accessors/button.rb +36 -0
- data/lib/screen-object/accessors/checkbox.rb +38 -0
- data/lib/screen-object/accessors/element.rb +144 -0
- data/lib/screen-object/accessors/image.rb +25 -0
- data/lib/screen-object/accessors/table.rb +26 -0
- data/lib/screen-object/accessors/text.rb +46 -0
- data/lib/screen-object/accessors/textfield.rb +41 -0
- data/lib/screen-object/appium_server.rb +58 -0
- data/lib/screen-object/elements.rb +21 -0
- data/lib/screen-object/load_appium.rb +31 -0
- data/lib/screen-object/screen_factory.rb +43 -0
- data/lib/screen-object/version.rb +4 -0
- data/screen-object.gemspec +28 -0
- data/spec/integration/appium_server_spec.rb +24 -0
- data/spec/lib/appium_server_spec.rb +59 -0
- data/spec/lib/screen_object_spec.rb +37 -0
- data/spec/screen-object/button_spec.rb +25 -0
- data/spec/screen-object/checkbox_spec.rb +35 -0
- data/spec/screen-object/element_spec.rb +205 -0
- data/spec/screen-object/image_spec.rb +21 -0
- data/spec/screen-object/text_field_spec.rb +37 -0
- data/spec/screen-object/text_spec.rb +29 -0
- data/spec/spec_helper.rb +29 -0
- metadata +201 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
=begin
|
2
|
+
***********************************************************************************************************
|
3
|
+
Copyright 2016 Capital One Services, LLC
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
Unless required by applicable law or agreed to in writing, software
|
9
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
10
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
11
|
+
See the License for the specific language governing permissions and limitations under the License.
|
12
|
+
***********************************************************************************************************
|
13
|
+
=end
|
14
|
+
|
15
|
+
module ScreenObject
|
16
|
+
module Load_App
|
17
|
+
|
18
|
+
def self.start_driver
|
19
|
+
$driver.start_driver
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.quit_driver
|
23
|
+
$driver.driver_quit
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.load_driver(appium_txt)
|
27
|
+
#Appium.promote_singleton_appium_methods ScreenObject
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'page_navigation'
|
2
|
+
|
3
|
+
module ScreenObject
|
4
|
+
|
5
|
+
#
|
6
|
+
# Module to facilitate to creating of screen objects in step definitions. You
|
7
|
+
# can make the methods below available to all of your step definitions by adding
|
8
|
+
# this module to World.
|
9
|
+
#
|
10
|
+
# @example Making the ScreenFactory available to your step definitions
|
11
|
+
# World ScreenObject::ScreenFactory
|
12
|
+
#
|
13
|
+
# @example using a screen in a Scenario
|
14
|
+
# on MyScreenObject do |screen|
|
15
|
+
# screen.name = 'Cheezy'
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# If you plan to use the navigate_to method you will need to ensure
|
19
|
+
# you setup the possible routes ahead of time. You must always have
|
20
|
+
# a default route in order for this to work. Here is an example of
|
21
|
+
# how you define routes:
|
22
|
+
#
|
23
|
+
# @example Example routes defined in env.rb
|
24
|
+
# ScreenObject::ScreenFactory.routes = {
|
25
|
+
# :default => [[ScreenOne,:method1], [ScreenTwoA,:method2], [ScreenThree,:method3]],
|
26
|
+
# :another_route => [[ScreenOne,:method1, "arg1"], [ScreenTwoB,:method2b], [ScreenThree,:method3]]
|
27
|
+
# }
|
28
|
+
#
|
29
|
+
# Notice the first entry of :another_route is passing an argument
|
30
|
+
# to the method.
|
31
|
+
#
|
32
|
+
|
33
|
+
module ScreenFactory
|
34
|
+
include PageNavigation
|
35
|
+
|
36
|
+
def on(screen_class, &blk)
|
37
|
+
@current_screen = screen_class.new
|
38
|
+
blk.call @current_screen if blk
|
39
|
+
@current_screen
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'screen-object/version'
|
3
|
+
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'screen-object'
|
7
|
+
s.version = ScreenObject::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['Sreepad Bhagwat','Shailendra Jain']
|
10
|
+
s.license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
11
|
+
s.homepage = 'https://github.kdc.capitalone.com/mobius/screen-object'
|
12
|
+
s.summary = 'Page Object like DSL for testing mobile application'
|
13
|
+
s.description = 'Page Object like DSL for testing mobile application'
|
14
|
+
|
15
|
+
s.files = `git ls-files | grep -v sample_app`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
#s.add_runtime_dependency 'appium_lib', '~> 7.0', '>= 7.0.0'
|
21
|
+
s.add_runtime_dependency 'appium_lib', '~> 8.0.2'
|
22
|
+
s.add_runtime_dependency 'page_navigation', '~> 0.9'
|
23
|
+
s.add_runtime_dependency 'childprocess', '~> 0.5'
|
24
|
+
|
25
|
+
s.add_development_dependency 'cucumber', '~> 1.3', '>= 1.3.0'
|
26
|
+
s.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'screen-object/appium_server'
|
3
|
+
|
4
|
+
describe ScreenObject::AppiumServer do
|
5
|
+
|
6
|
+
|
7
|
+
let(:the_server) { ScreenObject::AppiumServer.new }
|
8
|
+
|
9
|
+
context 'when appium server is started' do
|
10
|
+
it 'should start the appium server as a process' do
|
11
|
+
the_server.start
|
12
|
+
the_pid = the_server.process.pid
|
13
|
+
expect(the_server.process).to be_running_process
|
14
|
+
Process.kill(9, the_pid)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should be stopped when exiting' do
|
18
|
+
the_server.start
|
19
|
+
the_pid = the_server.process.pid
|
20
|
+
the_server.stop
|
21
|
+
expect(the_server.process).to_not be_running_process
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'screen-object/appium_server'
|
3
|
+
|
4
|
+
describe ScreenObject::AppiumServer do
|
5
|
+
|
6
|
+
attr_reader :the_server
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@process = double(:process)
|
10
|
+
allow(ChildProcess).to receive(:build).and_return(@process)
|
11
|
+
allow(@process).to receive(:start)
|
12
|
+
end
|
13
|
+
|
14
|
+
def the_server(params = {})
|
15
|
+
@the_server ||= ScreenObject::AppiumServer.new(params)
|
16
|
+
end
|
17
|
+
|
18
|
+
def expected_build_params(*params)
|
19
|
+
expect(ChildProcess).to receive(:build).with(*params).and_return(@process)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
context "when starting the appium server" do
|
24
|
+
it 'should start the appium process with no parameters' do
|
25
|
+
expected_build_params('appium')
|
26
|
+
the_server.start
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should pass a parameter and value to the appium process' do
|
30
|
+
expected_build_params('appium', '--foo', 'bar')
|
31
|
+
the_server('foo' => 'bar').start
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should not contain value in the server start parameter if value is nil' do
|
35
|
+
expected_build_params('appium', '--foo')
|
36
|
+
the_server('foo' => nil).start
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should accept symbol as key for the parameter' do
|
40
|
+
expected_build_params('appium', '--foo', 'bar')
|
41
|
+
the_server(:foo => 'bar').start
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should start the server process' do
|
45
|
+
expected_build_params('appium')
|
46
|
+
expect(@process).to receive(:start)
|
47
|
+
the_server.start
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "When stopping the appium server" do
|
52
|
+
it 'should stop the appium process' do
|
53
|
+
the_server.start
|
54
|
+
expect(@process).to receive(:stop)
|
55
|
+
the_server.stop
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
|
4
|
+
class TestScreen
|
5
|
+
include ScreenObject
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ScreenObject do
|
9
|
+
|
10
|
+
let(:the_screen) { TestScreen.new }
|
11
|
+
|
12
|
+
context 'when waiting for something to happen' do
|
13
|
+
|
14
|
+
let(:wait) { double('wait') }
|
15
|
+
|
16
|
+
before do
|
17
|
+
allow(wait).to receive(:until)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should wait for 5 seconds by default' do
|
21
|
+
expect(Selenium::WebDriver::Wait).to receive(:new).with(timeout: 5, message: nil).and_return(wait)
|
22
|
+
the_screen.wait_until { }
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should allow you to override the default wait time' do
|
26
|
+
expect(Selenium::WebDriver::Wait).to receive(:new).with(timeout: 10, message: nil).and_return(wait)
|
27
|
+
the_screen.wait_until(10) { }
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should allow you to provide a message to use when wait fails' do
|
31
|
+
expect(Selenium::WebDriver::Wait).to receive(:new).with(timeout: 10, message: 'foobar').and_return(wait)
|
32
|
+
the_screen.wait_until(10, 'foobar') { }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe "Interface" do
|
4
|
+
|
5
|
+
locator = "name~dummy"
|
6
|
+
let(:selenium_object) { double('') }
|
7
|
+
let(:button) {ScreenObject::AppElements::Button.new(locator)}
|
8
|
+
|
9
|
+
context "interaction with tap method" do
|
10
|
+
it "should tap on the button" do
|
11
|
+
expect(button).to receive(:element).and_return(selenium_object)
|
12
|
+
expect(selenium_object).to receive(:click).and_return(true)
|
13
|
+
expect(button.tap).to eq(true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "interaction with enable method" do
|
18
|
+
it "should check if button is enabled" do
|
19
|
+
expect(button).to receive(:element).and_return(selenium_object)
|
20
|
+
expect(selenium_object).to receive(:enabled?).and_return(true)
|
21
|
+
expect(button.enabled?).to eq(true)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe "Interface" do
|
4
|
+
|
5
|
+
locator = "name~dummy"
|
6
|
+
let(:selenium_object) { double('') }
|
7
|
+
let(:check_box) {ScreenObject::AppElements::CheckBox.new(locator)}
|
8
|
+
|
9
|
+
context "interaction with checked method" do
|
10
|
+
it "should retun true if checked?" do
|
11
|
+
expect(check_box).to receive(:element).and_return(selenium_object)
|
12
|
+
expect(selenium_object).to receive(:attribute).with('checked').and_return('true')
|
13
|
+
expect(check_box.checked?).to eq(true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "interaction with check method" do
|
18
|
+
it "should check the element" do
|
19
|
+
expect(check_box).to receive(:element).and_return(selenium_object)
|
20
|
+
expect(selenium_object).to receive(:click).and_return(true)
|
21
|
+
expect(check_box).to receive(:checked?).and_return(false)
|
22
|
+
expect(check_box.check).to eq(true)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "interaction with uncheck method" do
|
27
|
+
it "should uncheck the element" do
|
28
|
+
expect(check_box).to receive(:element).and_return(selenium_object)
|
29
|
+
expect(selenium_object).to receive(:click).and_return(true)
|
30
|
+
expect(check_box).to receive(:checked?).and_return(true)
|
31
|
+
expect(check_box.uncheck).to eq(true)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe "Interface" do
|
4
|
+
|
5
|
+
locator = "name~dummy"
|
6
|
+
let(:selenium_driver) {double('')}
|
7
|
+
let(:element) {ScreenObject::AppElements::Element.new(locator)}
|
8
|
+
|
9
|
+
context "interaction with click method" do
|
10
|
+
it "should click on element" do
|
11
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
12
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
13
|
+
expect(element.click).to be true
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
context "interaction with value method" do
|
19
|
+
it "should return value" do
|
20
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
21
|
+
expect(selenium_driver).to receive(:value).and_return("value")
|
22
|
+
expect(element.value).to eql ("value")
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
context "interaction with exists? method" do
|
28
|
+
it "should return value" do
|
29
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
30
|
+
expect(selenium_driver).to receive(:displayed?).and_return(true)
|
31
|
+
expect(element.exists?).to eql (true)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
context "interaction with element method" do
|
37
|
+
it "should return element object" do
|
38
|
+
expect(element).to receive(:driver).and_return(selenium_driver)
|
39
|
+
expect(selenium_driver).to receive(:find_element).and_return(selenium_driver)
|
40
|
+
expect(element.element).to eql (selenium_driver)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
context "interaction with element method" do
|
46
|
+
it "should return element object" do
|
47
|
+
expect(element).to receive(:driver).and_return(selenium_driver)
|
48
|
+
expect(selenium_driver).to receive(:find_elements).and_return(selenium_driver)
|
49
|
+
expect(element.elements).to eql (selenium_driver)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
context "interaction with element method" do
|
55
|
+
it "should return element object" do
|
56
|
+
expect(element).to receive(:dynamic_xpath).and_return(selenium_driver)
|
57
|
+
expect(selenium_driver).to receive(:displayed?).and_return(true)
|
58
|
+
expect(element.dynamic_text_exists?("dynamic_text")).to eql (true)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# context "interaction with scroll method" do
|
64
|
+
# it "should return element object" do
|
65
|
+
# expect(element).to receive(:driver).and_return(selenium_driver)
|
66
|
+
# expect(selenium_driver).to receive(:execute_script).and_return(selenium_driver)
|
67
|
+
# expect(element.scroll).to eql (selenium_driver)
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
|
71
|
+
context "interaction with scroll_for_element_click method" do
|
72
|
+
it "should click on object if it does exists on the first page" do
|
73
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
74
|
+
expect(selenium_driver).to receive(:displayed?).and_return(true)
|
75
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
76
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
77
|
+
expect(element.scroll_for_element_click).to eql (true)
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
context "interaction with scroll_for_element_click method" do
|
83
|
+
it "should scroll for element and click.." do
|
84
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
85
|
+
expect(selenium_driver).to receive(:displayed?).and_return(false)
|
86
|
+
expect(element).to receive(:scroll).and_return(selenium_driver)
|
87
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
88
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
89
|
+
expect(element.scroll_for_element_click).to eql (true)
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
context "interaction with scroll_for_dynamic_element_click method" do
|
95
|
+
it "should click on object if it does exists on the first page" do
|
96
|
+
expect(element).to receive(:dynamic_xpath).with("expected_text").and_return(selenium_driver)
|
97
|
+
expect(selenium_driver).to receive(:displayed?).and_return(true)
|
98
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
99
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
100
|
+
expect(element.scroll_for_dynamic_element_click("expected_text")).to eql (true)
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
context "interaction with scroll_for_dynamic_element_click method" do
|
106
|
+
it "should scroll for element and click.." do
|
107
|
+
expect(element).to receive(:dynamic_xpath).with("expected_text").and_return(selenium_driver)
|
108
|
+
expect(selenium_driver).to receive(:displayed?).and_return(false)
|
109
|
+
expect(element).to receive(:scroll).and_return(selenium_driver)
|
110
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
111
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
112
|
+
expect(element.scroll_for_dynamic_element_click("expected_text")).to eql (true)
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
context "interaction with click_text method" do
|
118
|
+
it "should click on object if it does exists on the first page" do
|
119
|
+
expect(element).to receive(:exists?).and_return(true)
|
120
|
+
expect(element).to receive(:click).and_return(true)
|
121
|
+
expect(element.click_text("text")).to eq (true)
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
context "interaction with click_text method" do
|
127
|
+
it "should click on object if it does exists on the first page" do
|
128
|
+
expect(element).to receive(:exists?).and_return(false)
|
129
|
+
expect(element).to receive(:scroll_to_text).with("text").and_return(selenium_driver)
|
130
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
131
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
132
|
+
expect(element.click_text("text")).to eq (true)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
context "interaction with click_dynamic_text method" do
|
138
|
+
it "should click on object if it does exists on the first page" do
|
139
|
+
expect(element).to receive(:dynamic_text_exists?).with("text").and_return(true)
|
140
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
141
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
142
|
+
expect(element.click_dynamic_text("text")).to eq (true)
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
context "interaction with click_dynamic_text method" do
|
148
|
+
it "should click on object if it does exists on the first page" do
|
149
|
+
expect(element).to receive(:dynamic_text_exists?).with("text").and_return(false)
|
150
|
+
expect(element).to receive(:scroll_to_text).with("text").and_return(selenium_driver)
|
151
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
152
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
153
|
+
expect(element.click_dynamic_text("text")).to eq (true)
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
context "interaction with click_exact_text method" do
|
160
|
+
it "should click on object if it does exists on the first page" do
|
161
|
+
expect(element).to receive(:exists?).and_return(true)
|
162
|
+
expect(element).to receive(:click).and_return(true)
|
163
|
+
expect(element.click_exact_text("text")).to eq (true)
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
context "interaction with click_exact_text method" do
|
169
|
+
it "should click on object if it does exists on the first page" do
|
170
|
+
expect(element).to receive(:exists?).and_return(false)
|
171
|
+
expect(element).to receive(:scroll_to_exact_text).with("text").and_return(selenium_driver)
|
172
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
173
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
174
|
+
expect(element.click_exact_text("text")).to eq (true)
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
context "interaction with click_dynamic_exact_text method" do
|
180
|
+
it "should click on object if it does exists on the first page" do
|
181
|
+
expect(element).to receive(:dynamic_text_exists?).with("text").and_return(true)
|
182
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
183
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
184
|
+
expect(element.click_dynamic_exact_text("text")).to eq (true)
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
context "interaction with click_exact_text method" do
|
190
|
+
it "should click on object if it does exists on the first page" do
|
191
|
+
expect(element).to receive(:dynamic_text_exists?).with("text").and_return(false)
|
192
|
+
expect(element).to receive(:scroll_to_exact_text).with("text").and_return(selenium_driver)
|
193
|
+
|
194
|
+
expect(element).to receive(:element).and_return(selenium_driver)
|
195
|
+
expect(selenium_driver).to receive(:click).and_return(true)
|
196
|
+
expect(element.click_dynamic_exact_text("text")).to eq (true)
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
|
201
|
+
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
|