2019-06-06 04:47:10 -04:00
|
|
|
import selectKit from "helpers/select-kit-helper";
|
2018-07-21 06:03:39 -04:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
2018-04-25 04:28:41 -04:00
|
|
|
|
2019-04-01 06:39:49 -04:00
|
|
|
acceptance("Dashboard", {
|
2018-12-26 04:29:07 -05:00
|
|
|
loggedIn: true,
|
|
|
|
settings: {
|
2020-04-30 11:31:04 -04:00
|
|
|
dashboard_visible_tabs: "moderation|security|reports",
|
2018-12-26 04:29:07 -05:00
|
|
|
dashboard_general_tab_activity_metrics: "page_view_total_reqs"
|
2019-04-26 06:17:10 -04:00
|
|
|
},
|
|
|
|
site: {
|
|
|
|
groups: [
|
|
|
|
{
|
|
|
|
id: 88,
|
|
|
|
name: "tl1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 89,
|
|
|
|
name: "tl2"
|
|
|
|
}
|
|
|
|
]
|
2018-12-26 04:29:07 -05:00
|
|
|
}
|
2018-04-25 04:28:41 -04:00
|
|
|
});
|
|
|
|
|
2020-04-30 11:31:04 -04:00
|
|
|
QUnit.test("default", async assert => {
|
2018-07-21 10:29:58 -04:00
|
|
|
await visit("/admin");
|
2020-04-30 11:31:04 -04:00
|
|
|
|
2019-04-01 06:39:49 -04:00
|
|
|
assert.ok(exists(".dashboard"), "has dashboard-next class");
|
2018-12-19 08:44:43 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("tabs", async assert => {
|
|
|
|
await visit("/admin");
|
|
|
|
|
2019-04-01 06:39:49 -04: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 08:44:43 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("general tab", async assert => {
|
|
|
|
await visit("/admin");
|
2018-07-21 10:29:58 -04: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 04:29:07 -05:00
|
|
|
});
|
|
|
|
|
2020-04-30 11:31:04 -04:00
|
|
|
QUnit.test("activity metrics", async assert => {
|
2018-12-26 04:29:07 -05:00
|
|
|
await visit("/admin");
|
2018-08-22 06:37:05 -04:00
|
|
|
|
2019-03-03 06:13:02 -05: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 06:37:05 -04:00
|
|
|
});
|
2018-12-19 08:44:43 -05:00
|
|
|
|
|
|
|
QUnit.test("reports tab", async assert => {
|
|
|
|
await visit("/admin");
|
2019-04-01 06:39:49 -04:00
|
|
|
await click(".dashboard .navigation-item.reports .navigation-link");
|
2018-12-19 08:44:43 -05:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 06:39:49 -04:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 08:44:43 -05:00
|
|
|
1
|
|
|
|
);
|
|
|
|
|
2019-04-01 06:39:49 -04:00
|
|
|
await fillIn(".dashboard .filter-reports-input", "flags");
|
2018-12-19 08:44:43 -05:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 06:39:49 -04:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 08:44:43 -05:00
|
|
|
0
|
|
|
|
);
|
|
|
|
|
2019-04-01 06:39:49 -04:00
|
|
|
await click(".dashboard .navigation-item.security .navigation-link");
|
|
|
|
await click(".dashboard .navigation-item.reports .navigation-link");
|
2018-12-19 08:44:43 -05:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 06:39:49 -04:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 08:44:43 -05:00
|
|
|
1,
|
|
|
|
"navigating back and forth resets filter"
|
|
|
|
);
|
|
|
|
|
2019-04-01 06:39:49 -04:00
|
|
|
await fillIn(".dashboard .filter-reports-input", "activities");
|
2018-12-19 08:44:43 -05:00
|
|
|
|
|
|
|
assert.equal(
|
2019-04-01 06:39:49 -04:00
|
|
|
find(".dashboard .reports-index.section .reports-list .report").length,
|
2018-12-19 08:44:43 -05:00
|
|
|
1,
|
|
|
|
"filter is case insensitive"
|
|
|
|
);
|
|
|
|
});
|
2019-04-26 06:17:10 -04:00
|
|
|
|
2020-04-30 11:31:04 -04:00
|
|
|
QUnit.test("reports filters", async assert => {
|
2019-04-26 06:17:10 -04:00
|
|
|
await visit(
|
2020-04-22 16:17:53 -04:00
|
|
|
'/admin/reports/signups_with_groups?end_date=2018-07-16&filters=%7B"group"%3A88%7D&start_date=2018-06-16'
|
2019-04-26 06:17:10 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
const groupFilter = selectKit(".group-filter .combo-box");
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
groupFilter.header().value(),
|
|
|
|
88,
|
|
|
|
"its set the value of the filter from the query params"
|
|
|
|
);
|
|
|
|
});
|
2020-04-30 11:31:04 -04:00
|
|
|
|
|
|
|
acceptance("Dashboard: dashboard_visible_tabs", {
|
|
|
|
loggedIn: true,
|
|
|
|
settings: {
|
|
|
|
dashboard_visible_tabs: "general|security|reports"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("visible tabs", async assert => {
|
|
|
|
await visit("/admin");
|
|
|
|
|
|
|
|
assert.ok(exists(".dashboard .navigation-item.general"), "general tab");
|
|
|
|
assert.notOk(
|
|
|
|
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");
|
|
|
|
});
|
|
|
|
|
|
|
|
acceptance("Dashboard: dashboard_hidden_reports", {
|
|
|
|
loggedIn: true,
|
|
|
|
settings: {
|
|
|
|
dashboard_visible_tabs: "reports",
|
|
|
|
dashboard_hidden_reports: "posts|dau_by_mau"
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test("hidden reports", async assert => {
|
|
|
|
await visit("/admin");
|
|
|
|
|
|
|
|
assert.ok(exists(".admin-report.signups.is-visible"), "signups report");
|
|
|
|
assert.notOk(exists(".admin-report.is-visible.posts"), "posts report");
|
|
|
|
assert.notOk(
|
|
|
|
exists(".admin-report.is-visible.dau-by-mau"),
|
|
|
|
"dau-by-mau report"
|
|
|
|
);
|
|
|
|
});
|