discourse/test/javascripts/acceptance/groups-index-test.js.es6

58 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-03-27 17:44:04 +08:00
import { acceptance } from "helpers/qunit-helpers";
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-06-15 23:03:24 +08:00
click(".group-index-join");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
});
2018-06-15 23:03:24 +08:00
click(".login-modal .close");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(invisible(".modal.login-modal"), "it closes the login modal");
});
2018-06-15 23:03:24 +08:00
click(".group-index-request");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
});
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-06-15 23:03:24 +08:00
click(".group-index-join");
andThen(() => {
2018-06-15 23:03:24 +08:00
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
});
});