Run Your First Desktop and Mobile Browser Check with Playwright
This check tests a browser feature at desktop and phone widths. It uses a small HTML fixture with no account, network dependency after download or external data. Selecting Parks should reveal Riverside Park, hide Corner Café and report 1 place shown. Checking all three catches a filter that only updates its count or only changes the visible list.


Set up the example
Create an empty project and install Playwright Test. Download the fixture into the same directory.
npm init -y
npm install -D @playwright/test
npx playwright install chromium
curl -fL https://www.open-auto-glm.com/examples/filter-places.html -o filter-places.htmlFrom that folder run python3 -m http.server 8000 --bind 127.0.0.1 in a separate terminal. Open http://127.0.0.1:8000/filter-places.html once to confirm that the fixture is being served. If that port is already in use, choose a different one in both the server and test.
Check the result at both widths
Set the fixture
Open the local saved-places page with its known starting items.
Select Parks
Apply the same filter in desktop and narrow browser contexts.
Inspect both outputs
Verify that the visible cards match the filter before comparing layout.
Save this as filter.spec.js and run npx playwright test filter.spec.js.
const { test, expect } = require('@playwright/test');
for (const width of [1280, 390]) {
test(`Parks filter at ${width}px`, async ({ page }, testInfo) => {
await page.setViewportSize({ width, height: 800 });
await page.goto('http://127.0.0.1:8000/filter-places.html');
await page.getByRole('combobox', { name: 'Category' }).selectOption('Parks');
const list = page.getByRole('list', { name: 'Places' });
await expect(list.getByText('Riverside Park')).toBeVisible();
await expect(list.getByText('Corner Café')).toBeHidden();
await expect(page.getByRole('status')).toHaveText('1 place shown');
await page.screenshot({ path: testInfo.outputPath('parks.png') });
});
}Playwright’s locator guide describes accessible names and automatic waiting. Inspect the captured screenshot when the viewport changes, then change the test to select Cafés and invert the assertions. Avoid fixed screen coordinates. This example covers the browser DOM and layout. A native app, operating system prompt or actual mobile browser capability needs its own test target. Use the system comparison to choose one.