refactor: plugin loading logic (#3448)
This commit is contained in:
1 parent
4cb1bf6a9f
commit
9f43c0ddc8
14 files changed
+332
-138
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import { waitEditorLoad } from '@affine-test/kit/utils/page-logic';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
test('plugin should exist', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.route('**/plugins/**/package.json', route => route.fetch(), {
|
||||
times: 3,
|
||||
});
|
||||
await page.waitForTimeout(50);
|
||||
const packageJson = await page.evaluate(() => {
|
||||
// @ts-expect-error
|
||||
return window.__pluginPackageJson__;
|
||||
});
|
||||
expect(packageJson).toEqual([
|
||||
{
|
||||
name: '@affine/bookmark-plugin',
|
||||
affinePlugin: expect.anything(),
|
||||
},
|
||||
{
|
||||
name: '@affine/copilot-plugin',
|
||||
affinePlugin: expect.anything(),
|
||||
},
|
||||
{
|
||||
name: '@affine/hello-world-plugin',
|
||||
affinePlugin: expect.anything(),
|
||||
},
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user