import React from 'react'; import { test, expect } from '@playwright/experimental-ct-react'; import { DarkBackground } from '@digigov/ui/navigation/Link/__stories__/DarkBackground'; import { Default } from '@digigov/ui/navigation/Link/__stories__/Default'; import { NoUnderline } from '@digigov/ui/navigation/Link/__stories__/NoUnderline'; test('renders the DarkBackground Hover and focus', async ({ mount, page }) => { await mount(); await page.evaluate(() => document.fonts.ready); // Move the mouse to the top-left corner to avoid random hover issues await page.mouse.move(0, 0); await page.locator('#root>section>a').hover(); await page.locator('#root>section>a').click(); const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled', }); expect(screenshot).toMatchSnapshot(); }); test('renders the Default Focus', async ({ mount, page }) => { await mount(); await page.evaluate(() => document.fonts.ready); // Move the mouse to the top-left corner to avoid random hover issues await page.mouse.move(0, 0); await page.keyboard.press('Tab'); const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled', }); expect(screenshot).toMatchSnapshot(); }); test('renders the NoUnderline Hover and focus', async ({ mount, page }) => { await mount(); await page.evaluate(() => document.fonts.ready); // Move the mouse to the top-left corner to avoid random hover issues await page.mouse.move(0, 0); await page.locator('#root>a').hover(); await page.locator('#root>a').click(); const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled', }); expect(screenshot).toMatchSnapshot(); });