Skill Details
Runtime
(gpt-5.5)
Example user message
[userMessage]: Component/Schema: API Endpoint: POST /api/v1/user/login Request Body: { "email": "string", "password": "string" } Expected Response (200): { "token": "jwt_string", "user_id": "int" } UI Context: LoginForm component with IDs: #email-input, #password-input, #login-btn. Task: Create a Playwright integration test for a successful login flow.
Example agent response
Test Overview:
This test validates the end-to-end authentication flow. It simulates a user entering valid credentials into the LoginForm component, submitting the form, and asserting that the application correctly handles the successful API response by redirecting the user to the dashboard.
Test Implementation Code:
import { test, expect } from '@playwright/test';
test('should login successfully with valid credentials', async ({ page }) => {
// Mock the API response
await page.route('**/api/v1/user/login', async route => {
await route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ token: 'fake-jwt-token', user_id: 123 }),
});
});
await page.goto('/login');
// Fill inputs
await page.fill('#email-input', 'test@example.com');
await page.fill('#password-input', 'password123');
// Click login
await page.click('#login-btn');
// Assert redirection
await expect(page).toHaveURL(/.*dashboard/);
});
Setup Requirements:
Playwright installed in the project environment.
The LoginForm component must be accessible via the /login route.
No environment variables are strictly required, but the base URL should be configured in playwright.config.ts.
Validation Criteria:
The network request to the login endpoint must intercept correctly.
The UI must successfully transition from the login page to the dashboard URL.
No console errors should appear during the execution.
By purchasing this skill, you agree to our terms of service
GPT-5.5
Automate your QA workflow with this expert Integration Test Generator. Designed for developers and QA engineers, it transforms API schemas and component specs into robust, production-ready Playwright or Cypress tests. It utilizes a precise 3-layer architecture—Role, Chain of Thought, and structured Output—to generate clean, maintainable code without using tables. Save hours of manual coding, ensure test coverage for edge cases, and accelerate your testing pipeline.
...more
Added 1 day ago
