inferno_core 0.4.9 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inferno/apps/cli/main.rb +15 -2
- data/lib/inferno/apps/web/controllers/test_runs/results/index.rb +1 -1
- data/lib/inferno/apps/web/controllers/test_sessions/client_show.rb +40 -0
- data/lib/inferno/apps/web/router.rb +4 -2
- data/lib/inferno/dsl/assertions.rb +6 -3
- data/lib/inferno/entities/test_session.rb +1 -1
- data/lib/inferno/public/bundle.js +15 -15
- data/lib/inferno/public/bundle.js.LICENSE.txt +33 -0
- data/lib/inferno/repositories/test_sessions.rb +2 -1
- data/lib/inferno/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '092fb0b6d99b9d5939bf03a48401991cc996f738600b99bc835f6cfee2327b48'
|
4
|
+
data.tar.gz: '09859d9dd31a88291194966bf7fe7d12aa3a7234dc0c6f3e3b7d3d75abd629fa'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa369e2243382e66c256acd24dbb31a524f1dc8ae7369dfbbe2055400efd0bf013775277c576ad981a436903c67e5efa6b7f91b8b8e3c2322d830b0f827b686e
|
7
|
+
data.tar.gz: 061f2d85cb388b77199ffb06491627f0337e2792aa7b7ffd44cadaf9eec52836cf07a4feb9734511bbb25cafa886c0a6548d17dd5635ad0dba6780fc8fb9fb0d
|
@@ -18,12 +18,25 @@ module Inferno
|
|
18
18
|
end
|
19
19
|
|
20
20
|
desc 'start', 'Start Inferno'
|
21
|
+
option :watch,
|
22
|
+
default: false,
|
23
|
+
type: :boolean,
|
24
|
+
desc: 'Automatically restart Inferno when a file is changed.'
|
21
25
|
def start
|
26
|
+
command = 'foreman start --env=/dev/null'
|
22
27
|
if `gem list -i foreman`.chomp == 'false'
|
23
|
-
puts "You must install foreman with 'gem install foreman' prior to running
|
28
|
+
puts "You must install foreman with 'gem install foreman' prior to running Inferno."
|
24
29
|
end
|
25
30
|
|
26
|
-
|
31
|
+
if options[:watch]
|
32
|
+
if `gem list -i rerun`.chomp == 'false'
|
33
|
+
puts "You must install 'rerun' with 'gem install rerun' to restart on file changes."
|
34
|
+
end
|
35
|
+
|
36
|
+
command = "rerun \"#{command}\" --background"
|
37
|
+
end
|
38
|
+
|
39
|
+
system command
|
27
40
|
end
|
28
41
|
|
29
42
|
desc 'suites', 'List available test suites'
|
@@ -7,7 +7,7 @@ module Inferno
|
|
7
7
|
include Import[test_runs_repo: 'inferno.repositories.test_runs']
|
8
8
|
|
9
9
|
def handle(req, res)
|
10
|
-
results = test_runs_repo.results_for_test_run(req.params[:
|
10
|
+
results = test_runs_repo.results_for_test_run(req.params[:id])
|
11
11
|
res.body = serialize(results)
|
12
12
|
end
|
13
13
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Inferno
|
2
|
+
module Web
|
3
|
+
module Controllers
|
4
|
+
module TestSessions
|
5
|
+
class ClientShow < Controller
|
6
|
+
config.default_response_format = :html
|
7
|
+
|
8
|
+
CLIENT_PAGE =
|
9
|
+
ERB.new(
|
10
|
+
File.read(
|
11
|
+
File.join(
|
12
|
+
Inferno::Application.root, 'lib', 'inferno', 'apps', 'web', 'index.html.erb'
|
13
|
+
)
|
14
|
+
)
|
15
|
+
).result.freeze
|
16
|
+
|
17
|
+
def handle(req, res)
|
18
|
+
test_session_id = req.params[:id]
|
19
|
+
test_suite_id = req.params[:test_suite_id]
|
20
|
+
|
21
|
+
test_session = repo.find(test_session_id)
|
22
|
+
halt 404 if test_session.nil?
|
23
|
+
|
24
|
+
if test_suite_id.blank? || test_suite_id != test_session.test_suite_id
|
25
|
+
test_suite_id = test_session.test_suite_id
|
26
|
+
|
27
|
+
res.redirect_to "#{Inferno::Application['base_url']}/#{test_suite_id}/#{test_session_id}"
|
28
|
+
end
|
29
|
+
|
30
|
+
test_suite = Inferno::Repositories::TestSuites.new.find(test_suite_id)
|
31
|
+
|
32
|
+
halt 404 if test_suite.nil?
|
33
|
+
|
34
|
+
res.body = CLIENT_PAGE
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -16,7 +16,7 @@ module Inferno
|
|
16
16
|
get '/:id', to: Inferno::Web::Controllers::TestRuns::Show, as: :show
|
17
17
|
delete '/:id', to: Inferno::Web::Controllers::TestRuns::Destroy, as: :destroy
|
18
18
|
|
19
|
-
get '/results', to: Inferno::Web::Controllers::TestRuns::Results::Index, as: :results
|
19
|
+
get ':id/results', to: Inferno::Web::Controllers::TestRuns::Results::Index, as: :results
|
20
20
|
end
|
21
21
|
|
22
22
|
scope 'test_sessions' do
|
@@ -53,7 +53,6 @@ module Inferno
|
|
53
53
|
# Should not need Content-Type header but GitHub Codespaces will not work without them.
|
54
54
|
# This could be investigated and likely removed if addressed properly elsewhere.
|
55
55
|
get '/', to: ->(_env) { [200, { 'Content-Type' => 'text/html' }, [client_page]] }
|
56
|
-
get '/test_sessions/:id', to: ->(_env) { [200, { 'Content-Type' => 'text/html' }, [client_page]] }
|
57
56
|
|
58
57
|
Inferno.routes.each do |route|
|
59
58
|
cleaned_id = route[:suite].id.gsub(/[^a-zA-Z\d\-._~]/, '_')
|
@@ -70,6 +69,9 @@ module Inferno
|
|
70
69
|
Application['logger'].info("Registering suite route: #{suite_path}")
|
71
70
|
get suite_path, to: ->(_env) { [200, {}, [client_page]] }
|
72
71
|
end
|
72
|
+
|
73
|
+
get '/test_sessions/:id', to: Inferno::Web::Controllers::TestSessions::ClientShow, as: :client_session_show
|
74
|
+
get '/:test_suite_id/:id', to: Inferno::Web::Controllers::TestSessions::ClientShow, as: :client_suite_session_show
|
73
75
|
end
|
74
76
|
|
75
77
|
Router = # rubocop:disable Naming/ConstantName
|
@@ -22,13 +22,15 @@ module Inferno
|
|
22
22
|
"Unexpected response status: expected #{Array.wrap(expected).join(', ')}, but received #{received}"
|
23
23
|
end
|
24
24
|
|
25
|
-
# Check
|
25
|
+
# Check a response's status
|
26
26
|
#
|
27
27
|
# @param status [Integer, Array<Integer>] a single integer or an array of
|
28
28
|
# integer status codes
|
29
|
+
# @param request [Inferno::Entities::Request]
|
29
30
|
# @param response [Hash]
|
30
31
|
# @return [void]
|
31
|
-
def assert_response_status(status,
|
32
|
+
def assert_response_status(status, request: self.request, response: nil)
|
33
|
+
response ||= request&.response
|
32
34
|
assert Array.wrap(status).include?(response[:status]), bad_response_status_message(status, response[:status])
|
33
35
|
end
|
34
36
|
|
@@ -171,7 +173,8 @@ module Inferno
|
|
171
173
|
assert uri =~ /\A#{URI::DEFAULT_PARSER.make_regexp(['http', 'https'])}\z/, error_message
|
172
174
|
end
|
173
175
|
|
174
|
-
# Check the Content-Type header of a response
|
176
|
+
# Check the Content-Type header of a response. This assertion will fail if
|
177
|
+
# the response's content type does not begin with the provided type.
|
175
178
|
#
|
176
179
|
# @param type [String]
|
177
180
|
# @param request [Inferno::Entities::Request]
|
@@ -40,7 +40,7 @@ module Inferno
|
|
40
40
|
|
41
41
|
self.suite_options ||= []
|
42
42
|
|
43
|
-
test_suite
|
43
|
+
test_suite&.suite_options&.each do |option|
|
44
44
|
if suite_options.none? { |selected_option| selected_option.id == option.id }
|
45
45
|
suite_options << DSL::SuiteOption.new(id: option.id, value: option.list_options.first[:value])
|
46
46
|
end
|