Supercheck LogoSupercheck

Browser Test

Playwright-based UI testingEdit

Automate user interactions with Playwright. Navigate pages, fill forms, click buttons, and validate content. Browser tests run in isolated containers on Chromium by default. Add @firefox, @webkit (or @safari) or @mobile to a test title to run it on that browser or device instead.

Example

import { expect, test } from '@playwright/test';

const APP_URL = 'https://the-internet.herokuapp.com';
const CREDENTIALS = { username: 'tomsmith', password: 'SuperSecretPassword!' };

test.describe('authentication flow', () => {
  test('user can sign in and sign out', async ({ page }) => {
    await page.goto(APP_URL + '/login');

    // Fill login form
    await page.getByLabel('Username').fill(CREDENTIALS.username);
    await page.getByLabel('Password').fill(CREDENTIALS.password);
    await page.getByRole('button', { name: 'Login' }).click();

    // Verify successful login
    await expect(page.getByText('You logged into a secure area!')).toBeVisible();
    
    // Perform logout
    await page.getByRole('link', { name: 'Logout' }).click();
    
    // Verify redirect to login page
    await expect(page).toHaveURL(APP_URL + '/login');
  });
});

📚 Playwright Writing Tests

Create Test

Go to Create → Browser Test

Write your test script

Click Run to validate

Save when passing

Common Actions

ActionCode
Navigateawait page.goto('url')
Clickawait page.getByRole('button', { name: 'Submit' }).click()
Fill inputawait page.getByLabel('Email').fill('user@example.com')
Check textawait expect(page.locator('selector')).toHaveText('text')
Waitawait page.waitForSelector('selector')
Screenshotawait page.screenshot({ path: 'file.png' })

Next steps

On this page