Skip to content

Commit

Permalink
casper: Use waitUntilVisible in realm creation tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
timabbott committed Feb 10, 2017
1 parent 89c515f commit ed4f245
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend_tests/casper_tests/00-realm-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ casper.start('http://' + host + '/create_realm/');

casper.then(function () {
// Submit the email for realm creation
this.waitForSelector('form[action^="/create_realm/"]', function () {
this.waitUntilVisible('form[action^="/create_realm/"]', function () {
this.fill('form[action^="/create_realm/"]', {
email: email,
}, true);
});
// Make sure confirmation email is send
this.waitWhileSelector('form[action^="/create_realm/"]', function () {
this.waitWhileVisible('form[action^="/create_realm/"]', function () {
var regex = new RegExp('^http://[^/]+/accounts/send_confirm/' + email);
this.test.assertUrlMatch(regex, 'Confirmation mail send');
});
Expand All @@ -42,23 +42,23 @@ casper.then(function () {

// Make sure the realm creation page is loaded correctly
casper.then(function () {
this.waitForSelector('.pitch', function () {
this.waitUntilVisible('.pitch', function () {
this.test.assertSelectorContains('.pitch', "You're almost there.");
});

this.waitForSelector('#id_email', function () {
this.waitUntilVisible('#id_email', function () {
this.test.assertEvalEquals(function () {
return $('#id_email').attr('placeholder');
}, email);
});

this.waitForSelector('label[for=id_team_name]', function () {
this.waitUntilVisible('label[for=id_team_name]', function () {
this.test.assertSelectorHasText('label[for=id_team_name]', 'Organization name');
});
});

casper.then(function () {
this.waitForSelector('form[action^="/accounts/register/"]', function () {
this.waitUntilVisible('form[action^="/accounts/register/"]', function () {
this.fill('form[action^="/accounts/register/"]', {
full_name: 'Alice',
realm_name: organization_name,
Expand All @@ -68,7 +68,7 @@ casper.then(function () {
}, true);
});

this.waitWhileSelector('form[action^="/accounts/register/"]', function () {
this.waitWhileVisible('form[action^="/accounts/register/"]', function () {
casper.test.assertUrlMatch(realm_host + '/', 'Home page loaded');
});
});
Expand Down

0 comments on commit ed4f245

Please sign in to comment.