Skip to content

test: fix TestHeader of Developer Sandbox E2E Tests#1244

Merged
rsoaresd merged 1 commit into
codeready-toolchain:masterfrom
rsoaresd:fix_header_test
Jan 6, 2026
Merged

test: fix TestHeader of Developer Sandbox E2E Tests#1244
rsoaresd merged 1 commit into
codeready-toolchain:masterfrom
rsoaresd:fix_header_test

Conversation

@rsoaresd
Copy link
Copy Markdown
Contributor

@rsoaresd rsoaresd commented Jan 6, 2026

Description

Today, we came across a failure in the TestHeader of Developer Sandbox E2E Tests.

=== RUN   TestHeader
    header_test.go:40: 
        	Error Trace:	/go/src/github.com/codeready-toolchain/toolchain-e2e/test/e2e/devsandbox-dashboard/header_test.go:40
        	Error:      	"Contact Red\u00a0Hat" does not contain "Contact Red Hat"
        	Test:       	TestHeader
    trace.go:42: saved trace to /logs/artifacts/devsandbox-dashboard/trace/trace-test-header.zip

Looking at the page redirected from "Contact Red Hat Sales" button, we can see:
image

Since we do not know if they will change again, I suggest replacing the non-breaking space with regular space

Issue ticket number and link

SANDBOX-1565

Summary by CodeRabbit

  • Tests
    • Improved text assertion handling in header popup tests by normalizing non-breaking space characters to ensure consistent test behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 6, 2026

Walkthrough

Added strings package import and normalized non-breaking spaces to regular spaces in h1Text text assertions for two popup tests in the header test file, preventing NBSP characters from affecting test validations.

Changes

Cohort / File(s) Change Summary
Header Test NBSP Normalization
test/e2e/devsandbox-dashboard/header_test.go
Added strings package import; normalized h1Text by replacing non-breaking spaces (U+00A0) with regular spaces in both Red Hat Developer Hub popup and Contact Red Hat Sales popup test assertions

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • toolchain-e2e#1229: Modifies the same test file (test/e2e/devsandbox-dashboard/header_test.go), involving import/path changes that may interact with this NBSP normalization fix.

Suggested reviewers

  • metlos
  • alexeykazakov
  • mfrancisc

Poem

🐰 A nibble here, a space so fine,
Those pesky NBSPs crossed the line,
With strings we dance, replace with care,
Now h1Text assertions run fair! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: fixing the TestHeader test in Developer Sandbox E2E tests by normalizing non-breaking spaces to handle page redirect changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

@xcoulon xcoulon left a comment

Choose a reason for hiding this comment

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

that's a clever way to fix the problem while keeping it working with the older versions! ;)

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jan 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rsoaresd, xcoulon

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

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
test/e2e/devsandbox-dashboard/header_test.go (1)

26-28: Consider applying the same normalization for consistency.

The "Contact Red Hat Sales" popup test normalizes non-breaking spaces (lines 41-42), but this "Red Hat Developer Hub" popup test does not. For consistency and to make both tests equally resilient to whitespace variations, consider applying the same normalization here.

🔎 Proposed fix for consistency
 h1Text, err := rhdhPage.Locator("h1").TextContent()
 require.NoError(t, err)
+// replace non-breaking space with regular space
+h1Text = strings.ReplaceAll(h1Text, "\u00a0", " ")
 require.Contains(t, h1Text, "Red Hat Developer Hub")
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba3a54d and 315b9c1.

📒 Files selected for processing (1)
  • test/e2e/devsandbox-dashboard/header_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Unit Tests
  • GitHub Check: Build & push operator bundles & dashboard image for e2e tests
🔇 Additional comments (2)
test/e2e/devsandbox-dashboard/header_test.go (2)

4-4: LGTM!

The strings package import is correctly added and used for the non-breaking space normalization.


39-43: LGTM! Clear fix for non-breaking space handling.

The normalization approach is correct and the comment clearly explains the intent. This makes the test resilient to non-breaking space characters in the h1 text.

Note: The AI summary states normalization was added for both popups, but the code only applies it to the "Contact Red Hat Sales" popup.

@rsoaresd rsoaresd merged commit 9d83fe9 into codeready-toolchain:master Jan 6, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants