acceptance_test 1.8.3 → 1.8.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTA4NTkwZDMzZTcwMTIzZjFlMGU1YmYwNzE0YmIxY2Q2NGUxMmFlZg==
4
+ NzY3NjY0MGEwZjI4MzAwZTViNWYyNTZmN2Y4ZDdiMTg4NzYxYzhiOQ==
5
5
  data.tar.gz: !binary |-
6
- ZDVmZTlkNWQ2NjE3OWRkNWU5NTk4OTdhZWViYWJiYzM5OTkzZTZiZQ==
6
+ YTk1MmMzMjM5YWViOWUxNDUyYzgxNTJiMmM2MGRhMmY4OTZmZjU3OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmQwZWI5Njk4YzYzY2UyYzg4ZTEwZmVmOWU2ZjZlY2E5MTdhMDhhZjc5NTMy
10
- MjFjOTA5MWE0NmE2ZDY1MWY5M2QyNjY0NDU4ZDI4MjAwYTI5YzU3OGU0ODY3
11
- MDFhNzJkMGZhMzVjMmQ4OWIzMDY4YTYxYjI3MjA1MmVkZTQ3ZjQ=
9
+ ZWE4YmVhYmJjZDFlNzc3N2UyNDg4MmJmNzU1NWQ5YWZiZDUzMjFlMDYyNzI4
10
+ MDViZDdkZjFlOTM1YWExOTIwNjUxNjQ5YzJmMGMyMjcwNmJiMDhjMGQ1OGVl
11
+ ZTE0N2NkMGFkMDM2MzNkNzExNjFiNDYzMThmYjM0MWZmZThkZWQ=
12
12
  data.tar.gz: !binary |-
13
- YTE4NmU2NWEwNDdlNzFlMzQ0ZTEyNjIxNTBkY2VhOTJkZDE5YTgyZTVlM2Y3
14
- Njc1MzM5M2E4MDE1NGJlMWIxMDYxYjE1YWU3MzhhNTZjNDk4N2RjZThhZGY4
15
- Y2Q0OWUxZWY1MTkwY2Q5NGE3NTZjYTRhYWU0NGU5NzRhYjdkZjQ=
13
+ ZGE1MTUwNThiYjNlZDAwYzQ4M2Y3OTk1ODg5YzgzZjhjZjhkODA5OTU1Njkx
14
+ YTQ5MmVkMThkOThlZWRkMDBjMTQ1ZGI5ZTU3ODhmZGExOTBiNTk4NDRiYzJk
15
+ M2VhYzdkNDIwZTc1MzQ3YzJkZjE4OTZkNThiNDBlNmE0ZDRmNTg=
data/CHANGES CHANGED
@@ -219,4 +219,8 @@
219
219
 
220
220
  == Version 1.8.3
221
221
 
222
- * Using Dsl builder
222
+ * Using Dsl builder
223
+
224
+ == Version 1.8.4
225
+
226
+ * Letting scenario outline read from hash
data/Rakefile CHANGED
@@ -45,3 +45,83 @@ end
45
45
  # system "mkdir -p $GEM_HOME/gems/debugger-ruby_core_source-1.2.3/lib"
46
46
  # system "cp -R ~/debugger-ruby_core_source/lib $GEM_HOME/gems/debugger-ruby_core_source-1.2.3"
47
47
  # end
