From a9c3437d515c27a8dc17d752b701e0ae78bbf876 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 25 Apr 2018 10:28:41 +0200 Subject: [PATCH] dashboard next: adds basic spec --- .../acceptance/dashboard-next-test.js.es6 | 16 ++ .../fixtures/dashboard-next.js.es6 | 146 ++++++++++++++++++ test/javascripts/fixtures/signups.js.es6 | 45 ++++++ test/javascripts/fixtures/topics.js.es6 | 48 ++++++ .../fixtures/trending-search.js.es6 | 22 +++ 5 files changed, 277 insertions(+) create mode 100644 test/javascripts/acceptance/dashboard-next-test.js.es6 create mode 100644 test/javascripts/fixtures/dashboard-next.js.es6 create mode 100644 test/javascripts/fixtures/signups.js.es6 create mode 100644 test/javascripts/fixtures/topics.js.es6 create mode 100644 test/javascripts/fixtures/trending-search.js.es6 diff --git a/test/javascripts/acceptance/dashboard-next-test.js.es6 b/test/javascripts/acceptance/dashboard-next-test.js.es6 new file mode 100644 index 00000000000..df119a0563a --- /dev/null +++ b/test/javascripts/acceptance/dashboard-next-test.js.es6 @@ -0,0 +1,16 @@ +import { + acceptance +} +from "helpers/qunit-helpers"; + +acceptance("Dashboard Next", { + loggedIn: true +}); + +QUnit.test("Vist dashboard next page", assert => { + visit("/admin/dashboard-next"); + + andThen(() => { + assert.ok($('.dashboard-next').length, "has dashboard-next class"); + }); +}); diff --git a/test/javascripts/fixtures/dashboard-next.js.es6 b/test/javascripts/fixtures/dashboard-next.js.es6 new file mode 100644 index 00000000000..4d5a8967064 --- /dev/null +++ b/test/javascripts/fixtures/dashboard-next.js.es6 @@ -0,0 +1,146 @@ +export default { + "/admin/dashboard-next.json": { + "global_reports": [{ + "type": "signups", + "title": "New Users", + "xaxis": "Day", + "yaxis": "Number of new users", + "data": [{ + "x": "2018-04-11", + "y": 10 + }, { + "x": "2018-04-12", + "y": 10 + }, { + "x": "2018-04-13", + "y": 58 + }, { + "x": "2018-04-15", + "y": 10 + }, { + "x": "2018-04-16", + "y": 10 + }, { + "x": "2018-04-17", + "y": 19 + }, { + "x": "2018-04-19", + "y": 19 + }], + "total": 136, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": 0, + "labels": null + }, { + "type": "topics", + "title": "Topics", + "xaxis": "Day", + "yaxis": "Number of new topics", + "data": [{ + "x": "2018-04-11", + "y": 10 + }, { + "x": "2018-04-12", + "y": 10 + }, { + "x": "2018-04-13", + "y": 60 + }, { + "x": "2018-04-15", + "y": 10 + }, { + "x": "2018-04-16", + "y": 10 + }, { + "x": "2018-04-17", + "y": 10 + }, { + "x": "2018-04-19", + "y": 10 + }, { + "x": "2018-04-20", + "y": 1 + }], + "total": 121, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": 0, + "labels": null + }, { + "type": "trending_search", + "title": "Trending search", + "xaxis": "translation missing: en.reports.trending_search.xaxis", + "yaxis": "translation missing: en.reports.trending_search.yaxis", + "data": [ + ["lon", 3, 1], + ["pub", 1, 1], + ["something", 1, 1] + ], + "total": null, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": null, + "labels": ["Term", "Searches", "Unique"] + }], + "user_reports": [{ + "type": "users_by_trust_level", + "title": "Users per Trust Level", + "xaxis": "Trust Level", + "yaxis": "Number of Users", + "data": [{ + "x": 0, + "y": 132 + }, { + "x": 1, + "y": 1 + }, { + "x": 3, + "y": 1 + }, { + "x": 2, + "y": 1 + }, { + "x": 4, + "y": 1 + }], + "total": null, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": null, + "labels": null + }, { + "type": "users_by_type", + "title": "Users per Type", + "xaxis": "Type", + "yaxis": "Number of Users", + "data": [{ + "x": "Admin", + "y": 1 + }], + "total": null, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": null, + "labels": null + }], + "last_backup_taken_at": "2018-04-13T12:51:19.926Z", + "updated_at": "2018-04-25T08:06:11.292Z", + "disk_space": { + "uploads_used": "74.5 KB", + "uploads_free": "117 GB", + "backups_used": "4.24 GB", + "backups_free": "117 GB" + } + } +}; diff --git a/test/javascripts/fixtures/signups.js.es6 b/test/javascripts/fixtures/signups.js.es6 new file mode 100644 index 00000000000..a93d26fe06c --- /dev/null +++ b/test/javascripts/fixtures/signups.js.es6 @@ -0,0 +1,45 @@ +export default { + "/admin/reports/signups": { + "report": { + "type": "signups", + "title": "New Users", + "xaxis": "Day", + "yaxis": "Number of new users", + "data": [{ + "x": "2018-04-11", + "y": 10 + }, { + "x": "2018-04-12", + "y": 10 + }, { + "x": "2018-04-13", + "y": 22 + }, { + "x": "2018-04-14", + "y": 58 + }, { + "x": "2018-04-15", + "y": 10 + }, { + "x": "2018-04-16", + "y": 10 + }, { + "x": "2018-04-17", + "y": 19 + }, { + "x": "2018-04-18", + "y": 12 + }, { + "x": "2018-04-19", + "y": 19 + }], + "total": 136, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": 0, + "labels": null + } + } +}; diff --git a/test/javascripts/fixtures/topics.js.es6 b/test/javascripts/fixtures/topics.js.es6 new file mode 100644 index 00000000000..7291642b5c2 --- /dev/null +++ b/test/javascripts/fixtures/topics.js.es6 @@ -0,0 +1,48 @@ +export default { + "/admin/reports/topics": { + "report": { + "type": "topics", + "title": "Topics", + "xaxis": "Day", + "yaxis": "Number of new topics", + "data": [{ + "x": "2018-04-11", + "y": 10 + }, { + "x": "2018-04-12", + "y": 10 + }, { + "x": "2018-04-13", + "y": 60 + }, { + "x": "2018-04-14", + "y": 60 + }, { + "x": "2018-04-15", + "y": 10 + }, { + "x": "2018-04-16", + "y": 10 + }, { + "x": "2018-04-17", + "y": 10 + }, { + "x": "2018-04-19", + "y": 10 + }, { + "x": "2018-04-18", + "y": 10 + }, { + "x": "2018-04-20", + "y": 1 + }], + "total": 121, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": 0, + "labels": null + } + } +}; diff --git a/test/javascripts/fixtures/trending-search.js.es6 b/test/javascripts/fixtures/trending-search.js.es6 new file mode 100644 index 00000000000..11a6070aa80 --- /dev/null +++ b/test/javascripts/fixtures/trending-search.js.es6 @@ -0,0 +1,22 @@ +export default { + "/admin/reports/trending_search": { + "report": { + "type": "trending_search", + "title": "Trending search", + "xaxis": "", + "yaxis": "", + "data": [ + ["lon", 3, 1], + ["pub", 1, 1], + ["something", 1, 1] + ], + "total": null, + "start_date": "2018-03-26T00:00:00.000Z", + "end_date": "2018-04-25T23:59:59.999Z", + "category_id": null, + "group_id": null, + "prev30Days": null, + "labels": ["Term", "Searches", "Unique"] + } + } +};