feat: bump blocksuite (#5194)

Co-authored-by: AyushAgrawal-A2 <ayushagl06@gmail.com>
This commit is contained in:
Yifeng Wang
2023-12-06 18:15:03 +08:00
committed by GitHub
co-authored by AyushAgrawal-A2
parent 2dcb5a3030
commit 6cbf5b2a92
37 changed files with 292 additions and 430 deletions
+51 -18
View File
@@ -6,7 +6,6 @@ import {
enableCloudWorkspaceFromShareButton,
loginUser,
} from '@affine-test/kit/utils/cloud';
import { dropFile } from '@affine-test/kit/utils/drop-file';
import { clickEdgelessModeButton } from '@affine-test/kit/utils/editor';
import {
clickNewPageButton,
@@ -17,6 +16,7 @@ import { clickUserInfoCard } from '@affine-test/kit/utils/setting';
import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar';
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
import { expect } from '@playwright/test';
import { resolve } from 'path';
let user: {
id: string;
@@ -226,12 +226,45 @@ test('can sync svg between different browsers', async ({ page, browser }) => {
await clickNewPageButton(page);
await waitForEditorLoad(page);
// drop an svg file
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="red" />
</svg>`;
// upload local svg
await dropFile(page, 'affine-paragraph', svg, 'test.svg', 'image/svg+xml');
const slashMenu = page.locator(`.slash-menu`);
const image = page.locator('affine-image');
page.evaluate(async () => {
window.showOpenFilePicker = undefined;
});
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('TEST TITLE', {
delay: 50,
});
await page.keyboard.press('Enter', { delay: 50 });
await page.waitForTimeout(100);
await page.keyboard.type('/', { delay: 50 });
await expect(slashMenu).toBeVisible();
await page.keyboard.type('image', { delay: 100 });
await expect(slashMenu).toBeVisible();
await page.keyboard.press('Enter', { delay: 50 });
await page.setInputFiles(
"input[type='file']",
resolve(__dirname, 'logo.svg')
);
await expect(image).toBeVisible();
// the user should see the svg
// get the image src under "affine-image img"
const src1 = await page.locator('affine-image img').getAttribute('src');
expect(src1).not.toBeNull();
// fetch the actual src1 resource in the browser
const svg1 = await page.evaluate(
src =>
fetch(src!)
.then(res => res.blob())
.then(blob => blob.text()),
src1
);
{
const context = await browser.newContext();
@@ -239,20 +272,20 @@ test('can sync svg between different browsers', async ({ page, browser }) => {
await loginUser(page2, user.email);
await page2.goto(page.url());
// the user should see the svg
// second user should see the svg
// get the image src under "affine-image img"
const src = await page2.locator('affine-image img').getAttribute('src');
const src2 = await page2.locator('affine-image img').getAttribute('src');
expect(src2).not.toBeNull();
expect(src).not.toBeNull();
// fetch the actual src2 resource in the browser
const svg2 = await page2.evaluate(
src =>
fetch(src!)
.then(res => res.blob())
.then(blob => blob.text()),
src2
);
// fetch the src resource in the browser
const svg2 = await page2.evaluate(src => {
return fetch(src!)
.then(res => res.blob())
.then(blob => blob.text());
}, src);
// turn the blob into string and check if it contains the svg
expect(svg2).toContain(svg);
expect(svg2).toEqual(svg1);
}
});
+1
View File
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><defs><style>.cls-1{fill:#000000;}</style></defs><g id="_20230202-pull_request"><path class="cls-1" d="m512,133.82L342.5,0,0,67.88v310.26l169.56,133.86,342.44-67.88V133.82Zm-203.39-84.81v89.67l51.84-10.27v-56.25l74.87,59.09-249.93,49.53-108.71-85.8,231.93-45.96ZM51.84,133.32l99.71,78.7v93.92l51.84-10.27v-76.15l256.78-50.89v210.06l-99.71-78.7v-93.92l-51.84,10.27v76.16l-256.78,50.89v-210.06Zm151.55,329.67v-89.67l-51.84,10.27v56.25l-74.87-59.09,249.93-49.53,108.71,85.8-231.93,45.96Z"/></g></svg>

After

Width:  |  Height:  |  Size: 608 B

+1 -1
View File
@@ -6,7 +6,7 @@ import type {
const config: PlaywrightTestConfig = {
testDir: './e2e',
fullyParallel: !process.env.CI,
timeout: process.env.CI ? 120_000 : 30_000,
timeout: 120_000,
use: {
baseURL: 'http://localhost:8081/',
browserName: