2018-03-27 17:44:04 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2018-03-27 16:45:21 +08:00
|
|
|
|
|
|
|
acceptance("Groups");
|
|
|
|
|
2018-07-19 18:11:18 +08:00
|
|
|
QUnit.test("Browsing Groups", async assert => {
|
2019-02-21 13:44:25 +08:00
|
|
|
await visit("/g?username=eviltrout");
|
2018-10-11 21:20:17 +08:00
|
|
|
|
2019-04-18 10:44:30 +08:00
|
|
|
assert.equal(count(".group-box"), 1, "it displays user's groups");
|
2018-10-11 21:20:17 +08:00
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
await visit("/g");
|
2018-07-19 18:11:18 +08:00
|
|
|
|
2019-04-18 10:44:30 +08:00
|
|
|
assert.equal(count(".group-box"), 2, "it displays visible groups");
|
2018-07-19 18:11:18 +08:00
|
|
|
assert.equal(
|
|
|
|
find(".group-index-join").length,
|
|
|
|
1,
|
|
|
|
"it shows button to join group"
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
find(".group-index-request").length,
|
|
|
|
1,
|
|
|
|
"it shows button to request for group membership"
|
|
|
|
);
|
|
|
|
|
|
|
|
await click(".group-index-join");
|
|
|
|
|
|
|
|
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
|
|
|
|
|
|
|
await click(".login-modal .close");
|
|
|
|
|
|
|
|
assert.ok(invisible(".modal.login-modal"), "it closes the login modal");
|
|
|
|
|
|
|
|
await click(".group-index-request");
|
|
|
|
|
|
|
|
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
|
|
|
|
2019-02-21 13:44:25 +08:00
|
|
|
await click("a[href='/g/discourse/members']");
|
2018-07-19 18:11:18 +08:00
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
find(".group-info-name")
|
|
|
|
.text()
|
|
|
|
.trim(),
|
|
|
|
"Awesome Team",
|
|
|
|
"it displays the group page"
|
|
|
|
);
|
|
|
|
|
|
|
|
await click(".group-index-join");
|
|
|
|
|
|
|
|
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|