Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix e2e test case of minimap #6247

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
16 changes: 7 additions & 9 deletions tests/g6/plugins/plugins-minimap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,25 @@ test.describe('plugin minimap', () => {
// wheel on to zoom
await page.mouse.move(250, 250);

// 在 github action 中执行时,滚动的距离需要更大
// In github action, the scroll distance needs to be larger
await page.mouse.wheel(0, process.env.CI ? 20 : 10);
await page.mouse.wheel(0, 10);

await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });

await page.mouse.wheel(0, process.env.CI ? -40 : -20);
await page.mouse.wheel(0, -20);

await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });

// drag minimap mask
await page.mouse.move(400, 425);
await page.mouse.move(375, 425);
await page.mouse.down();
await page.mouse.move(425, 450, { steps: 10 });
await page.mouse.move(400, 450, { steps: 10 });
await page.mouse.up();
await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });

// drag mask overflow
await page.mouse.move(425, 450);
await page.mouse.move(375, 400);
await page.mouse.down();
await page.mouse.move(550, 550, { steps: 10 });
await page.mouse.move(550, 550, { steps: 50 });
await page.mouse.up();
await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });

Expand All @@ -42,7 +40,7 @@ test.describe('plugin minimap', () => {
// 因此这里直接调用 graph 实例的方法
// playwright mouse simulation operation cannot trigger the drag event of g canvas normally
// So here directly call the method of the graph instance
await page.evaluate(() => (window as any).graph.translateTo([100, 100]));
await page.evaluate(() => (window as any).graph.translateTo([100, 100], false));

await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading