mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
Allow Basic Authentication to be set in smoke test.
This commit is contained in:
parent
4b3b54da70
commit
b0e4555a86
|
@ -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 = ""
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user