2018-07-21 18:03:39 +08:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2018-04-25 16:28:41 +08:00
|
|
|
|
2019-04-01 18:39:49 +08:00
|
|
|
acceptance("Dashboard", {
|
2018-12-26 17:29:07 +08:00
|
|
|
loggedIn: true,
|
|
|
|
settings: {
|
|
|
|
dashboard_general_tab_activity_metrics: "page_view_total_reqs"
|
|
|
|
}
|
2018-04-25 16:28:41 +08:00
|
|
|
});
|
|
|
|
|
2018-12-19 21:44:43 +08:00
|
|
|
QUnit.test("Dashboard", async assert => {
|
2018-07-21 22:29:58 +08:00
|
|
|
await visit("/admin");
|
2019-04-01 18:39:49 +08:00
|
|
|
assert.ok(exists(".dashboard"), "has dashboard-next class");
|
2018-12-19 21:44:43 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("tabs", async assert => {
|
|
|
|
await visit("/admin");
|
|
|
|
|
2019-04-01 18:39:49 +08:00
|
|
|
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
|
|
|
assert.ok(exists(".dashboard .navigation-item.moderation"), "moderation tab");
|
|
|
|
assert.ok(exists(".dashboard .navigation-item.security"), "security tab");
|
|
|
|
assert.ok(exists(".dashboard .navigation-item.reports"), "reports tab");
|
2018-12-19 21:44:43 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("general tab", async assert => {
|
|
|
|
await visit("/admin");
|
2018-07-21 22:29:58 +08:00
|
|
|
assert.ok(exists(".admin-report.signups"), "signups report");
|
|
|
|
assert.ok(exists(".admin-report.posts"), "posts report");
|
|
|
|
assert.ok(exists(".admin-report.dau-by-mau"), "dau-by-mau report");
|
|
|
|
assert.ok(
|
|
|
|
exists(".admin-report.daily-engaged-users"),
|
|
|
|
"daily-engaged-users report"
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
exists(".admin-report.new-contributors"),
|
|
|
|
"new-contributors report"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
$(".section.dashboard-problems .problem-messages ul li:first-child")
|
|
|
|
.html()
|
|
|
|
.trim(),
|
|
|
|
"Houston...",
|
|
|
|
"displays problems"
|
|
|
|
);
|
2018-12-26 17:29:07 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("general tab - activity metrics", async assert => {
|
|
|
|
await visit("/admin");
|
2018-08-22 18:37:05 +08:00
|
|
|
|
2019-03-03 19:13:02 +08:00
|
|
|
assert.ok(exists(".admin-report.page-view-total-reqs .today-count"));
|
|
|
|
assert.ok(exists(".admin-report.page-view-total-reqs .yesterday-count"));
|
|
|
|
assert.ok(exists(".admin-report.page-view-total-reqs .sevendays-count"));
|
|
|
|
assert.ok(exists(".admin-report.page-view-total-reqs .thirty-days-count"));
|
2018-08-22 18:37:05 +08:00
|
|
|
});
|
2018-12-19 21:44:43 +08:00
|
|
|
|
|
|
|
QUnit.test("reports tab", async assert => {
|
|
|
|
await visit("/admin");
|
2019-04-01 18:39:49 +08:00
|
|
|
await click(".dashboard .navigation-item.reports .navigation-link");
|
2018-12-19 21:44:43 +08:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 18:39:49 +08:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 21:44:43 +08:00
|
|
|
1
|
|
|
|
);
|
|
|
|
|
2019-04-01 18:39:49 +08:00
|
|
|
await fillIn(".dashboard .filter-reports-input", "flags");
|
2018-12-19 21:44:43 +08:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 18:39:49 +08:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 21:44:43 +08:00
|
|
|
0
|
|
|
|
);
|
|
|
|
|
2019-04-01 18:39:49 +08:00
|
|
|
await click(".dashboard .navigation-item.security .navigation-link");
|
|
|
|
await click(".dashboard .navigation-item.reports .navigation-link");
|
2018-12-19 21:44:43 +08:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 18:39:49 +08:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 21:44:43 +08:00
|
|
|
1,
|
|
|
|
"navigating back and forth resets filter"
|
|
|
|
);
|
|
|
|
|
2019-04-01 18:39:49 +08:00
|
|
|
await fillIn(".dashboard .filter-reports-input", "activities");
|
2018-12-19 21:44:43 +08:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 18:39:49 +08:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 21:44:43 +08:00
|
|
|
1,
|
|
|
|
"filter is case insensitive"
|
|
|
|
);
|
|
|
|
});
|