kaya 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/CHANGELOG +52 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/NOTAS +19 -0
  7. data/README.md +279 -0
  8. data/Rakefile +1 -0
  9. data/bin/kaya +4 -0
  10. data/documentation/api.md +47 -0
  11. data/documentation/api_execution_data.md +47 -0
  12. data/documentation/configuration.md +13 -0
  13. data/documentation/custom_parameters.md +117 -0
  14. data/documentation/document_kaya.md +122 -0
  15. data/documentation/link.md +12 -0
  16. data/documentation/results.md +119 -0
  17. data/documentation/start.md +19 -0
  18. data/documentation/suites.md +60 -0
  19. data/documentation/test_suite_information.md +9 -0
  20. data/kaya.gemspec +42 -0
  21. data/lib/generators/task_rack.rb +160 -0
  22. data/lib/generators/templates/Gemfile.tt +2 -0
  23. data/lib/generators/templates/config.ru.tt +2 -0
  24. data/lib/generators/templates/kaya_conf.tt +49 -0
  25. data/lib/generators/templates/kaya_log.tt +0 -0
  26. data/lib/generators/templates/sidekiq_log.tt +0 -0
  27. data/lib/generators/templates/tasks.kaya.tt +10 -0
  28. data/lib/generators/templates/unicorn.rb.tt +21 -0
  29. data/lib/kaya/API/error.rb +17 -0
  30. data/lib/kaya/API/execution.rb +141 -0
  31. data/lib/kaya/API/result.rb +49 -0
  32. data/lib/kaya/API/results.rb +31 -0
  33. data/lib/kaya/API/suite.rb +42 -0
  34. data/lib/kaya/API/suites.rb +36 -0
  35. data/lib/kaya/background_jobs/sidekiq.rb +35 -0
  36. data/lib/kaya/background_jobs/workers/execution_checker.rb +20 -0
  37. data/lib/kaya/background_jobs/workers/garbage_cleaner.rb +31 -0
  38. data/lib/kaya/commands/bye.rb +12 -0
  39. data/lib/kaya/commands/help.rb +13 -0
  40. data/lib/kaya/commands/install.rb +27 -0
  41. data/lib/kaya/commands/reset.rb +39 -0
  42. data/lib/kaya/commands/reset_suites.rb +40 -0
  43. data/lib/kaya/commands/restart.rb +9 -0
  44. data/lib/kaya/commands/start.rb +104 -0
  45. data/lib/kaya/commands/stop.rb +53 -0
  46. data/lib/kaya/cuba.rb +287 -0
  47. data/lib/kaya/cucumber/features.rb +15 -0
  48. data/lib/kaya/cucumber/task.rb +64 -0
  49. data/lib/kaya/custom/execution_data.rb +50 -0
  50. data/lib/kaya/custom/params.rb +34 -0
  51. data/lib/kaya/database/mongo_connector.rb +285 -0
  52. data/lib/kaya/error/errors.rb +55 -0
  53. data/lib/kaya/execution.rb +57 -0
  54. data/lib/kaya/results/result.rb +493 -0
  55. data/lib/kaya/results/results.rb +47 -0
  56. data/lib/kaya/suites/custom/params.rb +151 -0
  57. data/lib/kaya/suites/suite.rb +177 -0
  58. data/lib/kaya/suites/suites.rb +130 -0
  59. data/lib/kaya/support/clean.rb +12 -0
  60. data/lib/kaya/support/configuration.rb +254 -0
  61. data/lib/kaya/support/console.rb +11 -0
  62. data/lib/kaya/support/documentation.rb +34 -0
  63. data/lib/kaya/support/error_handler_helper.rb +24 -0
  64. data/lib/kaya/support/files_cleanner.rb +136 -0
  65. data/lib/kaya/support/git.rb +161 -0
  66. data/lib/kaya/support/if_config.rb +14 -0
  67. data/lib/kaya/support/logo.rb +23 -0
  68. data/lib/kaya/support/logs.rb +37 -0
  69. data/lib/kaya/support/notification.rb +127 -0
  70. data/lib/kaya/support/processes.rb +96 -0
  71. data/lib/kaya/support/query_string.rb +22 -0
  72. data/lib/kaya/support/request.rb +32 -0
  73. data/lib/kaya/support/risk.rb +9 -0
  74. data/lib/kaya/support/time_helper.rb +11 -0
  75. data/lib/kaya/support/update.rb +65 -0
  76. data/lib/kaya/version.rb +3 -0
  77. data/lib/kaya/view/body.mote +60 -0
  78. data/lib/kaya/view/custom/params/select_list.mote +14 -0
  79. data/lib/kaya/view/custom/params/text.mote +9 -0
  80. data/lib/kaya/view/custom/params.mote +9 -0
  81. data/lib/kaya/view/error_handler.mote +40 -0
  82. data/lib/kaya/view/features/feature.mote +14 -0
  83. data/lib/kaya/view/features/features_list.mote +10 -0
  84. data/lib/kaya/view/features.mote +57 -0
  85. data/lib/kaya/view/footer.mote +10 -0
  86. data/lib/kaya/view/git_information.mote +21 -0
  87. data/lib/kaya/view/help/main.mote +21 -0
  88. data/lib/kaya/view/help/page.mote +2 -0
  89. data/lib/kaya/view/help/search_result.mote +29 -0
  90. data/lib/kaya/view/help.mote +72 -0
  91. data/lib/kaya/view/javascript.mote +96 -0
  92. data/lib/kaya/view/logs/log.mote +3 -0
  93. data/lib/kaya/view/modals.mote +31 -0
  94. data/lib/kaya/view/navigation_bar.mote +48 -0
  95. data/lib/kaya/view/not_found.mote +40 -0
  96. data/lib/kaya/view/parser.rb +79 -0
  97. data/lib/kaya/view/results/all.mote +59 -0
  98. data/lib/kaya/view/results/console.mote +106 -0
  99. data/lib/kaya/view/results/detailed_info.mote +112 -0
  100. data/lib/kaya/view/results/report.mote +1 -0
  101. data/lib/kaya/view/results/result.mote +23 -0
  102. data/lib/kaya/view/results/results.mote +52 -0
  103. data/lib/kaya/view/screenshot.mote +42 -0
  104. data/lib/kaya/view/sections.rb +25 -0
  105. data/lib/kaya/view/styles.mote +58 -0
  106. data/lib/kaya/view/suites/suite.mote +73 -0
  107. data/lib/kaya/view/suites/suites.mote +9 -0
  108. data/lib/kaya/view/view.rb +72 -0
  109. data/lib/kaya.rb +175 -0
  110. data/test/features/install.feature +18 -0
  111. data/test/features/support/env.rb +3 -0
  112. metadata +395 -0
