Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

test(chrome-ext): update snapshots

Elijah Potter2306d09d0ab5
diff --git a/packages/chrome-plugin/tests/simple_textarea.spec.ts b/packages/chrome-plugin/tests/simple_textarea.spec.ts
index ac2dcd76a..03cc837f4 100644
--- a/packages/chrome-plugin/tests/simple_textarea.spec.ts
+++ b/packages/chrome-plugin/tests/simple_textarea.spec.ts
@@ -33,10 +33,30 @@ test('Wraps correctly', async ({ page }, testInfo) => {
if (testInfo.project.name == 'chromium') {
await assertHarperHighlightBoxes(page, [
- { x: 233.90625, y: 44, width: 48, height: 19 },
- { x: 281.90625, y: 44, width: 8, height: 19 },
- { x: 10, y: 61, width: 8, height: 19 },
- { x: 241.90625, y: 27, width: 24, height: 19 },
+ {
+ x: 196.52084350585938,
+ y: 48.66666793823242,
+ width: 39.96875,
+ height: 21.322917938232422,
+ },
+ {
+ x: 236.5,
+ y: 48.66666793823242,
+ width: 6.6666717529296875,
+ height: 21.322917938232422,
+ },
+ {
+ x: 10,
+ y: 68,
+ width: 6.666667938232422,
+ height: 21.333335876464844,
+ },
+ {
+ x: 203.17709350585938,
+ y: 29.33333396911621,
+ width: 20,
+ height: 21.33333396911621,
+ },
]);
} else {
await assertHarperHighlightBoxes(page, [
diff --git a/packages/chrome-plugin/tests/testUtils.ts b/packages/chrome-plugin/tests/testUtils.ts
index 30b75e207..40c4f347c 100644
--- a/packages/chrome-plugin/tests/testUtils.ts
+++ b/packages/chrome-plugin/tests/testUtils.ts
@@ -427,16 +427,24 @@ export async function testMultipleSuggestionsAndUndo(
export async function assertHarperHighlightBoxes(page: Page, boxes: Box[]): Promise<void> {
const highlights = getHarperHighlights(page);
+
await expect(highlights).toHaveCount(boxes.length);
- for (let i = 0; i < (await highlights.count()); i++) {
+ const count = await highlights.count();
+
+ const gotBoxes: Box[] = [];
+ for (let i = 0; i < count; i++) {
const box = await highlights.nth(i).boundingBox();
- expect(box).not.toBeNull();
+ gotBoxes.push(box!);
+ }
+
+ console.log('Got:', gotBoxes);
+ console.log('Expected:', boxes);
- console.log(`Expected: ${JSON.stringify(boxes[i])}`);
- console.log(`Got: ${JSON.stringify(box)}`);
+ for (let i = 0; i < count; i++) {
+ expect(gotBoxes[i]).not.toBeNull();
- assertBoxesClose(box!, boxes[i]);
+ assertBoxesClose(gotBoxes[i]!, boxes[i]);
}
}