48
+
49
+ task :steps_gen do
50
+ if ARGV.size < 2
51
+ puts "Usage: rake steps_gen <file_name.feature>"
52
+ else
53
+ ARGV.shift
54
+
55
+ file_name = ARGV.shift
56
+
57
+ StepsGenerator.instance.generate file_name
58
+ end
59
+ end
60
+
61
+ task :steps_diff do
62
+ if ARGV.size < 3
63
+ puts "Usage: rake steps_diff <file_name.feature> <file_name_spec.rb>"
64
+ else
65
+ ARGV.shift
66
+
67
+ file_name1 = ARGV.shift
68
+ file_name2 = ARGV.shift
69
+
70
+ # StepsGenerator.instance.generate file_name
71
+
72
+ phrases1 = []
73
+
74
+ keywords_exp1 = /^(Given|When|Then|And|But)/
75
+
76
+ File.open(file_name1).each_line do |line|
77
+ line = line.strip
78
+
79
+ if line !~ /^#/ and line =~ keywords_exp1
80
+ word = line.scan(keywords_exp1)[0][0]
81
+
82
+ phrases1 << line[word.size..-1].strip
83
+ end
84
+ end
85
+
86
+ phrases2 = []
87
+
88
+ keywords_exp2 = /step\s+('|")(.*)('|")/
89
+
90
+ File.open(file_name2).each_line do |line|
91
+ line = line.strip
92
+
93
+ if line !~ /^#/ and line =~ keywords_exp2
94
+ phrases2 << line.scan(keywords_exp2)[0][1]
95
+ end
96
+ end
97
+
98
+ phrases1.each_with_index do |phrase, index|
99
+ phrase1 = phrase.clone.gsub("\"", "'")
100
+ phrase2 = phrases2[index]
101
+
102
+ params = phrase2.gsub(/:\w+\S/).to_a
103
+
104
+ params.each do |param|
105
+ new_param = param.gsub(":", "")
106
+
107
+ phrase1.gsub!(%r{<#{new_param}>}, param)
108
+ end
109
+
110
+ # p phrase1
111
+ params.each do |param|
112
+ phrase1.gsub!(/(\w|\s)*/, param)
113
+ end
114
+ # p phrase1
115
+
116
+ if phrase1 != phrase2
117
+ puts "Fail:"
118
+ puts " {#{phrase}}"
119
+ puts " {#{phrases2[index]}}"
120
+ else
121
+ # puts "OK:"
122
+ # puts " {#{phrase}}"
123
+ # puts " {#{phrases2[index]}}"
124
+ end
125
+ end
126
+ end
127
+ end
@@ -43,7 +43,11 @@ class GherkinExt
43
43
 
44
44
  data = key.nil? ? values : values[key]
45
45
 
46
- new_source += build_data_section data
46
+ if data.size > 0
47
+ new_source += build_data_section data
48
+ else
49
+ new_source += line
50
+ end
47
51
  end
48
52
  else
49
53
  new_source += line
@@ -64,14 +68,28 @@ class GherkinExt
64
68
  encoded_text =~ /file\s?:/
65
69
  end
66
70
 
67
- def self.build_data_section values
71
+ def self.build_data_section rows, build_titles=true
68
72
  buffer = ""
69
73
 
70
- values.each do |row|
74
+ if build_titles and rows.first.kind_of?(Hash)
75
+ buffer += " |"
76
+
77
+ rows.first.each do |element|
78
+ buffer += " #{element[0]} |"
79
+ end
80
+
81
+ buffer += "\n"
82
+ end
83
+
84
+ rows.each do |row|
71
85
  buffer += " |"
72
86
 
73
87
  row.each do |element|
74
- buffer += " #{element} |"
88
+ if element.kind_of? Array
89
+ buffer += " #{element[1]} |"
90
+ else
91
+ buffer += " #{element} |"
92
+ end
75
93
  end
76
94
 
77
95
  buffer += "\n"
@@ -1,3 +1,3 @@
1
1
  class AcceptanceTest
2
- VERSION = "1.8.3"
2
+ VERSION = "1.8.4"
3
3
  end
@@ -3,4 +3,18 @@
3
3
  ["Capybara", "Hydrochoerus hydrochaeris", "1"],
4
4
  ["Wombat", "quadrupedal marsupials", "2"],
5
5
  ["Echidna", "Tachyglossidae", "3"]
6
- ]
6
+ ]
7
+
8
+ "test2":
9
+ -
10
+ keyword: "Capybara"
11
+ result: "Hydrochoerus hydrochaeris"
12
+ something_else: "1"
13
+ -
14
+ keyword: "Wombat"
15
+ result: "quadrupedal marsupials"
16
+ something_else: "2"
17
+ -
18
+ keyword: "Echidna"
19
+ result: "Tachyglossidae"
20
+ something_else: "3"
@@ -11,8 +11,8 @@ Feature: Using Wikipedia
11
11
  And I click submit button
12
12
  Then I should see "<result>"
13
13
 
14
- Examples:
15
- | keyword | result |
16
- | Capybara | Hydrochoerus hydrochaeris |
17
- | Wombat | quadrupedal marsupials |
18
- | Echidna | Tachyglossidae |
14
+ Examples:
15
+ | keyword | result |
16
+ | Capybara | Hydrochoerus hydrochaeris |
17
+ | Wombat | quadrupedal marsupials |
18
+ | Echidna | Tachyglossidae |
@@ -11,6 +11,6 @@ Feature: Using Wikipedia
11
11
  And I click submit button
12
12
  Then I should see "<result>"
13
13
 
14
- Examples:
15
- | keyword | result | something_else |
16
- | file:spec/data.csv || |
14
+ Examples:
15
+ | keyword | result | something_else |
16
+ | file:spec/data.csv || |
@@ -11,6 +11,6 @@ Feature: Using Wikipedia
11
11
  And I click submit button
12
12
  Then I should see "<result>"
13
13
 
14
- Examples:
15
- | keyword | result |something_else |
16
- | file:spec/data.yml, key:test1 || |
14
+ Examples:
15
+ | keyword | result |something_else |
16
+ | file:spec/data.yml, key:test1 || |
@@ -0,0 +1,15 @@
1
+ Feature: Using Wikipedia
2
+
3
+ Background: within wikipedia.com context
4
+ Given I am within wikipedia.com
5
+
6
+ @search_with_scenario_outline
7
+ Scenario Outline: Searching with selenium for a term with submit (external data)
8
+
9
+ Given I am on wikipedia.com
10
+ When I enter word <keyword>
11
+ And I click submit button
12
+ Then I should see "<result>"
13
+
14
+ Examples:
15
+ | file:spec/data.yml, key:test2 |
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acceptance_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shvets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-03 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gemspec_deps_gen
@@ -90,6 +90,7 @@ files:
90
90
  - spec/features/search_with_scenario_outline1.feature
91
91
  - spec/features/search_with_scenario_outline2.feature
92
92
  - spec/features/search_with_scenario_outline3.feature
93
+ - spec/features/search_with_scenario_outline4.feature
93
94
  - spec/features/search_with_table.feature
94
95
  - spec/support/pages/main_page.rb
95
96
  - spec/support/pages/wikipedia_pages.rb
@@ -141,6 +142,7 @@ test_files:
141
142
  - spec/features/search_with_scenario_outline1.feature
142
143
  - spec/features/search_with_scenario_outline2.feature
143
144
  - spec/features/search_with_scenario_outline3.feature
145
+ - spec/features/search_with_scenario_outline4.feature
144
146
  - spec/features/search_with_table.feature
145
147
  - spec/support/pages/main_page.rb
146
148
  - spec/support/pages/wikipedia_pages.rb