2018-03-27 05:44:04 -04:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2018-03-27 04:45:21 -04:00
|
|
|
|
|
|
|
acceptance("Groups");
|
|
|
|
|
2018-07-19 06:11:18 -04:00
|
|
|
QUnit.test("Browsing Groups", async (assert) => {
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g?username=eviltrout");
|
2018-10-11 09:20:17 -04:00
|
|
|
|
2019-04-17 22:44:30 -04:00
|
|
|
assert.equal(count(".group-box"), 1, "it displays user's groups");
|
2018-10-11 09:20:17 -04:00
|
|
|
|
2019-02-21 00:44:25 -05:00
|
|
|
await visit("/g");
|
2018-07-19 06:11:18 -04:00
|
|
|
|
2019-04-17 22:44:30 -04:00
|
|
|
assert.equal(count(".group-box"), 2, "it displays visible groups");
|
2018-07-19 06:11:18 -04: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 00:44:25 -05:00
|
|
|
await click("a[href='/g/discourse/members']");
|
2018-07-19 06:11:18 -04: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 04:45:21 -04:00
|
|
|
});
|