Skip to content

fix(#3788): replace clickBtnInCard with auto-retrying locator - #3791

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/3788-fix-dom-detach-card-click
Open

fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/3788-fix-dom-detach-card-click

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

The clickBtnInCard helper uses XPath + scrollIntoViewIfNeeded which does not auto-retry on DOM detachment. When React re-renders the Templates page card list between locator resolution and the scroll action, the old DOM node is detached, causing Element is not attached to the DOM errors.

Replace the clickBtnInCard call in runScaffolderTemplate with Playwright built-in locator chain (locator + filter + getByRole + click) which handles element location, scrolling, and retry automatically, eliminating the DOM detachment race condition.


Closes #3788

Post-script verification

  • Branch is not main/master (agent/3788-fix-dom-detach-card-click)
  • Secret scan passed (gitleaks — 547d1bb443fae81b56491003231d7b2513b99cd2..HEAD)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

The clickBtnInCard helper uses XPath + scrollIntoViewIfNeeded
which does not auto-retry on DOM detachment. When React
re-renders the Templates page card list between locator
resolution and the scroll action, the old DOM node is
detached, causing Element is not attached to the DOM errors.

Replace the clickBtnInCard call in runScaffolderTemplate with
Playwright built-in locator chain (locator + filter + getByRole
+ click) which handles element location, scrolling, and retry
automatically, eliminating the DOM detachment race condition.

Closes #3788
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner September 14, 2026 06:24
@openshift-ci

openshift-ci Bot commented Sep 14, 2026

Copy link
Copy Markdown

Hi @fullsend-ai-coder[bot]. Thanks for your PR.

I'm waiting for a redhat-developer member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot added mandatory-workspace PR affects a workspace with required plugins for releases workspace-update PR modifies files in an existing workspace labels Sep 14, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 14, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:25 AM UTC · Completed 6:35 AM UTC

Commit: e20420f · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $2.38

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [edge-case] workspaces/backstage/e2e-tests/tests/specs/gitlab-scaffolder-actions.spec.ts:41 — The locator chain does not include .first(), unlike the equivalent fix already landed in the orchestrator workspace (orchestrator-po.ts:383). Without .first(), Playwright operates in strict mode — if filter({ hasText: templateTitle }) ever matches more than one card (e.g., a template title is a substring of another card's text), the .click() will throw a strict-mode violation. The orchestrator's version of this same fix appends .first() to prevent that.
    Remediation: Append .first() before .click(), consistent with the orchestrator pattern.

await page
.locator('div[class*="MuiCard-root"]')
.filter({ hasText: templateTitle })
.getByRole("button", { name: "Choose" })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] edge-case

The locator chain does not include .first(), unlike the equivalent fix already landed in the orchestrator workspace (orchestrator-po.ts:383). Without .first(), Playwright operates in strict mode — if filter({ hasText: templateTitle }) ever matches more than one card (e.g., a template title is a substring of another card's text), the .click() will throw a strict-mode violation.

Suggested fix: Append .first() before .click(), consistent with the orchestrator pattern.

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Sep 14, 2026
@subhashkhileri

Copy link
Copy Markdown
Member

/test e2e-ocp-helm-nightly-pr-scoped

@rhdh-test-bot

Copy link
Copy Markdown

❌ Failed E2E Tests (-w backstage)

Platform: ocp 4.20 | RHDH Version: 1.11 | Duration: 22m 31s
Passed: 47 | Failed: 2 | Flaky: 0 | Skipped: 9
Playwright Report | Build Log | Logs | Artifacts

@openshift-ci

openshift-ci Bot commented Sep 15, 2026

Copy link
Copy Markdown

@fullsend-ai-coder[bot]: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-ocp-helm-nightly-pr-scoped e20420f link false /test e2e-ocp-helm-nightly-pr-scoped

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.

@rhdh-gh-app rhdh-gh-app Bot added the ci-diagnose Triggers the fullsend ci-diagnose agent label Sep 15, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Sep 15, 2026

Copy link
Copy Markdown

🤖 Finished Ci Diagnose · ✅ Success · Started 7:24 AM UTC · Completed 7:42 AM UTC

Commit: e20420f · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $3.80

@fullsend-ai-review

Copy link
Copy Markdown

🔍 CI Diagnosis — 1 of 1 curated checks failing · e20420f

Verdict:Needs human review — the e2e-failure-analysis skill could not access Prow/GCS artifacts (sandbox DNS restrictions), so the 2 specific failing tests could not be identified. The PR fixes a known DOM detachment issue (#3788); the failures may be in the changed spec or in unrelated backstage specs.

ci/prow/e2e-ocp-helm-nightly-pr-scoped — needs_human

Root cause: Cannot determine — artifact access blocked by sandbox DNS restrictions.

What we know:

  • Test results: 47 passed · 2 failed · 9 skipped (full backstage workspace, 14 projects)
  • Platform: OCP 4.20 · RHDH 1.11 · Duration: 22m 31s
  • PR change: Replaces uiHelper.clickBtnInCard(templateTitle, "Choose") with Playwright auto-retrying locator chain in runScaffolderTemplate() (gitlab-scaffolder-actions.spec.ts)
  • Original issue ([fullsend] E2E: backstage-gitlab-scaffolder-actions — DOM detachment in clickBtnInCard during card click #3788): gitlab:repo:push failed with locator.scrollIntoViewIfNeeded: Element is not attached to the DOM — the last of 6 serial tests, timing-dependent
  • Sep 14 nightly triage ([fullsend] E2E nightly failure: main (2026-09-14) #3787): Only 1 backstage failure (the one this PR fixes); other failures were in different workspaces (extensions, github-signin-resolver, orchestrator-app-next, scaffolder-k8s-app-next)

Why human review is needed:

  • The 2 failures could be in gitlab-scaffolder-actions.spec.ts (meaning the fix doesn't fully resolve the DOM detachment) or in other backstage specs (pre-existing/flake unrelated to this PR)
  • Without the Playwright report, we cannot distinguish these scenarios
  • The e2e-failure-analysis skill requires GCS artifact access for trace inspection, which was blocked

Action: Check the Playwright Report to identify the 2 failing tests. If both are outside gitlab-scaffolder-actions.spec.ts, the PR is not at fault. If either is in the scaffolder spec, the fix needs investigation.

Prow logs · Build log


Automated CI diagnosis · updates as checks complete · not a substitute for review. For bot-authored PRs, pr_regression failures are handed to the fix agent automatically (up to 2 attempts). pre_existing failures are linked to an open PR when one already exists. A maintainer can take over any time with /fs-fix <instruction>, or stop auto-fix with /fs-fix-stop — see the fix agent docs.

@openshift-ci

openshift-ci Bot commented Sep 20, 2026

Copy link
Copy Markdown

PR needs rebase.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-diagnose Triggers the fullsend ci-diagnose agent mandatory-workspace PR affects a workspace with required plugins for releases needs-ok-to-test needs-rebase ready-for-merge All reviewers approved — ready to merge workspace-update PR modifies files in an existing workspace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fullsend] E2E: backstage-gitlab-scaffolder-actions — DOM detachment in clickBtnInCard during card click

2 participants