mirror of
https://github.com/plausible/analytics.git
synced 2024-12-28 12:01:39 +03:00
30ac901141
* Adds manual-filters + friends commit 308192044d726e9a6f7406e333048ab3407aa260 Merge:39287ab
a299fab
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri Jun 11 03:40:55 2021 -0500 Merge branch 'manual-filters' into manual-filters-2 commita299fab1fb
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri Jun 11 02:20:26 2021 -0500 Changes to split and pattern matched function for time_on_page commit10f10c933a
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri Jun 11 01:53:18 2021 -0500 Fixes a couple of minor UX issues commitf2e5ce8eb3
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri Jun 11 01:49:10 2021 -0500 Fixes time on page for globbed and negated page paths commitbb18af6526
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu Jun 10 05:24:05 2021 -0500 Close to finalized version of updated version Just needs some additional testing + potentially code cleanup commitd0b7bfe3da
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri May 28 04:21:21 2021 -0500 Real Dialyzer Fix commit296a76af34
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri May 28 03:44:29 2021 -0500 Dialyzer fix commit91f3b44017
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 17:11:24 2021 -0500 Changelog commite041f75745
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 17:09:52 2021 -0500 Formatting commitf689642204
Merge:e00929b
4ff25f6
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 17:08:47 2021 -0500 Merge branch 'master' into manual-filters commite00929b1c5
Merge:83887c4
806975e
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 17:01:48 2021 -0500 Merge branch 'manual-filters' of github.com:Vigasaurus/plausible-analytics into manual-filters commit83887c49cc
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 16:59:32 2021 -0500 Adds tests for suggestions, formats goals suggestion query commit1cb7732a08
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 16:36:31 2021 -0500 Adds goals as auto-complete capable filter commit4ca39cc406
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 16:08:22 2021 -0500 95% completed auto-complete setup Still needs: - tests - goals added as filter commit22d38c4cd8
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Thu May 27 03:47:19 2021 -0500 80% of auto-complete filters progress Still needs - countries and screen into new format - re-style dropdown and background - drop debounce time - tests commit806975ede9
Merge:81c5e05
1a93542
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Tue May 25 15:28:21 2021 -0500 Merge branch 'master' into manual-filters commit81c5e05760
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Tue May 25 15:21:03 2021 -0500 Makes colorings on top bar elements consistent commitfa7f6c2268
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Tue May 25 14:58:25 2021 -0500 Makes requested changes, adds different version of filter button commit7dc65b9b7a
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Sat May 22 04:29:01 2021 -0500 Changelog commitc684f1c76a
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Sat May 22 04:26:14 2021 -0500 Various UI Improvements - Makes edit buttons full-length & properly sized - Adds remove filter button in edit menu commita632e7a8ee
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Sat May 22 03:11:50 2021 -0500 Adds tests for exclusions and wildcards commiteb91a7942b
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Sat May 22 03:02:23 2021 -0500 Fixes editing UX on list view commit6209d72aee
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri May 21 04:01:17 2021 -0500 Bugfix in realtime view, formatting commit007d44df38
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri May 21 03:23:16 2021 -0500 Second pass - mostly everything user-facing is done Still needs: - Tests - Potentially negating other filters - Potentially some code cleanup commitcb7b5b9fbd
Author: Vignesh Joglekar <rexvigasaurus@gmail.com> Date: Fri May 21 01:49:52 2021 -0500 First pass on manual filter & path regex/negated filters Still needs: - Form structure on filter modal - Edit filter button - Filter dropdown UI improvement - Filter modal mount data collection - Tests - Potentially negating other filters * Fixes an issue between the updated React version and Flatpickr not showing up Reverting to v16 was the simplest fix without diving into the issue upstream with Flatpickr * Resolves comments on UI and code style Co-authored-by: Uku Taht <Uku.taht@gmail.com>
134 lines
4.2 KiB
Elixir
134 lines
4.2 KiB
Elixir
defmodule PlausibleWeb.Api.StatsController.SuggestionsTest do
|
|
use PlausibleWeb.ConnCase
|
|
import Plausible.TestUtils
|
|
|
|
describe "GET /api/stats/:domain/suggestions/:filter_name" do
|
|
setup [:create_user, :log_in, :create_site]
|
|
|
|
test "returns suggestions for pages without a query", %{conn: conn, site: site} do
|
|
conn = get(conn, "/api/stats/#{site.domain}/suggestions/page?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == ["/", "/register", "/contact", "/irrelevant"]
|
|
end
|
|
|
|
test "returns suggestions for pages with a query", %{conn: conn, site: site} do
|
|
conn =
|
|
get(conn, "/api/stats/#{site.domain}/suggestions/page?period=month&date=2019-01-01&q=re")
|
|
|
|
assert json_response(conn, 200) == ["/register", "/irrelevant"]
|
|
end
|
|
|
|
test "returns suggestions for pages without any suggestions", %{conn: conn, site: site} do
|
|
conn =
|
|
get(
|
|
conn,
|
|
"/api/stats/#{site.domain}/suggestions/page?period=month&date=2019-01-01&q=/123"
|
|
)
|
|
|
|
assert json_response(conn, 200) == []
|
|
end
|
|
|
|
test "returns suggestions for goals", %{conn: conn, site: site} do
|
|
conn = get(conn, "/api/stats/#{site.domain}/suggestions/goal?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == []
|
|
end
|
|
|
|
test "returns suggestions for sources", %{conn: conn, site: site} do
|
|
conn =
|
|
get(conn, "/api/stats/#{site.domain}/suggestions/source?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == ["10words", "Bing"]
|
|
end
|
|
|
|
test "returns suggestions for countries", %{conn: conn, site: site} do
|
|
conn =
|
|
get(
|
|
conn,
|
|
"/api/stats/#{site.domain}/suggestions/country?period=month&date=2019-01-01&q=GBR,UKR,URY,USA"
|
|
)
|
|
|
|
assert json_response(conn, 200) == ["USA"]
|
|
end
|
|
|
|
test "returns suggestions for countries without country in search", %{conn: conn, site: site} do
|
|
conn =
|
|
get(
|
|
conn,
|
|
"/api/stats/#{site.domain}/suggestions/country?period=month&date=2019-01-01&q=GBR,UKR,URY"
|
|
)
|
|
|
|
assert json_response(conn, 200) == []
|
|
end
|
|
|
|
test "returns suggestions for screen sizes", %{conn: conn, site: site} do
|
|
conn =
|
|
get(conn, "/api/stats/#{site.domain}/suggestions/screen?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == ["Desktop"]
|
|
end
|
|
|
|
test "returns suggestions for browsers", %{conn: conn, site: site} do
|
|
conn =
|
|
get(conn, "/api/stats/#{site.domain}/suggestions/browser?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == ["Chrome"]
|
|
end
|
|
|
|
test "returns suggestions for browser versions", %{conn: conn, site: site} do
|
|
filters = Jason.encode!(%{browser: "Chrome"})
|
|
|
|
conn =
|
|
get(
|
|
conn,
|
|
"/api/stats/#{site.domain}/suggestions/browser_version?period=month&date=2019-01-01&filters=#{
|
|
filters
|
|
}"
|
|
)
|
|
|
|
assert json_response(conn, 200) == ["78.0"]
|
|
end
|
|
|
|
test "returns suggestions for OS", %{conn: conn, site: site} do
|
|
conn = get(conn, "/api/stats/#{site.domain}/suggestions/os?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == ["Mac"]
|
|
end
|
|
|
|
test "returns suggestions for OS versions", %{conn: conn, site: site} do
|
|
filters = Jason.encode!(%{os: "Mac"})
|
|
|
|
conn =
|
|
get(
|
|
conn,
|
|
"/api/stats/#{site.domain}/suggestions/os_version?period=month&date=2019-01-01&filters=#{
|
|
filters
|
|
}"
|
|
)
|
|
|
|
assert json_response(conn, 200) == ["10.15"]
|
|
end
|
|
|
|
test "returns suggestions for OS versions with search", %{conn: conn, site: site} do
|
|
filters = Jason.encode!(%{os: "Mac"})
|
|
|
|
conn =
|
|
get(
|
|
conn,
|
|
"/api/stats/#{site.domain}/suggestions/os_version?period=month&date=2019-01-01&filters=#{
|
|
filters
|
|
}&q=11"
|
|
)
|
|
|
|
assert json_response(conn, 200) == []
|
|
end
|
|
|
|
test "returns suggestions for referrers", %{conn: conn, site: site} do
|
|
conn =
|
|
get(conn, "/api/stats/#{site.domain}/suggestions/referrer?period=month&date=2019-01-01")
|
|
|
|
assert json_response(conn, 200) == ["10words.com/page1"]
|
|
end
|
|
end
|
|
end
|