Files
carmanagement/apps/homepage/tests/browser/homepage.spec.ts
T
root d7fb7b7a7b
Build & Deploy / Build & Push Docker Image (push) Failing after 47s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m4s
Test / Marketplace Unit Tests (push) Failing after 4m55s
Test / Admin Unit Tests (push) Successful in 9m37s
Test / Dashboard Unit Tests (push) Successful in 9m37s
Test / API Integration Tests (push) Successful in 9m54s
redesign the homepage
2026-06-26 16:27:21 -04:00

68 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { expect, test } from '@playwright/test';
for (const scenario of [
{ locale: 'en', dir: 'ltr' },
{ locale: 'fr', dir: 'ltr' },
{ locale: 'ar', dir: 'rtl' },
] as const) {
test(`${scenario.locale} homepage assembles the approved section sequence`, async ({ page }) => {
await page.goto(`/${scenario.locale}`);
await expect(page.locator('html')).toHaveAttribute('dir', scenario.dir);
await expect(page.locator('main h1')).toHaveCount(1);
await expect(page.locator('#product')).toBeVisible();
await expect(page.locator('#workflow')).toBeVisible();
await expect(page.locator('#modules')).toBeVisible();
await expect(page.locator('#pricing')).toBeVisible();
await expect(page.locator('#faq')).toBeVisible();
await expect(page.locator('main > section')).toHaveCount(12);
});
test(`${scenario.locale} unresolved actions remain non-navigable`, async ({ page }) => {
await page.goto(`/${scenario.locale}`);
const disabledActions = page.locator('main [aria-disabled="true"]');
await expect(disabledActions).toHaveCount(2);
await expect(disabledActions.first()).not.toHaveAttribute('href');
});
}
test('Arabic preview preserves left-to-right vehicle identifiers', async ({ page }) => {
await page.goto('/ar');
const identifiers = page.locator('[role="table"] bdi');
await expect(identifiers).toHaveCount(2);
await expect(identifiers.first()).toHaveAttribute('dir', 'ltr');
});
test('homepage navigation targets resolve to real sections', async ({ page }) => {
await page.goto('/en');
for (const hash of ['product', 'workflow', 'modules', 'pricing', 'faq']) {
await expect(page.locator(`#${hash}`)).toHaveCount(1);
await expect(page.locator(`header a[href="/en#${hash}"]`)).toHaveCount(2);
}
});
test('FAQ uses native disclosure behavior', async ({ page }) => {
await page.goto('/en');
const firstItem = page.locator('#faq details').first();
await expect(firstItem).toHaveAttribute('open', '');
await firstItem.locator('summary').click();
await expect(firstItem).not.toHaveAttribute('open', '');
});
test('pricing recommends a plan from the selected fleet band', async ({ page }) => {
await page.goto('/en');
await expect(page.locator('#pricing [data-plan="launch"]')).toHaveAttribute(
'data-recommended',
'true',
);
await page.getByLabel('2675 vehicles').check();
await expect(page.locator('#pricing [data-plan="growth"]')).toHaveAttribute(
'data-recommended',
'true',
);
await page.getByLabel('Annual', { exact: true }).check();
await expect(page.getByLabel('Annual', { exact: true })).toBeChecked();
});