chore: bump version (#3567)

This commit is contained in:
Alex Yang
2023-08-04 16:55:28 -07:00
committed by GitHub
parent ea76936508
commit bbf5f0efe0
31 changed files with 410 additions and 379 deletions
@@ -10,10 +10,10 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/blocks": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/global": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/store": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/block-std": "0.0.0-20230804190636-37f66904-nightly",
"@blocksuite/blocks": "0.0.0-20230804190636-37f66904-nightly",
"@blocksuite/global": "0.0.0-20230804190636-37f66904-nightly",
"@blocksuite/store": "0.0.0-20230804190636-37f66904-nightly",
"@playwright/test": "^1.36.2",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
@@ -9,10 +9,10 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine-test/kit": "workspace:*",
"@blocksuite/block-std": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/blocks": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/global": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/store": "0.0.0-20230802200139-381599c0-nightly",
"@blocksuite/block-std": "0.0.0-20230804190636-37f66904-nightly",
"@blocksuite/blocks": "0.0.0-20230804190636-37f66904-nightly",
"@blocksuite/global": "0.0.0-20230804190636-37f66904-nightly",
"@blocksuite/store": "0.0.0-20230804190636-37f66904-nightly",
"@playwright/test": "^1.36.2",
"express": "^4.18.2",
"http-proxy-middleware": "^3.0.0-beta.1",
@@ -1,17 +1,20 @@
import { test } from '@affine-test/kit/playwright';
import { openHomePage } from '@affine-test/kit/utils/load-page';
import { newPage, waitEditorLoad } from '@affine-test/kit/utils/page-logic';
import {
getBlockSuiteEditorTitle,
newPage,
waitEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import type { Page } from '@playwright/test';
import { expect } from '@playwright/test';
const addDatabase = async (page: Page) => {
await page.keyboard.press('/', { delay: 50 });
await page.keyboard.press('d');
await page.keyboard.press('a');
await page.keyboard.press('t');
await page.keyboard.press('a');
await page.keyboard.press('b');
await page.keyboard.press('a', { delay: 50 });
await page.keyboard.press('Enter', { delay: 50 });
await page.keyboard.press('/', { delay: 500 });
await page.keyboard.press('d', { delay: 500 });
await page.keyboard.press('a', { delay: 500 });
await page.keyboard.press('t', { delay: 500 });
await page.keyboard.press('a', { delay: 500 });
await page.getByTestId('Table View').click();
};
test('database is useable', async ({ page }) => {
@@ -19,7 +22,7 @@ test('database is useable', async ({ page }) => {
await waitEditorLoad(page);
await newPage(page);
await waitEditorLoad(page);
const title = page.locator('.affine-default-page-block-title');
const title = await getBlockSuiteEditorTitle(page);
await title.type('test title');
await page.keyboard.press('Enter');
expect(await title.innerText()).toBe('test title');
@@ -30,7 +33,7 @@ test('database is useable', async ({ page }) => {
await waitEditorLoad(page);
await newPage(page);
await waitEditorLoad(page);
const title2 = page.locator('.affine-default-page-block-title');
const title2 = await getBlockSuiteEditorTitle(page);
title2.type('test title2');
await page.waitForTimeout(500);
expect(await title2.innerText()).toBe('test title2');
@@ -45,13 +48,13 @@ test('link page is useable', async ({ page }) => {
await waitEditorLoad(page);
await newPage(page);
await waitEditorLoad(page);
const title = page.locator('.affine-default-page-block-title');
const title = await getBlockSuiteEditorTitle(page);
await title.type('page1');
await page.keyboard.press('Enter');
expect(await title.innerText()).toBe('page1');
await newPage(page);
await waitEditorLoad(page);
const title2 = page.locator('.affine-default-page-block-title');
const title2 = await getBlockSuiteEditorTitle(page);
await title2.type('page2');
await page.keyboard.press('Enter');
expect(await title2.innerText()).toBe('page2');
+147 -151
View File
@@ -19,12 +19,12 @@ async function importImage(page: Page, url: string) {
});
Object.defineProperty(e, 'target', {
writable: false,
value: document.body,
value: document,
});
Object.entries(clipData).forEach(([key, value]) => {
e.clipboardData?.setData(key, value);
});
document.body.dispatchEvent(e);
document.dispatchEvent(e);
},
[url]
);
@@ -45,7 +45,7 @@ test('image preview should be shown', async ({ page }) => {
await waitEditorLoad(page);
await newPage(page);
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -55,14 +55,14 @@ test('image preview should be shown', async ({ page }) => {
expect(await locator.isVisible()).toBeFalsy();
});
test.fixme('image go left and right', async ({ page }) => {
test('image go left and right', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -76,7 +76,7 @@ test.fixme('image go left and right', async ({ page }) => {
}
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
@@ -109,7 +109,7 @@ test('image able to zoom in and out with mouse scroll', async ({ page }) => {
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -162,7 +162,7 @@ test('image able to zoom in and out with button click', async ({ page }) => {
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -201,62 +201,59 @@ test('image able to zoom in and out with button click', async ({ page }) => {
}
});
test.fixme(
'image should able to go left and right by buttons',
async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
await page.waitForTimeout(500);
blobId = (await page
.locator('img')
.nth(1)
.getAttribute('data-blob-id')) as string;
expect(blobId).toBeTruthy();
await closeImagePreviewModal(page);
}
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
const locator = page.getByTestId('image-preview-modal');
expect(locator.isVisible()).toBeTruthy();
test('image should able to go left and right by buttons', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
// ensure the new image was imported
await page.waitForTimeout(1000);
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await locator.getByTestId('next-image-button').click();
await page.waitForTimeout(1000);
{
const newBlobId = (await page
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).toBe(blobId);
}
await locator.getByTestId('previous-image-button').click();
await page.waitForTimeout(1000);
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await page.waitForTimeout(500);
blobId = (await page
.locator('img')
.nth(1)
.getAttribute('data-blob-id')) as string;
expect(blobId).toBeTruthy();
await closeImagePreviewModal(page);
}
);
{
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
const locator = page.getByTestId('image-preview-modal');
expect(locator.isVisible()).toBeTruthy();
await page.locator('img').first().dblclick();
// ensure the new image was imported
await page.waitForTimeout(1000);
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await locator.getByTestId('next-image-button').click();
await page.waitForTimeout(1000);
{
const newBlobId = (await page
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).toBe(blobId);
}
await locator.getByTestId('previous-image-button').click();
await page.waitForTimeout(1000);
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
});
test('image able to fit to screen by button', async ({ page }) => {
await openHomePage(page);
@@ -265,7 +262,7 @@ test('image able to fit to screen by button', async ({ page }) => {
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -322,7 +319,7 @@ test('image able to reset zoom to 100%', async ({ page }) => {
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -375,7 +372,7 @@ test('image able to copy to clipboard', async ({ page }) => {
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -402,7 +399,7 @@ test('image able to download', async ({ page }) => {
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -434,7 +431,7 @@ test('image should only able to move when image is larger than viewport', async
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -482,81 +479,80 @@ test('image should only able to move when image is larger than viewport', async
expect(initialYPos).toBe(imageBoundary?.y);
});
test.fixme(
'image should able to delete and when delete, it will move to previous/next image',
async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
await page.waitForTimeout(500);
blobId = (await page
.locator('img')
.nth(1)
.getAttribute('data-blob-id')) as string;
expect(blobId).toBeTruthy();
await closeImagePreviewModal(page);
}
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
const locator = page.getByTestId('image-preview-modal');
await expect(locator.isVisible()).toBeTruthy();
test('image should able to delete and when delete, it will move to previous/next image', async ({
page,
}) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
// ensure the new image was imported
await page.waitForTimeout(1000);
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await page.waitForTimeout(500);
await locator.getByTestId('delete-button').click();
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).toBe(blobId);
await closeImagePreviewModal(page);
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
await page.locator('img').first().dblclick();
await locator.getByTestId('next-image-button').click();
await page.waitForTimeout(1000);
{
const newBlobId = (await page
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).toBe(blobId);
}
await locator.getByTestId('delete-button').click();
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await locator.getByTestId('delete-button').click();
await page.waitForTimeout(500);
{
const locator = await page.getByTestId('image-preview-modal').count();
expect(locator).toBe(0);
}
blobId = (await page
.locator('img')
.nth(1)
.getAttribute('data-blob-id')) as string;
expect(blobId).toBeTruthy();
await closeImagePreviewModal(page);
}
);
{
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
const locator = page.getByTestId('image-preview-modal');
await expect(locator.isVisible()).toBeTruthy();
await page.locator('img').first().dblclick();
// ensure the new image was imported
await page.waitForTimeout(1000);
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await page.waitForTimeout(500);
await locator.getByTestId('delete-button').click();
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).toBe(blobId);
await closeImagePreviewModal(page);
const title = await getBlockSuiteEditorTitle(page);
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/affine-preview.png');
}
await page.locator('img').first().dblclick();
await locator.getByTestId('next-image-button').click();
await page.waitForTimeout(1000);
{
const newBlobId = (await page
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).toBe(blobId);
}
await locator.getByTestId('delete-button').click();
{
const newBlobId = (await locator
.getByTestId('image-content')
.getAttribute('data-blob-id')) as string;
expect(newBlobId).not.toBe(blobId);
}
await locator.getByTestId('delete-button').click();
await page.waitForTimeout(500);
{
const locator = await page.getByTestId('image-preview-modal').count();
expect(locator).toBe(0);
}
});
test('tooltips for all buttons should be visible when hovering', async ({
page,
@@ -567,7 +563,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
let blobId: string;
{
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -581,7 +577,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
const locator = page.getByTestId('image-preview-modal');
await page.waitForTimeout(500);
await locator.getByTestId('previous-image-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const previousImageTooltip = await element.getByText('Previous').count();
@@ -589,7 +585,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('next-image-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const nextImageTooltip = await element.getByText('Next').count();
@@ -597,7 +593,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('fit-to-screen-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const fitToScreenToolTip = await element.getByText('Fit to Screen').count();
@@ -605,7 +601,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('zoom-out-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const zoomOutToolTip = await element.getByText('Zoom out').count();
@@ -613,7 +609,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('reset-scale-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const resetScaleTooltip = await element.getByText('Reset Scale').count();
@@ -621,7 +617,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('zoom-in-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const zoominToolTip = await element.getByText('Zoom in').count();
@@ -629,7 +625,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('download-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(2000);
{
const element = await page.getByRole('tooltip');
const downloadTooltip = await element.getByText('Download').count();
@@ -637,7 +633,7 @@ test('tooltips for all buttons should be visible when hovering', async ({
}
await locator.getByTestId('copy-to-clipboard-button').hover();
await page.waitForTimeout(500);
await page.waitForTimeout(1000);
{
const element = await page.getByRole('tooltip');
const downloadTooltip = await element
@@ -660,7 +656,7 @@ test('keypress esc should close the modal', async ({ page }) => {
await waitEditorLoad(page);
await newPage(page);
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -678,7 +674,7 @@ test('when mouse moves outside, the modal should be closed', async ({
await waitEditorLoad(page);
await newPage(page);
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().dblclick();
@@ -699,7 +695,7 @@ test('caption should be visible and different styles were applied if image zoome
await waitEditorLoad(page);
await newPage(page);
const title = await getBlockSuiteEditorTitle(page);
await title.dblclick();
await title.click();
await page.keyboard.press('Enter');
await importImage(page, 'http://localhost:8081/large-image.png');
await page.locator('img').first().hover();
+2 -2
View File
@@ -10,7 +10,7 @@ const openQuickSearchByShortcut = async (page: Page) =>
async function assertTitle(page: Page, text: string) {
const edgeless = page.locator('affine-edgeless-page');
if (!edgeless) {
const locator = page.locator('.affine-default-page-block-title').nth(0);
const locator = page.locator('.affine-doc-page-block-title').nth(0);
const actual = await locator.inputValue();
expect(actual).toBe(text);
}
@@ -24,7 +24,7 @@ async function assertResultList(page: Page, texts: string[]) {
async function titleIsFocused(page: Page) {
const edgeless = page.locator('affine-edgeless-page');
if (!edgeless) {
const title = page.locator('.affine-default-page-block-title');
const title = page.locator('.affine-doc-page-block-title');
await expect(title).toBeVisible();
await expect(title).toBeFocused();
}
+1 -1
View File
@@ -16,7 +16,7 @@ export async function newPage(page: Page) {
}
export function getBlockSuiteEditorTitle(page: Page) {
return page.locator('.affine-default-page-block-title').nth(0);
return page.locator('.affine-doc-page-block-title').nth(0);
}
export async function type(page: Page, content: string, delay = 50) {