test: cover case study gallery and sharing
This commit is contained in:
@@ -47,21 +47,44 @@ test('a shared route opens over the portfolio and adjacent navigation replaces h
|
||||
await expect(page).toHaveURL(/\/$/);
|
||||
});
|
||||
|
||||
test('copy feedback, focus containment, and the localized RTL route work', async ({ page, context }) => {
|
||||
test('share fallback, copy feedback, focus containment, and the localized RTL route work', async ({ page, context }) => {
|
||||
await context.grantPermissions(['clipboard-read', 'clipboard-write']);
|
||||
await page.goto('/fa/projects/qlockify', { waitUntil: 'domcontentloaded' });
|
||||
const dialog = await expectDrawerOpen(page);
|
||||
await expect(page.locator('html')).toHaveAttribute('dir', 'rtl');
|
||||
await expect(dialog.getByRole('button', { name: 'بستن مطالعه موردی' })).toBeFocused();
|
||||
|
||||
await dialog.getByRole('button', { name: 'کپی پیوند' }).click();
|
||||
await expect(dialog.getByText('پیوند کپی شد', { exact: true }).first()).toBeVisible();
|
||||
await dialog.getByRole('button', { name: 'اشتراکگذاری این مطالعه موردی' }).click();
|
||||
const shareDialog = page.getByRole('dialog', { name: 'اشتراکگذاری مطالعه موردی' });
|
||||
await expect(shareDialog).toBeVisible();
|
||||
await shareDialog.getByRole('button', { name: 'کپی پیوند' }).click();
|
||||
await expect(shareDialog.getByText('پیوند کپی شد', { exact: true }).first()).toBeVisible();
|
||||
expect(await page.evaluate(() => navigator.clipboard.readText())).toMatch(/\/fa\/projects\/qlockify$/);
|
||||
|
||||
await shareDialog.getByRole('button', { name: 'بستن گزینههای اشتراکگذاری' }).click();
|
||||
await expect(dialog.getByRole('button', { name: 'اشتراکگذاری این مطالعه موردی' })).toBeFocused();
|
||||
|
||||
await page.keyboard.press('Tab');
|
||||
expect(await page.evaluate(() => document.activeElement?.closest('dialog') !== null)).toBe(true);
|
||||
});
|
||||
|
||||
test('the gallery serves original media and opens an accessible full-screen viewer', async ({ page }) => {
|
||||
await page.goto(caseStudyPath, { waitUntil: 'domcontentloaded' });
|
||||
const drawer = await expectDrawerOpen(page);
|
||||
const stage = drawer.getByRole('button', { name: /Open full-screen image/ });
|
||||
const selectedImage = stage.getByRole('img');
|
||||
await expect(selectedImage).toHaveAttribute('src', '/images/screenshots/qlockify/qlockify-landing.png');
|
||||
|
||||
await stage.click();
|
||||
const viewer = page.getByRole('dialog', { name: 'Full-screen project gallery' });
|
||||
await expect(viewer).toBeVisible();
|
||||
await expect(viewer.getByText('1 of 8')).toBeVisible();
|
||||
await viewer.getByRole('button', { name: 'Next image' }).click();
|
||||
await expect(viewer.getByText('2 of 8')).toBeVisible();
|
||||
await viewer.getByRole('button', { name: 'Close full-screen image' }).click();
|
||||
await expect(stage).toBeFocused();
|
||||
});
|
||||
|
||||
test('the drawer stays bottom-anchored with its own scrolling surface', async ({ page }) => {
|
||||
await page.goto(caseStudyPath, { waitUntil: 'domcontentloaded' });
|
||||
const dialog = await expectDrawerOpen(page);
|
||||
|
||||
Reference in New Issue
Block a user