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
Team setup UI refactor (#6731)
RobertJoonasb1cd135852fb
diff --git a/assets/js/liveview/member-rows.js b/assets/js/liveview/member-rows.jsindex 4a203c7254..31a6e3422d 100644--- a/assets/js/liveview/member-rows.js+++ b/assets/js/liveview/member-rows.js@@ -2,167 +2,65 @@// waiting on a server round trip - this is a JS hook rather than plain// LiveView because that latency would be noticeable for something the// server doesn't need to know about until the form is actually submitted.--const ROW_ID_PLACEHOLDER = '__ROW_ID__'--const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1)+//+// Every row up to the team member limit is rendered by the server on+// mount, all but the first one hidden - that way each row's role picker+// (Prima.Listbox, see prima_listbox.ex) mounts as an ordinary LiveView+// hook the normal way. No row is ever created or destroyed after mount:+// "add" reveals the next hidden row, "remove" hides one and moves it to+// the end so a later "add" doesn't re-insert it in the middle.export default {mounted() {- this.template = this.el.querySelector('template[data-row-template]')this.list = this.el.querySelector('[data-row-list]')- this.maxRows = parseInt(this.el.dataset.maxRows, 10)this.addButton = this.el.querySelector('[data-add-row]')this.addButton.addEventListener('click', () => this.addRow())this.list.addEventListener('click', (e) => {const removeButton = e.target.closest('[data-remove-row]')- if (removeButton) return this.removeRow(removeButton)-- const roleItem = e.target.closest('[data-role-item]')- if (roleItem) return this.selectRole(roleItem)+ if (removeButton) this.removeRow(removeButton)})- // Native <details> only closes on a second click on <summary> - close it- // on an outside click too, like any other dropdown.- this.handleOutsideClick = (e) => {- this.list- .querySelectorAll('[data-role-picker][open]')- .forEach((details) => {- if (!details.contains(e.target)) this.closeRolePicker(details)- })- }- document.addEventListener('click', this.handleOutsideClick)-- this.list- .querySelectorAll('[data-role-picker]')- .forEach((details) => this.wireRolePicker(details))-this.updateAddButtonState()},- destroyed() {- document.removeEventListener('click', this.handleOutsideClick)- },-addRow() {- if (this.list.children.length >= this.maxRows) return-- const rowId =- window.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`-- const html = this.template.innerHTML.replaceAll(ROW_ID_PLACEHOLDER, rowId)- const wrapper = document.createElement('div')- wrapper.innerHTML = html- const row = wrapper.firstElementChild+ const nextRow = [...this.list.children].find((row) =>+ row.classList.contains('hidden')+ )+ if (!nextRow) return- this.list.appendChild(row)- this.wireRolePicker(row.querySelector('[data-role-picker]'))+ nextRow.classList.remove('hidden')+ nextRow.classList.add('flex')+ nextRow.querySelector('input[type="email"]').focus()this.updateAddButtonState()- row.querySelector('input[type="email"]').focus()- },-- updateAddButtonState() {- const atLimit = this.list.children.length >= this.maxRows-- this.addButton.classList.toggle('hidden', atLimit)- this.addButton.classList.toggle('inline-flex', !atLimit)},removeRow(button) {- button.closest('[data-row]').remove()- this.updateAddButtonState()- },-- selectRole(item) {- const row = item.closest('[data-row]')- const details = row.querySelector('[data-role-picker]')- const items = [...details.querySelectorAll('[data-role-item]')]- const role = item.dataset.roleItem-- row.querySelector('[data-role-value]').value = role- row.querySelector('[data-role-label]').textContent = capitalize(role)- items.forEach((i) => i.setAttribute('aria-selected', i === item))+ const row = button.closest('[data-row]')- this.closeRolePicker(details)- details.querySelector('summary').focus()- },-- // Wires up the WAI-ARIA listbox-button keyboard pattern for a role picker:- // arrow keys move a roving tabindex between options (opening the listbox on- // first use if needed), Home/End jump to the ends, Escape closes and- // returns focus to the trigger, and Tab closes the listbox on its way out.- wireRolePicker(details) {- const summary = details.querySelector('summary')- const items = [...details.querySelectorAll('[data-role-item]')]-- details.addEventListener('toggle', () => {- summary.setAttribute('aria-expanded', details.open)- this.setRovingIndex(items, 0)- })-- details.addEventListener('keydown', (e) => {- const currentIndex = items.indexOf(document.activeElement)-- switch (e.key) {- case 'ArrowDown':- e.preventDefault()- details.open = true- this.focusItem(- items,- currentIndex === -1 ? 0 : (currentIndex + 1) % items.length- )- break-- case 'ArrowUp':- e.preventDefault()- details.open = true- this.focusItem(- items,- currentIndex === -1- ? items.length - 1- : (currentIndex - 1 + items.length) % items.length- )- break-- case 'Home':- if (!details.open) return- e.preventDefault()- this.focusItem(items, 0)- break-- case 'End':- if (!details.open) return- e.preventDefault()- this.focusItem(items, items.length - 1)- break-- case 'Escape':- if (!details.open) return- this.closeRolePicker(details)- summary.focus()- break-- case 'Tab':- this.closeRolePicker(details)- break- }- })- },-- focusItem(items, index) {- this.setRovingIndex(items, index)- items[index].focus()+ row.classList.remove('flex')+ row.classList.add('hidden')+ this.resetRow(row)+ this.list.appendChild(row)+ this.updateAddButtonState()},- setRovingIndex(items, index) {- items.forEach((item, i) =>- item.setAttribute('tabindex', i === index ? '0' : '-1')+ resetRow(row) {+ row.querySelector('input[type="email"]').value = ''+ row.querySelector('[data-role-listbox]').dispatchEvent(+ new CustomEvent('prima:listbox:set-value', {+ detail: { value: 'viewer' }+ }))},- closeRolePicker(details) {- details.removeAttribute('open')+ updateAddButtonState() {+ const visibleRows = this.list.querySelectorAll('[data-row]:not(.hidden)')+ const atLimit = visibleRows.length >= this.list.children.length++ this.addButton.classList.toggle('hidden', atLimit)+ this.addButton.classList.toggle('inline-flex', !atLimit)}}diff --git a/e2e/tests/dashboard/team-setup.spec.ts b/e2e/tests/dashboard/team-setup.spec.tsindex 904b7857ef..de1b0459ce 100644--- a/e2e/tests/dashboard/team-setup.spec.ts+++ b/e2e/tests/dashboard/team-setup.spec.ts@@ -1,6 +1,6 @@import { test, expect } from '@playwright/test'-import { register, setupSite } from '../fixtures'-import { expectLiveViewConnected, randomID } from '../test-utils'+import { setupSite, subscribeToPlan } from '../fixtures'+import { expectLiveViewConnected } from '../test-utils'test('submitting team name via Enter key does not crash', async ({page,@@ -30,7 +30,7 @@ test('submitting team name via Enter key does not crash', async ({await expect(nameInput2).toHaveValue('My New Team')})-test('create team is blocked when the name is rejected on submit', async ({+test('add another button shows the next row, and disappears once the row limit is reached', async ({page,request}) => {@@ -39,120 +39,79 @@ test('create team is blocked when the name is rejected on submit', async ({await expectLiveViewConnected(page)- const createTeam = page.getByRole('button', { name: 'Create team' })- const nameInput = page.locator('input[name="team[name]"]')-- await expect(createTeam).toBeEnabled()-- await nameInput.fill('My personal sites')- await createTeam.click()+ const addAnother = page.getByRole('button', { name: 'Add another' })+ const visibleRows = page.locator('#member-rows > div:not(.hidden)')+ // 10 is the team member limit for a trial account+ const maxRows = 10- await expect(page.getByText('is reserved')).toBeVisible()- await expect(page).toHaveURL(/\/team\/setup/)+ await expect(addAnother).toBeVisible()+ await expect(page.locator('#member-rows > div')).toHaveCount(maxRows)- await test.step('recovers once the name is fixed', async () => {- await nameInput.fill('Fixed Team Name')- await createTeam.click()+ await addAnother.click()- await expect(page).toHaveURL(/\/settings\/team\/general/)- })+ await expect(+ page.locator('#member-rows > div:nth-child(2) input[type="email"]')+ ).toBeFocused()- await expectLiveViewConnected(page)+ // one row already exists by default, one more was just added above+ for (let i = 2; i < maxRows; i++) {+ await addAnother.click()+ }- await expect(page.locator('input[name="team[name]"]')).toHaveValue(- 'Fixed Team Name'- )+ await expect(visibleRows).toHaveCount(maxRows)+ await expect(addAnother).toBeHidden()})-test('creating a team when the user name is long', async ({- page,- request-}) => {- const userID = randomID()- // exactly 55 characters, prefixed with a unique ID so that `register` finds- // exactly one activation e-mail for this user- const longName = `${userID}${'a'.repeat(55)}`.slice(0, 55)- // the user name gets shortened to fit the 50 character team name limit- const expectedTeamName = `${longName.slice(0, 43)}'s team`-- const user = {- name: longName,- email: `email-${userID}@example.com`,- password: 'VeryStrongVerySecret'- }-- await register({ page, request, user })- await setupSite({ page, request, user })+test('removing and re-adding a row', async ({ page, request }) => {+ await setupSite({ page, request })+ // A growth plan with a team member limit of 3+ await subscribeToPlan({ page, planId: '857097' })await page.goto('/team/setup', { waitUntil: 'commit' })await expectLiveViewConnected(page)- // the page mounts instead of crashing on the over-long suggested name- await expect(page.getByRole('button', { name: 'Create team' })).toBeVisible()-- const nameInput = page.locator('input[name="team[name]"]')- const createTeam = page.getByRole('button', { name: 'Create team' })-- await expect(nameInput).toHaveValue(expectedTeamName)-- await test.step('a name over the limit is rejected on submit', async () => {- await nameInput.fill('b'.repeat(51))- await createTeam.click()-- await expect(- page.getByText('should be at most 50 character(s)')- ).toBeVisible()- await expect(page).toHaveURL(/\/team\/setup/)- })+ const addAnother = page.getByRole('button', { name: 'Add another' })+ const visibleRows = page.locator('#member-rows > div:not(.hidden)')- await test.step('a name carrying a URL scheme is rejected on submit', async () => {- await nameInput.fill('Cheap meds at https://spam.example.com')- await createTeam.click()+ const row1 = page.locator('#member-row-1')+ const row2 = page.locator('#member-row-2')+ const row3 = page.locator('#member-row-3')- await expect(page.getByText('cannot contain a URL')).toBeVisible()- await expect(page).toHaveURL(/\/team\/setup/)- })+ await row1.locator('input[type="email"]').fill('[email protected]')+ await row1.getByRole('button', { name: 'Role' }).click()+ await row1.getByRole('option', { name: 'Admin' }).click()- await nameInput.fill('Chosen Team Name')+ await addAnother.click()+ await row2.locator('input[type="email"]').fill('[email protected]')+ await row2.getByRole('button', { name: 'Role' }).click()+ await row2.getByRole('option', { name: 'Editor' }).click()- await createTeam.click()+ await addAnother.click()+ await row3.locator('input[type="email"]').fill('[email protected]')+ await row3.getByRole('button', { name: 'Role' }).click()+ await row3.getByRole('option', { name: 'Billing' }).click()- await expect(page).toHaveURL(/\/settings\/team\/general/)+ await row2.getByRole('button', { name: 'Remove row' }).click()- await expectLiveViewConnected(page)+ await expect(visibleRows).toHaveCount(2)+ await expect(row2).toBeHidden()- await expect(page.locator('input[name="team[name]"]')).toHaveValue(- 'Chosen Team Name'+ await expect(row1.locator('input[type="email"]')).toHaveValue()-})+ await expect(row1.getByTestId('role')).toHaveText('Admin')-test('add another button moves focus to the new row and hides once the row limit is reached', async ({- page,- request-}) => {- await setupSite({ page, request })- await page.goto('/team/setup', { waitUntil: 'commit' })-- await expectLiveViewConnected(page)-- const addAnother = page.getByRole('button', { name: 'Add another' })- // 10 is the team member limit for a trial account- const maxRows = 10-- await expect(addAnother).toBeVisible()+ await expect(row3.locator('input[type="email"]')).toHaveValue(+ )+ await expect(row3.getByTestId('role')).toHaveText('Billing')await addAnother.click()- await expect(- page.locator('#member-rows > div:last-child input[type="email"]')- ).toBeFocused()-- // one row already exists by default, one more was just added above- for (let i = 2; i < maxRows; i++) {- await addAnother.click()- }+ await expect(visibleRows).toHaveCount(3)+ await expect(visibleRows.nth(2)).toHaveAttribute('id', 'member-row-2')- await expect(page.locator('#member-rows > div')).toHaveCount(maxRows)- await expect(addAnother).toBeHidden()+ await expect(row2.locator('input[type="email"]')).toHaveValue('')+ await expect(row2.getByTestId('role')).toHaveText('Viewer')})diff --git a/e2e/tests/fixtures.ts b/e2e/tests/fixtures.tsindex f3022996ee..e66d3b92a7 100644--- a/e2e/tests/fixtures.ts+++ b/e2e/tests/fixtures.ts@@ -192,6 +192,7 @@ export async function createSharedLink({const table = page.locator('#shared-links-table')await page.goto(`/${domain}/settings/visibility`, { waitUntil: 'commit' })+ await expectLiveViewConnected(page)await page.getByRole('button', { name: 'Add shared link' }).click()@@ -519,6 +520,22 @@ export async function addFunnel({expect(response.ok()).toBeTruthy()}+export async function subscribeToPlan({+ page,+ planId+}: {+ page: Page+ planId: string+}) {+ await page.goto(`/dev/billing/create-subscription-form/${planId}`, {+ waitUntil: 'commit'+ })++ await page.getByRole('link', { name: 'Subscribe to plan' }).click()++ await expect(page).toHaveURL(/\/settings\/billing\/subscription/)+}+export async function setupSite({user,page,diff --git a/lib/plausible_web/live/components/team.ex b/lib/plausible_web/live/components/team.exindex 90a3868be2..e2ed689646 100644--- a/lib/plausible_web/live/components/team.ex+++ b/lib/plausible_web/live/components/team.ex@@ -123,7 +123,7 @@ defmodule PlausibleWeb.Live.Components.Team dosize="sm"><span class="sr-only">Role for {@user.email}:</span>- <PrimaListbox.listbox_value data-test-id="role">+ <PrimaListbox.listbox_value data-testid="role">{role_to_capitalized_string(@role)}</PrimaListbox.listbox_value><Heroicons.chevron_down mini class="size-4" />@@ -172,10 +172,10 @@ defmodule PlausibleWeb.Live.Components.Team dodef role_select_input(assigns) do~H"""- <PrimaListbox.listbox id={@id} name={@name} value={@role}>+ <PrimaListbox.listbox id={@id} name={@name} value={@role} data-role-listbox><PrimaListbox.listbox_trigger id={"#{@id}-trigger"} class="w-[100px]"><span class="sr-only">Role:</span>- <PrimaListbox.listbox_value>+ <PrimaListbox.listbox_value data-testid="role">{role_to_capitalized_string(@role)}</PrimaListbox.listbox_value><Heroicons.chevron_down mini class="size-4" />diff --git a/lib/plausible_web/live/team_setup.ex b/lib/plausible_web/live/team_setup.exindex 76f7dfd875..173303e4c1 100644--- a/lib/plausible_web/live/team_setup.ex+++ b/lib/plausible_web/live/team_setup.ex@@ -5,6 +5,8 @@ defmodule PlausibleWeb.Live.TeamSetup douse PlausibleWeb, :live_view+ import PlausibleWeb.Live.Components.Team, only: [role_select_input: 1]+alias Plausible.Teamsalias Plausible.Teams.Management.Layout@@ -78,13 +80,17 @@ defmodule PlausibleWeb.Live.TeamSetup dorequired/>- <div id="member-rows-container" phx-hook="MemberRows" data-max-rows={@max_new_members}>+ <div id="member-rows-container" phx-hook="MemberRows"><.label class="mb-2 mt-4">Team members</.label><div id="member-rows" data-row-list>- <.member_row row={%{id: "1", email: "", role: :viewer}} />+ <.member_row+ :for={n <- 1..@max_new_members//1}+ row={%{id: n, email: "", role: :viewer}}+ hidden?={n > 1}+ /></div><button@@ -94,10 +100,6 @@ defmodule PlausibleWeb.Live.TeamSetup do><Heroicons.plus class="size-4" /> Add another</button>-- <template data-row-template>- <.member_row row={%{id: "__ROW_ID__", email: "", role: :viewer}} />- </template></div><.button id="create-team-submit" type="submit" class="mt-8 w-full">@@ -111,10 +113,15 @@ defmodule PlausibleWeb.Live.TeamSetup doendattr(:row, :map, required: true)+ attr(:hidden?, :boolean, default: false)defp member_row(assigns) do~H"""- <div id={"member-row-#{@row.id}"} data-row class="flex items-center gap-x-3 mt-3">+ <div+ id={"member-row-#{@row.id}"}+ data-row+ class={["items-center gap-x-3 mt-3", if(@hidden?, do: "hidden", else: "flex")]}+ ><div class="flex-1"><.inputtype="email"@@ -124,43 +131,12 @@ defmodule PlausibleWeb.Live.TeamSetup do/></div>- <details- name="role-picker-group"- data-role-picker- class="relative inline-block text-left"- >- <summary- id={"role-picker-#{@row.id}-trigger"}- role="button"- aria-haspopup="listbox"- aria-expanded="false"- class="role w-[100px] list-none [&::-webkit-details-marker]:hidden cursor-pointer inline-flex items-center justify-between font-medium rounded-md px-3 py-2 text-sm border border-gray-300 dark:border-gray-750 text-gray-800 dark:text-gray-100 dark:bg-gray-750 dark:hover:bg-gray-700 whitespace-nowrap truncate shadow-xs hover:shadow-sm transition-all duration-150"- >- <span data-role-label>{@row.role |> Atom.to_string() |> String.capitalize()}</span>- <Heroicons.chevron_down mini class="size-4" />- </summary>-- <div- role="listbox"- aria-labelledby={"role-picker-#{@row.id}-trigger"}- class="absolute right-0 z-50 mt-2 w-max p-1.5 rounded-md shadow-lg overflow-hidden bg-white dark:bg-gray-800 ring-1 ring-black/5"- >- <button- :for={{role, description} <- PlausibleWeb.Live.Components.Team.role_descriptions()}- type="button"- role="option"- aria-selected={to_string(role == @row.role)}- tabindex="-1"- data-role-item={role}- class="block w-full max-w-60 text-left rounded-md text-sm/6 text-gray-900 dark:text-gray-100 hover:bg-gray-100 dark:hover:bg-gray-700/80 px-3 py-1.5"- >- <div>{role |> Atom.to_string() |> String.capitalize()}</div>- <div class="text-gray-500 dark:text-gray-400 text-xs/5">{description}</div>- </button>- </div>- </details>-- <input type="hidden" name={"rows[#{@row.id}][role]"} value={@row.role} data-role-value />+ <.role_select_input+ id={"role-select-#{@row.id}"}+ name={"rows[#{@row.id}][role]"}+ role={@row.role}+ my_role={:owner}+ /><buttontype="button"diff --git a/test/plausible_web/live/team_management_test.exs b/test/plausible_web/live/team_management_test.exsindex 7819eda9b2..ecab3ed1d1 100644--- a/test/plausible_web/live/team_management_test.exs+++ b/test/plausible_web/live/team_management_test.exs@@ -535,6 +535,6 @@ defmodule PlausibleWeb.Live.TeamMangementTest doenddefp role_el() do- ~s|[data-test-id="role"]|+ ~s|[data-testid="role"]|endenddiff --git a/test/plausible_web/live/team_setup_test.exs b/test/plausible_web/live/team_setup_test.exsindex f8e1a9dccb..59591fba37 100644--- a/test/plausible_web/live/team_setup_test.exs+++ b/test/plausible_web/live/team_setup_test.exs@@ -79,7 +79,7 @@ defmodule PlausibleWeb.Live.TeamSetupTest do{:ok, _lv, html} = live(conn, @url)assert element_exists?(html, ~s|input#create-team-form_name[name="team[name]"]|)assert element_exists?(html, "#create-team-submit")- assert elem_count(html, row_el()) == 1+ assert elem_count(html, visible_row_el()) == 1endtest "marks the name input as required so the browser blocks a blank submit", %{conn: conn} do@@ -163,8 +163,10 @@ defmodule PlausibleWeb.Live.TeamSetupTest dotest "starts out with a single empty row defaulting to viewer", %{conn: conn} do{:ok, _lv, html} = live(conn, @url)- assert elem_count(html, row_el()) == 1- assert text_of_attr(html, ~s|#member-rows input[type="hidden"]|, "value") == "viewer"+ assert elem_count(html, visible_row_el()) == 1++ assert text_of_attr(html, ~s|#{visible_row_el()} input[type="hidden"]|, "value") ==+ "viewer"endtest "creating the team sends out an invitation for a filled row with the given role", %{@@ -265,7 +267,8 @@ defmodule PlausibleWeb.Live.TeamSetupTest do# The client-side row cap itself (assets/js/liveview/member-rows.js) can't# be exercised here since ExUnit's LiveViewTest can't drive that JS - these- # tests cover the server-computed limit it's seeded from via `data-max-rows`.+ # tests cover the server-computed limit instead, by counting how many rows+ # (visible or not) it renders up front for the JS to reveal on "add".describe "/team/setup - member row limit" dosetup [:create_user, :log_in, :create_team]@@ -273,7 +276,7 @@ defmodule PlausibleWeb.Live.TeamSetupTest dotest "defaults to the trial team member limit", %{conn: conn} do{:ok, _lv, html} = live(conn, @url)- assert text_of_attr(html, "#member-rows-container", "data-max-rows") == "10"+ assert elem_count(html, row_el()) == 10end@tag :ee_only@@ -283,7 +286,7 @@ defmodule PlausibleWeb.Live.TeamSetupTest do{:ok, _lv, html} = live(conn, @url)- assert text_of_attr(html, "#member-rows-container", "data-max-rows") == "10"+ assert elem_count(html, row_el()) == 10end@tag :ee_only@@ -292,11 +295,25 @@ defmodule PlausibleWeb.Live.TeamSetupTest do{:ok, _lv, html} = live(conn, @url)- assert text_of_attr(html, "#member-rows-container", "data-max-rows") == "20"+ assert elem_count(html, row_el()) == 20+ end++ @tag :ee_only+ test "renders no rows for a solo team (member limit 0)", %{conn: conn, user: user} do+ subscribe_to_starter_plan(user)++ # Normally, starter tier accounts shouldn't even be setting up teams because+ # there's no point to do so. However, their access to the team setup page is+ # not restricted on the plug level, so this test makes sure it behaves+ # correctly and doesn't crash even in that scenario.+ {:ok, _lv, html} = live(conn, @url)++ assert elem_count(html, row_el()) == 0endenddefp row_el(), do: ~s|#member-rows > div|+ defp visible_row_el(), do: ~s|#member-rows > div:not(.hidden)|defp finish_setup(lv, opts) doname = Keyword.get(opts, :name, "Jane Smith's team")diff --git a/test/support/dev/billing/dev_subscriptions.ex b/test/support/dev/billing/dev_subscriptions.exindex f92a28028f..d18c5c0db4 100644--- a/test/support/dev/billing/dev_subscriptions.ex+++ b/test/support/dev/billing/dev_subscriptions.ex@@ -13,13 +13,6 @@ defmodule Plausible.Billing.DevSubscriptions doalias Plausible.{Repo, Billing}alias Plausible.Billing.{Plan, EnterprisePlan, DevPaddleApiMock}- def create_after_1s(team_id, plan_id) do- Task.start(fn ->- Process.sleep(1000)- create(team_id, plan_id)- end)- end-def create(team_id, plan_id, opts \\ []) doplan_or_enterprise_plan = get_plan_or_enterprise_plan(plan_id)diff --git a/test/support/dev/controllers/dev_subscription_controller.ex b/test/support/dev/controllers/dev_subscription_controller.exindex 3e48bf16c7..4d65bea210 100644--- a/test/support/dev/controllers/dev_subscription_controller.ex+++ b/test/support/dev/controllers/dev_subscription_controller.ex@@ -53,8 +53,8 @@ defmodule PlausibleWeb.DevSubscriptionController do%{current_user: %User{} = user} -> Teams.force_create_my_team(user)end- DevSubscriptions.create_after_1s(for_team.id, plan_id)- redirect(conn, to: ~p"/billing/upgrade-success")+ DevSubscriptions.create(for_team.id, plan_id)+ redirect(conn, to: ~p"/settings/billing/subscription")enddef update(conn, %{"status" => status}) dodiff --git a/test/support/dev/templates/dev_subscription/create_dev_subscription.heex b/test/support/dev/templates/dev_subscription/create_dev_subscription.heexindex 0a234cb919..6ce6591f13 100644--- a/test/support/dev/templates/dev_subscription/create_dev_subscription.heex+++ b/test/support/dev/templates/dev_subscription/create_dev_subscription.heex@@ -15,7 +15,7 @@</ul><br />- This local implementation skips steps 1-3, redirecting you first to <b><code>/billing/upgrade-success</code></b>, and after a short artificial delay, to <b><code>/settings</code></b>, with the subscription created.+ This local implementation skips steps 1-3, creating the subscription immediately and redirecting you straight to <b><code>/settings</code></b>.<br /><br />Read more about dev and staging subscriptions in the <aclass="text-indigo-600"