Skip to content

Commit 39371b8

Browse files
committed
Updated drag and drop test to allow for one pixel difference
1 parent fb6d485 commit 39371b8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

index.e2e.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,20 @@ describe("E2E drag & drop demo", () => {
6969
it("should run without throwing", async () => {
7070
jest.setTimeout(60000);
7171
screen.config.resourceDirectory = "./e2e/assets";
72+
73+
const expected = new Region(38, 585, 70, 86);
74+
const maxDiff = 1;
75+
7276
await assert.isVisible("trash.png");
7377
await mouse.move(straightTo(centerOf(screen.find("trash.png"))));
7478
await mouse.drag(down(500));
7579
await mouse.move(right(100));
7680
await mouse.leftClick();
77-
expect(await screen.find("moved_trash.png")).toEqual(new Region(38, 585, 70, 86));
81+
const dest = await screen.find("moved_trash.png");
82+
expect(Math.abs(dest.left - expected.left)).toBeLessThan(maxDiff);
83+
expect(Math.abs(dest.top - expected.top)).toBeLessThan(maxDiff);
84+
expect(Math.abs(dest.width - expected.width)).toBeLessThan(maxDiff);
85+
expect(Math.abs(dest.height - expected.height)).toBeLessThan(maxDiff);
7886
});
7987
});
8088

0 commit comments

Comments
 (0)