import { expect, test } from '../helpers/serve-dist'; test.use({ javaScriptEnabled: false }); const sectionIds = [ 'start', 'profile', 'experience', 'infrastructure', 'selected-builds', 'additional-work', 'toolkit', 'contact', ] as const; const sectionHeadings = [ 'START', 'PROFILE', 'EXPERIENCE', 'INFRASTRUCTURE', 'SELECTED BUILDS', 'ADDITIONAL WORK', 'TOOLKIT', 'CONTACT', ] as const; test('keeps the complete hiring-manager path readable without JavaScript', async ({ page, distUrl, }) => { const pageErrors: string[] = []; const consoleErrors: string[] = []; const failedRequests: string[] = []; page.on('pageerror', (error) => pageErrors.push(error.message)); page.on('console', (message) => { if (message.type() === 'error') consoleErrors.push(message.text()); }); page.on('requestfailed', (request) => { if (request.resourceType() !== 'script') { failedRequests.push( `${request.url()}: ${request.failure()?.errorText ?? 'failed'}`, ); } }); await page.goto(distUrl, { waitUntil: 'load' }); await expect(page.locator('h1:visible')).toHaveCount(1); await expect(page.locator('h1')).toHaveText('Luca Pîslaru'); await expect(page.locator('.site-header > p').first()).toHaveText( 'System Administrator & Full-Stack Developer', ); await expect(page.locator('main')).toBeVisible(); await expect( page.locator('nav[aria-label="Portfolio sections"]'), ).toBeVisible(); await expect(page.locator('footer')).toBeVisible(); expect( await page .locator('main > section') .evaluateAll((sections) => sections.map((section) => section.id)), ).toEqual(sectionIds); expect(await page.locator('main > section > h2').allTextContents()).toEqual( sectionHeadings, ); for (const evidence of [ 'Professional systems operations', 'Secure self-hosted platform and lifecycle', 'Private self-hosted medication tracker', 'Footy Tracker', 'Linux', 'Docker', 'Python', 'Vue.js', ]) { await expect( page.getByText(evidence, { exact: true }).first(), ).toBeVisible(); } const email = page.locator('a[href="mailto:luca.pislaru@gmail.com"]'); await expect(email).toBeVisible(); await expect(email).toHaveText('luca.pislaru@gmail.com'); await expect( page.getByText( 'For a current CV or role-specific information, contact me directly.', { exact: true }, ), ).toBeVisible(); for (const title of [ 'Private self-hosted medication tracker', 'Private healthcare platform', 'Private game prototype', ]) { await expect( page.locator('article').filter({ hasText: title }).locator('a'), ).toHaveCount(0); } await expect(page.locator('a[download]')).toHaveCount(0); expect(pageErrors).toEqual([]); expect(consoleErrors).toEqual([]); expect(failedRequests).toEqual([]); }); test('retains native section navigation when scripts are disabled', async ({ page, distUrl, }) => { await page.goto(distUrl, { waitUntil: 'load' }); await page.locator('nav a[href="#contact"]').click(); await expect(page).toHaveURL(`${distUrl}/#contact`); await expect(page.locator('#contact')).toBeInViewport(); await expect(page.locator('#contact a[href^="mailto:"]')).toBeVisible(); });