Skip to content

CONSOLE-5212: Fix ESM compatibility for Playwright e2e tests#16445

Merged
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
stefanonardo:CONSOLE-5212-esm-fix
May 15, 2026
Merged

CONSOLE-5212: Fix ESM compatibility for Playwright e2e tests#16445
openshift-merge-bot[bot] merged 3 commits into
openshift:mainfrom
stefanonardo:CONSOLE-5212-esm-fix

Conversation

@stefanonardo
Copy link
Copy Markdown
Contributor

@stefanonardo stefanonardo commented May 14, 2026

Summary

  • Fix require() of ESM module error on CI for @kubernetes/client-node v1.4.0 (pure ESM) by adding frontend/e2e/package.json with "type": "module" so Playwright loads e2e files as ESM
  • Replace __dirname (CJS-only) with import.meta.dirname (Node 21.2.0+) in 7 e2e files
  • Update e2e/tsconfig.json target to es2022 and moduleResolution to bundler
  • Set ConsoleIntegrationTestEnvironment user agent in Playwright fixtures to activate the INTEGRATION_TEST feature flag, disabling the guided tour during tests
  • Add Playwright e2e testing section to TESTING.md
  • Simplify test selector guidance in migration context to always prefer getByTestId

Details

ESM fix: The @kubernetes/client-node v1.4.0 declares "type": "module". On CI, Playwright finds frontend/package.json (CJS default), loads test files via require(), and Babel transforms imports into require() calls. Node.js rejects the require() of the ESM-only package. Adding e2e/package.json with "type": "module" makes Playwright load e2e files as ESM, preserving import statements for native resolution.

Integration test user agent: Override navigator.userAgent via context.addInitScript() in the test fixtures to ConsoleIntegrationTestEnvironment. This activates the existing INTEGRATION_TEST feature flag which disables the guided tour (same mechanism used by Cypress).

Test plan

  • cd frontend && npx tsc -p e2e/tsconfig.json --noEmit passes
  • cd frontend && npx playwright test --list discovers all tests without errors
  • CI Playwright job passes (no more require() of ES Module error)
  • Guided tour does not appear during Playwright tests

Screenshots / Recordings

N/A — no UI changes

🤖 Generated with Claude Code

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 14, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented May 14, 2026

@stefanonardo: This pull request references CONSOLE-5212 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Fix require() of ESM module error on CI for @kubernetes/client-node v1.4.0 (pure ESM) by adding frontend/e2e/package.json with "type": "module" so Playwright loads e2e files as ESM
  • Replace __dirname (CJS-only) with import.meta.dirname (Node 21.2.0+) in 7 e2e files
  • Update e2e/tsconfig.json target to es2022 and moduleResolution to bundler
  • Add Playwright e2e testing section to TESTING.md
  • Simplify test selector guidance in migration context to always prefer getByTestId

Details

The @kubernetes/client-node v1.4.0 declares "type": "module" in its package.json. On CI, Playwright walks up from the test file to find the nearest package.json (frontend/package.json, which defaults to CJS), then loads test files via require(). Babel transforms import statements into require() calls, and Node.js rejects the require() of the ESM-only package.

Adding e2e/package.json with "type": "module" makes Playwright's fileIsModule() return true for e2e files, loading them via import() instead. The ESM loader preserves import statements, allowing Node to natively resolve the ESM dependency.

Test plan

  • cd frontend && npx tsc -p e2e/tsconfig.json --noEmit passes
  • cd frontend && npx playwright test --list discovers all tests without errors
  • CI Playwright job passes (no more require() of ES Module error)

Screenshots / Recordings

N/A — no UI changes

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2026
@openshift-ci openshift-ci Bot requested review from fsgreco and rhamilto May 14, 2026 15:44
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the Playwright E2E testing infrastructure for the Console. It replaces top-level globalSetup and globalTeardown hooks with project-based setup and teardown flows, introducing new setup files for cluster initialization, kubeadmin login, and developer login. Fixtures are updated to use import.meta.dirname for ESM compatibility. A login helper module (login-helper.ts) encapsulates authentication logic for reuse across setups. Documentation is added via .claude/migration-context.md (Cypress-to-Playwright migration guide) and TESTING.md updates. Configuration files are adjusted to support the new architecture, and individual project-specific Playwright commands are consolidated.

