User Invitation Test Cases: Expired Links, Roles, and Existing Accounts

By HiTest
6 min read

User invitation test cases should follow the invitation all the way to membership. Sending an email is one observation. Confirming that the intended person joined the intended workspace with the intended role is another.

The difficult cases often involve existing state: the recipient is already signed in with another account, the invitation was revoked, an admin changed the proposed role, or the recipient belongs to several organizations. Build your checklist around those conditions.

Define what an invitation authorizes

Before writing cases, document who may invite, which roles they may grant, how long an invitation remains valid, and whether acceptance is bound to a particular identity or verified address. Also define what resending does to older links and what happens when an already-active member is invited again.

These rules differ across applications. A test should not assume that all invitation links are interchangeable bearer links, or that every product allows acceptance by any signed-in user.

Prepare two workspaces, an inviter, a fresh recipient, an existing recipient, and a separate signed-in identity. Use approved inbox access and disposable membership data.

A pending invitation branches to accepted, expired, or revoked; only acceptance leads to the intended membership.

Open full size

Check the final recipient, workspace, and role. Expired and revoked invitations should not create membership.

Sending and managing invitation test cases

CaseActionExpected result
Authorized inviterInvite a fresh recipient as an allowed roleOne pending invitation contains the intended recipient, workspace, and proposed role
Restricted inviterAttempt the workflow as a user without invitation permissionThe action cannot be completed; backend enforcement is covered separately
Invalid recipientSubmit a malformed recipient addressA useful validation message appears without creating an invitation
Duplicate pending inviteInvite the same recipient againBehavior follows the documented resend or duplicate rule
Existing memberInvite someone already in the workspaceThe app avoids unintended duplicate membership or role escalation
Role choiceSelect each role the inviter is allowed to grantThe invitation reflects the chosen role and disallows unsupported grants
Seat limitInvite when the workspace has reached its configured limitThe product follows its seat policy and explains any restriction
RevokeRevoke a pending invitationThe invitation is marked appropriately and its link no longer grants membership
ResendResend a pending invitationDelivery is attempted and old-link behavior follows the documented policy

Do not treat an on-screen “sent” message as proof of email delivery. Check receipt through the prepared inbox or a separate delivery check. A browser-only case may cover the UI while leaving delivery explicitly unverified.

Acceptance and workspace-routing test cases

CaseStarting condition and actionExpected result
Fresh recipientOpen a valid invitation without an existing accountRegistration and acceptance lead to the invited workspace with the proposed role
Existing recipientOpen a valid invitation for an existing accountThe account gains the intended membership without losing unrelated memberships
Wrong signed-in accountOpen the invitation while signed in as another identityThe app follows its identity-binding rule and offers an appropriate account-switch path
Expired linkOpen an expired invitationNo membership is granted; the user gets a useful next step
Revoked linkOpen the link after revocationAcceptance is unavailable and no membership is created
Repeated acceptanceReopen a successfully used linkThe app handles the visit coherently without duplicating membership
Role changed before acceptanceUpdate the invitation role, then acceptThe accepted role follows the documented change policy
Multi-workspace recipientAccept while already belonging to another workspaceThe intended workspace is identifiable and both memberships remain correct
Return visitSign out and back in after acceptanceThe invited workspace remains accessible with the correct role
First permitted actionPerform a task granted by the invited roleThe action works within the intended workspace
First forbidden actionAttempt a task outside that roleThe restricted workflow cannot be completed

Use the RBAC test matrix for detailed permission checks after acceptance. The invitation suite should establish that the membership was created correctly; it does not need to repeat every role scenario.

Example: accepting as the wrong signed-in user

Consider a product whose invitations require the recipient's verified address. The following is an illustrative test specification for that policy.

Preconditions: a pending invitation for the intended test recipient, a different signed-in test identity, and a disposable workspace.

  1. Open the pending invitation in the other identity's browser session. Expect the app to show the recipient mismatch or direct the user through the approved identity check.
  2. Confirm that the other identity has not gained membership.
  3. Switch through the supported sign-in flow to the intended recipient.
  4. Resume acceptance. Expect membership in the invited workspace with the intended role.
  5. Reopen the workspace after signing in again. Expect the same membership and role.

If your product deliberately supports a different acceptance policy, change the expected results. The purpose is to verify your identity rule consistently, not to impose this example on every SaaS app.

Prepare data so retries remain meaningful

An accepted invitation is no longer a fresh pending invitation. Reusing it in a later “first acceptance” case changes the test. Provision separate invitations for expired, revoked, and valid-link cases, and record how each state was prepared.

Resend and role-edit cases can also affect one another. Avoid parallel runs mutating the same invitation. Give each run a disposable recipient or isolated workspace, and clean up both pending invitations and created memberships according to the test plan.

When a case fails, preserve the starting invitation state, active identity, workspace, link status, and observed outcome. Keep invitation URLs and access tokens out of public reports.

Use HiTest for reviewed invitation journeys

Create manual cases for the acceptance behavior your team has approved. Use explicit test account context for logged-in portions. If inbox retrieval or fresh-account setup is outside the available browser flow, prepare that state separately and record the boundary.

Do not assume one case can switch between multiple stored accounts automatically. Split inviter and recipient work into independently prepared cases when that makes execution reliable. Connect them through known setup rather than an unrecorded dependency on a previous run.

See signup and onboarding cases for the registration portion of a new recipient's journey.

Frequently asked questions

What should an invitation test assert after acceptance?

Assert identity, workspace, role, membership persistence, and one role-relevant action. A welcome screen alone is weak evidence of the membership created.

That depends on the product's invitation policy. Document the rule and test both the old and new link against it.

Can email delivery and acceptance be tested separately?

Yes. Separate checks make failures easier to identify, provided the coverage record is clear about which part each check verifies and there is still coverage of the connected journey.