testgen 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ === Version 0.8.3
2
+ * Updated Mohawk's startup to match updates to gem
3
+ * Mohawk now takes screenshot when test fails
4
+
1
5
  === Version 0.8.2 / 2013-7-19
2
6
  * Changed gemfile to use https for rubygems.org
3
7
 
@@ -14,7 +14,7 @@ Feature: Generating a project with TestGen
14
14
  Then a file named "sample/Gemfile" should exist
15
15
  And the file "sample/Gemfile" should contain "gem 'cucumber'"
16
16
  And the file "sample/Gemfile" should contain "gem 'rspec'"
17
- And the file "sample/Gemfile" should contain "source 'http://rubygems.org'"
17
+ And the file "sample/Gemfile" should contain "source 'https://rubygems.org'"
18
18
 
19
19
 
20
20
  Scenario: Generating the Rakefile file
@@ -1,27 +1,39 @@
1
1
  Feature: Adding the --with-mohawk flag
2
2
 
3
- Scenario: Adding the childprocess and mohawk gems to Gemfile
3
+ Scenario: Adding the mohawk gems to Gemfile
4
4
  When I run `testgen project sample --with-mohawk`
5
5
  Then a file named "sample/Gemfile" should exist
6
- And the file "sample/Gemfile" should contain "gem 'childprocess'"
7
- And the file "sample/Gemfile" should contain "gem 'mohawk'"
6
+ And the file "sample/Gemfile" should contain "gem 'mohawk', '~> 0.0.5'"
7
+ And the file "sample/Gemfile" should contain "gem 'win32screenshot'"
8
8
  And the file "sample/Gemfile" should contain "gem 'rake'"
9
9
 
10
10
  Scenario: Adding mohawk to env.rb
11
11
  When I run `testgen project sample --with-mohawk`
12
12
  Then a file named "sample/features/support/env.rb" should exist
13
- And the file "sample/features/support/env.rb" should contain "require 'childprocess'"
14
13
  And the file "sample/features/support/env.rb" should contain "require 'mohawk'"
14
+ And the file "sample/features/support/env.rb" should contain "require 'win32screenshot'"
15
15
  And the file "sample/features/support/env.rb" should contain "World(Mohawk::Navigation)"
16
16
 
17
17
  Scenario: Creating the Driver and hooks
18
18
  When I run `testgen project sample --with-mohawk`
19
19
  Then a file named "sample/features/support/env.rb" should exist
20
- And the file "sample/features/support/env.rb" should contain "@process = ChildProcess.build(PATH_TO_EXECUTABLE)"
21
- And the file "sample/features/support/env.rb" should contain "@process.start"
22
- And the file "sample/features/support/env.rb" should contain "RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @process.pid).present?"
23
- And the file "sample/features/support/env.rb" should contain "@process.stop"
24
-
20
+ And the file "sample/features/support/env.rb" should contain "Mohawk.app_path = PATH_TO_EXECUTABLE"
21
+ And the file "sample/features/support/env.rb" should contain "Mohawk.start"
22
+ And the file "sample/features/support/env.rb" should contain:
23
+ """
24
+ def capture_screenshot(name)
25
+ Dir.mkdir('screenshots') unless Dir.exist? 'screenshots'
26
+ now = Time.now.to_s.gsub(/\W+/, '.')
27
+ Win32::Screenshot::Take.of(:desktop).write("screenshots/#{now}.#{name}.png")
28
+ end
29
+ """
30
+ And the file "sample/features/support/env.rb" should contain:
31
+ """
32
+ After do |scenario|
33
+ capture_screenshot(scenario.name.gsub(/\W+/,'_')) if scenario.failed?
34
+ Mohawk.stop
35
+ end
36
+ """
25
37
 
26
38
  Scenario: Should not create the hooks file
27
39
  When I run `testgen project sample --with-mohawk`
@@ -13,7 +13,7 @@ gem 'gametel'
13
13
  gem 'rake'
14
14
  <% end -%>
15
15
  <% if with_mohawk == 'true' -%>
16
- gem 'childprocess'
17
- gem 'mohawk'
16
+ gem 'mohawk', '~> 0.0.5'
17
+ gem 'win32screenshot'
18
18
  gem 'rake'
