mirror of
https://github.com/plausible/analytics.git
synced 2024-12-26 11:02:52 +03:00
e8f20e67cc
* Load dashboard with react * Rename stast2 to dashboard * Save timeframe on the frontend * Implement current visitors * Implement comparisons * React to route changes * Add modals * Show number of visitors on hover * Show 'Today' for today * Add 30 days * Show referrer drilldown * Arrow keys to go back and forward * Improve comparisons UI * Fix dropdown when clicking on it * Verify API access in a memoized fashion * Test API access * Test stats through controller * Move map formatting from stats controller to stats * Remove unused code * Remove dead code from query * Remove dead code from stats templates * Add stats view test back in * Render modal inside the modal component * Implement google search terms * Add explanation for screen sizes * Separate dashboard JS from the app js
41 lines
1.3 KiB
Elixir
41 lines
1.3 KiB
Elixir
defmodule PlausibleWeb.StatsControllerTest do
|
|
use PlausibleWeb.ConnCase
|
|
use Plausible.Repo
|
|
import Plausible.TestUtils
|
|
|
|
describe "as an anonymous visitor" do
|
|
test "public site - shows site stats", %{conn: conn} do
|
|
insert(:site, domain: "public-site.io", public: true)
|
|
insert(:pageview, hostname: "public-site.io")
|
|
|
|
conn = get(conn, "/public-site.io")
|
|
assert html_response(conn, 200) =~ "stats-react-container"
|
|
end
|
|
|
|
test "can not view stats of a private website", %{conn: conn} do
|
|
insert(:pageview, hostname: "some-other-site.com")
|
|
|
|
conn = get(conn, "/some-other-site.com")
|
|
assert html_response(conn, 404) =~ "There's nothing here"
|
|
end
|
|
end
|
|
|
|
describe "as a logged in user" do
|
|
setup [:create_user, :log_in, :create_site]
|
|
|
|
test "can view stats of a website I've created", %{conn: conn, site: site} do
|
|
insert(:pageview, hostname: site.domain)
|
|
|
|
conn = get(conn, "/" <> site.domain)
|
|
assert html_response(conn, 200) =~ "stats-react-container"
|
|
end
|
|
|
|
test "can not view stats of someone else's website", %{conn: conn} do
|
|
insert(:pageview, hostname: "some-other-site.com")
|
|
|
|
conn = get(conn, "/some-other-site.com")
|
|
assert html_response(conn, 404) =~ "There's nothing here"
|
|
end
|
|
end
|
|
end
|