anna

Menu

← Back to case studies

Portfolio Playwright tests.

Follow a visitor from Skills through Checkout, then look at what the catalogue and contact APIs validate.

Browser tests

portfolio.spec.ts

Covers the shortlist and checkout journey, email fallback, accessibility checks, and navigation between portfolio pages.

import AxeBuilder from '@axe-core/playwright';
import { expect, test } from '@playwright/test';

test('a recruiter searches and sends selected skills and qualities from checkout', async ({ page }) => {
  await page.goto('/');
  await expect(page.getByRole('heading', { level: 1 })).toHaveText('Beyond the happy path.');
  await page.getByRole('link', { name: 'Build a shortlist' }).click();
  await expect(page).toHaveURL('/skills');
  await page.getByRole('button', { name: 'Add to shortlist: Website migration testing' }).click();
  const search = page.getByRole('searchbox', { name: 'Find a skill' });
  await search.fill('xyzzy');
  await expect(page.getByText('No matching skills.')).toBeVisible();
  const footer = page.getByRole('contentinfo');
  await expect.poll(async () => {
    const box = await footer.boundingBox();
    return box ? box.y + box.height : 0;
  }).toBeGreaterThanOrEqual(page.viewportSize()!.height);
  await page.getByRole('button', { name: 'Clear filters' }).click();
  await expect(search).toBeFocused();
  await search.fill('playwright');
  await expect(page.getByRole('heading', { name: 'Playwright', exact: true })).toBeVisible();
  await page.getByRole('button', { name: 'Add to shortlist: Playwright', exact: true }).click();
  await search.clear();
  await page.getByRole('group', { name: 'Filter shortlist items' }).getByRole('button', { name: 'Ways of working', exact: true }).click();
  await expect(page.getByRole('heading', { name: 'Playwright', exact: true })).toBeHidden();
  await page.getByRole('button', { name: 'Add to shortlist: A suspicious relationship with the happy path' }).click();
  await page.getByRole('button', { name: 'Shortlist 3', exact: true }).click();

  const dialog = page.getByRole('dialog');
  await expect(dialog.getByRole('listitem')).toHaveCount(3);
  await dialog.getByRole('button', { name: 'Checkout' }).click();
  await expect(dialog.getByRole('heading', { name: 'Let’s talk.' })).toBeFocused();
  await dialog.getByLabel('Your name').fill('Alex Recruiter');
  await dialog.getByLabel('Your email').fill('alex@example.com');
  await dialog.getByLabel('What are you hiring for?').fill('QA for R&D + web');
  const sent = page.waitForResponse((response) => response.url().endsWith('/api/portfolio/contact'));
  await dialog.getByRole('button', { name: 'Send shortlist' }).click();
  const response = await sent;
  expect(response.status()).toBe(202);
  expect(response.request().postDataJSON()).toMatchObject({
    name: 'Alex Recruiter', email: 'alex@example.com', message: 'QA for R&D + web',
    skills: ['migrations', 'playwright', 'happy-path']
  });
  await expect(dialog.getByRole('heading', { name: 'Inquiry received.' })).toBeFocused();
});

test('merged skills preserve saved interest and old deep links', async ({ page }) => {
  await page.addInitScript(() => localStorage.setItem('anna.shortlist.v1', JSON.stringify({
    quantities: { scepticism: 3, questions: 2, ticketing: 1 }
  })));
  await page.goto('/skills#skill-scepticism');
  await expect(page.getByRole('heading', { name: 'A suspicious relationship with the happy path' })).toBeVisible();
  const filters = page.getByRole('group', { name: 'Filter shortlist items' });
  await expect(filters.getByRole('button', { name: 'Ways of working' })).toHaveAttribute('aria-pressed', 'true');
  await expect(page.locator('#skills article:visible')).toHaveCount(14);
  await page.getByRole('button', { name: 'Shortlist 2', exact: true }).click();
  const cart = page.getByRole('dialog');
  await expect(cart.getByRole('group', { name: 'Quantity for A suspicious relationship with the happy path' })).toHaveText('−3+');
  await expect(cart.getByText('Jira & ticket hygiene')).toBeVisible();
});

