moto 0.0.15 → 0.0.17
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/lib/cli.rb +1 -10
- data/lib/clients/website.rb +44 -22
- data/lib/parser.rb +31 -15
- data/lib/version.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67513bc98ab3246d5619d69d560a15956f4d01f7
|
4
|
+
data.tar.gz: e062119f15ac74b5012c701525a0e2ff6c1463ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93f8ce00760e6ea9e2c37d7f873d5a1e2bc1fa6a4f9f316e365ba0584a98eeff49445822683fb2e9da608f22424e14a5818b732e075cefcea8a1ff0e6908b026
|
7
|
+
data.tar.gz: dad258914f1fd10fa21f30614621c9dc9ab2f552a87d420cf848ab33880765dbc52aac23412e674e20018d92baf3b1c6728853a7281bbaebf9acc6514c8aa4f7
|
data/lib/cli.rb
CHANGED
@@ -1,19 +1,9 @@
|
|
1
|
-
# TODO: fix this dumb verification of current working directory
|
2
|
-
unless File.exists? "#{Dir.pwd}/config/moto.rb"
|
3
|
-
puts 'Config file (config/moto.rb) not present.'
|
4
|
-
puts 'Does current working directory contain Moto application?'
|
5
|
-
exit 1
|
6
|
-
end
|
7
|
-
|
8
1
|
require 'logger'
|
9
2
|
require 'pp'
|
10
3
|
require 'yaml'
|
11
4
|
require 'active_support/inflector'
|
12
5
|
require 'active_support/core_ext/object/blank'
|
13
6
|
|
14
|
-
require 'bundler/setup'
|
15
|
-
Bundler.require
|
16
|
-
|
17
7
|
module MotoApp
|
18
8
|
DIR = Dir.pwd
|
19
9
|
end
|
@@ -32,6 +22,7 @@ require_relative './result'
|
|
32
22
|
require_relative './assert'
|
33
23
|
require_relative './test'
|
34
24
|
require_relative './page'
|
25
|
+
require_relative './version'
|
35
26
|
require_relative './clients/base'
|
36
27
|
require_relative './listeners/base'
|
37
28
|
require_relative './listeners/console'
|
data/lib/clients/website.rb
CHANGED
@@ -2,15 +2,19 @@ require 'capybara'
|
|
2
2
|
|
3
3
|
module Moto
|
4
4
|
module Clients
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
class Website < Moto::Clients::Base
|
7
7
|
|
8
8
|
attr_reader :session
|
9
|
-
|
9
|
+
|
10
10
|
ignore_logging(:page)
|
11
11
|
ignore_logging(:context)
|
12
12
|
ignore_logging(:session)
|
13
|
-
|
13
|
+
|
14
|
+
def init
|
15
|
+
register_grid_driver
|
16
|
+
end
|
17
|
+
|
14
18
|
def start_run
|
15
19
|
# TODO: make session driver configurable
|
16
20
|
context.runner.my_config[:capybara][:default_selector] &&
|
@@ -18,32 +22,50 @@ module Moto
|
|
18
22
|
@session = Capybara::Session.new(context.runner.my_config[:capybara][:default_driver])
|
19
23
|
@pages = {}
|
20
24
|
end
|
21
|
-
|
25
|
+
|
22
26
|
def end_run
|
23
|
-
@session.driver.
|
27
|
+
@session.driver.quit
|
24
28
|
end
|
25
|
-
|
29
|
+
|
26
30
|
def start_test(test)
|
27
31
|
# @context.current_test.logger.info("Hi mom, I'm opening some pages!")
|
28
32
|
@session.reset_session!
|
29
33
|
end
|
30
|
-
|
34
|
+
|
31
35
|
def end_test(test)
|
32
36
|
@session.reset_session!
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
end
|
38
|
+
|
39
|
+
def page(p)
|
40
|
+
page_class_name = "#{self.class.name}::Pages::#{p}"
|
41
|
+
page_class_name.gsub!('Moto::', 'MotoApp::')
|
42
|
+
if @pages[page_class_name].nil?
|
39
43
|
a = page_class_name.underscore.split('/')
|
40
|
-
page_path = a[1
|
41
|
-
require "#{MotoApp::DIR}/lib/#{page_path}"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
page_path = a[1..-1].join('/')
|
45
|
+
require "#{MotoApp::DIR}/lib/#{page_path}"
|
46
|
+
@pages[page_class_name] = page_class_name.constantize.new(self)
|
47
|
+
end
|
48
|
+
@pages[page_class_name]
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def register_grid_driver
|
54
|
+
grid_config = context.runner.my_config[:capybara][:grid]
|
55
|
+
return if grid_config.nil?
|
56
|
+
if grid_config[:capabilities].nil?
|
57
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
|
58
|
+
else
|
59
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.new(grid_config[:capabilities])
|
60
|
+
end
|
61
|
+
Capybara.register_driver :grid do |app|
|
62
|
+
Capybara::Selenium::Driver.new(app,
|
63
|
+
:browser => :remote,
|
64
|
+
:url => grid_config[:url],
|
65
|
+
:desired_capabilities => capabilities)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
48
70
|
end
|
49
71
|
end
|
data/lib/parser.rb
CHANGED
@@ -9,17 +9,32 @@ module Moto
|
|
9
9
|
class Parser
|
10
10
|
|
11
11
|
def self.run(argv)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
begin
|
13
|
+
# TODO Generate app / Change the way parsing options goes so it doesnt generate them if they`re not needed
|
14
|
+
case argv[0]
|
15
|
+
when '--version' then puts Moto::VERSION
|
16
|
+
when 'run' then Moto::Cli.run run_parse(argv)
|
17
|
+
when 'help' then show_help
|
18
|
+
when 'generate' then Moto::AppGenerator.run generate_parse(argv)
|
19
|
+
else puts "Command '#{argv[0]}' not recognized. Type help for list of supported commands."
|
20
|
+
end
|
21
|
+
rescue Exception => e
|
22
|
+
puts e.message
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
26
|
def self.run_parse(argv)
|
27
|
+
|
28
|
+
# TODO: fix this dumb verification of current working directory.
|
29
|
+
unless File.exists? "#{MotoApp::DIR}/config/moto.rb"
|
30
|
+
msg = "Config file (config/moto.rb) not present.\n"
|
31
|
+
msg << 'Does current working directory contain Moto application?'
|
32
|
+
raise msg
|
33
|
+
end
|
34
|
+
|
35
|
+
require 'bundler/setup'
|
36
|
+
Bundler.require
|
37
|
+
|
23
38
|
# Default options
|
24
39
|
options = {}
|
25
40
|
options[:reporters] = []
|
@@ -33,13 +48,13 @@ module Moto
|
|
33
48
|
# TODO const
|
34
49
|
# TODO reporters should be consts - not strings
|
35
50
|
OptionParser.new do |opts|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
51
|
+
opts.on('-t', '--tests Tests', Array) { |v| options[:tests ] = v }
|
52
|
+
opts.on('-g', '--tags Tags', Array) { |v| options[:tags ] = v }
|
53
|
+
opts.on('-r', '--reporters Reporters', Array) { |v| options[:reporters] = v }
|
54
|
+
opts.on('-e', '--environments Environment', Array) { |v| options[:environments] = v }
|
55
|
+
opts.on('-c', '--const Const') { |v| options[:const] = v }
|
56
|
+
opts.on('-n', '--name Name') { |v| options[:name] = v }
|
57
|
+
opts.on('-f', '--config Config') { |v| options[:config] = options[:config].merge( eval( v ) ) }
|
43
58
|
end.parse!
|
44
59
|
|
45
60
|
if options[:name].empty?
|
@@ -73,7 +88,8 @@ module Moto
|
|
73
88
|
|
74
89
|
def self.show_help
|
75
90
|
puts """
|
76
|
-
Moto CLI Help:
|
91
|
+
Moto (#{Moto::VERSION}) CLI Help:
|
92
|
+
moto --version Display current version
|
77
93
|
moto run:
|
78
94
|
-t, --tests = Tests to be executed. For e.x Tests\Failure\Failure.rb should be passed as Tests::Failure
|
79
95
|
-r, --reporter = Reporters to be used. Defaults are Moto::Listeners::ConsoleDots, Moto::Listeners::JunitXml
|
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartek Wilczek
|
8
8
|
- Maciej Stark
|
9
|
+
- Radosław Sporny
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2015-12-
|
13
|
+
date: 2015-12-31 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activesupport
|
@@ -74,6 +75,7 @@ description: This is a development version of a rails philosophy inspired framew
|
|
74
75
|
email:
|
75
76
|
- bwilczek@gmail.com
|
76
77
|
- stark.maciej@gmail.com
|
78
|
+
- r.sporny@gmail.com
|
77
79
|
executables:
|
78
80
|
- moto
|
79
81
|
extensions: []
|
@@ -93,6 +95,7 @@ files:
|
|
93
95
|
- lib/test_generator.rb
|
94
96
|
- lib/test_logging.rb
|
95
97
|
- lib/thread_context.rb
|
98
|
+
- lib/version.rb
|
96
99
|
- lib/clients/base.rb
|
97
100
|
- lib/clients/website.rb
|
98
101
|
- lib/exceptions/moto.rb
|