@@ -0,0 +1,40 @@
1
+ % javascript = Mote.parse(File.read("#{Kaya::View.path}/javascript.mote"), self, []).call()
2
+
3
+ % styles = Mote.parse(File.read("#{Kaya::View.path}/styles.mote"), self, []).call()
4
+
5
+ % navigation_bar = Mote.parse(File.read("#{Kaya::View.path}/navigation_bar.mote"), self, [:section]).call(section:"help")
6
+
7
+
8
+ error_title = error_msg = Kaya::Support::ErrorHandlerHelper.evaluate exception
9
+
10
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
11
+ <html xmlns ="http://www.w3.org/1999/xhtml">
12
+
13
+ <head>
14
+ <title>{{Kaya::Support::Configuration.project_name}} through Kaya - Error</title>
15
+
16
+ <meta content='text/html;charset=utf-8' http-equiv='Content-Type'/>
17
+ <meta name='viewport' content='width=device-width, initial-scale=1.0'>
18
+ <link rel='shortcut icon' href='/favicon'>
19
+ <link href='https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css' rel='stylesheet'>
20
+
21
+ {{javascript}}
22
+
23
+ {{styles}}
24
+
25
+ </head>
26
+ <body class='padding-top: 50px;'>
27
+
28
+ {{navigation_bar}}
29
+
30
+ <div class='container'>
31
+ <br>
32
+ <div class='starter-template'>
33
+ <div class='panel-body' style='align=center;'>
34
+ <span style='font-size:35px; alignment=center'>404</span><br>
35
+ <span style='font-size:35px;alignment=center'><small>Page Not Found</small></span>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ </body>
40
+ </html>
@@ -0,0 +1,79 @@
1
+ module Kaya
2
+ module View
3
+ class Parser
4
+
5
+ # Parses cucumber report html doc
6
+ # Divides in each parts of document
7
+ # @param [String] source = the html code
8
+ # @param [Kaya::Result] the result object
9
+ def self.adapt_to_kaya(source, result)
10
+ source.gsub! 'Collapse All</p></div></div></div>',"
11
+ Collapse All</p></div></div></div>
12
+ <div>#{kaya_info(result)}</div>"
13
+ # end
14
+ source.inspect
15
+ end
16
+
17
+ # This is the information added to html report
18
+ # @param [Kaya::Results::Result] result object
19
+ # @return [String] the html to be added
20
+ def self.kaya_info(result)
21
+ info = "<h2><strong>Suite:</strong> #{result.suite_name}</h2>"
22
+ info += "<h4>Execution name: #{result.execution_name.gsub('-_-',' ')}</h4>" unless result.execution_name.empty?
23
+ info += "<h4>Command: #{result.command}</h4>"
24
+ info += "<h4>Custom Params: #{result.custom_params_values.split('=').last}</h4>"
25
+ info += "<h4>Started: #{result.started_at_formatted}</h4>"
26
+ info += "<h4>Commit ID: #{result.git_log.split('\n').first}</h4>"
27
+ info += "<h4><input type='button' onclick='window.close();' value='Close this window' />"
28
+ end
29
+
30
+ def self.extract_summary source
31
+ if no_scenario_but_green?(source) # 0 scenarios executed
32
+ get_elapsed_time_for_zero(source)
33
+ elsif has_scenarios_executed?(source) # scenarios executed > 0
34
+ get_scenarios_summary(source)
35
+ else
36
+ "running"
37
+ end
38
+ end
39
+
40
+ # Returns the status present on html cucumber report
41
+ # @param [String] the entire report html code
42
+ # @reurn [String] the text of status
43
+ def self.get_status(source)
44
+ source.scan(/\d\sscenarios?\s\(\d+\s(\w+)/i).flatten.first if finished_statement?(source)
45
+ end
46
+
47
+ # Checks if report says that execution is finised
48
+ # @param [String] source = the entire report html code
49
+ # @return [Boolean] true if report says finished
50
+ def self.finished_statement? source
51
+ !(source =~ /Finished in .*s seconds/).nil?
52
+ end
53
+
54
+ # Checks if result report is about no scenarios executed (scenarios not found)
55
+ # @param [String] the entire report html source code
56
+ # @return [Boolean] true if is finished (green) and no scenarios executed (It means that is empty. No scenarios executed)
57
+ def self.no_scenario_but_green?(source)
58
+ source.include? '0m0.000s seconds'
59
+ end
60
+
61
+ # Checks if has scenario results summary
62
+ # @param [String] the entire report html source code
63
+ # @return [Boolean] true if there is scenarios executed
64
+ def self.has_scenarios_executed? source
65
+ (source.include? "scenario") and (source.scan(/\d+\sscenario.*\)/).size > 0)
66
+ end
67
+
68
+ #
69
+ def self.get_elapsed_time_for_zero(source)
70
+ "0 Scenarios " + source.scan(/Finished in <strong>0m0.000s seconds/).first.gsub("<strong>","")
71
+ end
72
+
73
+ def self.get_scenarios_summary(source)
74
+ source.scan(/\d+\sscenario.*\)/).first.gsub(/\<.+\>/,' - ')
75
+ end
76
+
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,59 @@
1
+ <?
2
+ key = query_string.keyword if (query_string.keyword and !query_string.keyword.empty?)
3
+ status = query_string.status if (query_string.status and !query_string.status.empty?)
4
+
5
+ results = Kaya::API::Results.show()
6
+ results_list = results["results"]
7
+ if key
8
+ keyword = key.downcase
9
+ results_list.select! do |result_data|
10
+ result_data["execution_name"].downcase.include? keyword or
11
+ result_data["summary"].downcase.include? keyword or
12
+ result_data["suite"].inspect.downcase.include? keyword or
13
+ result_data["command"].downcase.include? keyword or
14
+ result_data["execution_data"].inspect.downcase.include? keyword or
15
+ result_data["custom_params"].inspect.downcase.include? keyword
16
+ end
17
+
18
+ results_list.select!{|result_data| result_data["_id"]==key} if key.is_a? Fixnum
19
+
20
+ end
21
+
22
+ if status
23
+ results_list.select! do |res|
24
+ res["status"].downcase==status.downcase or (res["summary"].split("step").first.downcase.include? status.downcase and res["summary"].split("step").first.scan(/\(\d.+\)/).first.scan(/[a-z]+/).first == status )
25
+ end
26
+ end
27
+
28
+ results_size_text = if (key or status)
29
+ "#{results_list.size} result#{'s' if results_list.size>1} found"
30
+ else
31
+ "Showing #{results_list.size} results."
32
+ end
33
+ ?>
34
+
35
+ <div class='well'>
36
+ <form name='search' method='get' action='/{{Kaya::Support::Configuration.hostname}}/kaya/results/all'>
37
+ <input type='text' name='keyword' title='' placeholder='Search' value='{{key}}' style='height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px;' />
38
+ <select id='status' name='status' style='height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px;'>
39
+ <option value='' {{'selected' if status.nil?}}>Any status</option>
40
+ <option value='passed' {{'selected' if status=='passed'}}>Passed</option>
41
+ <option value='failed' {{'selected' if status=='failed'}}>Failed</option>
42
+ <option value='stopped' {{'selected' if status=='stopped'}}>Stopped</option>
43
+ </select>
44
+ <input type='submit' class='btn btn-success' value='Search'>&nbsp;&nbsp;
45
+ % if key or status
46
+ <a class='btn btn-danger' href='/{{Kaya::Support::Configuration.hostname}}/kaya/results/all' role='button'>Clear</a>
47
+ % end
48
+ </form>
49
+ <br>
50
+ <p style='text-align:right'>{{results_size_text}}</p>
51
+ </div>
52
+ <div class='well'>
53
+
54
+ % if results_list.size > 0
55
+ % result_info = Mote.parse(File.read("#{Kaya::View.path}/results/detailed_info.mote"), self, [:result])
56
+ % results_list.each do |result_data|
57
+ {{result_info.call(result:result_data)}}
58
+ % end
59
+ % end
@@ -0,0 +1,106 @@
1
+
2
+ <? text = result.bundle_output.split("\n").join("</p><p>") + result.console_output.split("\n").join("</p><p>") unless result.console_output.nil?
3
+ if text.empty?
4
+ lines = []
5
+ begin
6
+ File.open("ls_#{result.id}.out","r").each_line do |line|
7
+ lines << line
8
+ end
9
+ rescue
10
+ lines << "Could not get console output"
11
+ end
12
+ text = lines.join("</small></p><p><small>")
13
+ end
14
+
15
+ suite = Kaya::Suites::Suite.get(result.suite_id)
16
+
17
+ custom_params = result.custom_params.empty? ? 'Not Defined' : result.custom_params_values.gsub('kaya_custom_params=',"")
18
+
19
+ execution_name = result.execution_name.empty? ? 'Not Defined' : result.execution_name.gsub('-_-',' ')
20
+
21
+ git_log = result.git_log.split('Author').first
22
+
23
+ javascript = Mote.parse(File.read("#{Kaya::View.path}/javascript.mote"), self, []).call()
24
+
25
+ ?>
26
+
27
+ <html lang='en'>
28
+ <head>
29
+ <meta charset='utf-8'>
30
+ <meta http-equiv='X-UA-Compatible' content='IE=edge'>
31
+ <meta name='viewport' content='width=device-width, initial-scale=1'>
32
+ <meta http-equiv='refresh' content='{{Kaya::Support::Configuration.refresh_time}}'>
33
+ <link rel='icon' href='../../favicon.ico'>
34
+ <title>Result for {{result.suite_name}}</title>
35
+ <!-- Bootstrap core CSS -->
36
+ <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'>
37
+ <!-- Custom styles for this template -->
38
+ <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/jumbotron-narrow.css' rel='stylesheet'>
39
+ {{javascript}}
40
+
41
+ </head>
42
+
43
+ <body>
44
+ <div class='container'>
45
+ <div class='well'>
46
+ <h3>Result for <b>{{result.suite_name}}</b> execution {{result.stopped? ? '(Stopped)' : ''}}</h3>
47
+ <h6><b>Result ID:</b> {{result.id}}</h6>
48
+ % if Kaya::Support::Configuration.use_git?
49
+ <h6><b>Git log:</b> {{git_log}}</h6>
50
+ % end
51
+ <h6><b>Status: </b>{{result.status}}</h6>
52
+ % if result.timeout
53
+ <h6><b>Timeout:</b> Stopped After {{result.timeout}} seconds</h6>
54
+ % end
55
+ % if result.started_at
56
+ <h6><b>Duration:</b> {{result.elapsed_time}} seconds</h6>
57
+ % end
58
+ <h6><b>Execution Name: </b>{{execution_name}}</h6>
59
+ <h6><b>Custom parameters:</b>{{custom_params}}</h6>
60
+ <h6>&nbsp;</h6>
61
+ <h6>
62
+ <div>
63
+ <a href='#' class='label label-default' onclick='window.close();'>
64
+ Close this window</a>
65
+ <a href='#' class='label label-info' onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/api/results/{{result.id}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
66
+ Result Data</a>
67
+ <a href='#' class='label label-warning' onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/api/results/{{result.id}}/data', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
68
+ Execution Data</a>
69
+ % unless result.status =~ /finished|stopped/
70
+ <a href='#' onclick="get_and_close('/{{Kaya::Support::Configuration.hostname}}/kaya/results/{{result.id}}/reset');" class='label label-danger'>
71
+ Stop execution</a>
72
+ % end
73
+ </div>
74
+ </h6>
75
+
76
+
77
+ % if (result.process_running? or result.running?) and (result.seconds_without_changes > Kaya::Support::Configuration.inactivity_timeout) and Kaya::Support::Configuration.reset_execution_availability?
78
+ % elapsed = Kaya::View.formatted_for(result.seconds_without_changes)
79
+ <p>There is no changes in this execution since more than {{elapsed}}.</p>
80
+ <p>If the suite you asked is still running, you can stop it by pressing the following button</p>
81
+ <p><a class='label label-danger' onclick='get_and_close("/{{Kaya::Support::Configuration.hostname}}/kaya/results/{{result.id}}/reset");' role='button'>Stop execution <b>{{result.suite_name}}</b></a>&nbsp;&nbsp;</p>
82
+ </p>
83
+ % end
84
+ </div>
85
+ <div>
86
+ <div class='page-header'>
87
+ <h4>Console Output</h4>
88
+ </div>
89
+ <button type='button' class='btn btn-default' title='Go down' onclick='go_to_bottom()' style='float: right'><span class='glyphicon glyphicon-chevron-down' aria-hidden='true'></span> Go down</button>
90
+ <h6>
91
+ <small style='color:DarkSlateGray '>{{text}}</small>
92
+ </h6>
93
+ <button type='button' class='btn btn-default' title='Go up' onclick='go_to_top()' style='float: right'><span class='glyphicon glyphicon-chevron-up' aria-hidden='true'></span> Go up</button><br><br>
94
+ </div>
95
+ <div>
96
+ <a href='#' class='label label-default' onclick='window.close();'>Close this window</a>
97
+ </div>
98
+
99
+ <br>
100
+ <br>
101
+ </div>
102
+ </body>
103
+ </html>
104
+
105
+
106
+
@@ -0,0 +1,112 @@
1
+
2
+ <div class='container-inner'>
3
+ <div class='starter-template'>
4
+ <div class='panel panel-default'>
5
+ <div class='panel-heading' data-toggle='collapse' data-target='#{{result["_id"]}}'>
6
+ <h4><small>Execution name &nbsp; <b>{{result["execution_name"]}}</b>&nbsp;(Result id: {{result["_id"]}})</small></h4></div>
7
+ <div class='panel-body collapse in' id='{{result["_id"]}}'>
8
+ % unless result["status"] =~ /finished|stopped/
9
+ <div class='pull-right' title='It seems that the execution gone wrong. Click here to force execution stop'>
10
+ <a href='/{{Kaya::Support::Configuration.hostname}}/kaya/results/{{result["_id"]}}/reset' class='label label-danger'>
11
+ Stop execution
12
+ </a>
13
+ </div>
14
+ % end
15
+
16
+ <table class="table">
17
+ <tbody>
18
+ <tr>
19
+ <th style="width:130px;">
20
+ <small>Suite name</small>
21
+ </th>
22
+ <th>
23
+ {{result["suite"]["name"]}}
24
+ <small>
25
+ (Suite id: {{result["suite"]["id"]}})
26
+ </small>
27
+ </th>
28
+ </tr>
29
+
30
+ <tr>
31
+ <th style="width:130px;">
32
+ <small>Command</small>
33
+ </th>
34
+ <th>
35
+ {{result["command"]}}
36
+ </th>
37
+ </tr>
38
+
39
+ <tr>
40
+ <th style="width:130px;">
41
+ <small>Execution date</small>
42
+ </th>
43
+ <th>
44
+ {{Time.at(result["started_at"]).strftime(Kaya::Support::Configuration.formatted_datetime)}}
45
+ </th>
46
+ </tr>
47
+
48
+ <tr>
49
+ <th style="width:130px;">
50
+ <small>Summary</small>
51
+ </th>
52
+ <th>
53
+ {{Kaya::View.label_color_for(result)}}
54
+ </th>
55
+ </tr>
56
+
57
+ <tr>
58
+ <th style="width:130px;">
59
+ <small>Status</small>
60
+ </th>
61
+ <th>
62
+ {{result["status"]}}
63
+ </th>
64
+ </tr>
65
+
66
+ % if result["custom_params"]
67
+
68
+ <tr>
69
+ <th style="width:130px;">
70
+ <small>Custom Parameters</small>
71
+ </th>
72
+ <th>
73
+ {{result["custom_params"]}}
74
+ </th>
75
+ </tr>
76
+ % end
77
+
78
+ % if result["execution_data"]
79
+ <tr>
80
+ <th style="width:130px;">
81
+ <small>Execution data</small>
82
+ </th>
83
+ <th>
84
+ <a href="#" class='label label-default' onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/api/results/{{result["_id"]}}/data', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');">Click here to see</a>
85
+ </th>
86
+ </tr>
87
+
88
+ % end
89
+
90
+
91
+ </tbody>
92
+ </table>
93
+
94
+ % if result["status"] == 'finished'
95
+ <a onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/results/report/{{result["_id"]}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-{{Kaya::View.color(result["show_as"])}}'>
96
+ See Report
97
+ </a>
98
+ % end
99
+
100
+ <a onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/results/log/{{result["_id"]}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-info'>
101
+ Console Log
102
+ </a>
103
+
104
+ <a onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/api/results/{{result["_id"]}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
105
+ Raw
106
+ </a>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
@@ -0,0 +1 @@
1
+ {{eval(result.html_report)}}
@@ -0,0 +1,23 @@
1
+ <div title="Command: {{result['command']}}">
2
+ <tr class="small">
3
+ <th>{{Kaya::Support::TimeHelper.formatted_time_for(result["started_at"])}}</th>
4
+ % execution_name = !result["execution_name"].empty? ? result["execution_name"].gsub("-_-"," ") : '<small>Not defined</small>'
5
+ <th>{{execution_name}}</th>
6
+ <th>{{Kaya::View.formatted_for(result["elapsed_time"])}}</th>
7
+ <th style="text-align: center;" >
8
+ % if result["saw"]
9
+ No
10
+ % else
11
+ <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
12
+ % end
13
+ </th>
14
+ <th>
15
+ <a onclick="window.open('/{{Kaya::Support::Configuration.hostname}}/kaya/results/log/{{result["_id"]}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class="label label-default">
16
+ Console Log
17
+ </a>
18
+ </th>
19
+ <th>
20
+ {{Kaya::View.label_color_for(result)}}
21
+ </th>
22
+ </tr>
23
+ </div>
@@ -0,0 +1,52 @@
1
+ % suites_list = Kaya::API::Suites.list({})
2
+ % $K_LOG.error "results.mote suite_name=#{suite_name}" if $K_LOG
3
+ % unless suites_list["suites"].empty?
4
+ % suites_list["suites"].select!{|suite| suite["name"]==suite_name} if suite_name
5
+ % suites_list["suites"].each do |suite|
6
+ % results_list = Kaya::API::Result.results_list_for(suite["_id"])
7
+ % if results_list.size > 0
8
+ <div class="panel panel-primary">
9
+ <div class="panel-heading" data-toggle="collapse" data-target="#at_world">
10
+ <h3 class="panel-title">
11
+ {{suite["name"]}}
12
+ <div class="pull-right">{{results_list.size}} Results</div>
13
+ </h3>
14
+ <div></div>
15
+ </div>
16
+ <div class="panel-body collapse in" id="at_world">
17
+ <table class="table">
18
+ <thead>
19
+ <tr>
20
+ <th style="font-weight: bold;">When</th>
21
+ <th style="font-weight: bold;">Label</th>
22
+ <th style="font-weight: bold;">Duration (sec)</th>
23
+ <th style="font-weight: bold; text-align: center;">Unviewed</th>
24
+ <th style="font-weight: bold;">Console</th>
25
+ <th style="font-weight: bold;">Status</th>
26
+ </tr>
27
+ </thead>
28
+ % result_template = Mote.parse(File.read("#{Kaya::View.path}/results/result.mote"), self, [:result])
29
+ % results_list_size = results_list.size
30
+ % results_list = results_list[0..2] unless suite_name
31
+ % results_list.each do |result_data|
32
+ {{result_template.call(result:result_data)}}
33
+ % end
34
+ </table>
35
+ <div class="text-center">
36
+ <a href="/{{Kaya::Support::Configuration.hostname}}/kaya/suites/{{suite["name"]}}" class="btn btn-info">
37
+ Go to suite
38
+ </a>
39
+ % unless suite_name
40
+ <a href="/{{Kaya::Support::Configuration.hostname}}/kaya/results/suite/{{suite["name"]}}" class="btn btn-default">
41
+ &nbsp;&nbsp;All results for this suite&nbsp;
42
+ <span class="label label-info label-as-badge">
43
+ {{results_list_size}}
44
+ </span>
45
+ </a>
46
+ % end
47
+ </div>
48
+ </div>
49
+ </div>
50
+ % end
51
+ % end
52
+ % end
@@ -0,0 +1,42 @@
1
+ <?
2
+ file_path = if File.exist?("#{Dir.pwd}/kaya/screenshot/#{file_name}") and file_name.count(".") == 1 and ["jpeg","jpg","png"].include? file_name.split(".").last
3
+ "#{Dir.pwd}/kaya/screenshot/#{file_name}"
4
+ else
5
+ nil
6
+ end
7
+
8
+ javascript = Mote.parse(File.read("#{Kaya::View.path}/javascript.mote"), self, []).call()
9
+
10
+ ?>
11
+ <html lang='en'>
12
+ <head>
13
+ <meta charset='utf-8'>
14
+ <meta http-equiv='X-UA-Compatible' content='IE=edge'>
15
+ <meta name='viewport' content='width=device-width, initial-scale=1'>
16
+ <link rel='icon' href='../../favicon.ico'>
17
+ <title>Screenshot</title>
18
+ <!-- Bootstrap core CSS -->
19
+ <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'>
20
+ <!-- Custom styles for this template -->
21
+ <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/jumbotron-narrow.css' rel='stylesheet'>
22
+ {{javascript}}
23
+
24
+ </head>
25
+
26
+ <body>
27
+
28
+
29
+ % if file_path
30
+ <img src="{{file_path}}" alt="Que mirás?" height="300" width="500">
31
+ % else
32
+ <div class='jumbotron'>
33
+ <h1>Screenshot does not exist</h1>
34
+ <p><a class='btn btn-lg btn-success' href='#' onclick='javascript:window.history.back();' role='button'>Back</a></p>
35
+ </div>
36
+ % end
37
+ </body>
38
+ </html>
39
+
40
+
41
+
42
+
@@ -0,0 +1,25 @@
1
+ module Kaya
2
+ module View
3
+ class Sections
4
+
5
+ @@sections = {
6
+ "Test Suites" => "suites/suites",
7
+ "Features" => "features/features",
8
+ "Feature" => "features/feature",
9
+ "Results"=> "results/results",
10
+ "Console" => "results/console",
11
+ "Report" => "results/report",
12
+ "All Results"=> "results/all",
13
+ "Repo" => "",
14
+ "Logs" => "logs/log",
15
+ "Help" => ""
16
+ }
17
+
18
+ def self.path_for section
19
+ @@sections[section]
20
+ end
21
+
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,58 @@
1
+ <style>
2
+ th{
3
+ font-weight: normal;
4
+ }
5
+ .spinner {
6
+ margin: 0px 0px 0;
7
+ width: 100%;
8
+ text-align: right;
9
+ }
10
+ .spinner > div {
11
+ width: 8px;
12
+ height: 8px;
13
+ background-color: #5CB85C;
14
+ border-radius: 100%;
15
+ display: inline-block;
16
+ -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
17
+ animation: bouncedelay 1.4s infinite ease-in-out;
18
+ /* Prevent first frame from flickering when animation starts */
19
+ -webkit-animation-fill-mode: both;
20
+ animation-fill-mode: both;
21
+ }
22
+ .spinner .bounce1 {
23
+ -webkit-animation-delay: -0.32s;
24
+ animation-delay: -0.32s;
25
+ }
26
+ .spinner .bounce2 {
27
+ -webkit-animation-delay: -0.16s;
28
+ animation-delay: -0.16s;
29
+ }
30
+ @-webkit-keyframes bouncedelay {
31
+ 0%, 80%, 100% { -webkit-transform: scale(0.0) }
32
+ 40% { -webkit-transform: scale(1.0) }
33
+ }
34
+ @keyframes bouncedelay {
35
+ 0%, 80%, 100% {
36
+ transform: scale(0.0);
37
+ -webkit-transform: scale(0.0);
38
+ } 40% {
39
+ transform: scale(1.0);
40
+ -webkit-transform: scale(1.0);
41
+ }
42
+ }
43
+ .list-group-item {
44
+ position: relative;
45
+ display: block;
46
+ font-weight: 500;
47
+ padding: 6px 15px;
48
+ margin-bottom: -1px;
49
+ background-color: #FFF;
50
+ border: 1px solid #DDD;
51
+ }
52
+ label {
53
+ display: inline-block;
54
+ margin-bottom: 5px;
55
+ font-weight: 500;
56
+ text-align: right;
57
+ }
58
+ </style>