Skip to content

Commit

Permalink
Fix sqlite3 dependency. Allow listing of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eoftedal committed May 21, 2013
1 parent 09e3c64 commit 87faa65
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -6,7 +6,7 @@ gem 'rails', '3.2.13'
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
# gem 'sqlite3'
gem 'sqlite3'

gem 'json'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -90,6 +90,7 @@ GEM
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.12)
Expand All @@ -110,4 +111,5 @@ DEPENDENCIES
pg
rails (= 3.2.13)
sass-rails (~> 3.2.3)
sqlite3
uglifier (>= 1.0.3)
30 changes: 30 additions & 0 deletions app/assets/javascripts/application.js
Expand Up @@ -28,6 +28,34 @@ $(function() {
setTimeout(function() { runTest(0) }, 100);
});

$("#listtests").click(function(evt) {
evt.preventDefault();
evt.stopPropagation();
$(".iframes").text("");
$(".results").show();
$(".testcase").remove();
$("#runner").hide();
for(var i in testcases) {
(function() {
var testcase = testcases[i];
var tr = $("<tr>").attr("id", "id-" + testcase.id).appendTo($(".results")).addClass("testcase");
$("<td>").text(testcase.id).appendTo(tr);
$("<td>").text(testcase.title).appendTo(tr);
$("<td>").appendTo(tr).append($("<button>").addClass("btn btn-small").text("Run").click(function(){
$("<iframe>").attr("src", testcase.load_uri + "&_=" + (new Date()).getTime()).appendTo($(".iframes")).hide();
setTimeout(function() { loadResults(true, false) }, 1000);
setTimeout(function() { loadResults(true, true) }, 5000);
setTimeout(function() { loadResults(false, true) }, 15000);
}));
$("<td>").appendTo(tr).append($("<button>").addClass("btn btn-small").text("Open").click(function() {
document.location = testcase.load_uri + "&_=" + (new Date()).getTime();
}));
})();
}
});



function runTest(id) {
var testcase = testcases[id];
if (testcase != null) {
Expand All @@ -43,6 +71,8 @@ $(function() {
setTimeout(function() { loadResults(false, true) }, 15000);
}
}


function loadResults(nofail, finishResults) {
$.getJSON("/test/results?_=" + (new Date()).getTime()).success(function(results) {
for (var i in results) {
Expand Down
4 changes: 2 additions & 2 deletions app/views/home/index.html.erb
Expand Up @@ -8,7 +8,7 @@
var testcases = <%= raw @testcase_json %>
</script>
<br>
<p><a id="runtests" class="btn btn-primary btn-large">Run tests</a></p>
<p><a id="runtests" class="btn btn-primary btn-large">Run tests</a> <a id="listtests" class="btn btn-large">List tests</a></p>

<p id="runner" class="running" style="display:none">Running...</p>

Expand All @@ -20,5 +20,5 @@ var testcases = <%= raw @testcase_json %>
</table>

<div class="iframes" style="display: none">
<iframe src="http://<%= @other_host %>/home/establish?session_id=<%= @session_id %>"></iframe>
<iframe src="//<%= @other_host %>/home/establish?session_id=<%= @session_id %>"></iframe>
</div>
70 changes: 35 additions & 35 deletions db/schema.rb
@@ -1,35 +1,35 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120927195906) do

create_table "results", :force => true do |t|
t.string "useragent"
t.string "results"
t.integer "total"
t.integer "success"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.float "version"
end

create_table "sessions", :force => true do |t|
t.string "session_id", :null => false
t.text "data"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"

end
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120927195906) do

create_table "results", :force => true do |t|
t.string "useragent"
t.string "results"
t.integer "total"
t.integer "success"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.float "version"
end

create_table "sessions", :force => true do |t|
t.string "session_id", :null => false
t.text "data"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"

end

0 comments on commit 87faa65

Please sign in to comment.