Skip to content

Comments

[KFLUXUI-1070] refactor(e2e-tests/utils/Applications): use expect() in checkPipelineStatuses#711

Open
rrosatti wants to merge 4 commits intokonflux-ci:mainfrom
rrosatti:KFLUXUI-1070/e2e-fix-cancelled-plr-check
Open

[KFLUXUI-1070] refactor(e2e-tests/utils/Applications): use expect() in checkPipelineStatuses#711
rrosatti wants to merge 4 commits intokonflux-ci:mainfrom
rrosatti:KFLUXUI-1070/e2e-fix-cancelled-plr-check

Conversation

@rrosatti
Copy link
Member

@rrosatti rrosatti commented Feb 17, 2026

Fixes

Fixes https://issues.redhat.com/browse/KFLUXUI-1070

Description

In this PR we're fixing the logic in the checkPipelineStatuses function, so it uses Cypress expect() callback instead of returning true/false. It seems Cypress would not fail/throw if it returns false.

Also, we are adding a logic to check if the -on-pull pipeline run is visible before merging the onboarding PR. It's a proposed approach to prevent https://issues.redhat.com/browse/KFLUXUI-796 from happening.

Type of change

  • Feature
  • Bugfix
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Screen shots / Gifs for design review

Before (notice on-pull PLR status is Running, and the test to check if the status is Cancelled succeeded):

e2e-cancelling-or-cancelled-check-ISSUE

After (notice on-pull PLR status is Running, and the test to check if the status is Cancelled correctly failed):

e2e-cancelling-or-cancelled-check-FIX

How to test or reproduce?

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

Summary by CodeRabbit

  • Tests
    • Added a verification step to confirm pipeline runs are visible from a component’s details view.
    • Improved pipeline status checks for greater reliability, more consistent wait handling, and clearer failure messages.
    • Added page-level helpers to simplify locating and asserting pipeline run entries during end-to-end tests.

@rrosatti rrosatti self-assigned this Feb 17, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'version', 'include', 'exclude', 'rules', 'limits'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds a pipeline-run visibility check: new page-object selector, a ComponentDetailsPage.verifyPipelineRunIsVisible(plrName) method, a test call in basic-happy-path.spec.ts, and an Applications utility refactor to use the new selector for status assertions.

Changes