Suggested reviewers

  • rhamilto
  • spadgett
  • fsgreco
  • logonoff
🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (11 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing ESM compatibility for Playwright e2e tests by addressing the @kubernetes/client-node v1.4.0 pure ESM issue.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR uses Playwright e2e tests (JS/TS), not Ginkgo (Go). Custom check requires Ginkgo test name stability. No Ginkgo tests present; check not applicable.
Test Structure And Quality ✅ Passed Custom check is for Ginkgo (Go) test code review. This PR contains only Playwright (TypeScript) e2e tests. Check is not applicable to the PR.
Microshift Test Compatibility ✅ Passed Custom check targets Ginkgo e2e tests. This PR adds only Playwright TypeScript tests and documentation—no Go/Ginkgo tests are present. Check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Check not applicable. This PR adds Playwright tests (browser-based JS/TS), not Ginkgo tests (Go). The SNO topology check is specific to Ginkgo e2e tests.
Topology-Aware Scheduling Compatibility ✅ Passed This PR modifies only E2E test infrastructure (configs, fixtures, setup files, documentation) with no deployment manifests, operator code, or scheduling constraints. The check does not apply.
Ote Binary Stdout Contract ✅ Passed Custom check is not applicable. PR modifies only JavaScript/TypeScript Playwright e2e tests in frontend/e2e/. OTE Binary Stdout Contract applies to Go/Ginkgo test binaries, which are not touched.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds Playwright e2e tests (JS/TS), not Ginkgo tests (Go). Custom check targets only Ginkgo tests. No IPv4/connectivity issues found.
Description check ✅ Passed The pull request description covers all critical sections: root cause (ESM incompatibility with @kubernetes/client-node v1.4.0), solution details (adding e2e/package.json, replacing __dirname, updating tsconfig, integration test setup), test plan with concrete commands, and a note that no UI changes require screenshots.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
frontend/e2e/setup/admin-auth.setup.ts (1)

12-14: ⚡ Quick win

Empty password default may cause confusing failures.

Line 14 defaults BRIDGE_KUBEADMIN_PASSWORD to an empty string. While login will fail with a clear timeout error, it would be more user-friendly to explicitly skip the setup or throw a clear error when the required credential is missing.

Consider:

setup.skip(!process.env.BRIDGE_KUBEADMIN_PASSWORD, 'BRIDGE_KUBEADMIN_PASSWORD not set');

This matches the pattern used in developer-auth.setup.ts (lines 12-15).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/e2e/setup/admin-auth.setup.ts` around lines 12 - 14, The file sets
const password = process.env.BRIDGE_KUBEADMIN_PASSWORD || '' which silently
defaults to an empty password and causes confusing failures; change the setup to
explicitly skip or error when BRIDGE_KUBEADMIN_PASSWORD is missing by checking
process.env.BRIDGE_KUBEADMIN_PASSWORD and calling
setup.skip('BRIDGE_KUBEADMIN_PASSWORD not set') (matching the pattern in
developer-auth.setup.ts) before using the password variable so tests are skipped
with a clear message instead of attempting login with an empty string.
frontend/e2e/setup/login-helper.ts (1)

18-20: ⚡ Quick win

Type safety issue with window.SERVER_FLAGS.

The code uses (window as any).SERVER_FLAGS?.authDisabled which bypasses TypeScript type checking. Consider:

  • Adding a proper type declaration for SERVER_FLAGS in a global type file
  • Or using a more specific type assertion: (window as { SERVER_FLAGS?: { authDisabled?: boolean } })
🔒 Proposed fix for type safety
  const authDisabled = await page
-   .evaluate(() => (window as any).SERVER_FLAGS?.authDisabled)
+   .evaluate(() => (window as { SERVER_FLAGS?: { authDisabled?: boolean } }).SERVER_FLAGS?.authDisabled)
    .catch(() => false);

Or better yet, add a type declaration file at e2e/types/global.d.ts:

declare global {
  interface Window {
    SERVER_FLAGS?: {
      authDisabled?: boolean;
      // ... other flags
    };
  }
}
export {};

Then use:

.evaluate(() => window.SERVER_FLAGS?.authDisabled)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/e2e/setup/login-helper.ts` around lines 18 - 20, The use of (window
as any).SERVER_FLAGS?.authDisabled bypasses TypeScript safety; add a proper
global Window type for SERVER_FLAGS (e.g., declare global { interface Window {
SERVER_FLAGS?: { authDisabled?: boolean; /* other flags */ } } } export {}; ) or
change the assertion to a specific shape and then update the page.evaluate call
to use window.SERVER_FLAGS?.authDisabled instead of casting to any; ensure the
new type file is picked up by the compiler so page.evaluate() references the
typed Window and removes the any cast.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/e2e/tests/smoke/developer/smoke-test.spec.ts`:
- Around line 5-7: The test is using
page.locator('[data-test-id="perspective-switcher-toggle"]') which bypasses the
shared Playwright testIdAttribute convention; replace that locator with
page.getByTestId('perspective-switcher-toggle') and update the expectation call
(the existing expect(...) .toContainText('Developer', { timeout: 60_000 })
should be applied to the getByTestId result) so the suite uses the standardized
testId lookup everywhere (locators to change: page.locator -> page.getByTestId).

---

Nitpick comments:
In `@frontend/e2e/setup/admin-auth.setup.ts`:
- Around line 12-14: The file sets const password =
process.env.BRIDGE_KUBEADMIN_PASSWORD || '' which silently defaults to an empty
password and causes confusing failures; change the setup to explicitly skip or
error when BRIDGE_KUBEADMIN_PASSWORD is missing by checking
process.env.BRIDGE_KUBEADMIN_PASSWORD and calling
setup.skip('BRIDGE_KUBEADMIN_PASSWORD not set') (matching the pattern in
developer-auth.setup.ts) before using the password variable so tests are skipped
with a clear message instead of attempting login with an empty string.

In `@frontend/e2e/setup/login-helper.ts`:
- Around line 18-20: The use of (window as any).SERVER_FLAGS?.authDisabled
bypasses TypeScript safety; add a proper global Window type for SERVER_FLAGS
(e.g., declare global { interface Window { SERVER_FLAGS?: { authDisabled?:
boolean; /* other flags */ } } } export {}; ) or change the assertion to a
specific shape and then update the page.evaluate call to use
window.SERVER_FLAGS?.authDisabled instead of casting to any; ensure the new type
file is picked up by the compiler so page.evaluate() references the typed Window
and removes the any cast.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 35715610-fdb6-4c00-aa71-1f25d29b2815

📥 Commits

Reviewing files that changed from the base of the PR and between c9d3418 and 213c344.

📒 Files selected for processing (17)
  • .claude/migration-context.md
  • TESTING.md
  • frontend/.eslintignore
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/global.setup.ts
  • frontend/e2e/global.teardown.ts
  • frontend/e2e/package.json
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/tsconfig.json
  • frontend/package.json
  • frontend/playwright.config.ts
💤 Files with no reviewable changes (2)
  • frontend/e2e/global.teardown.ts
  • frontend/e2e/global.setup.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (10)
frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

frontend/**/*.{ts,tsx}: Never import from package index files (barrel imports) like @console/shared in new code, as they create circular dependencies and slow builds. Import from specific file paths instead.
Never use backticks in i18n t() function calls as the i18n parser cannot extract keys from template literals. Use single or double quotes instead.
Never import from deprecated packages or use code marked with @deprecated TSdoc tag in new code.

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/playwright.config.ts
frontend/**/*.{ts,tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Never use absolute URLs or paths. The console runs behind a proxy under an arbitrary path.

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/tsconfig.json
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/package.json
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/playwright.config.ts
  • frontend/package.json
**/*

📄 CodeRabbit inference engine (STYLEGUIDE.md)

Use lowercase dash-separated names for all files (to avoid git issues with case-insensitive file systems)

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/tsconfig.json
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/package.json
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • TESTING.md
  • frontend/playwright.config.ts
  • frontend/package.json
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (STYLEGUIDE.md)

**/*.{ts,tsx,js,jsx}: New code MUST be written in TypeScript, not JavaScript
Run the linter and follow all rules defined in .eslintrc
Never use absolute paths in code; the app should be able to run behind a proxy under an arbitrary path
Use PascalCase for component file names, kebab-case for utility files, and *.spec.ts(x) for test files

Use camelCase for variable names in TypeScript and JavaScript files

**/*.{ts,tsx,js,jsx}: Any usage of i18next's TFunction (rather than react-i18next's TFunction) must be performed inside a function or component.
Don't use backticks inside of a TFunction. Our code parser will not automatically pick up the keys that contain backticks. Use single or double quotes instead.
Specify possible static values in comments for dynamic i18next keys that can't be interpolated by i18next-parser, such as t(key), t('key' + id), or t(key${id}).

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/playwright.config.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (STYLEGUIDE.md)

**/*.{ts,tsx}: Prefer functional programming patterns and immutable data structures in TypeScript/JavaScript
Use React functional components with hooks instead of class components in TypeScript
Use React hooks and Context API for state management (migrating away from legacy Redux/Immutable.js)
Use existing hooks from console-shared when possible (useK8sWatchResource, useUserSettings, etc.)
Use k8s resource hooks for data fetching and consoleFetchJSON for HTTP requests in TypeScript
Place plugin routes in plugin-specific route files
Check existing types in console-shared before creating new types
Use SCSS modules co-located with components, PatternFly design system components, and avoid any SCSS/CSS if possible
Follow WCAG 2.1 AA standards for accessibility; use semantic HTML, ARIA labels where needed, ensure keyboard navigation, and test with screen readers
Use useTranslation('namespace') hook with key format for translation keys in TypeScript
Use ErrorBoundary components and graceful degradation patterns for error handling in TypeScript
Use useCallback to memoize callbacks and prevent unnecessary re-renders in React
Use useMemo for expensive filtering and computations to prevent re-computation on every render
Use React.lazy() to lazy load heavy components
Avoid using the any type in TypeScript; suggest proper type definitions instead
Check that null/undefined are properly handled in TypeScript (e.g., string | undefined)
Verify exported types for reusable components in TypeScript
Reuse types from existing components rather than duplicating type definitions in component props
Use usePluginInfo hook for plugin data in TypeScript
Avoid deprecated components; check for JSDoc @deprecated tags, import paths containing /deprecated, and DEPRECATED_ file name prefixes
Use direct imports to specific files instead of barrel exports (index.ts) to avoid circular dependency cycles and improve build performance
Use import type for importing type...

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/playwright.config.ts
frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (README.md)

Follow internationalization guidelines as documented in INTERNATIONALIZATION.md for all frontend code

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/playwright.config.ts
**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (INTERNATIONALIZATION.md)

**/*.{ts,tsx,jsx}: The aria-label, aria-placeholder, aria-roledescription, and aria-valuetext attributes should be internationalized.
The optional i18nKey property on the react-i18next Trans component should only be used as a last resort when the parser incorrectly generates keys containing HTML tags.

Files:

  • frontend/e2e/fixtures/index.ts
  • frontend/e2e/fixtures/cleanup-fixture.ts
  • frontend/e2e/setup/developer-auth.setup.ts
  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
  • frontend/e2e/setup/admin-auth.setup.ts
  • frontend/e2e/setup/cluster.setup.ts
  • frontend/e2e/setup/login-helper.ts
  • frontend/e2e/setup/teardown.setup.ts
  • frontend/playwright.config.ts
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (STYLEGUIDE.md)

TypeScript tests should follow a similar 'test tables' convention as used in Go where applicable

Files:

  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
frontend/e2e/tests/**/*.spec.ts

📄 CodeRabbit inference engine (TESTING.md)

Use Playwright for E2E testing to validate full user workflows against a real OpenShift cluster. E2E tests live in frontend/e2e/tests/<package>/

Each Playwright test block must be self-contained: create its own resources, assert independently, and clean up via the cleanup fixture

Always use page.getByTestId('x') to query [data-test="x"] in Playwright tests. If a React element only has a legacy test attribute, add data-test to the element. Never remove legacy attributes

Use KubernetesClient from e2e/clients/kubernetes-client.ts for cluster interactions in Playwright tests. Never use shell commands in tests

Import test and expect from e2e/fixtures in Playwright tests, not from @playwright/test. Use custom fixtures that provide cleanup, testConfig, and k8sClient

Files:

  • frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
frontend/package.json

📄 CodeRabbit inference engine (README.md)

frontend/package.json: Pin frontend dependencies to exact versions without caret (^) or tilde () operators, except for @patternfly packages which should use tilde () operator for version ranges
When upgrading @patternfly packages, run 'yarn dedupe --strategy highest' to prevent multiple versions of the same @patternfly package from being pulled in and to avoid JavaScript heap memory issues

Files:

  • frontend/package.json
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-05-14T15:45:07.467Z
Learning: Use `gen-rtl-test` skill to generate unit tests that follow best practices and conventions
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-05-14T15:45:07.467Z
Learning: Use Cypress for integration tests with specialized test suites: Core Console, OLM, Dev Console, Shipwright, Web Terminal, Telemetry, Knative, Helm, and Topology
Learnt from: CR
Repo: openshift/console

Timestamp: 2026-05-14T15:45:07.467Z
Learning: Cypress integration tests support headless and interactive modes
🪛 LanguageTool
TESTING.md

[style] ~155-~155: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym.
Context: ... yarn test-playwright-developer — run only developer persona tests ## End-to-End ...

(ADVERB_REPETITION_PREMIUM)

🔇 Additional comments (23)
frontend/.eslintignore (1)

16-16: LGTM!

frontend/e2e/package.json (1)

1-3: LGTM!

frontend/e2e/tsconfig.json (2)

5-5: LGTM!


3-3: ⚡ Quick win

The es2022 target is justified—import.meta.dirname is actively used in e2e setup/fixtures, which requires Node 21.2.0+.

Good news: frontend/package.json already enforces >=22.x, exceeding the minimum requirement. However, consider adding a .nvmrc file at the repository root to make the Node version requirement explicit for local development environments and CI systems.

frontend/e2e/setup/login-helper.ts (3)

1-8: LGTM!


26-30: LGTM!


46-50: LGTM!

frontend/e2e/setup/admin-auth.setup.ts (1)

1-8: LGTM!

frontend/e2e/setup/developer-auth.setup.ts (2)

1-8: LGTM!


9-22: LGTM!

.claude/migration-context.md (4)

13-18: LGTM!


21-108: LGTM!


111-258: LGTM!


422-430: LGTM!

frontend/e2e/setup/cluster.setup.ts (3)

1-14: LGTM!


15-37: LGTM!


55-64: ⚡ Quick win

Config file properly excluded from version control. The .test-config.json written at lines 55–64 contains sensitive data (authToken and kubeConfigPath), and is already correctly listed in .gitignore at /frontend/e2e/.test-config.json, preventing accidental exposure.

frontend/e2e/fixtures/cleanup-fixture.ts (1)

40-40: LGTM!

frontend/e2e/fixtures/index.ts (1)

29-29: LGTM!

frontend/e2e/setup/teardown.setup.ts (1)

1-50: LGTM!

TESTING.md (1)

136-157: LGTM!

frontend/playwright.config.ts (1)

30-30: LGTM!

Also applies to: 83-119, 125-125, 135-135

frontend/package.json (1)

57-57: LGTM!

Comment on lines +5 to +7
await expect(
page.locator('[data-test-id="perspective-switcher-toggle"]'),
).toContainText('Developer', { timeout: 60_000 });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Use getByTestId instead of raw [data-test-id] selectors.

This bypasses the shared Playwright testIdAttribute convention and makes selector behavior inconsistent across suites.

Suggested fix
-  await expect(
-    page.locator('[data-test-id="perspective-switcher-toggle"]'),
-  ).toContainText('Developer', { timeout: 60_000 });
+  await expect(page.getByTestId('perspective-switcher-toggle')).toContainText('Developer', {
+    timeout: 60_000,
+  });

As per coding guidelines: "Always use page.getByTestId('x') to query [data-test="x"] in Playwright tests."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await expect(
page.locator('[data-test-id="perspective-switcher-toggle"]'),
).toContainText('Developer', { timeout: 60_000 });
await expect(page.getByTestId('perspective-switcher-toggle')).toContainText('Developer', {
timeout: 60_000,
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/e2e/tests/smoke/developer/smoke-test.spec.ts` around lines 5 - 7,
The test is using page.locator('[data-test-id="perspective-switcher-toggle"]')
which bypasses the shared Playwright testIdAttribute convention; replace that
locator with page.getByTestId('perspective-switcher-toggle') and update the
expectation call (the existing expect(...) .toContainText('Developer', {
timeout: 60_000 }) should be applied to the getByTestId result) so the suite
uses the standardized testId lookup everywhere (locators to change: page.locator
-> page.getByTestId).

stefanonardo and others added 2 commits May 14, 2026 20:43
@kubernetes/client-node v1.4.0 is pure ESM, which causes require()
failures on CI where Playwright loads test files as CommonJS. Add
e2e/package.json with "type": "module" so Playwright treats e2e files
as ESM, and replace __dirname with import.meta.dirname accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Playwright e2e testing section to TESTING.md covering test
structure, selectors, page objects, and available commands. Simplify
migration-context.md test selector guidance to always prefer
getByTestId over legacy attribute locators.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stefanonardo stefanonardo force-pushed the CONSOLE-5212-esm-fix branch from 56ef875 to bac2e51 Compare May 14, 2026 18:44
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2026
Override navigator.userAgent to ConsoleIntegrationTestEnvironment via
context.addInitScript() so the existing INTEGRATION_TEST feature flag
activates and disables the guided tour. Remove the now-redundant
guided tour ConfigMap patch from setupConsoleUserSettings().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stefanonardo stefanonardo force-pushed the CONSOLE-5212-esm-fix branch from bac2e51 to 0434b12 Compare May 14, 2026 18:57
Copy link
Copy Markdown
Member

@logonoff logonoff left a comment

Choose a reason for hiding this comment

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

/lgtm

@logonoff
Copy link
Copy Markdown
Member

/label px-approved
/label docs-approved
/verified by CI

@openshift-ci openshift-ci Bot added lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels May 14, 2026
@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 14, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@logonoff: This PR has been marked as verified by CI.

Details

In response to this:

/label px-approved
/label docs-approved
/verified by CI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@stefanonardo
Copy link
Copy Markdown
Contributor Author

/retest

@jhadvig jhadvig added approved Indicates a PR has been approved by an approver from all required OWNERS files. plugin-api-approved Indicates a PR with plugin API changes has been approved by an API reviewer labels May 15, 2026
@jhadvig
Copy link
Copy Markdown
Member

jhadvig commented May 15, 2026

thanks @stefanonardo 👍
/lgtm

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig, logonoff, stefanonardo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

@stefanonardo: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit 1fe2b52 into openshift:main May 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. plugin-api-approved Indicates a PR with plugin API changes has been approved by an API reviewer px-approved Signifies that Product Support has signed off on this PR verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants