2018-03-27 17:44:04 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2018-03-27 16:45:21 +08:00
|
|
|
|
|
|
|
acceptance("Groups");
|
|
|
|
|
|
|
|
QUnit.test("Browsing Groups", assert => {
|
|
|
|
visit("/groups");
|
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(count(".groups-table-row"), 2, "it displays visible groups");
|
|
|
|
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"
|
|
|
|
);
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".group-index-join");
|
2018-03-27 16:45:21 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".login-modal .close");
|
2018-03-27 16:45:21 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(invisible(".modal.login-modal"), "it closes the login modal");
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".group-index-request");
|
2018-03-27 16:45:21 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
click("a[href='/groups/discourse/members']");
|
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.equal(
|
|
|
|
find(".group-info-name")
|
|
|
|
.text()
|
|
|
|
.trim(),
|
|
|
|
"Awesome Team",
|
|
|
|
"it displays the group page"
|
|
|
|
);
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
click(".group-index-join");
|
2018-03-27 16:45:21 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-06-15 23:03:24 +08:00
|
|
|
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
2018-03-27 16:45:21 +08:00
|
|
|
});
|
|
|
|
});
|