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

import { Banner } from '@digigov/ui/feedback/CopyToClipboard/__stories__/Banner';
import { Default } from '@digigov/ui/feedback/CopyToClipboard/__stories__/Default';
import { Dense } from '@digigov/ui/feedback/CopyToClipboard/__stories__/Dense';

test('renders the Banner Click button', async ({ mount, page }) => {
  await mount(<Banner />);
  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>button').click();
  const screenshot = await page.screenshot({
    fullPage: true,
    animations: 'disabled',
  });
  expect(screenshot).toMatchSnapshot();
});

test('renders the Default Click button', 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>button').click();
  const screenshot = await page.screenshot({
    fullPage: true,
    animations: 'disabled',
  });
  expect(screenshot).toMatchSnapshot();
});

test('renders the Dense Click button', async ({ mount, page }) => {
  await mount(<Dense />);
  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>button').click();
  const screenshot = await page.screenshot({
    fullPage: true,
    animations: 'disabled',
  });
  expect(screenshot).toMatchSnapshot();
});
