Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Wire up progress bars for pageview and plan limits (#6085)
Sanne de Vries2e98bd598119
diff --git a/lib/plausible_web/components/billing/billing.ex b/lib/plausible_web/components/billing/billing.exindex 56f8113139..1fe4f7710a 100644--- a/lib/plausible_web/components/billing/billing.ex+++ b/lib/plausible_web/components/billing/billing.ex@@ -52,187 +52,112 @@ defmodule PlausibleWeb.Components.Billing dodef render_monthly_pageview_usage(%{usage: usage} = assigns)when is_map_key(usage, :last_30_days) do~H"""- <.monthly_pageview_usage_table usage={@usage.last_30_days} limit={@limit} period={:last_30_days} />+ <.monthly_pageview_usage_breakdown+ usage={@usage.last_30_days}+ limit={@limit}+ period={:last_30_days}+ expanded={true}+ />"""enddef render_monthly_pageview_usage(assigns) do+ exceeded =+ Plausible.Billing.Quota.exceeded_cycles(assigns.usage, assigns.limit, with_margin: false)++ show_all = :last_cycle in exceeded or :current_cycle in exceeded++ assigns = assign(assigns, :show_all, show_all)+~H"""- <article id="monthly_pageview_usage_container" x-data="{ tab: 'last_cycle' }">- <div class="mb-4">- <ol class="divide-y divide-gray-300 dark:divide-gray-600 rounded-md border dark:border-gray-600 md:flex md:flex-row-reverse md:divide-y-0 md:overflow-hidden">- <.billing_cycle_tab- name="Upcoming cycle"- tab={:current_cycle}- date_range={@usage.current_cycle.date_range}- with_separator={true}- />- <.billing_cycle_tab- name="Last cycle"- tab={:last_cycle}- date_range={@usage.last_cycle.date_range}- with_separator={true}- />- <.billing_cycle_tab- name="Penultimate cycle"- tab={:penultimate_cycle}- date_range={@usage.penultimate_cycle.date_range}- disabled={@usage.penultimate_cycle.total == 0}- />- </ol>- </div>- <div x-show="tab === 'current_cycle'">- <.monthly_pageview_usage_table- usage={@usage.current_cycle}+ <div id="monthly_pageview_usage_container" class="flex flex-col gap-12 pb-2">+ <.monthly_pageview_usage_breakdown+ usage={@usage.current_cycle}+ limit={@limit}+ period={:current_cycle}+ expanded={not @show_all}+ />+ <%= if @show_all do %>+ <.monthly_pageview_usage_breakdown+ usage={@usage.last_cycle}limit={@limit}- period={:current_cycle}+ period={:last_cycle}+ expanded={false}/>- </div>- <div x-show="tab === 'last_cycle'">- <.monthly_pageview_usage_table usage={@usage.last_cycle} limit={@limit} period={:last_cycle} />- </div>- <div x-show="tab === 'penultimate_cycle'">- <.monthly_pageview_usage_table+ <.monthly_pageview_usage_breakdownusage={@usage.penultimate_cycle}limit={@limit}period={:penultimate_cycle}+ expanded={false}/>- </div>- </article>+ <% end %>+ </div>"""endattr(:usage, :map, required: true)attr(:limit, :any, required: true)attr(:period, :atom, required: true)+ attr(:expanded, :boolean, required: true)- defp monthly_pageview_usage_table(assigns) do- ~H"""- <.usage_and_limits_table>- <.usage_and_limits_row- id={"total_pageviews_#{@period}"}- title={"Total billable pageviews#{if @period == :last_30_days, do: " (last 30 days)"}"}- usage={@usage.total}- limit={@limit}- />- <.usage_and_limits_row- id={"pageviews_#{@period}"}- pad- title="Pageviews"- usage={@usage.pageviews}- />- <.usage_and_limits_row- id={"custom_events_#{@period}"}- pad- title="Custom events"- usage={@usage.custom_events}- />- </.usage_and_limits_table>- """- end-- attr(:name, :string, required: true)- attr(:date_range, :any, required: true)- attr(:tab, :atom, required: true)- attr(:disabled, :boolean, default: false)- attr(:with_separator, :boolean, default: false)-- defp billing_cycle_tab(assigns) do+ defp monthly_pageview_usage_breakdown(assigns) do~H"""- <li id={"billing_cycle_tab_#{@tab}"} class="relative md:w-1/3">- <button- class={["w-full group", @disabled && "pointer-events-none opacity-50 dark:opacity-25"]}- x-on:click={"tab = '#{@tab}'"}- >- <span- class="absolute left-0 top-0 h-full w-1 md:bottom-0 md:top-auto md:h-1 md:w-full"- x-bind:class={"tab === '#{@tab}' ? 'bg-indigo-500' : 'bg-transparent group-hover:bg-gray-200 dark:group-hover:bg-gray-700 '"}- aria-hidden="true"- >+ <div class="flex flex-col gap-3" x-data={"{ open: #{@expanded} }"}>+ <div class="flex flex-col gap-2">+ <p class="text-xs text-gray-600 dark:text-gray-400">+ {PlausibleWeb.TextHelpers.format_date_range(@usage.date_range)}+ <span :if={@period in [:current_cycle, :last_30_days]}>{cycle_label(@period)}</span>+ </p>+ <.usage_progress_bar id={"total_pageviews_#{@period}"} usage={@usage.total} limit={@limit} />+ </div>+ <button class="flex justify-between items-center w-full text-left" x-on:click="open = !open">+ <span class="flex items-center gap-1 text-sm font-medium text-gray-900 dark:text-gray-100">+ <Heroicons.chevron_right+ mini+ class="size-4 transition-transform"+ x-bind:class="open ? 'rotate-90' : ''"+ /> Total billable pageviews</span>- <div class={"flex items-center justify-between md:flex-col md:items-start py-2 pr-2 #{if @with_separator, do: "pl-2 md:pl-4", else: "pl-2"}"}>- <span- class="text-sm dark:text-gray-100"- x-bind:class={"tab === '#{@tab}' ? 'text-indigo-600 dark:text-indigo-500 font-semibold' : 'font-medium'"}- >- {@name}+ <span class="text-sm font-medium text-gray-900 dark:text-gray-100">+ {PlausibleWeb.TextHelpers.number_format(@usage.total)}+ {if is_number(@limit), do: "/ #{PlausibleWeb.TextHelpers.number_format(@limit)}"}+ {if @limit == :unlimited, do: "/ Unlimited"}+ </span>+ </button>+ <div x-show="open" class="flex flex-col gap-3 text-sm text-gray-900 dark:text-gray-100">+ <div id={"pageviews_#{@period}"} class="flex justify-between">+ <span>+ <span class="inline-block size-4 mr-1 text-center">•</span> Pageviews</span>- <span class="flex text-xs text-gray-500 dark:text-gray-400">- {if @disabled,- do: "Not available",- else: PlausibleWeb.TextHelpers.format_date_range(@date_range)}+ <span>{PlausibleWeb.TextHelpers.number_format(@usage.pageviews)}</span>+ </div>+ <div id={"custom_events_#{@period}"} class="flex justify-between">+ <span>+ <span class="inline-block size-4 mr-1 text-center">•</span> Custom events</span>+ <span>{PlausibleWeb.TextHelpers.number_format(@usage.custom_events)}</span></div>- </button>- <div- :if={@with_separator}- class="absolute inset-0 left-0 top-0 w-3 hidden md:block"- aria-hidden="true"- >- <svg- class="h-full w-full text-gray-300 dark:text-gray-600"- viewBox="0 0 12 82"- fill="none"- preserveAspectRatio="none"- >- <path- d="M0.5 0V31L10.5 41L0.5 51V82"- stroke="currentcolor"- vector-effect="non-scaling-stroke"- />- </svg></div>- </li>- """- end-- slot(:inner_block, required: true)- attr(:rest, :global)-- def usage_and_limits_table(assigns) do- ~H"""- <table class="min-w-full text-gray-900 dark:text-gray-100" {@rest}>- <tbody class="divide-y divide-gray-200 dark:divide-gray-700">- {render_slot(@inner_block)}- </tbody>- </table>+ </div>"""end- attr(:title, :string, required: true)- attr(:usage, :integer, required: true)- attr(:limit, :integer, default: nil)- attr(:pad, :boolean, default: false)- attr(:rest, :global)-- def usage_and_limits_row(assigns) do- ~H"""- <tr {@rest}>- <td class={["text-sm py-4 pr-1 sm:whitespace-nowrap text-left", @pad && "pl-6"]}>- {@title}- </td>- <td class="text-sm py-4 sm:whitespace-nowrap text-right">- {PlausibleWeb.TextHelpers.number_format(@usage)}- {if is_number(@limit), do: "/ #{PlausibleWeb.TextHelpers.number_format(@limit)}"}- </td>- </tr>- """- end+ defp cycle_label(:current_cycle), do: "(current cycle)"+ defp cycle_label(:last_30_days), do: "(last 30 days)"@doc """- Renders a usage progress bar with color coding based on usage percentage.+ Renders a color-coded progress bar based on usage percentage.Color scheme:- 0-90%: Green (healthy usage)- 91-99%: Gradient from green through yellow to orange (approaching limit)- 100%: Gradient from green through orange to red (at limit)"""- attr(:title, :string, required: true)attr(:usage, :integer, required: true)attr(:limit, :any, required: true)attr(:rest, :global)- def usage_progress_row(assigns) do+ def usage_progress_bar(assigns) dopercentage = calculate_percentage(assigns.usage, assigns.limit)assigns =@@ -241,23 +166,11 @@ defmodule PlausibleWeb.Components.Billing do|> assign(:color_class, progress_bar_color_from_percentage(percentage, assigns.limit))~H"""- <div class="flex flex-col gap-y-2" {@rest}>- <div class="w-full bg-gray-200 rounded-full h-1.5 dark:bg-gray-700">- <div- class={["h-1.5 rounded-full transition-all duration-300", @color_class]}- style={"width: #{@percentage}%"}- >- </div>- </div>- <div class="flex justify-between items-center text-sm font-medium text-gray-900 dark:text-gray-100">- <span>- {@title}- </span>- <span>- {PlausibleWeb.TextHelpers.number_format(@usage)}- {if is_number(@limit), do: "/ #{PlausibleWeb.TextHelpers.number_format(@limit)}"}- {if @limit == :unlimited, do: "/ Unlimited"}- </span>+ <div class="w-full bg-gray-200 rounded-full h-1.5 dark:bg-gray-700" {@rest}>+ <div+ class={["h-1.5 rounded-full transition-all duration-300", @color_class]}+ style={"width: #{@percentage}%"}+ ></div></div>"""diff --git a/lib/plausible_web/templates/settings/subscription.html.heex b/lib/plausible_web/templates/settings/subscription.html.heexindex 303c5fac7f..5cfca3d995 100644--- a/lib/plausible_web/templates/settings/subscription.html.heex+++ b/lib/plausible_web/templates/settings/subscription.html.heex@@ -107,20 +107,40 @@<.tile docs="subscription-plans"><:title>Site and team usage</:title>- <PlausibleWeb.Components.Billing.usage_and_limits_table>- <PlausibleWeb.Components.Billing.usage_and_limits_row- id="site-usage-row"- title="Owned sites"- usage={@site_usage}- limit={@site_limit}- />- <PlausibleWeb.Components.Billing.usage_and_limits_row- id="team-member-usage-row"- title="Team members"- usage={@team_member_usage}- limit={@team_member_limit}- />- </PlausibleWeb.Components.Billing.usage_and_limits_table>+ <div class="grid grid-cols-2 gap-8">+ <div class="flex flex-col gap-3">+ <PlausibleWeb.Components.Billing.usage_progress_bar+ id="site-usage-row"+ usage={@site_usage}+ limit={@site_limit}+ />+ <div class="flex justify-between text-sm font-medium text-gray-900 dark:text-gray-100">+ <span>Owned sites</span>+ <span data-test-id="sites-usage">+ {PlausibleWeb.TextHelpers.number_format(@site_usage)}+ {if is_number(@site_limit),+ do: "/ #{PlausibleWeb.TextHelpers.number_format(@site_limit)}"}+ {if @site_limit == :unlimited, do: "/ Unlimited"}+ </span>+ </div>+ </div>+ <div class="flex flex-col gap-3">+ <PlausibleWeb.Components.Billing.usage_progress_bar+ id="team-member-usage-row"+ usage={@team_member_usage}+ limit={@team_member_limit}+ />+ <div class="flex justify-between text-sm font-medium text-gray-900 dark:text-gray-100">+ <span>Team members</span>+ <span data-test-id="team-member-usage">+ {PlausibleWeb.TextHelpers.number_format(@team_member_usage)}+ {if is_number(@team_member_limit),+ do: "/ #{PlausibleWeb.TextHelpers.number_format(@team_member_limit)}"}+ {if @team_member_limit == :unlimited, do: "/ Unlimited"}+ </span>+ </div>+ </div>+ </div></.tile></.settings_tiles>diff --git a/test/plausible_web/components/billing/billing_test.exs b/test/plausible_web/components/billing/billing_test.exsindex c254231067..07a9925f9b 100644--- a/test/plausible_web/components/billing/billing_test.exs+++ b/test/plausible_web/components/billing/billing_test.exs@@ -120,90 +120,146 @@ defmodule PlausibleWeb.Components.BillingTest do|> rendered_to_string()end- describe "usage_progress_row/1" do+ describe "usage_progress_bar/1" dotest "renders progress bar with green color at 0% usage" do- html = render_progress_row(0, 10_000)+ html = render_progress_bar(0, 10_000)- assert html =~ "0"- assert html =~ "10,000"assert html =~ "width: 0"assert html =~ "bg-green-500 dark:bg-green-600"endtest "renders progress bar with green color at 50% usage" do- html = render_progress_row(5_000, 10_000)+ html = render_progress_bar(5_000, 10_000)- assert html =~ "5,000"- assert html =~ "10,000"assert html =~ "width: 50.0%"assert html =~ "bg-green-500 dark:bg-green-600"endtest "renders progress bar with green color at 90% usage" do- html = render_progress_row(9_000, 10_000)+ html = render_progress_bar(9_000, 10_000)- assert html =~ "9,000"- assert html =~ "10,000"assert html =~ "width: 90.0%"assert html =~ "bg-green-500 dark:bg-green-600"endtest "renders progress bar with gradient at 95% usage" do- html = render_progress_row(9_500, 10_000)+ html = render_progress_bar(9_500, 10_000)- assert html =~ "9,500"- assert html =~ "10,000"assert html =~ "width: 95.0%"assert html =~ "bg-gradient-to-r from-green-500 via-yellow-500 via-[80%] to-orange-500"endtest "renders progress bar with red gradient at 100% usage" do- html = render_progress_row(10_000, 10_000)+ html = render_progress_bar(10_000, 10_000)- assert html =~ "10,000"assert html =~ "width: 100.0%"assert html =~ "bg-gradient-to-r from-green-500 via-orange-500 via-[80%] to-red-500"endtest "caps percentage at 100% when usage exceeds limit" do- html = render_progress_row(15_000, 10_000)+ html = render_progress_bar(15_000, 10_000)- assert html =~ "15,000"- assert html =~ "10,000"assert html =~ "width: 100.0%"assert html =~ "bg-gradient-to-r from-green-500 via-orange-500 via-[80%] to-red-500"endtest "handles unlimited limit" do- html = render_progress_row(5_000, :unlimited)+ html = render_progress_bar(5_000, :unlimited)- assert html =~ "5,000"- assert html =~ "Unlimited"assert html =~ "width: 0%"assert html =~ "bg-green-500 dark:bg-green-600"endtest "handles zero limit" do- html = render_progress_row(0, 0)+ html = render_progress_bar(0, 0)- assert html =~ "0"assert html =~ "width: 0%"assert html =~ "bg-gray-200 dark:bg-gray-700"end+ end++ describe "render_monthly_pageview_usage/1" do+ @cycle %{+ pageviews: 0,+ custom_events: 0,+ total: 0,+ date_range: Date.range(~D[2024-01-01], ~D[2024-01-31])+ }++ test "only shows current cycle when neither last nor current cycle is exceeded" do+ usage = %{+ current_cycle: @cycle,+ last_cycle: @cycle,+ penultimate_cycle: @cycle+ }++ html = render_monthly_pageview_usage(usage, 10_000)++ assert element_exists?(html, "#total_pageviews_current_cycle")+ refute element_exists?(html, "#total_pageviews_last_cycle")+ refute element_exists?(html, "#total_pageviews_penultimate_cycle")+ end- test "includes title in output" do- html = render_progress_row(100, 1000, "Test title")+ test "shows all three cycles when last cycle is exceeded" do+ usage = %{+ current_cycle: @cycle,+ last_cycle: %{@cycle | total: 11_000},+ penultimate_cycle: @cycle+ }- assert html =~ "Test title"+ html = render_monthly_pageview_usage(usage, 10_000)++ assert element_exists?(html, "#total_pageviews_current_cycle")+ assert element_exists?(html, "#total_pageviews_last_cycle")+ assert element_exists?(html, "#total_pageviews_penultimate_cycle")end++ test "shows all three cycles when current cycle is exceeded" do+ usage = %{+ current_cycle: %{@cycle | total: 11_000},+ last_cycle: @cycle,+ penultimate_cycle: @cycle+ }++ html = render_monthly_pageview_usage(usage, 10_000)++ assert element_exists?(html, "#total_pageviews_current_cycle")+ assert element_exists?(html, "#total_pageviews_last_cycle")+ assert element_exists?(html, "#total_pageviews_penultimate_cycle")+ end++ test "shows all three cycles when both last and current cycles are exceeded" do+ usage = %{+ current_cycle: %{@cycle | total: 11_000},+ last_cycle: %{@cycle | total: 11_000},+ penultimate_cycle: @cycle+ }++ html = render_monthly_pageview_usage(usage, 10_000)++ assert element_exists?(html, "#total_pageviews_current_cycle")+ assert element_exists?(html, "#total_pageviews_last_cycle")+ assert element_exists?(html, "#total_pageviews_penultimate_cycle")+ end+ end++ defp render_progress_bar(usage, limit) do+ assigns = %{usage: usage, limit: limit}++ ~H"""+ <PlausibleWeb.Components.Billing.usage_progress_bar+ usage={@usage}+ limit={@limit}+ />+ """+ |> rendered_to_string()end- defp render_progress_row(usage, limit, title \\ "Pageviews") do- assigns = %{title: title, usage: usage, limit: limit}+ defp render_monthly_pageview_usage(usage, limit) do+ assigns = %{usage: usage, limit: limit}~H"""- <PlausibleWeb.Components.Billing.usage_progress_row- title={@title}+ <PlausibleWeb.Components.Billing.render_monthly_pageview_usageusage={@usage}limit={@limit}/>diff --git a/test/plausible_web/controllers/settings_controller_test.exs b/test/plausible_web/controllers/settings_controller_test.exsindex 032d9dc4ef..b72bc0ec4c 100644--- a/test/plausible_web/controllers/settings_controller_test.exs+++ b/test/plausible_web/controllers/settings_controller_test.exs@@ -272,7 +272,7 @@ defmodule PlausibleWeb.SettingsControllerTest doend@tag :ee_only- test "renders pageview usage for current, last, and penultimate billing cycles", %{+ test "renders billing cycle usage breakdown", %{conn: conn,user: user} do@@ -300,44 +300,15 @@ defmodule PlausibleWeb.SettingsControllerTest do|> get(Routes.settings_path(conn, :subscription))|> html_response(200)- assert text_of_element(html, "#billing_cycle_tab_current_cycle") =~- Date.range(- last_bill_date,- Date.shift(last_bill_date, month: 1, day: -1)- )- |> PlausibleWeb.TextHelpers.format_date_range()-- assert text_of_element(html, "#billing_cycle_tab_last_cycle") =~- Date.range(- Date.shift(last_bill_date, month: -1),- Date.shift(last_bill_date, day: -1)- )- |> PlausibleWeb.TextHelpers.format_date_range()-- assert text_of_element(html, "#billing_cycle_tab_penultimate_cycle") =~- Date.range(- Date.shift(last_bill_date, month: -2),- Date.shift(last_bill_date, month: -1, day: -1)- )+ assert html =~+ Date.range(last_bill_date, Date.shift(last_bill_date, month: 1, day: -1))|> PlausibleWeb.TextHelpers.format_date_range()- assert text_of_element(html, "#total_pageviews_current_cycle") =~- "Total billable pageviews 1"-assert text_of_element(html, "#pageviews_current_cycle") =~ "Pageviews 1"assert text_of_element(html, "#custom_events_current_cycle") =~ "Custom events 0"- assert text_of_element(html, "#total_pageviews_last_cycle") =~- "Total billable pageviews 1 / 10,000"-- assert text_of_element(html, "#pageviews_last_cycle") =~ "Pageviews 0"- assert text_of_element(html, "#custom_events_last_cycle") =~ "Custom events 1"-- assert text_of_element(html, "#total_pageviews_penultimate_cycle") =~- "Total billable pageviews 2 / 10,000"-- assert text_of_element(html, "#pageviews_penultimate_cycle") =~ "Pageviews 1"- assert text_of_element(html, "#custom_events_penultimate_cycle") =~ "Custom events 1"+ refute element_exists?(html, "#total_pageviews_last_cycle")+ refute element_exists?(html, "#total_pageviews_penultimate_cycle")end@tag :ee_only@@ -349,8 +320,6 @@ defmodule PlausibleWeb.SettingsControllerTest dorefute element_exists?(doc, "#total_pageviews_last_30_days")assert element_exists?(doc, "#total_pageviews_current_cycle")- assert element_exists?(doc, "#total_pageviews_last_cycle")- assert element_exists?(doc, "#total_pageviews_penultimate_cycle")endsubscribe_to_plan(user, @v4_plan_id,@@ -393,49 +362,6 @@ defmodule PlausibleWeb.SettingsControllerTest do|> assert_cycles_rendered.()end- @tag :ee_only- test "penultimate cycle is disabled if there's no usage", %{conn: conn, user: user} do- site = new_site(owner: user)-- populate_stats(site, [- build(:event, name: "pageview", timestamp: DateTime.shift(DateTime.utc_now(), day: -5)),- build(:event,- name: "customevent",- timestamp: DateTime.shift(DateTime.utc_now(), day: -20)- )- ])-- last_bill_date = Date.shift(Date.utc_today(), day: -10)-- subscribe_to_plan(user, @v4_plan_id, last_bill_date: last_bill_date)-- html =- conn- |> get(Routes.settings_path(conn, :subscription))- |> html_response(200)-- assert class_of_element(html, "#billing_cycle_tab_penultimate_cycle button") =~- "pointer-events-none"-- assert text_of_element(html, "#billing_cycle_tab_penultimate_cycle") =~ "Not available"- end-- @tag :ee_only- test "last cycle tab is selected by default", %{- conn: conn,- user: user- } do- subscribe_to_plan(user, @v4_plan_id, last_bill_date: Date.shift(Date.utc_today(), day: -1))-- html =- conn- |> get(Routes.settings_path(conn, :subscription))- |> html_response(200)-- assert text_of_attr(find(html, "#monthly_pageview_usage_container"), "x-data") ==- "{ tab: 'last_cycle' }"- end-@tag :ee_onlytest "renders last 30 days pageview usage for trials and non-active/free_10k subscriptions",%{@@ -458,10 +384,7 @@ defmodule PlausibleWeb.SettingsControllerTest doassert_usage = fn doc ->refute element_exists?(doc, "#total_pageviews_current_cycle")-- assert text_of_element(doc, "#total_pageviews_last_30_days") =~- "Total billable pageviews (last 30 days) 3"-+ assert element_exists?(doc, "#total_pageviews_last_30_days")assert text_of_element(doc, "#pageviews_last_30_days") =~ "Pageviews 1"assert text_of_element(doc, "#custom_events_last_30_days") =~ "Custom events 2"end@@ -519,39 +442,39 @@ defmodule PlausibleWeb.SettingsControllerTest dosubscribe_to_plan(user, @v3_plan_id)new_site(owner: user)- site_usage_row_text =+ html =conn|> get(Routes.settings_path(conn, :subscription))|> html_response(200)- |> text_of_element("#site-usage-row")- assert site_usage_row_text =~ "Owned sites 1 / 50"+ sites_usage_text = text_of_element(html, "[data-test-id='sites-usage']")+ assert sites_usage_text =~ "1 / 50"end@tag :ee_onlytest "renders team members usage and limit", %{conn: conn, user: user} dosubscribe_to_plan(user, @v4_plan_id)- team_member_usage_row_text =+ html =conn|> get(Routes.settings_path(conn, :subscription))|> html_response(200)- |> text_of_element("#team-member-usage-row")- assert team_member_usage_row_text =~ "Team members 0 / 3"+ team_member_usage_text = text_of_element(html, "[data-test-id='team-member-usage']")+ assert team_member_usage_text =~ "0 / 3"end@tag :ee_only- test "renders team member usage without limit if it's unlimited", %{conn: conn, user: user} do+ test "renders team member usage with unlimited limit", %{conn: conn, user: user} dosubscribe_to_plan(user, @v3_plan_id)- team_member_usage_row_text =+ html =conn|> get(Routes.settings_path(conn, :subscription))|> html_response(200)- |> text_of_element("#team-member-usage-row")- assert team_member_usage_row_text == "Team members 0"+ team_member_usage_text = text_of_element(html, "[data-test-id='team-member-usage']")+ assert team_member_usage_text =~ "/ Unlimited"endend