test('portfolio routes have distinct metadata and share a decodable social image', async ({ page, request }) => {
  const descriptions = new Set<string>();
  for (const route of ['/', '/about-me', '/skills', '/experience', '/case-studies']) {
    await page.goto(route);
    const description = await page.locator('meta[name="description"]').getAttribute('content');
    expect(description).toBeTruthy();
    descriptions.add(description!);
    await expect(page.locator('meta[property="og:description"]')).toHaveAttribute('content', description!);
    await expect(page.locator('meta[name="twitter:title"]')).toHaveAttribute('content', await page.title());
    await expect(page.locator('meta[name="twitter:card"]')).toHaveAttribute('content', 'summary_large_image');
  }
  expect(descriptions.size).toBe(5);
  await expect(page).toHaveTitle('Case studies | Anna Ševelová');
  const image = await page.locator('meta[property="og:image"]').getAttribute('content');
  const dimensions = await page.evaluate(async (src) => {
    const img = new Image();
    img.src = src!;
    await img.decode();
    return [img.naturalWidth, img.naturalHeight];
  }, image);
  expect(dimensions).toEqual([1200, 630]);
  expect((await request.get('/favicon.svg')).headers()['content-type']).toBe('image/svg+xml');
});

for (const [status, feedback] of [
  [503, 'Direct sending is unavailable.'],
  [429, 'The form has reached its sending limit.']
] as const) {
  test(`checkout offers an email draft when sending returns ${status}`, async ({ page }) => {
    await page.route('**/api/portfolio/contact', (route) => route.fulfill({ status }));
    await page.goto('/skills');
    await page.getByRole('button', { name: 'Add to shortlist: API testing' }).click();
    await page.getByRole('button', { name: 'Shortlist 1', exact: true }).click();
    const dialog = page.getByRole('dialog');
    await dialog.getByRole('button', { name: 'Checkout' }).click();
    await dialog.getByLabel('Your name').fill('Alex Recruiter');
    await dialog.getByLabel('Your email').fill('alex@example.com');
    await dialog.getByRole('button', { name: 'Send shortlist' }).click();
    await expect(dialog.getByRole('status')).toContainText(feedback);
    const link = dialog.getByRole('link', { name: 'Open email draft' });
    await expect(link).toBeVisible();
    const draft = new URL((await link.getAttribute('href'))!);
    expect(draft.protocol).toBe('mailto:');
    expect(draft.pathname).toBe('sevelova.an@gmail.com');
    expect(draft.searchParams.get('body')).toContain('- API testing');
  });
}

test('the shortlist persists across reload and an empty shortlist can open contact', async ({ page }) => {
  await page.goto('/skills');
  await page.getByRole('button', { name: 'Add to shortlist: API testing' }).click();
  await expect(page.getByRole('button', { name: 'Remove from shortlist: API testing' })).toBeVisible();
  await page.reload();
  const cart = page.getByRole('button', { name: 'Shortlist 1', exact: true });
  await cart.click();
  const dialog = page.getByRole('dialog');
  await dialog.getByRole('button', { name: 'Remove API testing' }).click();
  await expect(dialog.getByRole('button', { name: 'Contact Anna' })).toBeEnabled();
  await page.keyboard.press('Escape');
  await expect(page.getByRole('button', { name: 'Shortlist 0', exact: true })).toBeFocused();
});

test('the portfolio and checkout have no axe violations in the selected WCAG rules', async ({ page }) => {
  await page.goto('/skills');
  const tags = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'];
  expect((await new AxeBuilder({ page }).withTags(tags).analyze()).violations).toEqual([]);
  await page.getByRole('button', { name: 'Add to shortlist: API testing' }).click();
  await page.getByRole('button', { name: 'Shortlist 1', exact: true }).click();
  await page.getByRole('button', { name: 'Checkout' }).click();
  expect((await new AxeBuilder({ page }).withTags(tags).analyze()).violations).toEqual([]);
});

