import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react';
import { Default } from '@digigov/ui/form/TextArea/__stories__/Default';
import { WithErrorMessage } from '@digigov/ui/form/TextArea/__stories__/WithErrorMessage';
import { WithHint } from '@digigov/ui/form/TextArea/__stories__/WithHint';
test('renders the Default click textarea', 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>label>textarea').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the WithErrorMessage Click textarea', 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>label>textarea').click();
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});
test('renders the WithHint Navigate 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.insertText('Πληροφορίες');
const screenshot = await page.screenshot({
fullPage: true,
animations: 'disabled',
});
expect(screenshot).toMatchSnapshot();
});