19
19
  <% end -%>
@@ -1,21 +1,18 @@
1
1
  <% if with_lib == 'true' -%>
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../../', 'lib'))
3
- <% end -%>
4
3
 
4
+ <% end -%>
5
5
  require 'rspec-expectations'
6
6
  <% unless pageobject_driver.downcase == 'none' -%>
7
7
  require 'page-object'
8
8
  <% end -%>
9
-
10
9
  <% if with_gametel == 'true' -%>
11
10
  require 'gametel'
12
11
  <% end -%>
13
-
14
12
  <% if with_mohawk == 'true' -%>
15
- require 'childprocess'
16
13
  require 'mohawk'
14
+ require 'win32screenshot'
17
15
  <% end -%>
18
-
19
16
  <% if with_lib == 'true' -%>
20
17
  require 'require_all'
21
18
 
@@ -43,21 +40,25 @@ After do
43
40
  Gametel.stop
44
41
  end
45
42
  <% end -%>
46
-
47
43
  <% unless pageobject_driver.downcase == 'none' -%>
48
44
  World(PageObject::PageFactory)
49
45
  <% end -%>
50
-
51
46
  <% if with_mohawk == 'true' -%>
52
47
  World(Mohawk::Navigation)
48
+ Mohawk.app_path = PATH_TO_EXECUTABLE
49
+
50
+ def capture_screenshot(name)
51
+ Dir.mkdir('screenshots') unless Dir.exist? 'screenshots'
52
+ now = Time.now.to_s.gsub(/\W+/, '.')
53
+ Win32::Screenshot::Take.of(:desktop).write("screenshots/#{now}.#{name}.png")
54
+ end
53
55
 
54
56
  Before do
55
- @process = ChildProcess.build(PATH_TO_EXECUTABLE)
56
- @process.start
57
- RAutomation::WaitHelper.wait_until {RAutomation::Window.new(:pid => @process.pid).present?}
57
+ Mohawk.start
58
58
  end
59
59
 
60
- After do
61
- @process.stop
60
+ After do |scenario|
61
+ capture_screenshot(scenario.name.gsub(/\W+/,'_')) if scenario.failed?
62
+ Mohawk.stop
62
63
  end
63
64
  <% end -%>
@@ -1,3 +1,3 @@
1
1
  module TestGen
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.3"
3
3
  end
@@ -5,6 +5,7 @@ require "testgen/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "testgen"
7
7
  s.version = TestGen::VERSION
8
+ s.license = 'MIT'
8
9
  s.authors = ["Jeffrey S. Morgan"]
9
10
  s.email = ["jeff.morgan@leandog.com"]
10
11
  s.homepage = "http://github.com/cheezy/testgen"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testgen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -115,7 +115,7 @@ files:
115
115
  - features/testgen_with_pageobject.feature
116
116
  - features/with_gametel_option.feature
117
117
  - features/with_lib_option.feature
118
- - features/with_mojawk_option.feature
118
+ - features/with_mohawk_option.feature
119
119
  - lib/testgen.rb
120
120
  - lib/testgen/cli.rb
121
121
  - lib/testgen/generators/project.rb
@@ -127,7 +127,8 @@ files:
127
127
  - lib/testgen/version.rb
128
128
  - testgen.gemspec
129
129
  homepage: http://github.com/cheezy/testgen
130
- licenses: []
130
+ licenses:
131
+ - MIT
131
132
  post_install_message:
132
133
  rdoc_options: []
133
134
  require_paths:
@@ -140,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  segments:
142
143
  - 0
143
- hash: 1977532532319330855
144
+ hash: -4210127392086382656
144
145
  required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  none: false
146
147
  requirements:
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  version: '0'
150
151
  segments:
151
152
  - 0
152
- hash: 1977532532319330855
153
+ hash: -4210127392086382656
153
154
  requirements: []
154
155
  rubyforge_project: testgen
155
156
  rubygems_version: 1.8.25
@@ -163,4 +164,4 @@ test_files:
163
164
  - features/testgen_with_pageobject.feature
164
165
  - features/with_gametel_option.feature
165
166
  - features/with_lib_option.feature
166
- - features/with_mojawk_option.feature
167
+ - features/with_mohawk_option.feature