test('renders the CV highlights and serves a decodable portrait', async ({ page, request }) => {
  await page.goto('/experience');
  await expect(page.getByRole('heading', { name: 'QA Engineer · NOTUM Technologies' })).toBeVisible();
  await expect(page.locator('summary').filter({ hasText: 'Axi · QA Lead' })).toBeVisible();
  await page.goto('/');
  const portrait = page.getByRole('img', { name: 'Anna Ševelová smiling, with Geralt, her blue-tongued skink, on her arm.' });
  await expect(portrait).toBeVisible();
  await expect(portrait.locator('..').locator('figcaption')).toHaveCount(0);
  await expect.poll(() => portrait.evaluate((element: HTMLImageElement) => element.naturalWidth)).toBe(733);
  const asset = await request.get('/anna-portrait.webp');
  expect(asset.ok()).toBeTruthy();
  expect(asset.headers()['content-type']).toBe('image/webp');
});

test('project entries expand by keyboard and expose their Notum case studies', async ({ page }) => {
  await page.goto('/experience');
  const axi = page.locator('details').filter({ hasText: 'Axi · QA Lead' });
  const search = page.locator('details').filter({ hasText: 'Meilisearch · CMS migration' });
  const axiLink = axi.getByRole('link', { name: 'Read the Notum case study for Axi' });

  await expect(axiLink).toBeHidden();
  await axi.locator('summary').press('Enter');
  await expect(axi.getByText(/I led QA for the migration/)).toBeVisible();
  await expect(axiLink).toHaveAttribute('href', 'https://www.notum.tech/case-studies/axi-umbraco-to-strapi-migration');

  const scenic = page.locator('details').filter({ hasText: 'Scenic Group · QA strategy & consulting' });
  await scenic.locator('summary').click();
  await expect(axiLink).toBeHidden();
  await expect(scenic.getByText(/stayed involved as a QA consultant/)).toBeVisible();
  await expect(scenic.getByRole('link', { name: 'Read the Notum case study for Scenic Group' }))
    .toHaveAttribute('href', 'https://www.notum.tech/case-studies/from-twelve-websites-to-one-platform-scenic-groups-enterprise-migration-from-sitecore-to-strapi');

  await search.locator('summary').click();
  await expect(axiLink).toBeHidden();
  await expect(search.getByRole('link', { name: 'Read the Notum case study for Meilisearch' })).toHaveAttribute('href', 'https://www.notum.tech/case-studies/how-we-helped-meilisearch-to-get-the-most-out-of-strapi');
});

test('a card chip opens its category and clears the previous search', async ({ page }) => {
  await page.goto('/skills');
  const filters = page.getByRole('group', { name: 'Filter shortlist items' });
  await filters.getByRole('button', { name: 'All skills', exact: true }).click();
  const search = page.getByRole('searchbox');
  await search.fill('smart tv testing');
  const card = page.locator('#skills article').filter({ has: page.getByRole('heading', { name: 'Smart TV testing', exact: true }) });
  await expect(card).toContainText('Full HD and 4K resolutions');
  await card.getByRole('button', { name: 'Testing & quality assurance' }).press('Enter');

  const category = filters.getByRole('button', { name: 'Testing & quality assurance' });
  await expect(category).toHaveAttribute('aria-pressed', 'true');
  await expect(category).toBeFocused();
  await expect(search).toBeEmpty();
  await expect(page.getByRole('heading', { name: 'End-to-end testing' })).toBeVisible();
  await expect(page.getByRole('heading', { name: 'Playwright', exact: true })).toBeHidden();
});

