import { test, expect } from '@playwright/test'

test('预定义颜色', async ({ page }) => {
  page.on('pageerror', (exception) => expect(exception).toBeNull())
  await page.goto('color-select-panel#predefine')
  await page.getByRole('button', { name: 'Show Color select panel' }).click()
  await page.locator('.black').click()
  await page.locator('.tiny-color-select-panel__inner__hue-select').click()
  await page.getByRole('button', { name: '选择' }).click()
  await page.getByRole('button', { name: 'Append predefine color' }).click()
  await page.getByRole('button', { name: 'Show Color select panel' }).click()
  await page.getByRole('button', { name: '预定义颜色' }).click()
  await page.locator('.tiny-color-select-panel__predefine > div:nth-child(8)').click()
  await page.getByRole('button', { name: 'Pop predefine color' }).click()
  await page.getByRole('button', { name: 'Show Color select panel' }).click()
  await page.getByRole('button', { name: '预定义颜色' }).click()
  await page.locator('.tiny-color-select-panel__inner__hue-select').click()
  await page.locator('.tiny-color-select-panel__inner__hue-select').click()
  await page.getByRole('button', { name: '选择' }).click()
  await page.getByRole('button', { name: 'Show Color select panel' }).click()
  await page.getByRole('button', { name: '预定义颜色' }).click()
  await page.getByRole('button', { name: 'Append predefine color' }).click()
  await page.getByRole('button', { name: 'Show Color select panel' }).click()
  await page.getByRole('button', { name: '预定义颜色' }).click()
})