Cohort / File(s) Summary
E2E test usage
e2e-tests/tests/basic-happy-path.spec.ts
Calls ComponentDetailsPage.verifyPipelineRunIsVisible(\${componentName}-on-pull`)` after opening a component.
Applications utility
e2e-tests/utils/Applications.ts
Replaced manual DOM parsing with cy.get(pipelinerunsTabPO.pipelineRunRow(...), { timeout: 90000 }) and a single text-contains assertion; added UIhelperPO import and simplified timeout handling.
Page objects — selectors
e2e-tests/support/pageObjects/pages-po.ts
Added compActivityPipelinerunsTabPO with clickTab and extended pipelinerunsTabPO with pipelineRunRow(runNamePrefix) selector helper.
Component details page object
e2e-tests/support/pages/ComponentDetailsPage.ts
Added imports and a new public static method verifyPipelineRunIsVisible(plrName: string) that navigates Activity → Pipeline Runs, waits for the pipeline-run row (long timeout), asserts visibility, then returns to Details.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • sahil143
  • testcara
  • Katka92
  • janaki29
  • abhinandan13jan

Poem

A tiny check on a pipeline row,
Tabs clicked where the e2e winds blow,
Page objects aligned, assertions bright,
CI hums softly into the night. 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title focuses on refactoring checkPipelineStatuses, but the PR also adds pipeline run verification logic and new page object selectors—significant changes not captured in the title. Consider revising the title to reflect the full scope, such as 'refactor checkPipelineStatuses and add pipeline run verification' or clarify if the title should emphasize only the primary refactor.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@snyk-io
Copy link
Contributor

snyk-io bot commented Feb 17, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.63%. Comparing base (d8a8dde) to head (7a8db0f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #711      +/-   ##
==========================================
- Coverage   87.23%   86.63%   -0.60%     
==========================================
  Files         764      764              
  Lines       58225    58225              
  Branches     5658     5656       -2     
==========================================
- Hits        50792    50444     -348     
- Misses       7376     7602     +226     
- Partials       57      179     +122     
Flag Coverage Δ
e2e 43.37% <ø> (-5.83%) ⬇️
unittests 85.79% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 104 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8a8dde...7a8db0f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rrosatti rrosatti force-pushed the KFLUXUI-1070/e2e-fix-cancelled-plr-check branch from 2f036ab to 8b61b9d Compare February 18, 2026 10:03
@rrosatti rrosatti changed the title [WIP] refactor(e2e-tests/utils/Applications): use expect() in checkPipelineStatuses [WIP] [KFLUXUI-1070] refactor(e2e-tests/utils/Applications): use expect() in checkPipelineStatuses Feb 18, 2026
@rrosatti rrosatti changed the title [WIP] [KFLUXUI-1070] refactor(e2e-tests/utils/Applications): use expect() in checkPipelineStatuses [KFLUXUI-1070] refactor(e2e-tests/utils/Applications): use expect() in checkPipelineStatuses Feb 18, 2026
@rrosatti rrosatti marked this pull request as ready for review February 18, 2026 10:57
@rrosatti rrosatti requested a review from a team as a code owner February 18, 2026 10:57
Copy link
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.

🧹 Nitpick comments (2)
e2e-tests/utils/Applications.ts (1)

49-55: Redundant return in wrapper methods.

checkPipelineStatuses no longer returns a meaningful value (void), so the return in both wrappers is a no-op. Safe to remove for clarity.

♻️ Proposed cleanup
  static checkPipelineIsCancellingOrCancelled(componentName: string) {
-   return this.checkPipelineStatuses(componentName, ['Cancelling', 'Cancelled']);
+   this.checkPipelineStatuses(componentName, ['Cancelling', 'Cancelled']);
  }

  static checkPipelineIsCancelled(componentName: string) {
-   return this.checkPipelineStatuses(componentName, ['Cancelled']);
+   this.checkPipelineStatuses(componentName, ['Cancelled']);
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-tests/utils/Applications.ts` around lines 49 - 55, Both wrapper methods
checkPipelineIsCancellingOrCancelled and checkPipelineIsCancelled are using
"return" when calling checkPipelineStatuses, but checkPipelineStatuses is void
so the return is redundant; remove the "return" keyword and simply call
this.checkPipelineStatuses(componentName, ['Cancelling','Cancelled']) and
this.checkPipelineStatuses(componentName, ['Cancelled']) respectively (preserve
method names and signatures in class Applications).
e2e-tests/tests/basic-happy-path.spec.ts (1)

102-104: Hardcoded cy.wait(30000) — consider a deterministic wait.

A fixed 30-second sleep will unconditionally slow every test run. If there's a detectable UI condition that signals readiness (e.g., the PR modal closing, a loading spinner disappearing, or a specific element becoming visible/hidden), a cy.get(...).should(...) wait would be both faster on average and more reliable under varying CI load. At a minimum, extracting the value to a named constant (e.g., const MERGE_PR_STABILIZATION_WAIT_MS = 30_000) co-locates the intent with the other existing wait constants and makes the magic number easier to locate and adjust.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-tests/tests/basic-happy-path.spec.ts` around lines 102 - 104, Replace the
hardcoded cy.wait(30000) with a deterministic wait or at least a named constant:
identify the UI condition that indicates readiness (e.g., PR modal close,
spinner disappearance, or target element visibility) and use
cy.get(...).should(...) to wait for that condition instead of a fixed sleep; if
a deterministic selector can't be used immediately, replace cy.wait(30000) with
a constant like MERGE_PR_STABILIZATION_WAIT_MS = 30_000 and reference that
constant where cy.wait is called to document intent and make tuning easier
(locate the existing cy.wait call in the test and update it).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@e2e-tests/tests/basic-happy-path.spec.ts`:
- Around line 102-104: Replace the hardcoded cy.wait(30000) with a deterministic
wait or at least a named constant: identify the UI condition that indicates
readiness (e.g., PR modal close, spinner disappearance, or target element
visibility) and use cy.get(...).should(...) to wait for that condition instead
of a fixed sleep; if a deterministic selector can't be used immediately, replace
cy.wait(30000) with a constant like MERGE_PR_STABILIZATION_WAIT_MS = 30_000 and
reference that constant where cy.wait is called to document intent and make
tuning easier (locate the existing cy.wait call in the test and update it).

In `@e2e-tests/utils/Applications.ts`:
- Around line 49-55: Both wrapper methods checkPipelineIsCancellingOrCancelled
and checkPipelineIsCancelled are using "return" when calling
checkPipelineStatuses, but checkPipelineStatuses is void so the return is
redundant; remove the "return" keyword and simply call
this.checkPipelineStatuses(componentName, ['Cancelling','Cancelled']) and
this.checkPipelineStatuses(componentName, ['Cancelled']) respectively (preserve
method names and signatures in class Applications).

@rrosatti rrosatti force-pushed the KFLUXUI-1070/e2e-fix-cancelled-plr-check branch 3 times, most recently from dad88ee to a711f38 Compare February 19, 2026 09:12
cy.contains(UIhelperPO.tableRow('Pipeline run List'), plrName, {
// extended timeout: GitHub synchronization can occasionally take some time,
// which causes PR creation to take longer.
timeout: 1200000, // 20min
Copy link
Member

Choose a reason for hiding this comment

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

Is this timeout based on your experience? 20 minutes is crazy high for a pipeline creation. I think we don't want users to be waiting 20 minutes for a pipeline to be created.

Copy link
Member Author

Choose a reason for hiding this comment

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

as we discussed in Slack, I've observed it taking from a few seconds up to ~15min. So, I just rounded up to 20min to be sure 😄

@rrosatti rrosatti force-pushed the KFLUXUI-1070/e2e-fix-cancelled-plr-check branch 2 times, most recently from 0257f18 to f80ee64 Compare February 23, 2026 10:36
…Statuses

Use Cypress expect() callback instead of returning true/false.

Assisted-by: Cursor
Update e2e test to check if the -on-pull pipeline run is visible before merging
the onboarding PR.

Assisted-by: Cursor
@rrosatti rrosatti force-pushed the KFLUXUI-1070/e2e-fix-cancelled-plr-check branch from f80ee64 to a6bb4e1 Compare February 23, 2026 11:13
@rrosatti rrosatti marked this pull request as ready for review February 23, 2026 11:58
Copy link
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e-tests/support/pages/ComponentDetailsPage.ts`:
- Around line 22-26: The test currently uses
cy.contains(UIhelperPO.tableRow('Pipeline run List'), plrName, { timeout:
1200000 }) which only asserts existence; update the verifyPipelineRunIsVisible
step to chain .should('be.visible') to that cy.contains call so it asserts
actual visibility; locate the verifyPipelineRunIsVisible usage (or the block
using cy.contains with UIhelperPO.tableRow('Pipeline run List') and plrName) and
append .should('be.visible') after the timeout options.

In `@e2e-tests/utils/Applications.ts`:
- Around line 27-37: The code is incorrectly casting an options object onto the
.should(...) call which only accepts a callback; remove the "as { timeout:
number }" argument and the trailing options object from the .should invocation
so the call is just .should(($row) => { ... }); keep the timeout on cy.get(...)
(already set to 90000) so retries still occur; update the block around
pipelinerunsTabPO.pipelineRunRow(pipelineRunName) and the statuses
check/expectation to rely on Cypress's built-in retry behavior without the bogus
type assertion.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b61b9d and a6bb4e1.

📒 Files selected for processing (4)
  • e2e-tests/support/pageObjects/pages-po.ts
  • e2e-tests/support/pages/ComponentDetailsPage.ts
  • e2e-tests/tests/basic-happy-path.spec.ts
  • e2e-tests/utils/Applications.ts

Copy link
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 (1)
e2e-tests/utils/Applications.ts (1)

32-32: Nitpick: ... is always appended even when text is shorter than 100 chars.

-          `Pipeline run row should show one of [${statuses.join(', ')}]; got: "${text.trim().slice(0, 100)}..."`,
+          `Pipeline run row should show one of [${statuses.join(', ')}]; got: "${text.trim().length > 100 ? text.trim().slice(0, 100) + '...' : text.trim()}"`,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e-tests/utils/Applications.ts` at line 32, The assertion message always
appends "..." even when the captured text is shorter than 100 chars; change the
message construction so you create a snippet from text.trim().slice(0, 100) and
only append "..." when text.trim().length > 100 (use the existing text variable
and the same template string context that builds `Pipeline run row should show
one of [...]`).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@e2e-tests/utils/Applications.ts`:
- Around line 26-29: The test is vulnerable to matching multiple pipeline run
rows because pipelineRunRow uses a starts-with selector; update the assertion to
target a single row (e.g., the most-recent row) by applying a single-element
selection before reading text — locate the cy.get(...) that uses
pipelineRunRow(pipelineRunName) and call a single-row selector like .first() (or
otherwise narrow the selector to an exact match) so the subsequent text/includes
check against statuses inspects only the intended pipelineRunName row.

---

Nitpick comments:
In `@e2e-tests/utils/Applications.ts`:
- Line 32: The assertion message always appends "..." even when the captured
text is shorter than 100 chars; change the message construction so you create a
snippet from text.trim().slice(0, 100) and only append "..." when
text.trim().length > 100 (use the existing text variable and the same template
string context that builds `Pipeline run row should show one of [...]`).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6bb4e1 and 7a8db0f.

📒 Files selected for processing (2)
  • e2e-tests/support/pages/ComponentDetailsPage.ts
  • e2e-tests/utils/Applications.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e-tests/support/pages/ComponentDetailsPage.ts

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.

2 participants