test('the shortlist carries across Skills and Experience and browser Back returns to Skills', async ({ page }) => {
  await page.goto('/skills');
  await expect(page).toHaveTitle('Skills | Anna Ševelová');
  await page.getByRole('button', { name: 'Add to shortlist: API testing' }).click();
  const nav = page.getByRole('navigation', { name: 'Main navigation' });
  await nav.getByRole('link', { name: 'Experience' }).click();
  await expect(page).toHaveURL('/experience');
  await expect(nav.getByRole('link', { name: 'Experience' })).toHaveAttribute('aria-current', 'page');
  await expect(page.getByRole('heading', { level: 1 })).toHaveText('What I’ve tested.');
  await expect(page.getByRole('searchbox')).toHaveCount(0);
  await page.getByRole('button', { name: 'Shortlist 1', exact: true }).click();
  const cart = page.getByRole('dialog');
  await expect(cart.getByRole('listitem')).toContainText('API testing');
  await cart.getByRole('button', { name: 'Remove API testing' }).click();
  await page.keyboard.press('Escape');
  await page.goBack();
  await expect(page).toHaveURL('/skills');
  await expect(page.getByRole('button', { name: 'Add to shortlist: API testing' })).toBeVisible();
  await expect(page.getByRole('button', { name: 'Shortlist 0', exact: true })).toBeVisible();
});


test('a featured project opens its accordion and its skill chip reveals the matching card', async ({ page }) => {
  await page.goto('/');
  await page.getByRole('link', { name: 'Explore the Scenic Group project' }).click();
  await expect(page).toHaveURL('/experience#project-scenic');
  const scenic = page.locator('#project-scenic');
  await expect(scenic).toHaveAttribute('open', '');
  await expect(scenic.locator('summary')).toBeFocused();
  await scenic.getByRole('link', { name: 'Test strategy', exact: true }).click();

  await expect(page).toHaveURL('/skills#skill-test-strategy');
  const card = page.locator('#skill-test-strategy');
  await expect(card).toBeFocused();
  await expect(card.getByRole('heading', { name: 'Test strategy', exact: true })).toBeVisible();
  const category = page.getByRole('group', { name: 'Filter shortlist items' })
    .getByRole('button', { name: 'Strategy & analytical skills' });
  await expect(category).toHaveAttribute('aria-pressed', 'true');
  await card.getByRole('button', { name: 'Add to shortlist: Test strategy' }).click();
  await expect(page.getByRole('button', { name: 'Shortlist 1', exact: true })).toBeVisible();
});


test('Home introduces Anna before the shortlist banner and the footer year follows the clock', async ({ page }) => {
  await page.clock.setFixedTime(new Date('2032-06-15T12:00:00Z'));
  await page.goto('/');
  await expect(page.getByRole('main').getByRole('heading', { level: 2 }))
    .toHaveText(['One QA. Many applications.', 'Configure your QA.', 'QA in practice.', 'Don’t take my word for it.', 'Let’s talk.']);
  const about = page.getByRole('region', { name: 'One QA. Many applications.' });
  await expect(about.locator('h2 em')).toHaveText('Many applications.');
  await expect(page.getByText('Feel free to explore my professional repertoire', { exact: false })).toHaveCount(0);
  await expect(about).toContainText('a healthy dose of scepticism and a killer sense of humour');
  await expect(page.getByRole('region', { name: 'Configure your QA.' }).getByRole('link', { name: 'Build a shortlist' }))
    .toHaveAttribute('href', '/skills');
  const footer = page.getByRole('contentinfo');
  await expect(footer.getByText('© 2032 Anna Ševelová')).toBeVisible();
  await page.goto('/experience');
  await expect(footer.getByText('© 2032 Anna Ševelová')).toBeVisible();
});

