Skip to content

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

fix(chrome-ext): remove useless test

Elijah Potter5f33d450956a
diff --git a/packages/chrome-plugin/tests/iframe_dynamic_textarea.spec.ts b/packages/chrome-plugin/tests/iframe_dynamic_textarea.spec.ts
deleted file mode 100644
index a6167b498..000000000
--- a/packages/chrome-plugin/tests/iframe_dynamic_textarea.spec.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-import type { BrowserContext, Page } from '@playwright/test';
-import { expect, test } from './fixtures';
-import { replaceEditorContent } from './testUtils';
-
-const PARENT_DOMAIN = 'localhost';
-const TEST_PAGE_URL = 'http://localhost:8081/iframe_dynamic_textarea_parent.html';
-
-async function getBackground(context: BrowserContext) {
- return (
- context.serviceWorkers()[0] ??
- context.backgroundPages()[0] ??
- (await context.waitForEvent('serviceworker'))
- );
-}
-
-async function seedDomainSettings(
- context: BrowserContext,
- domains: Record<string, boolean>,
- defaultEnable = false,
-) {
- const background = await getBackground(context);
- const storageEntries = Object.fromEntries(
- Object.entries(domains).map(([domain, enabled]) => [`domainStatus ${domain}`, enabled]),
- );
-
- await background.evaluate(
- async ({ defaultEnable, storageEntries }) => {
- await chrome.storage.local.set({ defaultEnable, ...storageEntries });
- },
- { defaultEnable, storageEntries },
- );
-}
-
-test.skip(
- ({ browserName }) => browserName === 'firefox',
- 'Firefox MV3 background context is not exposed reliably in playwright-webextext.',
-);
-
-function getChildFrame(page: Page) {
- return page.frameLocator('#editor-frame');
-}
-
-function getRevealButton(page: Page) {
- return getChildFrame(page).getByRole('button', { name: 'Enter manually' });
-}
-
-function getChildTextarea(page: Page) {
- return getChildFrame(page).locator('#editor');
-}
-
-function getChildHighlights(page: Page) {
- return getChildFrame(page).locator('#harper-highlight');
-}
-
-async function clickChildHighlight(page: Page) {
- const highlight = getChildHighlights(page).first();
- await highlight.waitFor({ state: 'visible', timeout: 12000 });
-
- const box = await highlight.boundingBox();
- if (box == null) {
- throw new Error('Expected iframe highlight to have a bounding box.');
- }
-
- await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);
-}
-
-test('attaches to a dynamically revealed iframe textarea on focus', async ({ context, page }) => {
- test.slow();
- await seedDomainSettings(context, { [PARENT_DOMAIN]: true });
-
- await page.goto(TEST_PAGE_URL);
- await getRevealButton(page).click();
-
- const editor = getChildTextarea(page);
- await editor.waitFor({ state: 'visible', timeout: 10000 });
- await replaceEditorContent(editor, 'This is an test');
-
- await clickChildHighlight(page);
- await expect(getChildFrame(page).locator('.harper-container')).toBeVisible();
-});
diff --git a/packages/chrome-plugin/tests/pages/iframe_dynamic_textarea_child.html b/packages/chrome-plugin/tests/pages/iframe_dynamic_textarea_child.html
deleted file mode 100644
index d1f0d3711..000000000
--- a/packages/chrome-plugin/tests/pages/iframe_dynamic_textarea_child.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Dynamic child editor</title>
- <style>
- body {
- margin: 0;
- padding: 24px;
- font-family: sans-serif;
- background: white;
- }
-
- button {
- margin-bottom: 16px;
- padding: 10px 18px;
- border: 1px solid #6a3be5;
- border-radius: 999px;
- background: white;
- color: #6a3be5;
- cursor: pointer;
- }
-
- textarea {
- width: 100%;
- min-height: 120px;
- padding: 12px;
- font: 16px/1.4 sans-serif;
- border: 1px solid #a1a1aa;
- box-sizing: border-box;
- }
- </style>
- </head>
- <body>
- <button id="reveal" type="button">Enter manually</button>
- <div id="editor-root"></div>
- <script>
- const revealButton = document.getElementById('reveal');
- const editorRoot = document.getElementById('editor-root');
-
- revealButton.addEventListener('click', () => {
- if (document.getElementById('editor') != null) {
- return;
- }
-
- const textarea = document.createElement('textarea');
- textarea.id = 'editor';
- textarea.spellcheck = true;
-
- editorRoot.appendChild(textarea);
- });
- </script>
- </body>
-</html>
diff --git a/packages/chrome-plugin/tests/pages/iframe_dynamic_textarea_parent.html b/packages/chrome-plugin/tests/pages/iframe_dynamic_textarea_parent.html
deleted file mode 100644
index 35bfad069..000000000
--- a/packages/chrome-plugin/tests/pages/iframe_dynamic_textarea_parent.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Dynamic iframe textarea parent</title>
- <style>
- body {
- margin: 0;
- font-family: sans-serif;
- background: #f4f4f5;
- }
-
- main {
- max-width: 960px;
- margin: 32px auto;
- padding: 24px;
- }
-
- iframe {
- width: 100%;
- height: 320px;
- border: 1px solid #d4d4d8;
- background: white;
- }
- </style>
- </head>
- <body>
- <main>
- <h1>Dynamic iframe textarea test</h1>
- <iframe
- id="editor-frame"
- title="Cross-origin child editor"
- src="http://127.0.0.1:8081/iframe_dynamic_textarea_child.html"
- ></iframe>
- </main>
- </body>
-</html>