When Claude Met Playwright: My First Experiments in AI-Powered Testing
claude mcp add playwright npx ‘@playwright/mcp@latest’
Page Observations
URL: https://xxxxxx.com/login (redirected from homepage)
Page Elements:
– SmartSlots Logo: Top right with the brand logo
– Hospital Illustration: Left side with a hospital building and ambulance graphic
– Login Form with:
– Email field: Textbox with placeholder “Enter Email”
– Password field: Textbox with placeholder “Enter Password” and a show/hide password toggle icon
– Login button: Blue button
– Forgot Password link: Below the login buttonConsole Log:
– The app is connecting to API: https://xxxxxxx.com/api/v1Available Actions:
– e17 – Email textbox
– e20 – Password textbox
– e24 – Login button
– e26 – Forgot Password link (navigates to /forgot-password)
Here’s what the response meant:
Page Elements:
The app is connecting to API: https://xxxxxxxxx/api/v1
- e17 → Email textbox
- e20 → Password textbox
- e24 → Login button
- e26 → Forgot Password link
The Moment Claude Ran My First Test Case
# Test Case: User Login
## Test Data
| Data Name | Value / Description |
|————|———————|
| URL | https://xxxxxxxxxx |
| Username | xxxxxx@xxxxxxx.com |
| Password | xxxxx |## Test Steps
1. Navigate to the application URL (`[URL]`) from Test Data.
2. Enter username (`[Username]`) and password (`[Password]`) from Test Data.
3. Click on the **Login** button.
4. Observe the application response.## Things to be Verified
– User should be redirected to the dashboard page.
– Session token should be generated and stored securely.
– No error messages should appear.
🧪 Login Test Results – PASSED ✅
Test Execution Summary
Test Case: User LoginTest URL: https://xxxxxxx Status: PASSED ✅
—
Test Steps Executed1. ✅ Navigated to https://xxxxxxxxxx
– Automatically redirected to /login page
2. ✅ Entered credentials:
– Email: xxxxxx@xxxxx.com
– Password: xxxxxxxx
3. ✅ Clicked Login button
– Form submitted successfully
4. ✅ Verified results—
Verification Results| Verification Point | Status | Details |
|————————-|——–|———————————————————-|
| Redirect to Dashboard | ✅ PASS | Successfully redirected to /clinic-admin/dashboard |
| Session Token Generated | ✅ PASS | User authenticated with ID: xxxxxxxxxxxxxxxxxxxx |
| No Error Messages | ✅ PASS | Login completed without errors |
| User Data Loaded | ✅ PASS | User type: clinic admin, Clinic: Tester Clinic |
| Dashboard Rendered | ✅ PASS | Dashboard showing appointments, doctors, navigation menu |—
Console Logs (Key Events)– ✅ User login successful
– ✅ User type identified: clinic admin
– ✅ Clinic details loaded: Tester Clinic
– ✅ Dashboard components initialized
– ✅ Appointments fetched (0 found)
– ✅ Doctors fetched (4 doctors available)
– ✅ Booking widget loaded—
ScreenshotsScreenshot saved at: /smart-slots-appointments/tests/.playwright-mcp/login-test-dashboard-result.png
The dashboard shows:
– User logged in as: xxxxx@xxx.com
– Clinic: Tester Clinic
– Navigation menu with all admin options
– Upcoming Appointments section (currently empty)
– Doctor Availability panel showing 4 doctorsAll test criteria passed successfully! 🎉
When Claude Became a Test Script Generator
test(‘User Login’, async ({ page }) => {
await page.goto(‘https://xxxx.com’);
await page.fill(‘input[placeholder=”Enter Email”]’, ‘xxxx@xxx.com’);
await page.fill(‘input[placeholder=”Enter Password”]’, ‘xxxxx’);
await page.click(‘button:has-text(“Login”)’);
await expect(page).toHaveURL(/.*dashboard/);
});
npm run test
 
                 
                 
                 
                                            