test('about and case studies connect the portfolio, demo, and published test sources', async ({ page, request }) => {
  await page.goto('/');
  await page.getByRole('link', { name: 'More about me' }).click();
  await expect(page).toHaveURL('/about-me');
  await expect(page.getByRole('heading', { level: 1 })).toHaveText('One QA. Many applications.');
  await expect(page.getByRole('link', { name: 'About me', exact: true })).toHaveAttribute('aria-current', 'page');

  await page.getByRole('link', { name: 'Case studies', exact: true }).click();
  await expect(page).toHaveURL('/case-studies');
  await expect(page.getByRole('link', { name: 'Open the playground' })).toHaveAttribute('href', '/python-speedrun/');
  const browserTest = page.getByRole('link', { name: 'Read the browser test' });
  const apiTestPath = await page.getByRole('link', { name: 'Read the API test' }).getAttribute('href');
  await browserTest.click();
  await expect(page).toHaveURL('/case-studies/trailhead/tests#browser-booking');
  await expect(page.locator('#browser-booking code')).toContainText('books the last spots');
  await expect(page.locator('#browser-booking .code-keyword').first()).toBeVisible();
  await page.context().grantPermissions(['clipboard-read', 'clipboard-write']);
  await page.getByRole('button', { name: 'Copy reservations.spec.ts' }).click();
  const raw = await request.get('/case-studies/trailhead/booking.spec.ts');
  expect(await page.evaluate(() => navigator.clipboard.readText())).toBe(await raw.text());
  await page.goto(apiTestPath!);
  await expect(page.locator('#api-booking code')).toContainText('reserves shared capacity atomically');
  await expect(page.locator('[data-spec]')).toHaveCount(5);
  await page.getByRole('link', { name: /Back to case studies/ }).click();
  await page.getByRole('link', { name: 'Try the Trailhead demo' }).click();
  await expect(page).toHaveURL('/trailhead');
  await page.getByRole('link', { name: 'Back to Anna’s portfolio' }).click();
  await expect(page).toHaveURL('/case-studies#trailhead-case');
});

test('the portfolio case study links to expandable browser and API specs', async ({ page }) => {
  await page.goto('/case-studies');
  const study = page.getByRole('article', { name: 'This portfolio' });
  await expect(study.getByText('GitHub repository · TBD')).toBeVisible();
  await study.getByText('Testing infrastructure', { exact: false }).first().click();
  await expect(study.getByText(/isolated, in-memory SQLite/)).toBeVisible();
  await study.getByRole('link', { name: 'Read the portfolio tests' }).click();
  await expect(page).toHaveURL('/case-studies/portfolio/tests');
  await expect(page.getByRole('heading', { name: 'Portfolio Playwright tests.' })).toBeVisible();
  await expect(page.locator('[data-spec]')).toHaveCount(3);
  const browserSpec = page.locator('#portfolio-ui');
  await browserSpec.getByText('portfolio.spec.ts', { exact: true }).click();
  await expect(browserSpec.getByRole('button', { name: 'Copy portfolio.spec.ts' })).toBeVisible();
  await expect(browserSpec.locator('code')).toContainText('a recruiter searches and sends selected skills');
  await page.getByRole('link', { name: /Back to case studies/ }).click();
  await expect(page).toHaveURL('/case-studies#portfolio-case');
});

