auth-for-browser-tests

Establish authenticated sessions for browser end-to-end tests via API login and cookie injection.

2|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/pmarashian/cursor-agent-skills --skill auth-for-browser-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-for-browser-tests
Source: https://github.com/pmarashian/cursor-agent-skills/tree/main/auth-for-browser-tests
Command: npx skills add https://github.com/pmarashian/cursor-agent-skills --skill auth-for-browser-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill ensures that browser-based end-to-end tests can reliably verify protected pages by establishing authenticated sessions, avoiding ad-hoc bypasses and clarifying fallbacks.

Core Features & Use Cases

  • API-driven Authentication: Register and log in users via API (e.g., using curl with cookie jars).
  • Session/Cookie Injection: Load authenticated session state into the browser context if supported by the testing tool.
  • Fallback Mechanisms: Document manual login requirements or test-only bypasses when injection isn't possible, and revert mocks.
  • Use Case: When testing a user profile page that requires login, this skill ensures a valid session is established before the test proceeds, preventing failures due to unauthenticated access.

Quick Start

Use the auth-for-browser-tests skill to establish an authenticated session for browser testing.

Frequently Asked Questions about auth-for-browser-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I authenticate users for browser e2e tests without UI login?

Browser e2e test authentication can be established by registering and logging in users via API, then injecting the resulting session cookies or state directly into the browser context. This approach avoids ad-hoc bypasses and ensures protected pages are reliably tested.

What is session injection in browser testing?

Session injection in browser testing is the process of loading an authenticated session state, typically via API-generated cookies, directly into the browser context. This allows tests to bypass the login UI and immediately access protected pages.

How do I test protected pages that require login in end-to-end tests?

To test protected pages requiring login in e2e tests, you establish an authenticated session beforehand by logging in via API and injecting the session cookies into the browser context. This prevents test failures due to unauthenticated access.

What is the best way to handle authentication when cookie injection isn't supported?

When direct session injection is not supported by the testing tool, the best approach is to document manual login procedures or implement test-only bypasses. You must ensure any mocks or bypasses are reverted when the test concludes.

Can I use API calls to set up authentication for browser-based tests?

Yes, you can use API calls, such as curl with cookie jars, to register and log in users. The API-generated session state or cookies are then loaded into the browser context to authenticate your end-to-end tests.

Why do my e2e tests fail on protected pages even after login?

E2e tests fail on protected pages when the authenticated session is not properly established or injected into the browser context. Establishing the session via API and loading the correct cookies before navigating prevents unauthenticated access failures.