import { test, expect } from '@playwright/test' // See here how to get started: // https://playwright.dev/docs/intro test('opens the canvas and creates a note', async ({ page }) => { await page.goto('/') await expect(page.getByText('无界笺', { exact: true })).toBeVisible() const notesBefore = await page.locator('.note-card').count() await page.getByRole('button', { name: '新便笺' }).click() await expect(page.locator('.note-card')).toHaveCount(notesBefore + 1) }) test('pastes clipboard text into a new note on the canvas', async ({ page }) => { await page.context().grantPermissions(['clipboard-read', 'clipboard-write']) await page.goto('/') await expect(page.getByText('无界笺', { exact: true })).toBeVisible() const notesBefore = await page.locator('.note-card').count() await page.evaluate(() => navigator.clipboard.writeText('临时灵感\n把复制的文字直接变成一张新便笺。'), ) await page.locator('.vue-flow__pane').click({ position: { x: 90, y: 90 } }) await page.keyboard.press('Control+V') await expect(page.locator('.note-card')).toHaveCount(notesBefore + 1) const pastedCard = page.locator('.note-card').last() await expect(pastedCard.locator('.note-card__title')).toHaveValue('临时灵感') await expect(pastedCard.locator('.note-card__content')).toHaveValue( '临时灵感\n把复制的文字直接变成一张新便笺。', ) })