page_magic 2.0.6 → 2.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -7
- data/lib/page_magic/session.rb +0 -6
- data/lib/page_magic/version.rb +3 -0
- metadata +81 -88
- data/.codeclimate.yml +0 -4
- data/.pullreview.yml +0 -14
- data/.rspec +0 -1
- data/.rubocop.yml +0 -39
- data/.simplecov +0 -10
- data/.zsh_config +0 -6
- data/Dockerfile +0 -11
- data/Gemfile +0 -24
- data/Gemfile.lock +0 -175
- data/Makefile +0 -17
- data/Rakefile +0 -32
- data/VERSION +0 -1
- data/circle.yml +0 -8
- data/page_magic.gemspec +0 -128
- data/spec/lib/active_support/core_ext/object/to_query_test.rb +0 -78
- data/spec/page_magic/class_methods_spec.rb +0 -92
- data/spec/page_magic/comparator/fuzzy_spec.rb +0 -44
- data/spec/page_magic/comparator/literal_spec.rb +0 -41
- data/spec/page_magic/comparator/null_spec.rb +0 -35
- data/spec/page_magic/comparator/parameter_map_spec.rb +0 -75
- data/spec/page_magic/driver_spec.rb +0 -40
- data/spec/page_magic/drivers/poltergeist_spec.rb +0 -8
- data/spec/page_magic/drivers/rack_test_spec.rb +0 -8
- data/spec/page_magic/drivers/selenium_spec.rb +0 -15
- data/spec/page_magic/drivers_spec.rb +0 -48
- data/spec/page_magic/element/locators_spec.rb +0 -36
- data/spec/page_magic/element/not_found_spec.rb +0 -24
- data/spec/page_magic/element/query/multiple_results_spec.rb +0 -14
- data/spec/page_magic/element/query/single_result_spec.rb +0 -21
- data/spec/page_magic/element/query_spec.rb +0 -38
- data/spec/page_magic/element/selector_spec.rb +0 -166
- data/spec/page_magic/element_context_spec.rb +0 -72
- data/spec/page_magic/element_definition_builder_spec.rb +0 -19
- data/spec/page_magic/element_spec.rb +0 -256
- data/spec/page_magic/elements/config_spec.rb +0 -203
- data/spec/page_magic/elements_spec.rb +0 -125
- data/spec/page_magic/instance_methods_spec.rb +0 -90
- data/spec/page_magic/mapping_spec.rb +0 -181
- data/spec/page_magic/session_methods_spec.rb +0 -40
- data/spec/page_magic/session_spec.rb +0 -164
- data/spec/page_magic/transitions_spec.rb +0 -43
- data/spec/page_magic/utils/string_spec.rb +0 -29
- data/spec/page_magic/utils/url_spec.rb +0 -9
- data/spec/page_magic/wait_methods_spec.rb +0 -35
- data/spec/page_magic/watcher_spec.rb +0 -22
- data/spec/page_magic/watchers_spec.rb +0 -80
- data/spec/page_magic_spec.rb +0 -115
- data/spec/spec_helper.rb +0 -15
- data/spec/support/shared_contexts.rb +0 -5
- data/spec/support/shared_examples.rb +0 -25
@@ -1,164 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe PageMagic::Session do
|
4
|
-
subject(:session) { described_class.new(browser, 'http://base.url') }
|
5
|
-
|
6
|
-
let(:page) do
|
7
|
-
Class.new do
|
8
|
-
include PageMagic
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:browser) do
|
13
|
-
rack_application = Class.new do
|
14
|
-
def self.call(_env)
|
15
|
-
[200, {}, ['ok']]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
Capybara::Session.new(:rack_test, rack_application)
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#current_page' do
|
23
|
-
let(:another_page_class) do
|
24
|
-
Class.new do
|
25
|
-
include PageMagic
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'returns the current page' do
|
30
|
-
session.visit(page, url: 'http://base.url')
|
31
|
-
expect(session.current_page).to be_an_instance_of(page)
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when the page url has changed' do
|
35
|
-
it 'returns the mapped page object' do
|
36
|
-
session.define_page_mappings '/another_page1' => another_page_class
|
37
|
-
browser.visit('/another_page1')
|
38
|
-
expect(session.current_page).to be_an_instance_of(another_page_class)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#define_page_mappings' do
|
44
|
-
context 'when the mapping includes a literal' do
|
45
|
-
it 'creates a matcher to contain the specification' do
|
46
|
-
session.define_page_mappings path: :page
|
47
|
-
expect(session.transitions.to_h).to include(PageMagic::Mapping.new(:path) => :page)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'when the mapping is a matcher' do
|
52
|
-
it 'leaves it intact' do
|
53
|
-
expected_matcher = PageMagic::Mapping.new(:page)
|
54
|
-
session.define_page_mappings expected_matcher => :page
|
55
|
-
expect(session.transitions.key(:page)).to be(expected_matcher)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#method_missing' do
|
61
|
-
before do
|
62
|
-
page.class_eval do
|
63
|
-
def my_method
|
64
|
-
:called
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'delegates to current page' do
|
70
|
-
session = described_class.new(browser).visit(page, url: 'http://base.url')
|
71
|
-
expect(session.my_method).to be(:called)
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'when method not on current page' do
|
75
|
-
it 'delegates to the capybara session' do
|
76
|
-
session = described_class.new(browser).visit(page, url: 'http://base.url')
|
77
|
-
expect(session).to have_text('ok')
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe '#is_a?' do
|
83
|
-
context 'when other is a `Capybara::Session`' do
|
84
|
-
it 'returns true' do
|
85
|
-
expect(described_class.new(browser).is_a?(Capybara::Session)).to eq(true)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe '#respond_to?' do
|
91
|
-
it 'checks self' do
|
92
|
-
session = described_class.new(browser)
|
93
|
-
expect(session.respond_to?(:current_url)).to eq(true)
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'when method is not on self' do
|
97
|
-
before do
|
98
|
-
page.class_eval do
|
99
|
-
def my_method
|
100
|
-
:called
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'checks the current page' do
|
106
|
-
session = described_class.new(browser)
|
107
|
-
session.visit(page, url: '/')
|
108
|
-
expect(session.respond_to?(:my_method)).to eq(true)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
context 'when method not on self or the current page' do
|
113
|
-
it 'checks the capybara session' do
|
114
|
-
session = described_class.new(browser)
|
115
|
-
expect(session).to respond_to(:has_text?)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe '#visit' do
|
121
|
-
context 'when a page is supplied' do
|
122
|
-
it 'sets the current page' do
|
123
|
-
session.define_page_mappings '/page' => page
|
124
|
-
session.visit(page)
|
125
|
-
expect(session.current_page).to be_a(page)
|
126
|
-
end
|
127
|
-
|
128
|
-
it 'uses the base url and the path in the page mappings' do
|
129
|
-
session = described_class.new(browser, 'http://base.url')
|
130
|
-
session.define_page_mappings '/page' => page
|
131
|
-
session.visit(page)
|
132
|
-
expect(session.current_url).to eq('http://base.url/page')
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'raises an error when page no page mappings are found' do
|
136
|
-
expect do
|
137
|
-
session.visit(page)
|
138
|
-
end.to raise_exception PageMagic::InvalidURLException, described_class::URL_MISSING_MSG
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'calls the onload hook' do
|
142
|
-
on_load_hook_called = false
|
143
|
-
page.on_load { on_load_hook_called = true }
|
144
|
-
session.visit(page, url: 'http://base.url')
|
145
|
-
expect(on_load_hook_called).to eq(true)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
context 'when a page and `:url` supplied' do
|
150
|
-
it 'uses the url' do
|
151
|
-
session.visit(page, url: 'http://other.url/')
|
152
|
-
expect(session.current_url).to eq('http://other.url/')
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
context 'when `url` is supplied' do
|
157
|
-
it 'visits that url' do
|
158
|
-
expected_url = 'http://base.url/page'
|
159
|
-
session.visit(expected_url)
|
160
|
-
expect(browser.current_url).to eq(expected_url)
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe PageMagic::Transitions do
|
4
|
-
describe '#mapped_page' do
|
5
|
-
context 'when a match is match found' do
|
6
|
-
it 'returns the page class' do
|
7
|
-
mappings = described_class.new('/page' => :mapped_page_using_string)
|
8
|
-
expect(mappings.mapped_page('/page')).to be(:mapped_page_using_string)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'when more than one match is found' do
|
13
|
-
it 'returns the most specific match' do
|
14
|
-
mappings = described_class.new(%r{/page} => :mapped_page_using_regex, '/page' => :mapped_page_using_string)
|
15
|
-
expect(mappings.mapped_page('/page')).to eq(:mapped_page_using_string)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when a mapping is not found' do
|
20
|
-
it 'returns nil' do
|
21
|
-
mappings = described_class.new({})
|
22
|
-
expect(mappings.mapped_page('/unmapped_page')).to be(nil)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#url_for' do
|
28
|
-
it 'returns the url for the mapped page' do
|
29
|
-
page = Object.new
|
30
|
-
mappings = described_class.new('/mapping' => page)
|
31
|
-
expect(mappings.url_for(page, base_url: 'http://base.url')).to eq('http://base.url/mapping')
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when page mapping is a regular expression' do
|
35
|
-
it 'raises an error' do
|
36
|
-
page = Object.new
|
37
|
-
mappings = described_class.new(/mapping/ => page)
|
38
|
-
expect { mappings.url_for(page, base_url: 'http://base.url') }
|
39
|
-
.to raise_exception PageMagic::InvalidURLException, described_class::REGEXP_MAPPING_MSG
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe PageMagic::Utils::String do
|
4
|
-
describe '.classify' do
|
5
|
-
context 'when parameter is symbol' do
|
6
|
-
it 'returns a string' do
|
7
|
-
expect(described_class.classify(:Symbol)).to eq('Symbol')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
context 'when parameter is string' do
|
12
|
-
it 'returns a string' do
|
13
|
-
expect(described_class.classify(:String)).to eq('String')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when the first letter is lower case' do
|
18
|
-
it 'converts the first letter to uppercase' do
|
19
|
-
expect(described_class.classify(:symbol)).to eq('Symbol')
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'when parameter is in snakecase' do
|
24
|
-
it 'removes underscores and capitalises each word' do
|
25
|
-
expect(described_class.classify(:snake_case)).to eq('SnakeCase')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe PageMagic::WaitMethods do
|
4
|
-
include described_class
|
5
|
-
|
6
|
-
describe '#wait_until' do
|
7
|
-
let(:default_options) { { timeout_after: 0.1, retry_every: 0.05 } }
|
8
|
-
let!(:start_time) { Time.now }
|
9
|
-
|
10
|
-
it 'waits until the prescribed thing has happened' do
|
11
|
-
expect { wait_until(**default_options) { true } }.not_to raise_exception
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'keeps trying for a specified period' do
|
15
|
-
wait_until(**default_options) { false }
|
16
|
-
rescue PageMagic::TimeoutException
|
17
|
-
expect(Time.now - default_options[:timeout_after]).to be > start_time
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'when `timeout_after` specified' do
|
21
|
-
it 'throws an exception if when the prescribed action does not happen in time' do
|
22
|
-
expect { wait_until(**default_options) { false } }.to raise_error PageMagic::TimeoutException
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'when retry time specified' do
|
27
|
-
it 'retries at the given interval' do
|
28
|
-
count = 0
|
29
|
-
expect { wait_until(timeout_after: 0.2, retry_every: 0.1) { count += 1 } }
|
30
|
-
.to raise_exception(PageMagic::TimeoutException)
|
31
|
-
.and change { count }.by(2)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe PageMagic::Watcher do
|
4
|
-
describe '#initialize' do
|
5
|
-
context 'when `check` has not been called yet' do
|
6
|
-
it 'sets `observed_value` to nil' do
|
7
|
-
instance = described_class.new(:custom_watcher, context: self)
|
8
|
-
expect(instance.observed_value).to be_nil
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#check' do
|
14
|
-
it 'assigns last to be the result of calling the block passed to the constructor' do
|
15
|
-
instance = described_class.new(:object_id, context: self) do
|
16
|
-
object_id
|
17
|
-
end
|
18
|
-
instance.check
|
19
|
-
expect(instance.observed_value).to eq(object_id)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'ostruct'
|
4
|
-
RSpec.describe PageMagic::Watchers do
|
5
|
-
include described_class
|
6
|
-
let(:element) { OpenStruct.new(text: :current_value) }
|
7
|
-
|
8
|
-
describe '#changed?' do
|
9
|
-
context 'when the watched element has changed' do
|
10
|
-
it 'returns true' do
|
11
|
-
watch(:element_watcher, context: element, method: :text)
|
12
|
-
element.text = :new_value
|
13
|
-
expect(changed?(:element_watcher)).to eq(true)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when the watched element has not changed' do
|
18
|
-
it 'returns false' do
|
19
|
-
watch(:element_watcher, context: element, method: :text)
|
20
|
-
expect(changed?(:element_watcher)).to eq(false)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#watch' do
|
26
|
-
it 'stores the initial value of the watched element' do
|
27
|
-
watch(:element_watcher, context: element, method: :text)
|
28
|
-
expect(watcher(:element_watcher).observed_value).to eq(:current_value)
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'when a method name is supplied' do
|
32
|
-
it 'stores the watch instruction' do
|
33
|
-
watch(:object_id)
|
34
|
-
watcher = watcher(:object_id)
|
35
|
-
expect(watcher.check.observed_value).to eq(object_id)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'when a watcher name and a method are supplied' do
|
40
|
-
it 'stores the watch instruction' do
|
41
|
-
watch(:my_watcher, method: :object_id)
|
42
|
-
watcher = watcher(:my_watcher)
|
43
|
-
expect(watcher.check.observed_value).to eq(object_id)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'when a block is supplied' do
|
48
|
-
it 'stores the watch instruction' do
|
49
|
-
block = proc { :value }
|
50
|
-
watch(:my_watcher, &block)
|
51
|
-
watcher = watcher(:my_watcher)
|
52
|
-
expect(watcher.check.observed_value).to eq(:value)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'when a watcher with the same name is added' do
|
57
|
-
it 'replaces the watcher' do
|
58
|
-
original_watcher = watch(:object_id)
|
59
|
-
expect(watcher(:object_id)).not_to be(original_watcher)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'when a watcher defined on a method that does not exist' do
|
64
|
-
it 'raises an error' do
|
65
|
-
expected_message = described_class::ELEMENT_MISSING_MSG % :text
|
66
|
-
expect do
|
67
|
-
watch(:missing, method: :text)
|
68
|
-
end.to raise_exception(PageMagic::ElementMissingException, expected_message)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#watcher' do
|
74
|
-
it 'returns the watcher with the given name' do
|
75
|
-
watch(:my_watcher, method: :object_id)
|
76
|
-
watcher = watcher(:my_watcher)
|
77
|
-
expect(watcher.check.observed_value).to eq(object_id)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
data/spec/page_magic_spec.rb
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'page_magic'
|
4
|
-
|
5
|
-
RSpec.describe PageMagic do
|
6
|
-
subject(:page_class) do
|
7
|
-
Class.new.tap do |klass|
|
8
|
-
klass.include(described_class)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '.drivers' do
|
13
|
-
it 'returns loaded drivers' do
|
14
|
-
expected_drivers = described_class::Drivers.new.tap(&:load)
|
15
|
-
|
16
|
-
expect(described_class.drivers).to eq(expected_drivers)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '.included' do
|
21
|
-
it 'gives a method for defining the url' do
|
22
|
-
page_class.url :url
|
23
|
-
expect(page_class.url).to eq(:url)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'lets you define elements' do
|
27
|
-
expect(page_class).to be_a(PageMagic::Elements)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '.inherited' do
|
32
|
-
let(:parent_page) do
|
33
|
-
Class.new do
|
34
|
-
include PageMagic
|
35
|
-
link(:next, text: 'next page')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
let(:child_page) do
|
40
|
-
Class.new(parent_page)
|
41
|
-
end
|
42
|
-
|
43
|
-
describe 'children' do
|
44
|
-
it 'inherits elements defined on the parent class' do
|
45
|
-
expect(child_page.element_definitions).to include(:next)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'passes on element definitions to their children' do
|
49
|
-
grand_child_class = Class.new(child_page)
|
50
|
-
expect(grand_child_class.element_definitions).to include(:next)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#mapping' do
|
56
|
-
it 'returns a matcher' do
|
57
|
-
mapping = described_class.mapping('/', parameters: {}, fragment: '')
|
58
|
-
expect(mapping).to eq(PageMagic::Mapping.new('/', parameters: {}, fragment: ''))
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '.session' do
|
63
|
-
let(:rack_application) do
|
64
|
-
Class.new do
|
65
|
-
def self.call(_env)
|
66
|
-
[200, {}, ['hello world!!']]
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
let(:url) { 'http://url.com/' }
|
72
|
-
|
73
|
-
it "defaults to capybara's default session " do
|
74
|
-
Capybara.default_driver = :rack_test
|
75
|
-
expect(page_class.new.browser.mode).to eq(:rack_test)
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'when `:browser` is specified' do
|
79
|
-
it 'loads the correct driver' do
|
80
|
-
session = described_class.session(application: rack_application, browser: :firefox, url: :url)
|
81
|
-
expect(session.raw_session.driver).to be_a(Capybara::Selenium::Driver)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'when `:rack_application` is specified' do
|
86
|
-
it 'configures capybara to run against the app' do
|
87
|
-
session = described_class.session(application: rack_application, url: url)
|
88
|
-
expect(session.raw_session.app).to be(rack_application)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'when `session` is specified' do
|
93
|
-
it 'uses it' do
|
94
|
-
session = described_class.session(session: :custom_session)
|
95
|
-
expect(session.raw_session).to be(:custom_session)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context 'when `:options` is specified' do
|
100
|
-
it 'passes the options to the browser driver' do
|
101
|
-
options = { option: :config }
|
102
|
-
session = described_class.session(options: options, browser: :chrome, url: url)
|
103
|
-
|
104
|
-
expect(session.raw_session.driver.options).to include(options)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'when the driver assigned to `:browser` is not found' do
|
109
|
-
it 'raises an error' do
|
110
|
-
expected_exception = described_class::UnsupportedBrowserException
|
111
|
-
expect { described_class.session(browser: :invalid, url: url) }.to raise_exception expected_exception
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
this_dir = File.dirname(__FILE__)
|
4
|
-
$LOAD_PATH.unshift("#{this_dir}/lib")
|
5
|
-
require 'support/shared_contexts'
|
6
|
-
require 'support/shared_examples'
|
7
|
-
|
8
|
-
require 'simplecov' if ENV['coverage']
|
9
|
-
|
10
|
-
require 'page_magic'
|
11
|
-
|
12
|
-
Dir["#{this_dir}/../lib/page_magic/drivers/*.rb"].sort.each do |driver|
|
13
|
-
require driver
|
14
|
-
end
|
15
|
-
Capybara.server = :webrick
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.shared_examples 'session accessor' do
|
4
|
-
it 'includes session methods' do
|
5
|
-
expect(described_class.included_modules).to include(PageMagic::SessionMethods)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
RSpec.shared_examples 'element watcher' do
|
10
|
-
it 'includes watchers' do
|
11
|
-
expect(described_class.included_modules).to include(PageMagic::Watchers)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
RSpec.shared_examples 'waiter' do
|
16
|
-
it 'includes waiters' do
|
17
|
-
expect(described_class.included_modules).to include(PageMagic::WaitMethods)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
RSpec.shared_examples 'element locator' do
|
22
|
-
it 'includes Locators' do
|
23
|
-
expect(described_class.included_modules).to include(PageMagic::Element::Locators)
|
24
|
-
end
|
25
|
-
end
|