一键导入
login-flows
Common login automation patterns for web apps using Playwright
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Common login automation patterns for web apps using Playwright
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when working with Flutter Bloc/Cubit state management. Covers when to choose Bloc vs Cubit, how to use bloc and flutter_bloc together, lifecycle, testing, and safe defaults.
Use when working with Flutter Riverpod state management. Covers providers, consumers, refs, containers, overrides, async state, code generation, testing, and safe defaults.
Use this skill to get documentation for third-party APIs, SDKs or libraries before writing code that uses them to ensure you have the latest, most accurate documentation. This is a better way to find documentation than doing web search. This includes when a user asks for tasks like "use the OpenAI API", "call the Stripe API", "use the Anthropic SDK", "query Pinecone", or any other time the user asks you to write code against an external service and you need current API reference. Fetch the docs with chub before answering, rather than relying on your pre-trained knowledge, which may be outdated because of recent changes to these APIs. Be sure to use this skill when the user asks for the latest docs, latest API behavior, or explicitly mentions chub or Context Hub. Ensure `chub` is available, run `chub --help`, then follow the instructions there.
Use this skill for intelligent document processing and content extraction using LandingAI's Agentic Document Extraction (ADE). Trigger when users need to (1) Parse documents (PDFs, images, spreadsheets, presentations) into structured Markdown with layout understanding, (2) Extract specific structured data from documents using schemas (invoice fields, form data, table data, etc.), (3) Classify and separate multi-document batches by type (invoices vs receipts, statements vs forms, etc.), (4) Process large documents asynchronously (up to 1GB/1000 pages), (5) Get visual grounding (bounding boxes, page numbers) for extracted content — use when users mention bounding boxes, word locations, grounding, highlighting extracted content, or showing where data appears in a document. Use this skill when the task involves understanding document content for a set of documents. In particular this skill can help you write code that run on sets of documents. This will increase speed, and reduce the cost of loading the documents
Use this skill for building end-to-end document processing workflows and pipelines using LandingAI ADE. Trigger when users need to: (1) Process batches of documents in parallel or async, (2) Build classify-then-extract pipelines for mixed document types, (3) Prepare parsed documents for RAG systems with chunking and vector DB ingestion, (4) Load extraction results into databases like Snowflake or export to CSV/DataFrames, (5) Visualize extraction results: draw bounding box overlays on pages, crop chunk images, or highlight/annotate specific words or phrases found in documents, (6) Build Streamlit or web UIs for document processing, (7) Find and highlight specific terms within document sections using word-level grounding (e.g. highlight "L2S" in the Introduction, redact PII, annotate extracted values on the original page). This skill complements the document-extraction skill which covers ADE SDK basics. Use document-extraction to write code that executes parse/extract/split operations with more precision and l
Guide for AI agents to source electronic components using parts-mcp — tool sequencing, decision patterns, and multi-step workflows
| name | login-flows |
| description | Common login automation patterns for web apps using Playwright |
| metadata | {"updated-on":"2026-02-01","source":"community","tags":"browser,automation,playwright,login,testing"} |
Reusable patterns for automating login flows in end-to-end tests.
import { Page } from '@playwright/test';
async function login(page: Page, username: string, password: string) {
await page.goto('/login');
await page.fill('[name="username"]', username);
await page.fill('[name="password"]', password);
await page.click('button[type="submit"]');
await page.waitForURL('/dashboard');
}
For OAuth flows that redirect to an external provider:
async function loginWithOAuth(page: Page) {
await page.goto('/login');
await page.click('text=Sign in with Google');
// Handle the OAuth popup or redirect
await page.fill('input[type="email"]', process.env.TEST_EMAIL!);
await page.click('text=Next');
await page.fill('input[type="password"]', process.env.TEST_PASSWORD!);
await page.click('text=Next');
// Wait for redirect back to app
await page.waitForURL('**/dashboard');
}
Avoid logging in before every test by saving and reusing browser state:
// global-setup.ts — runs once before all tests
import { chromium } from '@playwright/test';
async function globalSetup() {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('/login');
await page.fill('[name="username"]', 'testuser');
await page.fill('[name="password"]', 'testpass');
await page.click('button[type="submit"]');
await page.waitForURL('/dashboard');
// Save signed-in state
await page.context().storageState({ path: './auth.json' });
await browser.close();
}
export default globalSetup;
Then in playwright.config.ts:
export default defineConfig({
globalSetup: './global-setup.ts',
use: {
storageState: './auth.json',
},
});
For test environments with TOTP-based 2FA:
import { authenticator } from 'otplib';
async function loginWithMFA(page: Page, secret: string) {
await login(page, 'user', 'pass');
// Generate TOTP code
const code = authenticator.generate(secret);
await page.fill('[name="totp"]', code);
await page.click('button[type="submit"]');
await page.waitForURL('/dashboard');
}
storageState to avoid repeated logins — it's the single biggest speedup for E2E suitespage.waitForURL() instead of arbitrary waitForTimeout() after login