E2E tests development for website (Playwright)

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Developing E2E Tests for Website (Playwright)

Playwright—E2E framework from Microsoft. Supports Chromium, Firefox, WebKit in single version. Faster than Cypress on parallel tests, built-in mobile viewport support, better network tools.

Installation

npm install -D @playwright/test
npx playwright install  # download browsers
npx playwright codegen https://example.com  # code generator for clicks

Configuration

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
    testDir: './tests',
    timeout: 30_000,
    retries: process.env.CI ? 2 : 0,
    workers: process.env.CI ? 4 : undefined,

    reporter: [
        ['html', { outputFolder: 'playwright-report' }],
        ['github'],
    ],

    use: {
        baseURL: process.env.BASE_URL || 'http://localhost:3000',
        trace: 'on-first-retry',
        screenshot: 'only-on-failure',
    },

    projects: [
        { name: 'chromium',        use: { ...devices['Desktop Chrome'] } },
        { name: 'firefox',         use: { ...devices['Desktop Firefox'] } },
        { name: 'webkit',          use: { ...devices['Desktop Safari'] } },
        { name: 'mobile-chrome',   use: { ...devices['Pixel 7'] } },
        { name: 'mobile-safari',   use: { ...devices['iPhone 14'] } },
    ],
});

Basic Test

// tests/checkout.spec.ts
import { test, expect } from '@playwright/test';

test.describe('Checkout flow', () => {
    test.beforeEach(async ({ page }) => {
        // Login via API (faster than UI)
        const response = await page.request.post('/api/auth/login', {
            data: { email: '[email protected]', password: 'password' },
        });
        const { token } = await response.json();
        await page.context().addCookies([{ name: 'auth_token', value: token, url: '/' }]);
    });

    test('complete order placement', async ({ page }) => {
        await page.goto('/products/laptop-pro');

        await page.getByRole('button', { name: 'Add to cart' }).click();
        await expect(page.getByTestId('cart-count')).toHaveText('1');

        await page.getByRole('link', { name: 'Cart' }).click();
        await page.getByRole('button', { name: 'Checkout' }).click();

        await page.getByLabel('Shipping address').fill('New York, 123 Main St');
        await page.getByLabel('Phone').fill('+19001234567');

        await page.getByRole('button', { name: 'Confirm order' }).click();

        await expect(page).toHaveURL(/\/orders\/\d+/);
        await expect(page.getByRole('heading')).toContainText('Order placed');
    });
});

Page Object Model

// pages/LoginPage.ts
import { Page, expect } from '@playwright/test';

export class LoginPage {
    constructor(private page: Page) {}

    async goto() {
        await this.page.goto('/login');
    }

    async login(email: string, password: string) {
        await this.page.getByLabel('Email').fill(email);
        await this.page.getByLabel('Password').fill(password);
        await this.page.getByRole('button', { name: 'Login' }).click();
    }

    async expectError(message: string) {
        await expect(this.page.getByRole('alert')).toContainText(message);
    }
}

// tests/login.spec.ts
test('login with invalid credentials', async ({ page }) => {
    const loginPage = new LoginPage(page);
    await loginPage.goto();
    await loginPage.login('[email protected]', 'wrongpass');
    await loginPage.expectError('Invalid email or password');
});

Intercepting Requests

test('shows error on API failure', async ({ page }) => {
    await page.route('/api/products', route =>
        route.fulfill({ status: 500, body: 'Server Error' })
    );

    await page.goto('/products');
    await expect(page.getByRole('alert')).toContainText('An error occurred');
});

// Mock data
await page.route('/api/users*', async route => {
    const json = { users: [{ id: 1, name: 'Test User' }], total: 1 };
    await route.fulfill({ json });
});

Testing Accessibility

import AxeBuilder from '@axe-core/playwright';

test('homepage has no WCAG violations', async ({ page }) => {
    await page.goto('/');
    const results = await new AxeBuilder({ page })
        .withTags(['wcag2aa'])
        .analyze();

    expect(results.violations).toHaveLength(0);
});

Snapshot Testing

test('UI matches snapshot', async ({ page }) => {
    await page.goto('/components');
    await expect(page).toHaveScreenshot('components-page.png', {
        maxDiffPixels: 100,
    });
});

GitHub Actions

- name: Install Playwright
  run: npx playwright install --with-deps

- name: Run Playwright tests
  run: npx playwright test --workers=4

- name: Upload report
  uses: actions/upload-artifact@v3
  if: always()
  with:
    name: playwright-report
    path: playwright-report/

Timeline

Setup + Page Objects + 30–50 scenarios: 5–10 days.