import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react';
import { Auto } from '@digigov/ui/app/Modal/__stories__/Auto';
import { Dense } from '@digigov/ui/app/Modal/__stories__/Dense';
import { WithHooks } from '@digigov/ui/app/Modal/__stories__/WithHooks';
test('renders the Auto Click modal', 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>div>button:nth-child(1)').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the Dense Open modal', 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>div>button').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the WithHooks Click modal with hooks', 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>div>button').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});