Skip to content

add testing packages#2

Merged
seokju-na merged 2 commits into
mainfrom
testing
Jun 14, 2026
Merged

add testing packages#2
seokju-na merged 2 commits into
mainfrom
testing

Conversation

@seokju-na

@seokju-na seokju-na commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary by cubic

Adds @wvb-playground/testing, a small, cross‑platform WebviewDriver for E2E tests with Playwright/Selenium/Appium drivers, and ships a runnable test suite for @wvb-playground/webview-hacker-news. This enables one set of cases to run across Electron, Tauri, Android, and iOS.

  • New Features

    • New @wvb-playground/testing package exporting WebviewDriver plus createPlaywrightDriver, createSeleniumDriver, and createAppiumDriver with baseURL and timeout support.
    • @wvb-playground/webview-hacker-news now exports ./testing (dist-testing) with selectors, tiny assert helpers, and platform-agnostic cases that cover feed, sorting, post detail, voting, comments, profiles, filters, theme, back, and deep links.
    • Added data-testids across the Hacker News UI to match selectors (feed, posts, votes, comments, profile, theme, nav).
    • Build/workspace updates: tsdown configs, dist-testing/ output, and workspaces include packages/*.
  • Dependencies

    • @wvb-playground/testing declares optional peers: playwright-core, selenium-webdriver, webdriverio.
    • @wvb-playground/webview-hacker-news adds vitest as an optional peer and depends on @wvb-playground/testing (workspace).
    • Lockfile updated.

Written for commit 838cc84. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 30 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/testing/package.json">

<violation number="1" location="packages/testing/package.json:55">
P2: `@types/selenium-webdriver` is redundant — `selenium-webdriver` v4+ bundles its own TypeScript types. This can cause type conflicts if the `@types` package version drifts from the actual `selenium-webdriver` version.</violation>
</file>

<file name="packages/testing/src/playwright.ts">

<violation number="1" location="packages/testing/src/playwright.ts:22">
P2: Compound CSS selectors (comma-separated) break under `:visible` — only the last segment gets the pseudo-class. E.g. `visible('button, a')` produces `button, a:visible`, matching all buttons regardless of visibility instead of only visible buttons/anchors.</violation>
</file>

You're on the cubic free plan with 18 free PR reviews remaining this month. Upgrade for unlimited reviews.

Re-trigger cubic

}
},
"devDependencies": {
"@types/selenium-webdriver": "^4.1.28",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: @types/selenium-webdriver is redundant — selenium-webdriver v4+ bundles its own TypeScript types. This can cause type conflicts if the @types package version drifts from the actual selenium-webdriver version.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/testing/package.json, line 55:

<comment>`@types/selenium-webdriver` is redundant — `selenium-webdriver` v4+ bundles its own TypeScript types. This can cause type conflicts if the `@types` package version drifts from the actual `selenium-webdriver` version.</comment>

<file context>
@@ -0,0 +1,62 @@
+    }
+  },
+  "devDependencies": {
+    "@types/selenium-webdriver": "^4.1.28",
+    "playwright-core": "^1.49.0",
+    "selenium-webdriver": "^4.27.0",
</file context>

const { baseURL, defaultTimeoutMs } = options;
// `:visible` resolves the first *visible* match — important when a test id
// exists in both the desktop and mobile chrome.
const visible = (selector: string) => page.locator(`${selector}:visible`).first();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Compound CSS selectors (comma-separated) break under :visible — only the last segment gets the pseudo-class. E.g. visible('button, a') produces button, a:visible, matching all buttons regardless of visibility instead of only visible buttons/anchors.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/testing/src/playwright.ts, line 22:

<comment>Compound CSS selectors (comma-separated) break under `:visible` — only the last segment gets the pseudo-class. E.g. `visible('button, a')` produces `button, a:visible`, matching all buttons regardless of visibility instead of only visible buttons/anchors.</comment>

<file context>
@@ -0,0 +1,56 @@
+  const { baseURL, defaultTimeoutMs } = options;
+  // `:visible` resolves the first *visible* match — important when a test id
+  // exists in both the desktop and mobile chrome.
+  const visible = (selector: string) => page.locator(`${selector}:visible`).first();
+  const timeout = (opts?: WaitOptions) => opts?.timeoutMs ?? defaultTimeoutMs;
+
</file context>
Suggested change
const visible = (selector: string) => page.locator(`${selector}:visible`).first();
const visible = (selector: string) => page.locator(`:is(${selector}):visible`).first();

@seokju-na seokju-na merged commit 88f9a44 into main Jun 14, 2026
2 checks passed
@seokju-na seokju-na deleted the testing branch June 14, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant