mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
DEV: migrate acceptance tests to async await - invite, login, mobile
This commit is contained in:
@ -25,51 +25,41 @@ acceptance("Accept Invite - User Fields", {
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("accept invite with user fields", assert => {
|
||||
visit("/invites/myvalidinvitetoken");
|
||||
andThen(() => {
|
||||
assert.ok(exists(".invites-show"), "shows the accept invite page");
|
||||
assert.ok(exists(".user-field"), "it has at least one user field");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is disabled"
|
||||
);
|
||||
});
|
||||
QUnit.test("accept invite with user fields", async assert => {
|
||||
await visit("/invites/myvalidinvitetoken");
|
||||
assert.ok(exists(".invites-show"), "shows the accept invite page");
|
||||
assert.ok(exists(".user-field"), "it has at least one user field");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is disabled"
|
||||
);
|
||||
|
||||
fillIn("#new-account-name", "John Doe");
|
||||
fillIn("#new-account-username", "validname");
|
||||
fillIn("#new-account-password", "secur3ty4Y0uAndMe");
|
||||
await fillIn("#new-account-name", "John Doe");
|
||||
await fillIn("#new-account-username", "validname");
|
||||
await fillIn("#new-account-password", "secur3ty4Y0uAndMe");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(exists(".username-input .good"), "username is valid");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is still disabled due to lack of user fields"
|
||||
);
|
||||
});
|
||||
assert.ok(exists(".username-input .good"), "username is valid");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is still disabled due to lack of user fields"
|
||||
);
|
||||
|
||||
fillIn(".user-field input[type=text]:first", "Barky");
|
||||
await fillIn(".user-field input[type=text]:first", "Barky");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is disabled because field is not checked"
|
||||
);
|
||||
});
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is disabled because field is not checked"
|
||||
);
|
||||
|
||||
click(".user-field input[type=checkbox]");
|
||||
andThen(() => {
|
||||
assert.not(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is enabled because field is checked"
|
||||
);
|
||||
});
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.not(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"submit is enabled because field is checked"
|
||||
);
|
||||
|
||||
click(".user-field input[type=checkbox]");
|
||||
andThen(() => {
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"unclicking the checkbox disables the submit"
|
||||
);
|
||||
});
|
||||
await click(".user-field input[type=checkbox]");
|
||||
assert.ok(
|
||||
exists(".invites-show .btn-primary:disabled"),
|
||||
"unclicking the checkbox disables the submit"
|
||||
);
|
||||
});
|
||||
|
Reference in New Issue
Block a user