Skip to content

196 — should add team with owner permissions and delete myself, then try to delete team

Description

Verifies the "at least one owner must remain" rule when ownership is granted via a team: after adding a team with the Client Owner role, removing the current user's individual membership still leaves them in the list through the team, but trying to remove the last owner-team is rejected with the owner-must-remain warning.

Preconditions

  • Signed-in user (the owner) inside a freshly registered organization
  • A client and five additional employees have been seeded via the API
  • A team has been pre-created (Team 1 = employee 1 + employee 2)
  • Browser is on the client's Members tab

Steps

  1. Click Add teams, pick Team 1, assign role Client Owner, click Save, then reload. Expected: the list has 3 entries.
  2. Verify the rows. Expected: employee 1, employee 2 and the owner all show team Team 1 / Client Owner, and the owner row has both "Team 1" and "member" removable options.
  3. Click the row-level Delete action on the owner, confirm in the modal. Expected: a "member removed" toast appears.
  4. Verify the resulting list. Expected: the list still has 3 entries (the owner remains via Team 1), but the owner's row now only exposes the "Team 1" removable option (the individual "member" option is gone).
  5. Click Remove team on the owner's Team 1 row and confirm. Expected: an "owner must remain" warning is shown and the membership is not removed.
  • Spec: playwright/tests/integration/client.spec.ts (line 816)