Clerk Auth E2E Testing Only

VerifiedSafe

Sign in Clerk users programmatically for e2e tests without interacting with the Clerk UI. Works with Replit's Clerk support.

Sby Skills Guide Bot
TestingIntermediate
8/30/2026
Claude Code
#clerk#e2e-testing#authentication#playwright#replit

Recommended for

Automated summary

This skill programmatically signs in Clerk users for e2e testing, avoiding any interaction with the Clerk UI.

Strengths

  • Bypasses the Clerk UI for faster and more reliable tests
  • Supports multi-user scenarios with independent browser contexts
  • Allows custom session TTL and redirect base path

Limitations

  • Only works with applications built on Replit's Clerk Authentication support
  • Requires the specific signInClerkUser function provided by the environment
  • The session is scoped to the browser context that navigates to the sign-in URL
When to use it

When testing an application that uses Clerk authentication and you need to sign in test users programmatically, including multi-user cases.

When not to use it

When the application does not use Clerk or is not hosted on Replit, or when testing the Clerk UI flow itself.

Security analysis

Safe
Quality score90/100

The skill provides instructions for programmatic Clerk sign-in during e2e testing using a provided function. It does not include destructive commands, exfiltration, obfuscated payloads, or attempts to disable safety mechanisms. The use of authentication APIs is for legitimate testing purposes.

No concerns found

How this analysis is made

Examples

Sign in a single test user
Use signInClerkUser to sign in testuser@example.com (firstName Test, lastName User) and navigate the page to the returned sign-in URL.
Sign in multiple users in separate contexts
Sign in two different Clerk users in separate browser contexts and verify each user sees only their own data.
Sign in with a redirect base path
Sign in a Clerk user with basePath '/my-app/' to test an artifact in a pnpm workspace, then navigate to the returned sign-in URL.

name: clerk-auth-e2e-testing-only description: Programmatic Clerk sign-in for e2e testing. Use when the application authenticates with Clerk and you need to sign in test users (including multi-user scenarios) without interacting with the Clerk UI. Note this only works for applications built with Replit's Clerk Authentication support.

Clerk Auth E2E Testing Only

Sign in Clerk users programmatically for e2e tests. Use the signInClerkUser function only — do not interact with the Clerk UI directly.

Available Functions (from ExecutePlaywrightAction)

async function signInClerkUser(
  signInOptions: {
    firstName: string;
    lastName?: string;
    email: string;
    ttl?: number; // TTL in seconds (default: 3600)
    basePath?: string; // Relative URL path appended to the dev domain for the post-sign-in redirect
  }
): Promise<string>

This function is in scope of the code for ExecutePlaywrightAction and can be used directly without any registration.

It returns a sign-in URL; navigate a page to that URL to inject the sign-in session.

Usage

Sign in a single user

const signInUrl = await signInClerkUser({
  firstName: "Test",
  lastName: "User",
  email: "testuser@example.com",
});
// Navigate to the returned sign-in URL to inject the sign-in session.
await page.goto(signInUrl);

Sign in for an artifact in a pnpm workspace

When testing an artifact served under its own preview path (e.g. in a multi-artifact or pnpm workspace repl), set basePath to the artifact's preview URL so the sign-in session redirects to the correct artifact.

// Set basePath to the artifact's preview path so Clerk redirects there after sign-in
const signInUrl = await signInClerkUser({
  firstName: "Test",
  lastName: "User",
  email: "testuser@example.com",
  basePath: "/my-app/",
});
await page.goto(signInUrl);

Sign in multiple users in independent browser contexts

const context = await newBrowserContext({ /* context options */ });
context.setDefaultTimeout(3000);
const newPage = await context.newPage();
const signInUrl = await signInClerkUser({
  firstName: "Bob",
  lastName: "Test",
  email: "bobtest@example.com",
});
await newPage.goto(signInUrl);

Test Plan Examples

  • [Clerk] Sign in admin@example.com programmatically and navigate to the returned sign-in URL
  • [Browser] Verify the admin dashboard appears
  • [Clerk] Sign in a second user in a new browser context
  • [Browser] Verify both users see their own data

Notes

  • Sessions are scoped to the browser context whose page navigates to the sign-in URL
  • Do not interact with the Clerk UI (sign-in forms, modals) — only use signInClerkUser
  • The default session TTL is 3600 seconds; pass ttl to change it

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/clerk-auth-e2e-testing-only-mtfbwmri/download' --output '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md.part' && mv '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md.part' '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md' && test -s '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/clerk-auth-e2e-testing-only' && cp -R '.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri' '.claude/skills/clerk-auth-e2e-testing-only'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri'

openskills read 'clerk-auth-e2e-testing-only-mtfbwmri'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/clerk-auth-e2e-testing-only-mtfbwmri/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills