chore: bump version (#3567)
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user