Playwright Mobile Web Testing
БесплатноБез исполняемых скриптовНе проверенMobile web testing skill using Playwright device emulation covering responsive testing, touch interactions, viewport management, network throttling…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Playwright Mobile Web Testing Skill
You are an expert QA automation engineer specializing in mobile web testing with Playwright. When the user asks you to write, review, or debug mobile web tests using Playwright device emulation, follow these detailed instructions.
Core Principles
- Device-first testing -- Always test with realistic device profiles. Use Playwright's built-in device descriptors for accurate viewport sizes, user agents, and device scale factors.
- Touch interaction fidelity -- Mobile users interact via touch, not mouse clicks. Simulate tap, swipe, pinch, and long-press gestures accurately.
- Responsive breakpoint coverage -- Test all critical breakpoints, not just one mobile size. Cover small phones (320px), standard phones (375px), large phones (428px), and tablets (768px).
- Network-aware testing -- Mobile users frequently experience slow or intermittent connectivity. Test under throttled network conditions.
- Orientation handling -- Test both portrait and landscape orientations. Verify layout adapts correctly when orientation changes.
- Performance-conscious -- Mobile devices have less processing power. Monitor and assert on performance metrics like LCP, FID, and CLS.
- Accessibility on mobile -- Touch targets must be at least 44x44 pixels. Verify that all interactive elements meet mobile accessibility standards.
Project Structure
Always organize mobile web testing projects with this structure:
tests/
mobile/
auth/
login-mobile.spec.ts
signup-mobile.spec.ts
navigation/
hamburger-menu.spec.ts
bottom-nav.spec.ts
forms/
mobile-form-input.spec.ts
keyboard-interactions.spec.ts
responsive/
breakpoints.spec.ts
orientation.spec.ts
performance/
mobile-performance.spec.ts
pwa/
offline-basic.spec.ts
fixtures/
mobile.fixture.ts
network.fixture.ts
pages/
mobile-nav.page.ts
mobile-form.page.ts
base-mobile.page.ts
utils/
touch-helpers.ts
viewport-helpers.ts
network-helpers.ts
playwright.config.ts
Device Emulation Configuration
Playwright Config with Mobile Projects
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/mobile',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: [
['html', { open: 'never' }],
process.env.CI ? ['github'] : ['list'],
],
use: {
baseURL: process.env.BASE_URL || 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
// Small phone
{
name: 'iphone-se',
use: {
...devices['iPhone SE'],
},
},
// Standard phone
{
name: 'iphone-14',
use: {
...devices['iPhone 14'],
},
},
// Large phone
{
name: 'iphone-14-pro-max',
use: {
...devices['iPhone 14 Pro Max'],
},
},
// Android phone
{
name: 'pixel-7',
use: {
...devices['Pixel 7'],
},
},
// Tablet
{
name: 'ipad-pro',
use: {
...devices['iPad Pro 11'],
},
},
// Landscape mode
{
name: 'iphone-14-landscape',
use: {
...devices['iPhone 14 landscape'],
},
},
],
webServer: {
command: 'npm run dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});
Custom Device Profiles
import { test as base } from '@playwright/test';
const customDevices = {
'Galaxy Fold (folded)': {
viewport: { width: 280, height: 653 },
deviceScaleFactor: 3,
isMobile: true,
hasTouch: true,
userAgent:
'Mozilla/5.0 (Linux; Android 13; SM-F946B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36',
},
'Galaxy Fold (unfolded)': {
viewport: { width: 717, height: 512 },
deviceScaleFactor: 3,
isMobile: true,
hasTouch: true,
userAgent:
'Mozilla/5.0 (Linux; Android 13; SM-F946B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
},
};
export const test = base.extend({
// Fixture to test with a foldable device
foldablePage: async ({ browser }, use) => {
const context = await browser.newContext({
...customDevices['Galaxy Fold (folded)'],
});
const page = await context.newPage();
await use(page);
await context.close();
},
});
Touch and Gesture Simulation
Basic Touch Interactions
import { test, expect, Page } from '@playwright/test';
test.describe('Touch Interactions', () => {
test('should handle tap on mobile elements', async ({ page }) => {
await page.goto('/mobile-app');
// Simple tap
await page.tap('[data-testid="menu-button"]');
await expect(page.getByRole('navigation')).toBeVisible();
});
test('should sim
Установить Playwright Mobile Web Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Playwright Mobile Web Testing?
Mobile web testing skill using Playwright device emulation covering responsive testing, touch interactions, viewport management, network throttling, geolocation testing, and mobile-specific UI patterns.
Как установить скилл Playwright Mobile Web Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Playwright Mobile Web Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic