lucid-gen 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20336f2ad83d1cbfbff0be3566ccaf63cb6a2592
4
- data.tar.gz: dca848a7d5e33a48194d3bd5eada3bc79f01b916
3
+ metadata.gz: 73b13b40501b043be9137f2dfe095fea33de5e40
4
+ data.tar.gz: 1bd98b95b0dd15bc1da558537a74568551722562
5
5
  SHA512:
6
- metadata.gz: dac03e822416abb38976155d965a7ee54e79d81368953b39728d4526fbece34ea003b3f7e2140086bbd1b84636ca85b813012c0df15d5c0b4d3ee65c6916dccd
7
- data.tar.gz: 47c6eb5b5ed28fd4f00b555a9860c8624a6df63c7d938954a703c8dcc23fc4eeb02465a358684261f9ccd2ef6283590949181c611019aca00d605f945ff54920
6
+ metadata.gz: 2dbf6d5d9a46c10e4f5366e5b2bbb26399fd8c0dd3c1df644f322cfa756059c81303562c10a7873de0c44948a84cc22eb38aecf09658edaaf9ada84dc55fb20f
7
+ data.tar.gz: 055d3805bb1ecd340bb36291ea3047cd6ae165a3c1fb5905c5caf2846526f76be381ff86ffb30d6d985ec4346690e1c86ce4c04c07c10dbe21ee8944a3638400
data/README.md CHANGED
@@ -10,17 +10,17 @@ Install the gem as normal:
10
10
 
11
11
  ## Usage
12
12
 
13
- The easiest way to use Venom would be to have it generate the default structure for you:
13
+ The easiest way to use LucidGen would be to have it generate the default structure for you:
14
14
 
15
15
  $ lucid-gen project project-spec
16
16
 
17
17
  This command will create a project structure with the directory name as project-spec.
18
18
 
