Skip to content

Instantly share code, notes, and snippets.

@barelyknown
Created July 11, 2015 15:29
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 barelyknown/ed18b2b7b4f258b691e3 to your computer and use it in GitHub Desktop.
Save barelyknown/ed18b2b7b4f258b691e3 to your computer and use it in GitHub Desktop.
login with valid credentials by pressing enter from password input
// login.hbs
// {{input value=identification name='identification'}}
// {{input value=password name='password' enter='authenticate'}}
// <button name='login' {{action 'authenticate'}}>Login</button>
// this test passes
test('login with valid credentials', function(assert) {
visit('/login');
andThen(function() {
fillIn("input[name='identification']", "test@test.com");
fillIn("input[name='password']", "12345678");
click("button[name='login']");
andThen(function() {
assert.equal(currentURL(), '/');
});
});
});
// this test does not pass
test('login with valid credentials by pressing enter from password input', function(assert) {
visit('/login');
andThen(function() {
fillIn("input[name='identification']", "test@test.com");
fillIn("input[name='password']", "12345678");
keyEvent("input[name='password']", 'keydown', 13);
andThen(function() {
assert.equal(currentURL(), "/");
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment