Skip to content

Commit

Permalink
fix: fix e2e test case of minimap (#6247)
Browse files Browse the repository at this point in the history
* test(plugins): fix minimap plugin test case

* chore: update build.yml to ci.yml

---------

Co-authored-by: antv <antv@antfin.com>
  • Loading branch information
Aarebecca and antv committed Aug 29, 2024
1 parent c9ba7fc commit 4fb0fd4
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 9 deletions.
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.

0 comments on commit 4fb0fd4

Please sign in to comment.