import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react';
import { AlignRight } from '@digigov/ui/navigation/Dropdown/__stories__/AlignRight';
import { Default } from '@digigov/ui/navigation/Dropdown/__stories__/Default';
import { Dense } from '@digigov/ui/navigation/Dropdown/__stories__/Dense';
import { PlacementTop } from '@digigov/ui/navigation/Dropdown/__stories__/PlacementTop';
import { ScrollableContent } from '@digigov/ui/navigation/Dropdown/__stories__/ScrollableContent';
test('renders the AlignRight Align right action', 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>details>summary').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the Default Open dropdown action', 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>details>summary').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the Dense Open dropdown action', 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>details>summary').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the PlacementTop Placement top action', 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>details>summary').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the ScrollableContent open content', 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>details>summary').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});