Skip to content

Instantly share code, notes, and snippets.

@Roadmaster
Last active April 18, 2017 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Roadmaster/f3e214f26a3218dd65d9cdd6f8d67c51 to your computer and use it in GitHub Desktop.
Save Roadmaster/f3e214f26a3218dd65d9cdd6f8d67c51 to your computer and use it in GitHub Desktop.
A codeceptjs test (acceptance test). This creates a user in login.ubuntu.com (assumes a development instance with no captcha protection)
Feature('Create an account');
ac_num = Math.floor(Math.random() * 1e10);
var the_mail = "user" + ac_num + "@example.com";
Scenario('test some forms', (I) => {
I.amOnPage("/");
I.see("One account");
I.dontSee("Strength:")
I.dontSee("Please tell us your name and choose a password");
I.checkOption('form[data-qa-id="login_form"] #id_new_user');
I.see("Please tell us your name and choose a password");
within('form[data-qa-id="create_account_form"]', function() {
I.checkOption('#id_accept_tos');
I.fillField( '#id_email', the_mail);
I.fillField( '#id_displayname', 'my name');
I.fillField( '#id_password', 'p1i2z3z4a');
I.fillField( '#id_passwordconfirm', 'p1i2z3z4a');
});
I.see("Strength:");
I.click("button[data-qa-id='register_button']");
I.see('account was created successfully');
});
@yogieputra8
Copy link

What if there is a google captcha in it's login?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment