Skip to content

test: add test id to frozen icon and streamline freeze functionality test#8619

Merged
Yukiyukiyeah merged 35 commits into
mainfrom
refactor-freeze-component-test
Jun 20, 2025
Merged

test: add test id to frozen icon and streamline freeze functionality test#8619
Yukiyukiyeah merged 35 commits into
mainfrom
refactor-freeze-component-test

Conversation

@ogabrielluiz
Copy link
Copy Markdown
Contributor

@ogabrielluiz ogabrielluiz commented Jun 18, 2025

Summary by CodeRabbit

  • Tests
    • Simplified the test for freezing a component to focus on a single component and verify output consistency after freezing.
  • Chores
    • Added a test identifier to the frozen icon to improve test reliability.

…eractions and enhancing test clarity

- Removed unnecessary component interactions and waits to streamline the test flow.
- Updated assertions to ensure expected output values are validated correctly.
- Improved timeout settings for better reliability in test execution.
@ogabrielluiz ogabrielluiz requested a review from Cristhianzl June 18, 2025 15:42
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 18, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 18, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A test identifier was added to the frozen icon in the frontend, and the freeze functionality test was streamlined. The test now focuses on freezing a single text input component and verifying output consistency, with unnecessary steps and interactions removed for simplicity.

Changes

File(s) Change Summary
src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx Added data-testid="frozen-icon" to the frozen icon's wrapper div for easier DOM querying in tests.
src/frontend/tests/core/features/freeze.spec.ts Simplified the freeze functionality test to focus on a single component, removing extraneous interactions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant NodeComponent
    participant Modal

    User->>UI: Add "text input" component
    User->>NodeComponent: Enter "hello world"
    User->>UI: Inspect output
    UI->>NodeComponent: Capture initial output
    User->>NodeComponent: Change input to "goodbye world"
    User->>UI: Open options modal
    User->>Modal: Click "Freeze All"
    Modal->>NodeComponent: Freeze node
    UI->>NodeComponent: Wait for frozen icon
    UI->>NodeComponent: Verify output unchanged
Loading
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch refactor-freeze-component-test

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot changed the title @coderabbitai test: add test id to frozen icon and streamline freeze functionality test Jun 18, 2025
@ogabrielluiz ogabrielluiz enabled auto-merge June 18, 2025 15:43
@github-actions github-actions Bot added the test Changes to tests label Jun 18, 2025
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: 2

🧹 Nitpick comments (1)
src/frontend/tests/core/features/freeze.spec.ts (1)

65-69: Minor: prefer expect(locator).toBeVisible() over waitForSelector

waitForSelector is fine, but Playwright’s expect(locator).toBeVisible() provides built-in waiting and clearer intent.

No action required if the current pattern is consistent across the suite.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea02f63 and 1a9d66f.

📒 Files selected for processing (2)
  • src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx (1 hunks)
  • src/frontend/tests/core/features/freeze.spec.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: autofix
🔇 Additional comments (1)
src/frontend/src/CustomNodes/GenericNode/components/NodeOutputfield/index.tsx (1)

359-362: data-testid addition looks good and is non-intrusive

The attribute provides a stable selector for the tests without affecting runtime logic or styling. Naming is consistent with the other data-testid values in this component.

Comment on lines +45 to 48
await page.getByTestId("output-inspection-output text-textinput").click();

//fourth component

await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("Parser");
await page.waitForSelector('[data-testid="processingParser"]', {
timeout: 1000,
});

await page
.getByTestId("processingParser")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 50, y: 300 },
});

await page.getByTestId("zoom_out").click();

//fifth component

await page.getByTestId("sidebar-search-input").click();
await page.getByTestId("sidebar-search-input").fill("chat output");
await page.waitForSelector('[data-testid="input_outputChat Output"]', {
timeout: 1000,
});

await page
.getByTestId("input_outputChat Output")
.dragTo(page.locator('//*[@id="react-flow-id"]'), {
targetPosition: { x: 600, y: 200 },
});

await page.getByTestId("div-generic-node").nth(4).click();

await page.getByTestId("more-options-modal").click();

await page.getByTestId("expand-button-modal").click();

await page.getByTestId("fit_view").click();

let outdatedComponents = await page.getByTestId("update-button").count();

while (outdatedComponents > 0) {
await page.getByTestId("update-button").first().click();
await page.waitForSelector('[data-testid="update-button"]', {
timeout: 1000,
});
outdatedComponents = await page.getByTestId("update-button").count();
}

let filledApiKey = await page.getByTestId("remove-icon-badge").count();
while (filledApiKey > 0) {
await page.getByTestId("remove-icon-badge").first().click();
filledApiKey = await page.getByTestId("remove-icon-badge").count();
}

