fix: fix e2e test case of minimap (#6247)

* test(plugins): fix minimap plugin test case

* chore: update build.yml to ci.yml

---------

Co-authored-by: antv <antv@antfin.com>
This commit is contained in:
Aaron 2024-08-29 10:00:01 +08:00 committed by GitHub
parent c9ba7fcce6
commit 4fb0fd4bbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 7 additions and 9 deletions

View File

@ -13,27 +13,25 @@ test.describe('plugin minimap', () => {
// wheel on to zoom // wheel on to zoom
await page.mouse.move(250, 250); await page.mouse.move(250, 250);
// 在 github action 中执行时,滚动的距离需要更大 await page.mouse.wheel(0, 10);
// In github action, the scroll distance needs to be larger
await page.mouse.wheel(0, process.env.CI ? 20 : 10);
await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 }); 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 }); await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });
// drag minimap mask // drag minimap mask
await page.mouse.move(400, 425); await page.mouse.move(375, 425);
await page.mouse.down(); 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 page.mouse.up();
await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 }); await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });
// drag mask overflow // drag mask overflow
await page.mouse.move(425, 450); await page.mouse.move(375, 400);
await page.mouse.down(); 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 page.mouse.up();
await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 }); await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });
@ -42,7 +40,7 @@ test.describe('plugin minimap', () => {
// 因此这里直接调用 graph 实例的方法 // 因此这里直接调用 graph 实例的方法
// playwright mouse simulation operation cannot trigger the drag event of g canvas normally // playwright mouse simulation operation cannot trigger the drag event of g canvas normally
// So here directly call the method of the graph instance // 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 }); await expect(page).toHaveScreenshot({ clip, maxDiffPixels: 100 });
}); });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB