Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Run full test suite against `read_team_schemas` FF on CI (#4763)

Adrian Gruntkowski5d9e94770d96
diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml
index ad04573915..30f2b3295d 100644
--- a/.github/workflows/elixir.yml
+++ b/.github/workflows/elixir.yml
@@ -16,25 +16,25 @@ env:
jobs:
build:
- name: "Build and test (${{ matrix.mix_env }}, ${{ matrix.postgres_image }}${{ matrix.test_experimental_reduced_joins == '1' && ', experimental_reduced_joins' || '' }})"
+ name: "Build and test (${{ matrix.mix_env }}, ${{ matrix.postgres_image }}${{ matrix.test_read_team_schemas_and_experimental_reduced_joins == '1' && ', read_team_schemas_and_experimental_reduced_joins' || '' }})"
runs-on: ubuntu-latest
strategy:
matrix:
mix_env: ["test", "ce_test"]
postgres_image: ["postgres:16"]
- test_experimental_reduced_joins: ["0"]
+ test_read_team_schemas_and_experimental_reduced_joins: ["0"]
include:
- mix_env: "test"
postgres_image: "postgres:15"
- test_experimental_reduced_joins: "0"
+ test_read_team_schemas_and_experimental_reduced_joins: "0"
- mix_env: "test"
postgres_image: "postgres:16"
- test_experimental_reduced_joins: "1"
+ test_read_team_schemas_and_experimental_reduced_joins: "1"
env:
MIX_ENV: ${{ matrix.mix_env }}
- TEST_EXPERIMENTAL_REDUCED_JOINS: ${{ matrix.test_experimental_reduced_joins }}
+ TEST_READ_TEAM_SCHEMAS_AND_EXPERIMENTAL_REDUCED_JOINS: ${{ matrix.test_read_team_schemas_and_experimental_reduced_joins }}
services:
postgres:
image: ${{ matrix.postgres_image }}
diff --git a/test/plausible_web/live/sites_test.exs b/test/plausible_web/live/sites_test.exs
index 6e29cb7839..61c1af0443 100644
--- a/test/plausible_web/live/sites_test.exs
+++ b/test/plausible_web/live/sites_test.exs
@@ -16,6 +16,22 @@ defmodule PlausibleWeb.Live.SitesTest do
assert text(html) =~ "You don't have any sites yet"
end
+ test "renders metadata for invitation", %{
+ conn: conn,
+ user: user
+ } do
+ inviter = new_user()
+ site = new_site(owner: inviter)
+
+ invitation = invite_guest(site, user, inviter: inviter, role: :viewer)
+
+ {:ok, _lv, html} = live(conn, "/sites")
+
+ invitation_data = get_invitation_data(html)
+
+ assert get_in(invitation_data, ["invitations", invitation.invitation_id, "invitation"])
+ end
+
@tag :ee_only
test "renders ownership transfer invitation for a case with no plan", %{
conn: conn,
diff --git a/test/support/teams/test.ex b/test/support/teams/test.ex
index 93fd3b8994..f1f2b8fa7a 100644
--- a/test/support/teams/test.ex
+++ b/test/support/teams/test.ex
@@ -78,7 +78,13 @@ defmodule Plausible.Teams.Test do
)
team_invitation =
- insert(:team_invitation, team: team, email: email, inviter: inviter, role: :guest)
+ insert(:team_invitation,
+ invitation_id: old_model_invitation.invitation_id,
+ team: team,
+ email: email,
+ inviter: inviter,
+ role: :guest
+ )
insert(:guest_invitation, team_invitation: team_invitation, site: site, role: role)
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 53956b8a9a..d405644c56 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -6,15 +6,16 @@ end
Mox.defmock(Plausible.HTTPClient.Mock, for: Plausible.HTTPClient.Interface)
Application.ensure_all_started(:double)
-# Temporary flag to test `experimental_reduced_joins` flag on all tests.
-if System.get_env("TEST_EXPERIMENTAL_REDUCED_JOINS") == "1" do
+# Temporary flag to test `read_team_schemas` and `experimental_reduced_joins`
+# flags on all tests.
+if System.get_env("TEST_READ_TEAM_SCHEMAS_AND_EXPERIMENTAL_REDUCED_JOINS") == "1" do
+ FunWithFlags.enable(:read_team_schemas)
FunWithFlags.enable(:experimental_reduced_joins)
else
+ FunWithFlags.disable(:read_team_schemas)
FunWithFlags.disable(:experimental_reduced_joins)
end
-FunWithFlags.enable(:read_team_schemas)
-
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual)
# warn about minio if it's included in tests but not running