fix: restore case study drawer interactions

This commit is contained in:
2026-09-09 23:17:39 +03:30
parent 24cd86ede7
commit b87a1be8fc
6 changed files with 22 additions and 19 deletions

View File

@@ -9,20 +9,19 @@ async function expectDrawerOpen(page: import('@playwright/test').Page) {
return dialog;
}
test('a card CTA opens a route-backed drawer and restores the portfolio', async ({ page }) => {
test('a pointer click on the card CTA opens a route-backed drawer and restores the portfolio', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded' });
await page.evaluate(() => {
window.scrollTo({ top: document.body.scrollHeight * 0.35, behavior: 'instant' });
});
const card = page.getByRole('article', { name: 'Qlockify' });
const cta = card.getByRole('link', { name: 'View case study' });
await cta.focus();
const portfolioScroll = await page.evaluate(() => window.scrollY);
await cta.press('Enter');
await cta.click();
await expect(page).toHaveURL(new RegExp(`${caseStudyPath}$`));
const dialog = await expectDrawerOpen(page);
await expect(dialog.getByRole('heading', { name: 'Qlockify', level: 1 })).toBeFocused();
await expect(dialog.getByRole('button', { name: 'Close case study' })).toBeFocused();
await expect(card.getByRole('link', { name: /Open the live Qlockify/ })).toHaveAttribute('target', '_blank');
await expect(card.getByRole('link', { name: /Open the live Qlockify/ })).toHaveAttribute('rel', 'noopener noreferrer');
@@ -53,7 +52,7 @@ test('copy feedback, focus containment, and the localized RTL route work', async
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('heading', { name: 'Qlockify', level: 1 })).toBeFocused();
await expect(dialog.getByRole('button', { name: 'بستن مطالعه موردی' })).toBeFocused();
await dialog.getByRole('button', { name: 'کپی پیوند' }).click();
await expect(dialog.getByText('پیوند کپی شد', { exact: true }).first()).toBeVisible();