feat: mid click links to open in new tab (#7784)

fix AF-1200
This commit is contained in:
pengx17
2024-08-08 09:43:35 +00:00
parent fd6e198295
commit 7fca13076a
22 changed files with 163 additions and 78 deletions

View File

@@ -10,7 +10,7 @@ import {
import { waitForLogMessage } from '@affine-test/kit/utils/utils';
import { expect } from '@playwright/test';
test('New a page and open it ,then favorite it', async ({
test('New a page and open it, then favorite it', async ({
page,
workspace,
}) => {

View File

@@ -8,7 +8,7 @@ import {
} from '@affine-test/kit/utils/page-logic';
import { expect } from '@playwright/test';
test('click btn bew page and open in tab', async ({ page, workspace }) => {
test('click btn new page and open in tab', async ({ page, workspace }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await clickNewPageButton(page);
@@ -31,3 +31,54 @@ test('click btn bew page and open in tab', async ({ page, workspace }) => {
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('switch between new page and all page', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
const title = 'this is a new page';
await clickNewPageButton(page, title);
await page.getByTestId('all-pages').click();
const cell = page.getByTestId('page-list-item').getByText(title);
await expect(cell).toBeVisible();
await cell.click();
await expect(getBlockSuiteEditorTitle(page)).toHaveText(title);
await page.getByTestId('all-pages').click();
await expect(cell).toBeVisible();
});
test('ctrl click all page and open in new tab', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
const [newTabPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByTestId('all-pages').click({
modifiers: ['ControlOrMeta'],
}),
]);
await expect(newTabPage).toHaveURL(/\/all/, {
timeout: 15000,
});
});
test('mid click all page and open in new tab', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
const [newTabPage] = await Promise.all([
page.waitForEvent('popup'),
page.getByTestId('all-pages').click({
button: 'middle',
}),
]);
await expect(newTabPage).toHaveURL(/\/all/, {
timeout: 15000,
});
});