web4cucumber 0.0.2 → 0.0.3
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/examples/testproject/Gemfile +0 -1
- data/examples/testproject/Gemfile.lock +10 -9
- data/examples/testproject/features/example.feature +0 -5
- data/examples/testproject/features/step_definitions/web.rb +1 -11
- data/lib/web4cucumber.rb +80 -15
- data/lib/web4cucumber/version.rb +1 -1
- data/web4cucumber.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4ad351ac2b8da43d6e8b8921ea89c45daf4ed20
|
4
|
+
data.tar.gz: 2a7e12e29bad39f31bc674ab32224aaaf6e70c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57c3e99545d0334bf001b969142889428e53342e6e2cc6492383d1e73a5449712f3a5cdc055f2ae0022422898084d3f8c99285158c47a3ff297503eef8583410
|
7
|
+
data.tar.gz: 55fc9079cb9df2347a00f812048562a36f5f6888382a279f22137f247d21337732eb0d83984fffa71eaefa13d80cbf1fe49c3141232c0e85fbc0e6fa6705c4c3
|
@@ -2,22 +2,20 @@ GEM
|
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
4
|
builder (3.2.2)
|
5
|
+
byebug (2.7.0)
|
6
|
+
columnize (~> 0.3)
|
7
|
+
debugger-linecache (~> 1.2)
|
5
8
|
childprocess (0.5.5)
|
6
9
|
ffi (~> 1.0, >= 1.0.11)
|
7
10
|
coderay (1.1.0)
|
8
|
-
columnize (0.
|
11
|
+
columnize (0.9.0)
|
9
12
|
cucumber (1.3.19)
|
10
13
|
builder (>= 2.1.2)
|
11
14
|
diff-lcs (>= 1.1.3)
|
12
15
|
gherkin (~> 2.12)
|
13
16
|
multi_json (>= 1.7.5, < 2.0)
|
14
17
|
multi_test (>= 0.1.2)
|
15
|
-
debugger (1.6.8)
|
16
|
-
columnize (>= 0.3.1)
|
17
|
-
debugger-linecache (~> 1.2.0)
|
18
|
-
debugger-ruby_core_source (~> 1.3.5)
|
19
18
|
debugger-linecache (1.2.0)
|
20
|
-
debugger-ruby_core_source (1.3.5)
|
21
19
|
diff-lcs (1.2.5)
|
22
20
|
ffi (1.9.6)
|
23
21
|
gherkin (2.12.2)
|
@@ -42,18 +40,21 @@ GEM
|
|
42
40
|
slop (3.5.0)
|
43
41
|
watir-webdriver (0.6.11)
|
44
42
|
selenium-webdriver (>= 2.18.0)
|
45
|
-
|
43
|
+
web4cucumber (0.0.2)
|
44
|
+
byebug (~> 2.7)
|
45
|
+
headless (~> 1.0)
|
46
|
+
watir-webdriver (~> 0.6)
|
46
47
|
websocket (1.2.1)
|
47
48
|
|
48
49
|
PLATFORMS
|
49
50
|
ruby
|
50
51
|
|
51
52
|
DEPENDENCIES
|
53
|
+
byebug
|
52
54
|
cucumber
|
53
|
-
debugger
|
54
55
|
headless
|
55
56
|
json
|
56
57
|
pry
|
57
58
|
rspec-expectations
|
58
59
|
watir-webdriver
|
59
|
-
|
60
|
+
web4cucumber
|
@@ -5,8 +5,3 @@ Feature: example.feature
|
|
5
5
|
Scenario: Login to Openshift web console
|
6
6
|
Given I am logged in to OpenShift web console
|
7
7
|
Then the url should contain "app/account"
|
8
|
-
When I run my beautiful action with:
|
9
|
-
|option |value |
|
10
|
-
|field_one_on_page_one |some text |
|
11
|
-
|field_two_on_page_one | some other text|
|
12
|
-
|field_one_on_page_two| lib/files/myfile |
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Given /^I am logged in to OpenShift web console$/ do
|
2
2
|
options = {}
|
3
|
-
options[:login] = ENV["
|
3
|
+
options[:login] = ENV["OPENSHIFT_LOGIN"]
|
4
4
|
options[:password] = ENV["OPENSHIFT_PASSWORD"]
|
5
5
|
@result = @web.login(options)
|
6
6
|
expect(@result[:result]).to be_true, "Failed to log in"
|
@@ -11,13 +11,3 @@ Then /^the url should contain "(.*?)"$/ do |urlpart|
|
|
11
11
|
expect(url.include?(urlpart)).to be_true, "Failed to find #{urlpart} in page url"
|
12
12
|
|
13
13
|
end
|
14
|
-
|
15
|
-
When /^I run my beautiful action with:$/ do |table|
|
16
|
-
options = {}
|
17
|
-
table.rows.each do |row|
|
18
|
-
options[row[0].to_sym] = row[1]
|
19
|
-
end
|
20
|
-
@result = @web.run_action(:our_test_action, options)
|
21
|
-
end
|
22
|
-
|
23
|
-
|
data/lib/web4cucumber.rb
CHANGED
@@ -484,7 +484,7 @@ class Web4Cucumber
|
|
484
484
|
return @result
|
485
485
|
end
|
486
486
|
end
|
487
|
-
|
487
|
+
return new_cookies
|
488
488
|
end
|
489
489
|
if opt == 'delete_all'
|
490
490
|
unless @cookies.clear
|
@@ -515,7 +515,10 @@ class Web4Cucumber
|
|
515
515
|
# elements should be an array of hashes, for example:
|
516
516
|
# [{:a=>{:class=>"block"}}, {:a=>{:href=>"/products"}}, {:a=>{:text=>"Log In"}}]
|
517
517
|
@counter = 0
|
518
|
-
@result = {:result=>true,
|
518
|
+
@result = {:result=>true,
|
519
|
+
:failed_positive_checkpoints => [],
|
520
|
+
:failed_negative_checkpoints => [],
|
521
|
+
:errors => []}
|
519
522
|
elements.each do |element|
|
520
523
|
myhash = {
|
521
524
|
:a=>@@b.a(element.values[0]),
|
@@ -535,6 +538,7 @@ class Web4Cucumber
|
|
535
538
|
end
|
536
539
|
else
|
537
540
|
unless myhash[element.keys[0]].exists?
|
541
|
+
screenshot_save
|
538
542
|
@result[:result] = false
|
539
543
|
@result[:failed_positive_checkpoints] << element
|
540
544
|
end
|
@@ -542,9 +546,10 @@ class Web4Cucumber
|
|
542
546
|
begin
|
543
547
|
myhash[element.keys[0]].click
|
544
548
|
rescue => e
|
549
|
+
screenshot_save
|
545
550
|
@result[:result] = false
|
546
551
|
@result[:failed_positive_checkpoints] << element
|
547
|
-
@result[:
|
552
|
+
@result[:errors] << e.message
|
548
553
|
end
|
549
554
|
end
|
550
555
|
end
|
@@ -560,15 +565,15 @@ class Web4Cucumber
|
|
560
565
|
result = {
|
561
566
|
:result => true,
|
562
567
|
:failed_positive_checkpoints => [],
|
563
|
-
:
|
564
|
-
:error_messages => []
|
568
|
+
:errors => []
|
565
569
|
}
|
566
570
|
until @@b.select_list(element_selector).exists? do
|
567
571
|
begin
|
568
572
|
wait_for_element(element_selector)
|
569
573
|
rescue => e
|
570
574
|
result[:result] = false
|
571
|
-
result[:
|
575
|
+
result[:failed_positive_checkpoints] << element_selector
|
576
|
+
result[:errors] << e.message
|
572
577
|
break
|
573
578
|
end
|
574
579
|
end
|
@@ -594,11 +599,59 @@ class Web4Cucumber
|
|
594
599
|
end
|
595
600
|
|
596
601
|
def dropdown_value(selector)
|
597
|
-
|
602
|
+
if not element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
|
603
|
+
raise "Please pass the element string in the form :selector=>\"value\""
|
604
|
+
end
|
605
|
+
result = {:result => true,
|
606
|
+
:failed_positive_checkpoints => [],
|
607
|
+
:errors => [],
|
608
|
+
:value => nil}
|
609
|
+
begin
|
610
|
+
result[:value] = @@b.select_list(selector).value
|
611
|
+
rescue => e
|
612
|
+
screenshot_save
|
613
|
+
result[:result] = false
|
614
|
+
result[:failed_positive_checkpoints] << selector
|
615
|
+
result[:errors] << e.message
|
616
|
+
end
|
617
|
+
end
|
618
|
+
|
619
|
+
def select_value(element, value)
|
620
|
+
if not element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
|
621
|
+
raise "Please pass the element string in the form :selector=>\"value\""
|
622
|
+
end
|
623
|
+
result = {:result => true, :errors => []}
|
624
|
+
unless @@b.select_list(element).exists?
|
625
|
+
result[:result] = false
|
626
|
+
result[:errors] << "Unable to find element with #{element.keys[0].to_s} #{element.values[0]}"
|
627
|
+
else
|
628
|
+
begin
|
629
|
+
@@b.select_list(element).select_value(value)
|
630
|
+
rescue => e
|
631
|
+
screenshot_save
|
632
|
+
result[:result] = false
|
633
|
+
result[:errors] << e.message
|
634
|
+
end
|
635
|
+
end
|
636
|
+
return result
|
598
637
|
end
|
599
638
|
|
600
639
|
def element_text(selector)
|
601
|
-
|
640
|
+
if not element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
|
641
|
+
raise "Please pass the element string in the form :selector=>\"value\""
|
642
|
+
end
|
643
|
+
result = {:result => true,
|
644
|
+
:errors => [],
|
645
|
+
:failed_positive_checkpoints => []}
|
646
|
+
begin
|
647
|
+
result[:text] = @@b.element(selector).text
|
648
|
+
rescue => e
|
649
|
+
screenshot_save
|
650
|
+
result[:result] = false
|
651
|
+
result[:failed_positive_checkpoints] << selector
|
652
|
+
result[:errors] << e.message
|
653
|
+
end
|
654
|
+
return result
|
602
655
|
end
|
603
656
|
|
604
657
|
def refresh_page
|
@@ -606,23 +659,35 @@ class Web4Cucumber
|
|
606
659
|
end
|
607
660
|
|
608
661
|
def send_keys(element, text)
|
609
|
-
|
662
|
+
if not element.match(/\:\w+\=\>[\'\"]\S+[\"\']/)
|
663
|
+
raise "Please pass the element string in the form :selector=>\"value\""
|
664
|
+
end
|
665
|
+
result = {:result=>true,
|
666
|
+
:failed_positive_checkpoints => [],
|
667
|
+
:errors => []
|
668
|
+
}
|
610
669
|
begin
|
611
670
|
@@b.text_field(element).clear
|
612
671
|
@@b.text_field(element).send_keys text
|
613
672
|
rescue => e
|
614
673
|
result[:result] = false
|
615
|
-
result[:
|
674
|
+
result[:failed_positive_checkpoints] << element
|
675
|
+
result[:errors] << e.message
|
616
676
|
end
|
617
677
|
end
|
618
678
|
|
619
|
-
def check_textfield_content(selector
|
620
|
-
result = {
|
621
|
-
|
679
|
+
def check_textfield_content(selector)
|
680
|
+
result = {:result => true,
|
681
|
+
:failed_positive_checkpoints => [],
|
682
|
+
:errors => []
|
683
|
+
}
|
684
|
+
begin
|
622
685
|
result[:text] = @@b.text_field(selector).value
|
623
|
-
|
624
|
-
|
686
|
+
rescue => e
|
687
|
+
screenshot_save
|
625
688
|
result[:result] = false
|
689
|
+
result[:failed_positive_checkpoints] << selector
|
690
|
+
result[:errors] << e.message
|
626
691
|
end
|
627
692
|
return result
|
628
693
|
end
|
data/lib/web4cucumber/version.rb
CHANGED
data/web4cucumber.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.license = "GPLv3"
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.require_paths = ["lib"]
|
18
|
+
s.required_ruby_version = '~> 2.0'
|
18
19
|
s.add_runtime_dependency "watir-webdriver", "~> 0.6"
|
19
20
|
s.add_runtime_dependency "headless", "~> 1.0"
|
20
21
|
s.add_runtime_dependency "byebug", "~> 2.7"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web4cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Fayans
|
@@ -113,9 +113,9 @@ require_paths:
|
|
113
113
|
- lib
|
114
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- - "
|
116
|
+
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
118
|
+
version: '2.0'
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|
@@ -128,3 +128,4 @@ signing_key:
|
|
128
128
|
specification_version: 4
|
129
129
|
summary: Web testing module for cucumber
|
130
130
|
test_files: []
|
131
|
+
has_rdoc:
|