Replace localhost with 127.0.0.1 in casper tests.

This commit is contained in:
Tim Abbott 2016-07-27 11:54:00 -07:00
parent e515484c41
commit 97e0306795
6 changed files with 12 additions and 12 deletions

View File

@ -83,7 +83,7 @@ exports.then_log_in = function (credentials) {
}; };
exports.start_and_log_in = function (credentials, viewport) { exports.start_and_log_in = function (credentials, viewport) {
casper.start('http://localhost:9981/accounts/login', function () { casper.start('http://127.0.0.1:9981/accounts/login', function () {
exports.initialize_casper(viewport); exports.initialize_casper(viewport);
log_in(credentials); log_in(credentials);
}); });

View File

@ -4,7 +4,7 @@ var email = 'alice@test.example.com';
var domain = 'test.example.com'; var domain = 'test.example.com';
var organization_name = 'Awesome Organization'; var organization_name = 'Awesome Organization';
casper.start('http://localhost:9981/create_realm/'); casper.start('http://127.0.0.1:9981/create_realm/');
casper.then(function () { casper.then(function () {
// Submit the email for realm creation // Submit the email for realm creation
@ -21,12 +21,12 @@ casper.then(function () {
}); });
// Special endpoint enabled only during tests for extracting confirmation key // Special endpoint enabled only during tests for extracting confirmation key
casper.thenOpen('http://localhost:9981/confirmation_key/'); casper.thenOpen('http://127.0.0.1:9981/confirmation_key/');
// Open the confirmation URL // Open the confirmation URL
casper.then(function () { casper.then(function () {
var confirmation_key = JSON.parse(this.getPageContent()).confirmation_key; var confirmation_key = JSON.parse(this.getPageContent()).confirmation_key;
var confirmation_url = 'http://localhost:9981/accounts/do_confirm/' + confirmation_key; var confirmation_url = 'http://127.0.0.1:9981/accounts/do_confirm/' + confirmation_key;
this.thenOpen(confirmation_url); this.thenOpen(confirmation_url);
}); });
@ -56,7 +56,7 @@ casper.then(function () {
}); });
this.waitWhileSelector('form[action^="/accounts/register/"]', function () { this.waitWhileSelector('form[action^="/accounts/register/"]', function () {
casper.test.assertUrlMatch('http://localhost:9981/invite/', 'Invite more users page loaded'); casper.test.assertUrlMatch('http://127.0.0.1:9981/invite/', 'Invite more users page loaded');
}); });
}); });
@ -75,7 +75,7 @@ casper.then(function () {
}); });
this.waitWhileSelector('#submit_invitation', function () { this.waitWhileSelector('#submit_invitation', function () {
this.test.assertUrlMatch('http://localhost:9981/', 'Realm created and logged in'); this.test.assertUrlMatch('http://127.0.0.1:9981/', 'Realm created and logged in');
}); });
}); });

View File

@ -1,7 +1,7 @@
var common = require('../casper_lib/common.js').common; var common = require('../casper_lib/common.js').common;
// Start of test script. // Start of test script.
casper.start('http://localhost:9981/', common.initialize_casper); casper.start('http://127.0.0.1:9981/', common.initialize_casper);
casper.then(function () { casper.then(function () {
casper.test.assertHttpStatus(302); casper.test.assertHttpStatus(302);

View File

@ -162,7 +162,7 @@ casper.waitForSelector("#default_language", function () {
casper.test.info("Opening German page through i18n url."); casper.test.info("Opening German page through i18n url.");
}); });
casper.thenOpen('http://localhost:9981/de/#settings'); casper.thenOpen('http://127.0.0.1:9981/de/#settings');
casper.waitForSelector("#settings-change-box", function check_url_preference() { casper.waitForSelector("#settings-change-box", function check_url_preference() {
casper.test.info("Checking the i18n url language precedence."); casper.test.info("Checking the i18n url language precedence.");

View File

@ -144,7 +144,7 @@ casper.then(function () {
casper.waitForSelector('.admin-emoji-form', function () { casper.waitForSelector('.admin-emoji-form', function () {
casper.fill('form.admin-emoji-form', { casper.fill('form.admin-emoji-form', {
'name': 'MouseFace', 'name': 'MouseFace',
'url': 'http://localhost:9991/static/images/integrations/logos/jenkins.png' 'url': 'http://127.0.0.1:9991/static/images/integrations/logos/jenkins.png'
}); });
casper.click('form.admin-emoji-form input.btn'); casper.click('form.admin-emoji-form input.btn');
}); });
@ -159,7 +159,7 @@ casper.then(function () {
casper.then(function () { casper.then(function () {
casper.waitForSelector('.emoji_row', function () { casper.waitForSelector('.emoji_row', function () {
casper.test.assertSelectorHasText('.emoji_row .emoji_name', 'MouseFace'); casper.test.assertSelectorHasText('.emoji_row .emoji_name', 'MouseFace');
casper.test.assertExists('.emoji_row img[src="http://localhost:9991/static/images/integrations/logos/jenkins.png"]'); casper.test.assertExists('.emoji_row img[src="http://127.0.0.1:9991/static/images/integrations/logos/jenkins.png"]');
casper.click('.emoji_row button.delete'); casper.click('.emoji_row button.delete');
}); });
}); });

View File

@ -25,7 +25,7 @@ except ImportError as e:
# on how to use remote debugging # on how to use remote debugging
# #
os.environ["TORNADO_SERVER"] = "http://localhost:9983" os.environ["TORNADO_SERVER"] = "http://127.0.0.1:9983"
usage = """%prog [options] usage = """%prog [options]
test-js-with-casper # Run all test files test-js-with-casper # Run all test files
@ -60,7 +60,7 @@ def server_is_up(server):
assert_server_running(server) assert_server_running(server)
try: try:
# We could get a 501 error if the reverse proxy is up but the Django app isn't. # We could get a 501 error if the reverse proxy is up but the Django app isn't.
return requests.get('http://localhost:9981/accounts/home').status_code == 200 return requests.get('http://127.0.0.1:9981/accounts/home').status_code == 200
except: except:
return False return False