19
- The default driver for the projects created is [Fluent](https://github.com/jnyman/fluent). You can change this by specifying a driver
19
+ The default driver for the projects created is [Symbiont](https://github.com/jnyman/symbiont). You can change this by specifying a driver as such:
20
20
 
21
21
  $ lucid-gen project project-spec --driver=capybara
22
22
 
23
- Do note that, for the moment, LucidGen only generates driver files relevant to Fluent.
23
+ Do note that, for the moment, LucidGen only generates driver files relevant to Symbiont.
24
24
 
25
25
  ## Contributing
26
26
 
@@ -5,11 +5,11 @@ module LucidGen
5
5
  class Generator < Thor
6
6
  desc 'project NAME', 'Create a new project.'
7
7
 
8
- method_option :driver, aliases: '-d', type: :string, required: false, desc: "Framework driver to use. (Default value is 'fluent'.)"
8
+ method_option :driver, aliases: '-d', type: :string, required: false, desc: "Framework driver to use. (Default value is 'symbiont'.)"
9
9
 
10
10
  def project(name)
11
11
  puts "Name of project: #{name}"
12
- driver = options[:driver].nil? ? 'fluent' : options[:driver]
12
+ driver = options[:driver].nil? ? 'symbiont' : options[:driver]
13
13
  LucidGen::Generators::Project.start([name, driver])
14
14
  end
15
15
  end
@@ -38,8 +38,8 @@ module LucidGen
38
38
  end
39
39
 
40
40
  def copy_driver
41
- if driver.downcase == 'fluent'
42
- copy_file 'driver-fluent.rb', "#{name}/common/support/driver.rb"
41
+ if driver.downcase == 'symbiont'
42
+ copy_file 'driver-symbiont.rb', "#{name}/common/support/driver.rb"
43
43
  end
44
44
  end
45
45
 
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'lucid'
4
- <% if driver.downcase == 'fluent' -%>gem 'fluent'<% end -%>
4
+ <% if driver.downcase == 'symbiont' -%>gem 'symbiont'<% end -%>
5
5
  gem 'syntax'
@@ -0,0 +1,114 @@
1
+ begin
2
+ require 'symbiont'
3
+ rescue LoadError
4
+ STDOUT.puts ['The Symbiont test execution library is not installed.',
5
+ 'The driver file is currently set to use the Symbiont library but',
6
+ 'that gem was not found. Run the following command:', '',
7
+ ' gem install symbiont'].join("\n")
8
+ Kernel.exit(1)
9
+ end
10
+
11
+ Domain(Symbiont::Factory)
12
+
13
+ if ENV['BROWSER']
14
+ case ENV['BROWSER']
15
+ when 'firefox', 'ff', 'ie', 'chrome'
16
+ target = ENV['BROWSER'].to_sym
17
+ else
18
+ puts "The browser #{ENV['BROWSER']} is not supported."
19
+ puts ""
20
+ puts "Supported browsers are:"
21
+ puts " firefox, ie, chrome"
22
+ Kernel.exit(1)
23
+ end
24
+ end
25
+
26
+ module Symbiont
27
+ module Browser
28
+
29
+ @@browser = false
30
+
31
+ def self.start
32
+ unless @@browser
33
+ target = (ENV['BROWSER'] || 'firefox').to_sym
34
+ @@browser = watir_browser(target) if ENV['DRIVER'] == 'watir' or !ENV['DRIVER']
35
+ end
36
+ @@browser
37
+ end
38
+
39
+ def self.stop
40
+ @@browser.quit if @@browser
41
+ @@browser = false
42
+ end
43
+
44
+ private
45
+
46
+ def self.watir_browser(target)
47
+ if ENV['HEADLESS']
48
+ @driver = Watir::Browser.new :phantomjs
49
+ else
50
+ Watir::Browser.new(target, :http_client => client)
51
+ end
52
+ end
53
+
54
+ def self.client
55
+ Selenium::WebDriver::Remote::Http::Default.new
56
+ end
57
+ end
58
+ end
59
+
60
+ AfterConfiguration do |config|
61
+ puts("Specs are being executed from: #{config.spec_location}")
62
+ end
63
+
64
+ Before('~@manual','~@practice','~@sequence') do
65
+ @driver = Symbiont::Browser.start
66
+ end
67
+
68
+ AfterStep('@pause') do
69
+ print 'Press ENTER to continue...'
70
+ STDIN.getc
71
+ end
72
+
73
+ AfterStep do
74
+ if ENV['LATENCY']
75
+ sleep 2
76
+ end
77
+ end
78
+
79
+ After do |scenario|
80
+ Dir::mkdir('results') if not File.directory?('results')
81
+
82
+ def screenshot_name(type, name)
83
+ screenshot = "./results/#{type}_#{name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png"
84
+
85
+ if @driver
86
+ encoded_img = @driver.driver.screenshot_as(:base64)
87
+ embed("data:image/png;base64,#{encoded_img}", 'image/png')
88
+
89
+ return screenshot
90
+ end
91
+ end
92
+
93
+ if scenario.failed?
94
+ screenshot = screenshot_name('FAILED', scenario.name)
95
+ end
96
+
97
+ if ENV['SCREENS']
98
+ if scenario.passed?
99
+ screenshot = screenshot_name('PASSED', scenario.name)
100
+ end
101
+ end
102
+
103
+ Symbiont::Browser.stop
104
+ end
105
+
106
+ After do |scenario|
107
+ if ENV['QUICKFAIL']
108
+ Lucid.wants_to_quit = true if scenario.failed?
109
+ end
110
+ end
111
+
112
+ at_exit do
113
+ Symbiont::Browser.stop
114
+ end
@@ -1,3 +1,3 @@
1
1
  module LucidGen
2
- VERSION = '1.0.0'
2
+ VERSION = '2.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-15 00:00:00.000000000 Z
11
+ date: 2014-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,7 @@ files:
73
73
  - lib/lucid-gen/generator.rb
74
74
  - lib/lucid-gen/generators/project.rb
75
75
  - lib/lucid-gen/generators/project/Gemfile.tt
76
- - lib/lucid-gen/generators/project/driver-fluent.rb
76
+ - lib/lucid-gen/generators/project/driver-symbiont.rb
77
77
  - lib/lucid-gen/generators/project/errors.rb
78
78
  - lib/lucid-gen/version.rb
79
79
  - lucid-gen.gemspec
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 2.1.11
100
+ rubygems_version: 2.2.2
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: Lucid Test Repository Project Generator
@@ -1,85 +0,0 @@
1
- begin
2
- require 'fluent'
3
- rescue LoadError
4
- STDOUT.puts ['The Fluent test execution library is not installed.',
5
- 'The driver file is currently set to use the Fluent library but',
6
- 'that gem was not found. Run the following command:', '',
7
- ' gem install fluent'].join("\n")
8
- Kernel.exit(1)
9
- end
10
-
11
- Domain(Fluent::Factory)
12
-
13
- module Fluent
14
- module Browser
15
-
16
- @@browser = false
17
-
18
- class Selenium::WebDriver::IE::Server
19
- old_server_args = instance_method(:server_args)
20
- define_method(:server_args) do
21
- old_server_args.bind(self).() << "--silent"
22
- end
23
- end
24
-
25
- class Selenium::WebDriver::Chrome::Service
26
- old_initialize = instance_method(:initialize)
27
- define_method(:initialize) do |executable_path, port, *extra_args|
28
- old_initialize.bind(self).call(executable_path, port, '--silent', *extra_args)
29
- end
30
- end
31
-
32
- def self.start
33
- unless @@browser
34
- target = ENV['BROWSER'] || 'firefox'
35
- @@browser = watir_browser(target)
36
- end
37
- @@browser
38
- end
39
-
40
- def self.stop
41
- @@browser.quit if @@browser
42
- @@browser = false
43
- end
44
-
45
- private
46
-
47
- def self.watir_browser(target)
48
- Watir::Browser.new(target.to_sym)
49
- end
50
- end
51
- end
52
-
53
- AfterConfiguration do |config|
54
- puts("Specs are being executed from: #{config.spec_location}")
55
- end
56
-
57
- Before('~@practice','~@sequence') do
58
- @browser = Fluent::Browser.start
59
- end
60
-
61
- AfterStep('@pause') do
62
- print 'Press ENTER to continue...'
63
- STDIN.getc
64
- end
65
-
66
- After do |scenario|
67
- if scenario.failed?
68
- Dir::mkdir('results') if not File.directory?('results')
69
- screenshot = "./results/FAILED_#{scenario.name.gsub(' ','_').gsub(/[^0-9A-Za-z_]/, '')}.png"
70
-
71
- if @browser
72
- # This way attempts to save the screenshot as a file.
73
- #@browser.driver.save_screenshot(screenshot)
74
-
75
- # This way the image is encoded into the results.
76
- encoded_img = @browser.driver.screenshot_as(:base64)
77
- embed("data:image/png;base64,#{encoded_img}", 'image/png')
78
- end
79
- end
80
- Fluent::Browser.stop
81
- end
82
-
83
- at_exit do
84
- Fluent::Browser.stop
85
- end