import React from 'react';
import { test, expect } from '@playwright/experimental-ct-react';

import { Default } from '@digigov/ui/feedback/NotificationBanner/__stories__/Default';
import { Success } from '@digigov/ui/feedback/NotificationBanner/__stories__/Success';

test('renders the Default Hover and click', async ({ mount, page }) => {
  await mount(<Default />);
  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>div:nth-child(2)>h3>a').hover();
  await page.locator('#root>div>div:nth-child(2)>h3>a').click();

  const screenshot = await page.screenshot({
    fullPage: true,
    animations: 'disabled',
  });
  expect(screenshot).toMatchSnapshot();
});

test('renders the Success Hover and click', async ({ mount, page }) => {
  await mount(<Success />);
  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>div:nth-child(2)>h3>a').hover();
  await page.locator('#root>div>div:nth-child(2)>h3>a').click();

  const screenshot = await page.screenshot({
    fullPage: true,
    animations: 'disabled',
  });
  expect(screenshot).toMatchSnapshot();
});
