import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react';
import { Default } from '@digigov/ui/form/DateInputContainer/__stories__/Default';
import { WithErrorMessageForSingleField } from '@digigov/ui/form/DateInputContainer/__stories__/WithErrorMessageForSingleField';
test('renders the Default Actions with mouse', 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>fieldset>div>div:nth-child(1)>label>input')
.click();
await page.keyboard.insertText('11');
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the WithErrorMessageForSingleField Actions with keyboard', 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');
await page.keyboard.press('Tab');
await page.keyboard.press('Tab');
await page.keyboard.insertText('2022');
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});