discourse/test/javascripts/acceptance/user-anonymous-test.js

Failed to ignore revisions in .git-blame-ignore-revs.

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2015-04-21 14:36:46 -04:00
import { acceptance } from "helpers/qunit-helpers";
acceptance("User Anonymous");
2017-06-14 13:57:58 -04:00
function hasStream(assert) {
assert.ok(exists(".user-main .about"), "it has the about section");
assert.ok(count(".user-stream .item") > 0, "it has stream items");
2015-04-21 14:36:46 -04:00
}
2017-06-14 13:57:58 -04:00
function hasTopicList(assert) {
assert.equal(count(".user-stream .item"), 0, "has no stream displayed");
assert.ok(count(".topic-list tr") > 0, "it has a topic list");
}
QUnit.test("Root URL", async assert => {
await visit("/u/eviltrout");
assert.ok($("body.user-summary-page").length, "has the body class");
assert.equal(currentPath(), "user.summary", "it defaults to summary");
});
QUnit.test("Filters", async assert => {
await visit("/u/eviltrout/activity");
assert.ok($("body.user-activity-page").length, "has the body class");
2017-06-14 13:57:58 -04:00
hasStream(assert);
await visit("/u/eviltrout/activity/topics");
await hasTopicList(assert);
await visit("/u/eviltrout/activity/replies");
2017-06-14 13:57:58 -04:00
hasStream(assert);
assert.ok(exists(".user-stream.filter-5"), "stream has filter class");
});
QUnit.test("Badges", async assert => {
await visit("/u/eviltrout/badges");
assert.ok($("body.user-badges-page").length, "has the body class");
assert.ok(exists(".user-badges-list .badge-card"), "shows a badge");
});
QUnit.test("Restricted Routes", async assert => {
await visit("/u/eviltrout/preferences");
assert.equal(
currentURL(),
"/u/eviltrout/activity",
"it redirects from preferences"
);
});