DEV: migrate acceptance tests to async await - invite, login, mobile

This commit is contained in:
Maja Komel
2018-07-19 12:12:00 +02:00
parent a2281fbb19
commit 2e96646659
8 changed files with 142 additions and 198 deletions

View File

@ -7,7 +7,7 @@ acceptance("Invite Accept", {
}
});
QUnit.test("Invite Acceptance Page", assert => {
QUnit.test("Invite Acceptance Page", async assert => {
PreloadStore.store("invite_info", {
invited_by: {
id: 123,
@ -20,56 +20,46 @@ QUnit.test("Invite Acceptance Page", assert => {
username: "invited"
});
visit("/invites/myvalidinvitetoken");
andThen(() => {
assert.ok(exists("#new-account-username"), "shows the username input");
assert.equal(
find("#new-account-username").val(),
"invited",
"username is prefilled"
);
assert.ok(exists("#new-account-name"), "shows the name input");
assert.ok(exists("#new-account-password"), "shows the password input");
assert.ok(
exists(".invites-show .btn-primary:disabled"),
"submit is disabled because name is not filled"
);
});
await visit("/invites/myvalidinvitetoken");
assert.ok(exists("#new-account-username"), "shows the username input");
assert.equal(
find("#new-account-username").val(),
"invited",
"username is prefilled"
);
assert.ok(exists("#new-account-name"), "shows the name input");
assert.ok(exists("#new-account-password"), "shows the password input");
assert.ok(
exists(".invites-show .btn-primary:disabled"),
"submit is disabled because name is not filled"
);
fillIn("#new-account-name", "John Doe");
andThen(() => {
assert.not(
exists(".invites-show .btn-primary:disabled"),
"submit is enabled"
);
});
await fillIn("#new-account-name", "John Doe");
assert.not(
exists(".invites-show .btn-primary:disabled"),
"submit is enabled"
);
fillIn("#new-account-username", "a");
andThen(() => {
assert.ok(exists(".username-input .bad"), "username is not valid");
assert.ok(
exists(".invites-show .btn-primary:disabled"),
"submit is disabled"
);
});
await fillIn("#new-account-username", "a");
assert.ok(exists(".username-input .bad"), "username is not valid");
assert.ok(
exists(".invites-show .btn-primary:disabled"),
"submit is disabled"
);
fillIn("#new-account-password", "aaa");
andThen(() => {
assert.ok(exists(".password-input .bad"), "password is not valid");
assert.ok(
exists(".invites-show .btn-primary:disabled"),
"submit is disabled"
);
});
await fillIn("#new-account-password", "aaa");
assert.ok(exists(".password-input .bad"), "password is not valid");
assert.ok(
exists(".invites-show .btn-primary:disabled"),
"submit is disabled"
);
fillIn("#new-account-username", "validname");
fillIn("#new-account-password", "secur3ty4Y0uAndMe");
andThen(() => {
assert.ok(exists(".username-input .good"), "username is valid");
assert.ok(exists(".password-input .good"), "password is valid");
assert.not(
exists(".invites-show .btn-primary:disabled"),
"submit is enabled"
);
});
await fillIn("#new-account-username", "validname");
await fillIn("#new-account-password", "secur3ty4Y0uAndMe");
assert.ok(exists(".username-input .good"), "username is valid");
assert.ok(exists(".password-input .good"), "password is valid");
assert.not(
exists(".invites-show .btn-primary:disabled"),
"submit is enabled"
);
});