Allow Basic Authentication to be set in smoke test.

This commit is contained in:
Guo Xiang Tan 2017-05-17 19:24:43 +08:00
parent 4b3b54da70
commit b0e4555a86
2 changed files with 22 additions and 3 deletions

View File

@ -15,9 +15,19 @@ task "smoke:test" do
require 'open-uri'
require 'net/http'
res = Net::HTTP.get_response(URI.parse(url))
if res.code != "200"
raise "TRIVIAL GET FAILED WITH #{res.code}"
uri = URI(url)
request = Net::HTTP::Get.new(uri)
if ENV["AUTH_USER"] && ENV["AUTH_PASSWORD"]
request.basic_auth(ENV['AUTH_USER'], ENV['AUTH_PASSWORD'])
end
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(request)
end
if response.code != "200"
raise "TRIVIAL GET FAILED WITH #{response.code}"
end
results = ""

View File

@ -12,6 +12,11 @@ if (system.args.length !== 2) {
var TIMEOUT = 25000;
var page = require("webpage").create();
if (system.env["AUTH_USER"] && system.env["AUTH_PASSWORD"]) {
page.settings.userName = system.env["AUTH_USER"];
page.settings.password = system.env["AUTH_PASSWORD"];
}
page.viewportSize = {
width: 1366,
height: 768
@ -139,6 +144,10 @@ var runTests = function() {
return $(".login-button").text().trim() === "Log In";
});
execAsync("go to latest page", 500, function(){
window.location = "/latest";
});
test("at least one topic shows up", function() {
return $(".topic-list tbody tr").length;
});