test: add mutex to clipboard copy & paste operation to reduce flaky (#11884)
This commit is contained in:
@@ -7,7 +7,6 @@ import {
|
||||
} from '@affine-test/kit/utils/editor';
|
||||
import { importImage } from '@affine-test/kit/utils/image';
|
||||
import {
|
||||
pasteByKeyboard,
|
||||
selectAllByKeyboard,
|
||||
writeTextToClipboard,
|
||||
} from '@affine-test/kit/utils/keyboard';
|
||||
@@ -253,7 +252,6 @@ test('should show toolbar when inline link is preceded by image or surface-ref',
|
||||
const url = new URL(page.url());
|
||||
|
||||
await writeTextToClipboard(page, url.toString());
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
const toolbar = locateToolbar(page);
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ test('not allowed to switch to embed view when linking to the same document', as
|
||||
const url0 = new URL(page.url());
|
||||
|
||||
await writeTextToClipboard(page, url0.toString());
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
const { toolbar, switchViewBtn, inlineViewBtn, cardViewBtn, embedViewBtn } =
|
||||
toolbarButtons(page);
|
||||
@@ -296,7 +295,6 @@ test('allow switching to embed view when linking to the other document with mode
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await writeTextToClipboard(page, url.toString());
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
// Inline
|
||||
await inlineLink.hover();
|
||||
@@ -516,9 +514,8 @@ test('the viewport should be fit when the linked document is with edgeless mode'
|
||||
|
||||
// move viewport
|
||||
const { x, y } = noteBoundingBox;
|
||||
await page.mouse.click(x - 10, y - 10);
|
||||
await page.mouse.click(x - 10, y + 100);
|
||||
await page.keyboard.down('Space');
|
||||
await page.waitForTimeout(50);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(x + 1000, y);
|
||||
await page.mouse.up();
|
||||
@@ -538,7 +535,6 @@ test('the viewport should be fit when the linked document is with edgeless mode'
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await writeTextToClipboard(page, url.toString());
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
// Inline
|
||||
await page.locator('affine-reference').hover();
|
||||
@@ -608,7 +604,7 @@ test('should show edgeless content when switching card view of linked mode doc i
|
||||
await clickEdgelessModeButton(page);
|
||||
|
||||
await page.mouse.move(x, y);
|
||||
await writeTextToClipboard(page, url.toString());
|
||||
await writeTextToClipboard(page, url.toString(), false);
|
||||
|
||||
// Inline
|
||||
const embed = page.locator('affine-embed-edgeless-linked-doc-block');
|
||||
@@ -1116,7 +1112,6 @@ test('should show full email address', async ({ page }) => {
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await writeTextToClipboard(page, 'dev@affine.pro');
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
const inlineLink = page.locator('affine-link');
|
||||
|
||||
@@ -1140,7 +1135,6 @@ test('should not show view toggle button when protocol of link is not http(s)',
|
||||
await page.keyboard.press('Enter');
|
||||
|
||||
await writeTextToClipboard(page, 'ftp://affine.pro/blocksuite.pdf');
|
||||
await pasteByKeyboard(page);
|
||||
|
||||
const inlineLink = page.locator('affine-link');
|
||||
|
||||
|
||||
@@ -515,8 +515,6 @@ test('can paste a doc link to create link reference', async ({ page }) => {
|
||||
// paste the url
|
||||
await writeTextToClipboard(page, url);
|
||||
|
||||
// check the link reference
|
||||
await page.waitForTimeout(500);
|
||||
await expect(
|
||||
page.locator('affine-reference:has-text("Getting Started")')
|
||||
).toBeVisible();
|
||||
@@ -524,8 +522,6 @@ test('can paste a doc link to create link reference', async ({ page }) => {
|
||||
// can ctrl-z to revert to normal link
|
||||
await page.keyboard.press('ControlOrMeta+z');
|
||||
|
||||
// check the normal link
|
||||
await page.waitForTimeout(500);
|
||||
await expect(page.locator(`affine-link:has-text("${url}")`)).toBeVisible();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user