test('Python Speedrun opens from the portfolio and serves its lessons without Claude', async ({ page, request }) => {
  await page.route(/https:\/\//, (route) => route.abort());
  await page.goto('/case-studies');
  await page.getByRole('link', { name: 'Open the playground' }).click();
  await expect(page).toHaveURL('/python-speedrun/');
  await expect(page).toHaveTitle('Python Speedrun | Anna Ševelová');
  const lessons = await request.get('/python-speedrun/data.js');
  expect(lessons.ok()).toBe(true);
  expect(await lessons.text()).toContain('Your first tests');
  const wheels = await request.head('/python-speedrun/pytest-wheels.js');
  expect(wheels.ok()).toBe(true);
  expect(wheels.headers()['content-type']).toContain('text/javascript');
  await page.getByRole('link', { name: /Back to Anna’s portfolio/ }).click();
  await expect(page).toHaveURL('/case-studies#python-case');
});

test('a shortlist starter adds missing skills and keeps manual selections throughout checkout', async ({ page }) => {
  await page.goto('/skills');
  await page.getByRole('button', { name: 'Add to shortlist: API testing' }).click();
  await page.getByRole('button', { name: 'Add to shortlist: Technical SEO testing' }).click();
  await page.getByRole('button', { name: 'Shortlist 2', exact: true }).click();
  await page.getByRole('button', { name: 'Increase quantity for Technical SEO testing' }).click();
  await page.keyboard.press('Escape');

  const starter = page.getByRole('region', { name: "What's on your QA agenda?" });
  await starter.getByRole('button', { name: 'Surviving a CMS migration' }).click();
  await expect(starter.getByRole('listitem')).toHaveText([
    'Website migration testing', 'CMS testing', 'Technical SEO testing', 'Visual regression testing',
    'Integration testing', 'Accessibility testing', 'Test strategy'
  ]);
  await starter.getByRole('button', { name: 'Add this skill set' }).click();
  await expect(starter.getByRole('button', { name: 'Skill set already on shortlist' })).toBeDisabled();

  await page.getByRole('link', { name: 'Experience', exact: true }).click();
  await page.getByRole('button', { name: 'Shortlist 8', exact: true }).click();
  const cart = page.getByRole('dialog');
  await expect(cart.getByRole('listitem')).toHaveCount(8);
  await cart.getByRole('button', { name: 'Checkout' }).click();
  await cart.getByText('Review selected skills').click();
  for (const skill of ['API testing ×1', 'Technical SEO testing ×2', 'Test strategy ×1']) {
    await expect(cart.getByText(skill, { exact: true })).toBeVisible();
  }
});

test('the Skills page remains usable if shortlist starters need a retry', async ({ page }) => {
  await page.route('**/api/portfolio/presets', (route) =>
    route.fulfill({ json: [{ id: 'invalid', name: 'Invalid', description: 'Invalid', skills: ['unknown'] }] }), { times: 1 });
  await page.goto('/skills');
  const starter = page.getByRole('region', { name: "What's on your QA agenda?" });
  await expect(starter.getByRole('status')).toContainText('Shortlist starters couldn’t load');
  await expect(page.getByRole('button', { name: 'Add to shortlist: API testing' })).toBeVisible();
  await starter.getByRole('button', { name: 'Retry loading starters' }).click();
  await expect(starter.getByRole('button', { name: 'Getting ready for release' })).toBeFocused();
});


test('Taking ownership of QA and Head-to-toe testing are selectable skill sets', async ({ page }) => {
  await page.goto('/skills');
  const starter = page.getByRole('region', { name: "What's on your QA agenda?" });
  await starter.getByRole('button', { name: 'Taking ownership of QA', exact: true }).click();
  await expect(starter.getByRole('listitem')).toHaveText([
    'Quality ownership', 'Test strategy', 'Risk analysis', 'Independent problem-solving', 'QA coordination',
    'QA process improvement', 'Clear communication'
  ]);
  await starter.getByRole('button', { name: 'Head-to-toe testing', exact: true }).click();
  await expect(starter.getByRole('listitem')).toHaveText([
    'Requirements analysis', 'Exploratory testing', 'Functional testing', 'End-to-end testing',
    'API testing', 'Integration testing', 'Systems thinking', 'Release verification'
  ]);
  await starter.getByRole('button', { name: 'Add this skill set', exact: true }).click();
  await expect(page.getByRole('button', { name: 'Shortlist 8', exact: true })).toBeVisible();
});

test('quantity messages change from 1 to 5, retain keyboard focus, and carry into checkout', async ({ page }) => {
  await page.addInitScript(() => {
    if (!localStorage.getItem('anna.shortlist.v1')) localStorage.setItem('anna.shortlist.v1', '["exploratory"]');
  });
  await page.goto('/skills');
  await page.getByRole('button', { name: 'Shortlist 1', exact: true }).click();
  const cart = page.getByRole('dialog');
  const plus = cart.getByRole('button', { name: 'Increase quantity for Exploratory testing' });
  const minus = cart.getByRole('button', { name: 'Decrease quantity for Exploratory testing' });
  await expect(minus).toBeDisabled();
  for (const joke of [
    'The happy path is getting lonely.',
    "I'll investigate that suspicious-looking button, too.",
    'At this point, even the documentation is under investigation.',
    'The application has requested legal representation.'
  ]) {
    await plus.press('Enter');
    await expect(cart.getByText(joke, { exact: true })).toBeVisible();
    await expect(plus).toBeFocused();
  }
  await expect(plus).toBeDisabled();
  await expect(cart.locator('#toast-context')).toHaveText('I appreciate your enthusiasm. There is still only one of me, though.');
  await minus.click();
  await expect(cart.getByText('At this point, even the documentation is under investigation.', { exact: true })).toBeVisible();

  await page.reload();
  await page.getByRole('button', { name: 'Shortlist 1', exact: true }).click();
  await cart.getByRole('button', { name: 'Checkout' }).click();
  const summary = cart.getByRole('region', { name: 'Order summary' });
  await summary.getByText('Review selected skills').click();
  await expect(summary.getByRole('listitem')).toHaveText('Exploratory testing ×4');
  await expect(summary.locator('#checkout-count')).toHaveText('1');
  await expect(summary.locator('.order-reptile')).toContainText('Geralt is an independent contractor and is not included in this offer.');
  await cart.getByLabel('Your name').fill('Alex Example');
  await cart.getByLabel('Your email').fill('alex@example.com');
  const response = page.waitForResponse((result) => result.url().endsWith('/api/portfolio/contact'));
  await cart.getByRole('button', { name: 'Send shortlist' }).click();
  const sent = await response;
  expect(sent.request().postDataJSON()).toMatchObject({ skills: ['exploratory'], quantities: { exploratory: 4 } });
  await expect(cart.getByRole('heading', { name: 'Inquiry received.' })).toBeVisible();
});

test('clearing a shortlist shows the regression message and an empty inquiry can be sent', async ({ page }) => {
  await page.goto('/skills#skill-humour');
  await page.getByRole('button', { name: 'Add to shortlist: Killer sense of humour' }).click();
  await page.getByRole('button', { name: 'Shortlist 1', exact: true }).click();
  const cart = page.getByRole('dialog');
  await expect(cart.locator('#shortlist-toast:popover-open #toast-message')).toHaveText('An unconventional recruitment strategy, but I respect it.');
  await cart.getByRole('button', { name: 'Clear shortlist' }).click();
  await expect(cart.locator('#shortlist-toast:popover-open #toast-message')).toHaveText('Shortlist cleared.');
  await expect(cart.locator('#toast-context')).toHaveText("Regression complete. We're back to the initial state.");
  await cart.getByRole('button', { name: 'Contact Anna' }).click();
  await cart.getByLabel('Your name').fill('Alex Example');
  await cart.getByLabel('Your email').fill('alex@example.com');
  await cart.getByRole('button', { name: 'Send shortlist' }).click();
  await expect(cart.getByRole('heading', { name: 'Inquiry received.' })).toBeVisible();
});

test('adding skills shows a temporary toast and announces contextual feedback', async ({ page }) => {
  await page.clock.install();
  await page.goto('/skills');
  await page.getByRole('button', { name: 'Add to shortlist: Exploratory testing' }).click();
  const toast = page.locator('#shortlist-toast:popover-open');
  await expect(toast).toHaveText('Exploratory testing added to your shortlist.');
  await expect(page.getByRole('button', { name: 'Remove from shortlist: Exploratory testing' })).toBeFocused();
  await page.clock.fastForward(5100);
  await expect(toast).toHaveCount(0);

  const filters = page.getByRole('group', { name: 'Filter shortlist items' });
  await filters.getByRole('button', { name: 'Automation & technical skills' }).click();
  await page.getByRole('button', { name: 'Add to shortlist: Playwright', exact: true }).click();
  await expect(toast.locator('#toast-message')).toHaveText('Playwright added to your shortlist.');
  await expect(toast.locator('#toast-context')).toHaveText('Machines and humans working together. As they should.');
  await expect(page.locator('#cart-status')).toHaveText('Playwright added to your shortlist. Machines and humans working together. As they should.');
});

test('About offers the CV as English and Czech PDF downloads', async ({ page, request }) => {
  await page.goto('/about-me');
  const cvs = [
    ['Download CV, English (PDF)', '/cv/Anna_Sevelova_CV_EN.pdf'],
    ['Download CV, Čeština (PDF)', '/cv/Anna_Sevelova_CV_CZ.pdf']
  ] as const;
  for (const [name, path] of cvs) {
    const link = page.getByRole('link', { name });
    await expect(link).toHaveAttribute('href', path);
    await expect(link).toHaveAttribute('download', '');
    const response = await request.get(path);
    expect(response.status()).toBe(200);
    expect(response.headers()['content-type']).toBe('application/pdf');
    expect((await response.body()).subarray(0, 5).toString()).toBe('%PDF-');
  }
  const download = page.waitForEvent('download');
  await page.getByRole('link', { name: 'Download CV, English (PDF)' }).click();
  expect((await download).suggestedFilename()).toBe('Anna_Sevelova_CV_EN.pdf');
});

API tests

portfolio-catalog-api.spec.ts

Checks catalogue filters, individual skill responses, and whether preset bundles reference valid skills.

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

test('filters the catalogue and returns the matching skill detail', async ({ request }) => {
  const filtered = await request.get('/api/portfolio/skills', { params: { category: 'testing', q: '  structured data ' } });
  expect(filtered.status()).toBe(200);
  expect(filtered.headers()['content-type']).toContain('application/json');
  expect(await filtered.json()).toEqual([
    expect.objectContaining({ id: 'seo', category: 'testing', name: 'Technical SEO testing' })
  ]);
  const detail = await request.get('/api/portfolio/skills/seo');
  expect(detail.status()).toBe(200);
  expect(await detail.json()).toMatchObject({ id: 'seo', name: 'Technical SEO testing' });
  expect((await request.get('/api/portfolio/skills/missing')).status()).toBe(404);
  expect((await request.get('/api/portfolio/skills', { params: { category: 'missing' } })).status()).toBe(400);
});

test('every shortlist starter points to skills in the catalogue', async ({ request }) => {
  const [starters, catalogue] = await Promise.all([
    request.get('/api/portfolio/presets'),
    request.get('/api/portfolio/skills')
  ]);
  expect(starters.status()).toBe(200);
  expect(catalogue.status()).toBe(200);

  const ids = new Set((await catalogue.json()).map((skill) => skill.id));
  const presets = await starters.json();
  expect(presets.map((preset) => [preset.id, preset.skills.length])).toEqual([
    ['web-release', 6], ['cms-migration', 7], ['test-automation', 7], ['autonomous-qa', 7],
    ['head-to-toe-testing', 8], ['technical-investigation', 5], ['beyond-functional', 8]
  ]);
  expect(ids.has('autonomous-qa')).toBe(false);
  expect(ids.has('whole-product-qa')).toBe(false);
  for (const preset of presets) {
    expect(new Set(preset.skills).size).toBe(preset.skills.length);
    expect(preset.skills.every((id) => ids.has(id))).toBe(true);
  }
});
portfolio-contact-api.spec.ts

Checks that the contact endpoint accepts valid inquiries and rejects unknown skills, invalid quantities, and cross-origin requests.

import { expect, test } from '@playwright/test';
import { randomUUID } from 'node:crypto';

test('direct contact accepts catalogue IDs and rejects unknown skills or cross-origin submissions', async ({ request, baseURL }) => {
  const data = { id: randomUUID(), name: 'Alex Example', email: 'alex@example.com', message: 'QA role', skills: ['playwright', 'seo'] };
  const origin = new URL(baseURL!).origin;
  const crossOrigin = await request.post('/api/portfolio/contact', { headers: { Origin: 'https://example.com' }, data });
  expect(crossOrigin.status()).toBe(403);
  const invalid = await request.post('/api/portfolio/contact', {
    headers: { Origin: origin },
    data: { ...data, skills: ['invented-item'] }
  });
  expect(invalid.status()).toBe(422);
  for (const quantities of [{ playwright: 0 }, { playwright: 6 }, { playwright: 1.5 }, { invented: 2 }]) {
    const invalidQuantity = await request.post('/api/portfolio/contact', {
      headers: { Origin: origin }, data: { ...data, quantities }
    });
    expect(invalidQuantity.status()).toBe(422);
  }
  const accepted = await request.post('/api/portfolio/contact', { headers: { Origin: origin }, data });
  expect(accepted.status()).toBe(202);
  expect(await accepted.json()).toEqual({ accepted: true });
});

Your shortlist

Nothing selected yet. An unusual number of edge cases remain available.