pickles 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +196 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/cucumber/pickles.rb +6 -0
- data/lib/cucumber/pickles/check_in.rb +10 -0
- data/lib/cucumber/pickles/config.rb +61 -0
- data/lib/cucumber/pickles/errors/ambigious.rb +27 -0
- data/lib/cucumber/pickles/errors/node_find_error.rb +37 -0
- data/lib/cucumber/pickles/fill_in.rb +10 -0
- data/lib/cucumber/pickles/helpers.rb +40 -0
- data/lib/cucumber/pickles/helpers/extensions/chrome/.DS_Store +0 -0
- data/lib/cucumber/pickles/helpers/extensions/chrome/compiled.crx.base64 +1 -0
- data/lib/cucumber/pickles/helpers/extensions/chrome/manifest.json +15 -0
- data/lib/cucumber/pickles/helpers/extensions/chrome/src/.DS_Store +0 -0
- data/lib/cucumber/pickles/helpers/extensions/chrome/src/inject/inject.js +35 -0
- data/lib/cucumber/pickles/helpers/main.rb +88 -0
- data/lib/cucumber/pickles/helpers/node_finders.rb +125 -0
- data/lib/cucumber/pickles/helpers/regex.rb +6 -0
- data/lib/cucumber/pickles/helpers/waiter.rb +152 -0
- data/lib/cucumber/pickles/locator/equal.rb +26 -0
- data/lib/cucumber/pickles/locator/index.rb +20 -0
- data/lib/cucumber/pickles/refinements.rb +49 -0
- data/lib/cucumber/pickles/steps.rb +73 -0
- data/lib/cucumber/pickles/steps/can_see.rb +70 -0
- data/lib/cucumber/pickles/steps/check.rb +55 -0
- data/lib/cucumber/pickles/steps/check_in/complex_input.rb +17 -0
- data/lib/cucumber/pickles/steps/check_in/factory.rb +26 -0
- data/lib/cucumber/pickles/steps/check_in/input.rb +36 -0
- data/lib/cucumber/pickles/steps/check_in/text.rb +17 -0
- data/lib/cucumber/pickles/steps/click.rb +91 -0
- data/lib/cucumber/pickles/steps/fill.rb +72 -0
- data/lib/cucumber/pickles/steps/fill_in/complex_input.rb +19 -0
- data/lib/cucumber/pickles/steps/fill_in/factory.rb +25 -0
- data/lib/cucumber/pickles/steps/fill_in/input.rb +29 -0
- data/lib/cucumber/pickles/steps/fill_in/select.rb +30 -0
- data/lib/cucumber/pickles/steps/redirect.rb +3 -0
- data/lib/cucumber/pickles/transform.rb +13 -0
- data/lib/cucumber/pickles/version.rb +3 -0
- data/lib/pickles.rb +3 -0
- data/pickles.gemspec +36 -0
- data/spec/helpers/node_finders_spec.rb +155 -0
- data/spec/helpers/waiter_spec.rb +41 -0
- data/spec/locator_spec.rb +31 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/step_def_spec.rb +0 -0
- data/spec/steps/check_in/factory_spec.rb +52 -0
- data/spec/steps/fill_in/factory_spec.rb +51 -0
- metadata +153 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Locator; end
|
4
|
+
require 'cucumber/pickles/locator/index'
|
5
|
+
require 'cucumber/pickles/locator/equal'
|
6
|
+
|
7
|
+
RSpec.describe "#Locator" do
|
8
|
+
|
9
|
+
describe "#Index" do
|
10
|
+
|
11
|
+
it 'returns correct index xpath with index' do
|
12
|
+
locator, index = Locator::Index.execute('locator[1]')
|
13
|
+
|
14
|
+
expect(index).to eq 1
|
15
|
+
expect(locator).to eq 'locator'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns empty without index' do
|
19
|
+
locator, index = Locator::Index.execute('locator')
|
20
|
+
|
21
|
+
expect(index).to be_nil
|
22
|
+
expect(locator).to eq 'locator'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#Equal" do
|
28
|
+
# ???
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
2
|
+
|
3
|
+
require 'capybara'
|
4
|
+
require 'capybara/dsl'
|
5
|
+
|
6
|
+
require 'pry'
|
7
|
+
|
8
|
+
require 'capybara/spec/test_app'
|
9
|
+
|
10
|
+
require 'selenium-webdriver'
|
11
|
+
require 'cucumber/pickles/helpers'
|
12
|
+
|
13
|
+
Capybara.register_driver :selenium_chrome_clear_storage do |app|
|
14
|
+
chrome_options = {
|
15
|
+
browser: :chrome,
|
16
|
+
options: ::Selenium::WebDriver::Chrome::Options.new.tap { |options| options.args << 'headless' },
|
17
|
+
clear_local_storage: true,
|
18
|
+
clear_session_storage: true,
|
19
|
+
}
|
20
|
+
|
21
|
+
Capybara::Selenium::Driver.new(app, chrome_options)
|
22
|
+
end
|
23
|
+
|
24
|
+
Capybara.app = TestApp
|
25
|
+
|
26
|
+
Capybara.javascript_driver = Capybara.current_driver = :selenium_chrome_clear_storage
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
config.before(:all) do
|
30
|
+
@session = Capybara.current_session
|
31
|
+
end
|
32
|
+
end
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'cucumber/pickles/fill_in'
|
4
|
+
require 'cucumber/pickles/check_in'
|
5
|
+
|
6
|
+
RSpec.describe '#CheckIn::Factory' do
|
7
|
+
|
8
|
+
class NewCoolStep
|
9
|
+
def initialize(*); end
|
10
|
+
end
|
11
|
+
|
12
|
+
Pickles.configure do |config|
|
13
|
+
config.check_tag_steps_map = {
|
14
|
+
'new_cool_step' => NewCoolStep
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'uses custom step if label demands it' do
|
19
|
+
label = "input (new_cool_step)"
|
20
|
+
|
21
|
+
step = CheckIn::Factory.new(label, nil).call
|
22
|
+
|
23
|
+
expect(step).to be_instance_of(NewCoolStep)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'uses input step if custom step required but not defined' do
|
27
|
+
label = "input (another_cool_step)"
|
28
|
+
|
29
|
+
step = CheckIn::Factory.new(label, nil).call
|
30
|
+
|
31
|
+
expect(step).to be_instance_of(CheckIn::Input)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'uses complex input step if value has :' do
|
35
|
+
label = "input (new_cool_step)"
|
36
|
+
value = "1:2:3"
|
37
|
+
|
38
|
+
step = CheckIn::Factory.new(label, value).call
|
39
|
+
|
40
|
+
expect(step).to be_instance_of(CheckIn::ComplexInput)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'uses input step by default' do
|
44
|
+
label = "input"
|
45
|
+
value = "1"
|
46
|
+
|
47
|
+
step = CheckIn::Factory.new(label, value).call
|
48
|
+
|
49
|
+
expect(step).to be_instance_of(CheckIn::Input)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'cucumber/pickles/fill_in'
|
4
|
+
|
5
|
+
RSpec.describe '#FillIN::Factory' do
|
6
|
+
|
7
|
+
class NewCoolStep
|
8
|
+
def initialize(*); end
|
9
|
+
end
|
10
|
+
|
11
|
+
Pickles.configure do |config|
|
12
|
+
config.fill_tag_steps_map = {
|
13
|
+
'new_cool_step' => NewCoolStep
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'uses custom step if label demands it' do
|
18
|
+
label = "input (new_cool_step)"
|
19
|
+
|
20
|
+
step = FillIN::Factory.new(label, nil).call
|
21
|
+
|
22
|
+
expect(step).to be_instance_of(NewCoolStep)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'uses input step if custom step required but not defined' do
|
26
|
+
label = "input (another_cool_step)"
|
27
|
+
|
28
|
+
step = FillIN::Factory.new(label, nil).call
|
29
|
+
|
30
|
+
expect(step).to be_instance_of(FillIN::Input)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'uses complex input step if value has :' do
|
34
|
+
label = "input (new_cool_step)"
|
35
|
+
value = "1:2:3"
|
36
|
+
|
37
|
+
step = FillIN::Factory.new(label, value).call
|
38
|
+
|
39
|
+
expect(step).to be_instance_of(FillIN::ComplexInput)
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'uses input step by default' do
|
43
|
+
label = "input"
|
44
|
+
value = "1"
|
45
|
+
|
46
|
+
step = FillIN::Factory.new(label, value).call
|
47
|
+
|
48
|
+
expect(step).to be_instance_of(FillIN::Input)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pickles
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- vs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capybara
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Set of common everyday steps with shortcuts
|
70
|
+
email:
|
71
|
+
- vshaveyko@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- lib/cucumber/pickles.rb
|
86
|
+
- lib/cucumber/pickles/check_in.rb
|
87
|
+
- lib/cucumber/pickles/config.rb
|
88
|
+
- lib/cucumber/pickles/errors/ambigious.rb
|
89
|
+
- lib/cucumber/pickles/errors/node_find_error.rb
|
90
|
+
- lib/cucumber/pickles/fill_in.rb
|
91
|
+
- lib/cucumber/pickles/helpers.rb
|
92
|
+
- lib/cucumber/pickles/helpers/extensions/chrome/.DS_Store
|
93
|
+
- lib/cucumber/pickles/helpers/extensions/chrome/compiled.crx.base64
|
94
|
+
- lib/cucumber/pickles/helpers/extensions/chrome/manifest.json
|
95
|
+
- lib/cucumber/pickles/helpers/extensions/chrome/src/.DS_Store
|
96
|
+
- lib/cucumber/pickles/helpers/extensions/chrome/src/inject/inject.js
|
97
|
+
- lib/cucumber/pickles/helpers/main.rb
|
98
|
+
- lib/cucumber/pickles/helpers/node_finders.rb
|
99
|
+
- lib/cucumber/pickles/helpers/regex.rb
|
100
|
+
- lib/cucumber/pickles/helpers/waiter.rb
|
101
|
+
- lib/cucumber/pickles/locator/equal.rb
|
102
|
+
- lib/cucumber/pickles/locator/index.rb
|
103
|
+
- lib/cucumber/pickles/refinements.rb
|
104
|
+
- lib/cucumber/pickles/steps.rb
|
105
|
+
- lib/cucumber/pickles/steps/can_see.rb
|
106
|
+
- lib/cucumber/pickles/steps/check.rb
|
107
|
+
- lib/cucumber/pickles/steps/check_in/complex_input.rb
|
108
|
+
- lib/cucumber/pickles/steps/check_in/factory.rb
|
109
|
+
- lib/cucumber/pickles/steps/check_in/input.rb
|
110
|
+
- lib/cucumber/pickles/steps/check_in/text.rb
|
111
|
+
- lib/cucumber/pickles/steps/click.rb
|
112
|
+
- lib/cucumber/pickles/steps/fill.rb
|
113
|
+
- lib/cucumber/pickles/steps/fill_in/complex_input.rb
|
114
|
+
- lib/cucumber/pickles/steps/fill_in/factory.rb
|
115
|
+
- lib/cucumber/pickles/steps/fill_in/input.rb
|
116
|
+
- lib/cucumber/pickles/steps/fill_in/select.rb
|
117
|
+
- lib/cucumber/pickles/steps/redirect.rb
|
118
|
+
- lib/cucumber/pickles/transform.rb
|
119
|
+
- lib/cucumber/pickles/version.rb
|
120
|
+
- lib/pickles.rb
|
121
|
+
- pickles.gemspec
|
122
|
+
- spec/helpers/node_finders_spec.rb
|
123
|
+
- spec/helpers/waiter_spec.rb
|
124
|
+
- spec/locator_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
- spec/step_def_spec.rb
|
127
|
+
- spec/steps/check_in/factory_spec.rb
|
128
|
+
- spec/steps/fill_in/factory_spec.rb
|
129
|
+
homepage: https://github.com/vshaveyko/pickles
|
130
|
+
licenses:
|
131
|
+
- MIT
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.6.8
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: Capybara test helpers
|
153
|
+
test_files: []
|