await page.getByTestId("fit_view").click();
await zoomOut(page, 2);

//connection 1
await page
.getByTestId("handle-urlcomponent-shownode-extracted pages-right")
.nth(0)
.click();
await page
.getByTestId("handle-splittext-shownode-data or dataframe-left")
.click();

//connection 2
await page
.getByTestId("handle-textinput-shownode-output text-right")
.nth(0)
.click();
await page.getByTestId("handle-splittext-shownode-separator-left").click();

//connection 3
await page
.getByTestId("handle-splittext-shownode-chunks-right")
.nth(0)
.click();
await page
.getByTestId("handle-parsercomponent-shownode-data or dataframe-left")
.click();

//connection 4
await page
.getByTestId("handle-parsercomponent-shownode-parsed text-right")
.nth(0)
.click();
await page.getByTestId("handle-chatoutput-shownode-inputs-left").click();

await page
.getByTestId("textarea_str_input_value")
.first()
.fill("lorem ipsum");

await page
.getByTestId("inputlist_str_urls_0")
.fill("https://www.lipsum.com/feed/html");

await runChatOutput(page);

await page.waitForSelector("text=built successfully", {
timeout: 30000 * 3,
});

await page.waitForSelector(
'[data-testid="output-inspection-output message-chatoutput"]',
{
timeout: 1000,
},
);

await page
.getByTestId("output-inspection-output message-chatoutput")
.first()
.click();

const firstRunWithoutFreezing = await page
.getByPlaceholder("Empty")
.textContent();
const firstOutputText = await page.getByPlaceholder("Empty").textContent();

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.

⚠️ Potential issue

Reading the output with .textContent() is unreliable for <textarea> – use .inputValue() instead

Locator.textContent() returns null for form controls (e.g. <textarea>, <input>), so the assertions will always fail or compare null/"". Switch to inputValue() (or evaluate(el => el.value)) which is guaranteed to return the control’s value.

-const firstOutputText = await page.getByPlaceholder("Empty").textContent();
+const firstOutputText = await page.getByPlaceholder("Empty").inputValue();
 ...
-const secondOutputText = await page.getByPlaceholder("Empty").textContent();
+const secondOutputText = await page.getByPlaceholder("Empty").inputValue();

Also applies to: 76-79

🤖 Prompt for AI Agents
In src/frontend/tests/core/features/freeze.spec.ts around lines 45 to 48 and
also lines 76 to 79, the code uses textContent() to read the value of a
textarea, which returns null and causes assertions to fail. Replace all
instances of textContent() used on form controls like textarea or input with
inputValue() to reliably get their current value for assertions.

Comment thread src/frontend/tests/core/features/freeze.spec.ts Outdated
Copy link
Copy Markdown
Member

@Cristhianzl Cristhianzl left a comment

Choose a reason for hiding this comment

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

lgtm

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 18, 2025
…ector for improved test reliability

- Updated the test to use waitForSelector instead of a fixed timeout, enhancing the robustness of the test execution.
- This change aims to ensure that the test waits for the specific element to be present before proceeding, reducing flakiness.
…itForSelector for improved test reliability"

This reverts commit 42eccbf.
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 18, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 18, 2025
@ogabrielluiz ogabrielluiz added the fast-track Skip tests and sends PR into the merge queue label Jun 18, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jun 18, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 18, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2025
@ogabrielluiz ogabrielluiz enabled auto-merge June 18, 2025 18:19
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jun 18, 2025
@github-actions github-actions Bot removed the test Changes to tests label Jun 18, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
…ze button for better testing

🐛 (freeze.spec.ts): update test to use new data-testid for freeze button to ensure proper element selection
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
…to ensure user can freeze components in the application and verify the frozen state with polling approach for better error handling.
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
…o use waitForSelector for improved reliability and error handling, replacing the previous polling approach.
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jun 20, 2025
…lication to ensure the functionality works as expected
@Cristhianzl Cristhianzl removed this pull request from the merge queue due to a manual request Jun 20, 2025
@Yukiyukiyeah Yukiyukiyeah added this pull request to the merge queue Jun 20, 2025
@Cristhianzl Cristhianzl removed this pull request from the merge queue due to a manual request Jun 20, 2025
@github-actions github-actions Bot added test Changes to tests and removed test Changes to tests labels Jun 20, 2025
@Yukiyukiyeah Yukiyukiyeah enabled auto-merge June 20, 2025 18:21
@coderabbitai coderabbitai Bot mentioned this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast-track Skip tests and sends PR into the merge queue lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. test Changes to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants