Skip to content

Fix tests #477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 9, 2025
Merged

Fix tests #477

merged 9 commits into from
Jul 9, 2025

Conversation

Naseem77
Copy link
Contributor

@Naseem77 Naseem77 commented Jul 8, 2025

PR Type

Tests, Enhancement


Description

  • Implement CI sharding for parallel test execution

  • Fix test stability with improved waiting mechanisms

  • Update test constants and data for better reliability

  • Enhance canvas interaction methods with retry logic


Changes diagram

flowchart LR
  A["Test Constants"] --> B["Canvas Interactions"]
  B --> C["Waiting Mechanisms"]
  C --> D["CI Sharding"]
  D --> E["Parallel Execution"]
Loading

Changes walkthrough 📝

Relevant files
Configuration changes
2 files
constants.ts
Update test constants for different graphs                             
+2/-2     
playwright.config.ts
Configure CI reporters and test output                                     
+6/-1     
Tests
6 files
testData.ts
Update search completion test data                                             
+1/-1     
canvas.spec.ts
Update canvas tests with improved stability                           
+40/-58 
chat.spec.ts
Fix chat tests with better timing                                               
+21/-16 
nodeDetailsPanel.spec.ts
Update node details panel tests                                                   
+40/-38 
searchBar.spec.ts
Update search bar test constants                                                 
+7/-7     
elementMenu.tsx
Add ID attribute for test targeting                                           
+1/-0     
Enhancement
3 files
codeGraph.ts
Enhance canvas interactions and waiting mechanisms             
+113/-34
utils.ts
Add utility function for finding nodes                                     
+5/-1     
playwright.yml
Implement test sharding and report merging                             
+57/-2   

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • New Features

      • Improved Playwright test reporting with multi-format outputs and unified report merging for easier result analysis.
      • The main container of the element menu now includes a unique identifier for easier DOM targeting.
    • Bug Fixes

      • Enhanced test reliability by synchronizing with UI animations and loading indicators, reducing flakiness.
    • Refactor

      • Unified and simplified graph identifier usage across all tests.
      • Streamlined graph data retrieval and node lookup methods in tests.
      • Removed redundant or unused test cases and constants.
    • Chores

      • Updated GitHub Actions workflow to shard Playwright tests and merge results for faster CI runs and consolidated reporting.
      • Improved Playwright configuration for better CI compatibility.

    Copy link
    Contributor

    coderabbitai bot commented Jul 8, 2025

    """

    Walkthrough

    The updates introduce Playwright test sharding and report merging in the CI workflow, enhance Playwright configuration for multi-reporter output, and refactor E2E test constants and data retrieval for improved consistency. Several utility and page object methods are added or refined, and DOM element identification is improved. Test suites are updated to reflect these changes.

    Changes

    File(s) Change Summary
    .github/workflows/playwright.yml Workflow updated to run Playwright tests in two parallel shards with matrix strategy, upload shard-specific reports and test results, and merge results in a new job with summary artifact.
    playwright.config.ts Reporter configuration updated: multi-reporter support enabled for CI with 'dot', 'list', 'json', and 'html' reporters; retains single 'html' reporter locally with auto-open disabled on CI.
    app/components/elementMenu.tsx Added static id="elementMenu" attribute to the main container <div>.
    e2e/config/constants.ts Replaced GRAPH_ID and PROJECT_NAME with unified GRAPHRAG_SDK; added new constant FLASK_GRAPH.
    e2e/config/testData.ts Modified one searchData entry: changed completedSearchInput for "low" from "lower" to "lower_items".
    e2e/logic/POM/codeGraph.ts Added locators for loading indicator and element menu; enhanced nodeClick with animation wait, retries, and error handling; split getGraphDetails into getGraphNodes (with transform and retries) and a new getGraphDetails (with animation wait); added waitForCanvasAnimationToEnd utility; improved synchronization with UI states.
    e2e/logic/utils.ts Added utility functions findFirstNodeWithSrc and findNodeWithSpecificSrc for node lookup by src property.
    e2e/tests/canvas.spec.ts Unified to use GRAPHRAG_SDK; replaced getGraphDetails() with getGraphNodes(); relaxed assertion tolerances; removed node copy-to-clipboard test; added clickCenter() after graph selection.
    e2e/tests/chat.spec.ts Unified to use GRAPHRAG_SDK; reduced loop counts; added 3000 ms delays after sending messages; refactored API/UI response comparison test; clarified comments; updated message content to use constant.
    e2e/tests/nodeDetailsPanel.spec.ts Switched to GRAPHRAG_SDK and FLASK_GRAPH; replaced getGraphDetails() with getGraphNodes(); used new utility for node lookup; set browser to fullscreen before graph selection; updated API calls accordingly; refactored copy test to use node with specific src.
    e2e/tests/searchBar.spec.ts Unified to use GRAPHRAG_SDK for graph and project identifiers in all tests.

    Sequence Diagram(s)

    sequenceDiagram
        participant CI
        participant Playwright Shard 1
        participant Playwright Shard 2
        participant Merge Reports
    
        CI->>Playwright Shard 1: Run tests (shard 1)
        CI->>Playwright Shard 2: Run tests (shard 2)
        Playwright Shard 1->>CI: Upload shard 1 report/results
        Playwright Shard 2->>CI: Upload shard 2 report/results
        CI->>Merge Reports: Trigger merge job after shards complete
        Merge Reports->>CI: Download all shard reports
        Merge Reports->>Merge Reports: Merge reports into combined HTML/JSON
        Merge Reports->>CI: Upload merged report artifact
    
    Loading

    Suggested reviewers

    • AviAvni
    • gkorland

    Poem

    In the warren where tests multiply and grow,
    Shards run in parallel, swift as the flow.
    Reports hop together, merging as one,
    While constants and helpers are neatly spun.
    With a twitch of a nose and a flick of an ear,
    This bunny says: "Great work—release time is near!"
    🐇✨
    """


    📜 Recent review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between 5656d2b and f7a2de2.

    📒 Files selected for processing (1)
    • .github/workflows/playwright.yml (2 hunks)
    🚧 Files skipped from review as they are similar to previous changes (1)
    • .github/workflows/playwright.yml
    ⏰ 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: test (1)
    • GitHub Check: test (2)

    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 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.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • 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

    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.

    Copy link

    vercel bot commented Jul 8, 2025

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    code-graph ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2025 8:25pm

    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 8, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Performance Concern

    The waitForCanvasAnimationToEnd method uses JSON.stringify to compare large ImageData arrays, which could be very slow and memory-intensive for large canvas elements. This could cause timeouts or performance issues in tests.

    if (JSON.stringify(previousData) === JSON.stringify(currentData)) {
        resolve(true);
    Error Handling

    The nodeClick method throws a generic error after 3 failed attempts without providing specific information about what went wrong. This makes debugging test failures more difficult.

        throw new Error(`Failed to click, elementMenu not visible after multiple attempts.`);
    }
    Race Condition

    The getGraphNodes method has a retry loop for transform data but doesn't handle the case where graphData might be null or undefined, which could cause runtime errors.

        return (window as any).graph;
    });

    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 8, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Optimize image data comparison performance

    Using JSON.stringify to compare large ImageData arrays is inefficient and can
    cause performance issues. The comparison should use a more efficient method like
    comparing pixel data directly or using a hash-based approach.

    e2e/logic/POM/codeGraph.ts [578-623]

     async waitForCanvasAnimationToEnd(timeout = 15000, checkInterval = 500): Promise<void> {
         const canvasHandle = await this.canvasElement.elementHandle();
     
         if (!canvasHandle) {
             throw new Error("Canvas element not found!");
         }
     
         await this.page.waitForFunction(
             async ({ canvas, checkInterval, timeout }) => {
                 const ctx = canvas.getContext('2d');
                 if (!ctx) return false;
     
                 const width = canvas.width;
                 const height = canvas.height;
     
                 let previousData = ctx.getImageData(0, 0, width, height).data;
                 const startTime = Date.now();
     
                 return new Promise<boolean>((resolve) => {
                     const checkCanvas = () => {
                         if (Date.now() - startTime > timeout) {
                             resolve(true);
                             return;
                         }
     
                         setTimeout(() => {
                             const currentData = ctx.getImageData(0, 0, width, height).data;
    -                        if (JSON.stringify(previousData) === JSON.stringify(currentData)) {
    +                        let isEqual = previousData.length === currentData.length;
    +                        if (isEqual) {
    +                            for (let i = 0; i < previousData.length; i++) {
    +                                if (previousData[i] !== currentData[i]) {
    +                                    isEqual = false;
    +                                    break;
    +                                }
    +                            }
    +                        }
    +                        if (isEqual) {
                                 resolve(true);
                             } else {
                                 previousData = currentData;
                                 checkCanvas();
                             }
                         }, checkInterval);
                     };
                     checkCanvas();
                 });
             },
             { 
                 canvas: await canvasHandle.evaluateHandle((el) => el as HTMLCanvasElement),
                 checkInterval,
                 timeout
             },
             { timeout }
         );
     }
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly identifies that comparing ImageData arrays with JSON.stringify is inefficient and provides a more performant direct comparison loop, improving test execution speed.

    Medium
    Add error handling for missing report directory

    The script assumes the playwright-report directory exists after running
    merge-reports, but if the merge fails or produces no output, the mv command will
    fail. Add error handling to check if the directory exists before moving it.

    .github/workflows/playwright.yml [75-90]

     - name: Merge test results
       run: |
         # Create combined results directory
         mkdir -p combined-results
         
         # Merge JSON results
         npx playwright merge-reports --reporter=html,json all-reports/playwright-report-shard-*/
         
    -    # Move merged report to combined directory
    -    mv playwright-report combined-results/
    +    # Move merged report to combined directory if it exists
    +    if [ -d "playwright-report" ]; then
    +      mv playwright-report combined-results/
    +    else
    +      echo "Warning: playwright-report directory not found after merge"
    +    fi
         
         # Create a summary of all test results
         echo "## Test Results Summary" > combined-results/summary.md
         echo "Total shards: 2" >> combined-results/summary.md
         echo "Workers per shard: 2" >> combined-results/summary.md
         echo "Generated on: $(date)" >> combined-results/summary.md
    • Apply / Chat
    Suggestion importance[1-10]: 6

    __

    Why: The suggestion correctly points out a potential failure point in the CI workflow and adds a check to prevent the mv command from failing, making the workflow more robust.

    Low
    • Update

    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

    🧹 Nitpick comments (4)
    e2e/logic/utils.ts (1)

    22-24: Consider improving TypeScript typing.

    The function logic is correct, but the return type any could be more specific for better type safety.

    Consider using a generic type or a more specific return type:

    -export function findFirstNodeWithSrc(nodes: { src?: string }[]): any {
    +export function findFirstNodeWithSrc<T extends { src?: string }>(nodes: T[]): T | undefined {
        return nodes.find((node) => node.src !== undefined);
    }
    e2e/tests/nodeDetailsPanel.spec.ts (1)

    5-5: Minor formatting issue with trailing comma.

    The trailing comma after GRAPHRAG_SDK in the import statement is unnecessary and should be removed for cleaner code.

    -import { FLASK_GRAPH, GRAPHRAG_SDK,  } from "../config/constants";
    +import { FLASK_GRAPH, GRAPHRAG_SDK } from "../config/constants";
    .github/workflows/playwright.yml (1)

    59-59: Fix YAML formatting issues.

    The static analysis tools identified several formatting issues that should be addressed for code quality.

        steps:
    -   - uses: actions/checkout@v4
    +     - uses: actions/checkout@v4

    Also remove trailing spaces from lines 79, 82, and 85:

    -        # Create combined results directory
    +        # Create combined results directory
    -        
    +        
    -        # Move merged report to combined directory
    +        # Move merged report to combined directory

    Also applies to: 79-79, 82-82, 85-85

    e2e/logic/POM/codeGraph.ts (1)

    578-623: Innovative canvas animation detection but consider performance impact

    The waitForCanvasAnimationToEnd method uses pixel-level comparison to detect animation completion, which is innovative. However, there are some considerations:

    1. Performance Impact: Comparing entire canvas pixel data using JSON.stringify is expensive
    2. Memory Usage: getImageData returns large arrays that are being stringified
    3. Timeout Handling: The method resolves true on timeout, which might mask real issues

    Consider optimizing the pixel comparison:

    -                            if (JSON.stringify(previousData) === JSON.stringify(currentData)) {
    +                            // Compare only a sample of pixels for better performance
    +                            let pixelsMatch = true;
    +                            for (let i = 0; i < currentData.length; i += 1000) {
    +                                if (previousData[i] !== currentData[i]) {
    +                                    pixelsMatch = false;
    +                                    break;
    +                                }
    +                            }
    +                            if (pixelsMatch) {

    Or use a hash-based comparison for better performance:

    +                            const hash = (data: Uint8ClampedArray) => {
    +                                let hash = 0;
    +                                for (let i = 0; i < data.length; i += 100) {
    +                                    hash = ((hash << 5) - hash + data[i]) & 0xffffffff;
    +                                }
    +                                return hash;
    +                            };
    +                            
    -                            if (JSON.stringify(previousData) === JSON.stringify(currentData)) {
    +                            if (hash(previousData) === hash(currentData)) {
    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between a4b6e33 and 9377bd7.

    📒 Files selected for processing (11)
    • .github/workflows/playwright.yml (2 hunks)
    • app/components/elementMenu.tsx (1 hunks)
    • e2e/config/constants.ts (1 hunks)
    • e2e/config/testData.ts (1 hunks)
    • e2e/logic/POM/codeGraph.ts (6 hunks)
    • e2e/logic/utils.ts (1 hunks)
    • e2e/tests/canvas.spec.ts (8 hunks)
    • e2e/tests/chat.spec.ts (6 hunks)
    • e2e/tests/nodeDetailsPanel.spec.ts (4 hunks)
    • e2e/tests/searchBar.spec.ts (6 hunks)
    • playwright.config.ts (1 hunks)
    🧰 Additional context used
    🧬 Code Graph Analysis (3)
    e2e/tests/searchBar.spec.ts (2)
    e2e/config/constants.ts (1)
    • GRAPHRAG_SDK (1-1)
    e2e/logic/api/apiCalls.ts (1)
    • ApiCalls (5-42)
    e2e/tests/chat.spec.ts (5)
    e2e/config/constants.ts (3)
    • GRAPHRAG_SDK (1-1)
    • CHAT_OPTTIONS_COUNT (3-3)
    • Node_Question (4-4)
    e2e/logic/POM/codeGraph.ts (1)
    • CodeGraph (11-625)
    e2e/logic/utils.ts (1)
    • delay (3-3)
    e2e/config/testData.ts (1)
    • nodesPath (17-20)
    e2e/logic/api/apiCalls.ts (1)
    • ApiCalls (5-42)
    e2e/logic/POM/codeGraph.ts (1)
    e2e/logic/utils.ts (1)
    • delay (3-3)
    🪛 YAMLlint (1.37.1)
    .github/workflows/playwright.yml

    [warning] 59-59: wrong indentation: expected 6 but found 4

    (indentation)


    [error] 79-79: trailing spaces

    (trailing-spaces)


    [error] 82-82: trailing spaces

    (trailing-spaces)


    [error] 85-85: trailing spaces

    (trailing-spaces)

    🔇 Additional comments (22)
    app/components/elementMenu.tsx (1)

    44-44: Good addition for test automation!

    Adding a stable DOM identifier improves test reliability by providing a consistent selector for the element menu container.

    e2e/config/constants.ts (1)

    1-2: Good refactoring to unify graph identifiers.

    Consolidating GRAPH_ID and PROJECT_NAME into GRAPHRAG_SDK and adding FLASK_GRAPH improves consistency and supports multiple graph contexts.

    e2e/config/testData.ts (1)

    4-4: Confirm the test data update reflects actual autocomplete behavior

    I didn’t find any references to “lower” or “lower_items” in the autocomplete implementation, so please manually verify that for the input "low", the system now suggests "lower_items" as expected.

    e2e/tests/searchBar.spec.ts (3)

    5-5: Good import update for the constants refactoring.

    Properly updated to use the new unified GRAPHRAG_SDK constant.


    24-24: Consistent usage of the new constant.

    All selectGraph() calls have been properly updated to use GRAPHRAG_SDK instead of the previous constants.

    Also applies to: 37-37, 49-49, 59-59, 69-69


    73-73: API call updated consistently.

    The searchAutoComplete() API call correctly uses the new GRAPHRAG_SDK constant.

    playwright.config.ts (1)

    25-30: LGTM! Configuration properly supports CI test sharding.

    The conditional reporter configuration correctly provides JSON output for CI report merging while maintaining simple HTML reporting for local development. This aligns well with the new workflow sharding strategy.

    e2e/tests/chat.spec.ts (3)

    6-6: LGTM! Constants consolidation improves maintainability.

    The import update to use centralized constants (GRAPHRAG_SDK, Node_Question) from the constants file improves code maintainability and consistency across test files.


    34-44: Good optimization of test timing and reliability.

    The reduction from 5 to 3 iterations and addition of 3000ms delays improves test reliability by allowing proper time for asynchronous processing. This should reduce flaky test failures.


    123-125: Efficient test optimization by moving API call.

    Moving the API call before page creation and graph selection is a good optimization that reduces test execution time while maintaining the same validation logic.

    e2e/tests/nodeDetailsPanel.spec.ts (2)

    24-28: Excellent improvement to test reliability.

    The addition of browser.setPageToFullScreen() and the switch to getGraphNodes() with utility functions for node finding should significantly improve test reliability and maintainability.


    66-67: Good use of utility function for robust node selection.

    Using findFirstNodeWithSrc() instead of hardcoded node selection makes the test more robust and adaptable to different graph structures.

    e2e/tests/canvas.spec.ts (3)

    5-5: LGTM! Constants consolidation improves maintainability.

    The switch to using GRAPHRAG_SDK from centralized constants improves consistency across the test suite and makes maintenance easier.


    46-46: Good addition for canvas synchronization.

    Adding the clickCenter() call after graph selection should help ensure consistent canvas state before running assertions, improving test reliability.


    53-54: Reasonable tolerance adjustment for flaky tests.

    Relaxing the assertion tolerance from 0.1 to 0.2 for scale comparisons should reduce test flakiness while still validating the centering functionality effectively.

    .github/workflows/playwright.yml (2)

    11-14: LGTM! Good implementation of test sharding.

    The matrix strategy with 2 shards and fail-fast disabled should improve CI performance while ensuring all tests run even if some fail.


    54-96: Excellent implementation of report merging.

    The merge-reports job properly combines shard results into unified reports. The dependency on the test job and artifact handling look correct.

    e2e/logic/POM/codeGraph.ts (5)

    123-125: LGTM: Well-defined locator for loading indicator

    The new waitingForResponseImage locator provides a clean way to target the loading indicator across the entire page, which is an improvement over the more specific previousQuestionLoadingImage locator.


    287-295: Good improvement: Dynamic waiting replaces fixed delay

    The enhancement to wait for the loading indicator to disappear before retrieving text is a significant improvement over fixed delays. This makes the test more reliable and faster.


    196-199: LGTM: Stable element menu locator

    Using an ID selector for the element menu is a good practice for test stability, as IDs are typically more stable than other selectors.


    431-444: Excellent enhancement: Robust node clicking with retry logic

    The enhanced nodeClick method significantly improves test reliability by:

    • Waiting for canvas animations to complete
    • Implementing retry logic with hover and click attempts
    • Providing clear error messaging when attempts fail

    566-576: Confirmed correct usage of getGraphDetails() in tests

    • Reviewed e2e/tests/canvas.spec.ts: every final-graph assertion now calls getGraphDetails() and no legacy calls to an older graph-fetch method remain.
    • The only remaining use of getGraphNodes() is for initial-state validation, preserving single-responsibility.

    All tests are synchronized with the updated method—no further changes required.

    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/logic/utils.ts (1)

    22-28: LGTM! Consider type safety improvements.

    The new utility functions are well-implemented and serve clear purposes. Consider these improvements:

    1. Apply optional chaining as suggested by static analysis:
    export function findNodeWithSpecificSrc(nodes: { src?: string }[], srcContent: string): any {
    -    return nodes.find((node) => node.src && node.src.includes(srcContent));
    +    return nodes.find((node) => node.src?.includes(srcContent));
    }
    1. Improve type safety by using more specific return types:
    -export function findFirstNodeWithSrc(nodes: { src?: string }[]): any {
    +export function findFirstNodeWithSrc(nodes: { src?: string }[]): { src?: string } | undefined {
        return nodes.find((node) => node.src !== undefined);
    }
    
    -export function findNodeWithSpecificSrc(nodes: { src?: string }[], srcContent: string): any {
    +export function findNodeWithSpecificSrc(nodes: { src?: string }[], srcContent: string): { src?: string } | undefined {
        return nodes.find((node) => node.src?.includes(srcContent));
    }
    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between 0e4d9a2 and a9ef198.

    📒 Files selected for processing (2)
    • e2e/logic/utils.ts (1 hunks)
    • e2e/tests/nodeDetailsPanel.spec.ts (4 hunks)
    🧰 Additional context used
    🧠 Learnings (1)
    📓 Common learnings
    Learnt from: Naseem77
    PR: FalkorDB/code-graph#477
    File: .github/workflows/playwright.yml:40-40
    Timestamp: 2025-07-08T16:44:48.096Z
    Learning: In Playwright, CLI --reporter flags completely override the reporter configuration in playwright.config.ts, even when the config file has conditional reporter settings for CI environments.
    
    🧬 Code Graph Analysis (1)
    e2e/tests/nodeDetailsPanel.spec.ts (5)
    e2e/config/constants.ts (2)
    • GRAPHRAG_SDK (1-1)
    • FLASK_GRAPH (2-2)
    e2e/logic/utils.ts (2)
    • findNodeByName (18-20)
    • findNodeWithSpecificSrc (26-28)
    e2e/logic/api/apiCalls.ts (1)
    • ApiCalls (5-42)
    e2e/logic/POM/codeGraph.ts (1)
    • CodeGraph (11-625)
    e2e/config/testData.ts (1)
    • nodes (22-27)
    🪛 Biome (1.9.4)
    e2e/tests/nodeDetailsPanel.spec.ts

    [error] 61-61: Don't focus the test.

    The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
    Consider removing 'only' to ensure all tests are executed.
    Unsafe fix: Remove focus from test.

    (lint/suspicious/noFocusedTests)

    e2e/logic/utils.ts

    [error] 27-27: Change to an optional chain.

    Unsafe fix: Change to an optional chain.

    (lint/complexity/useOptionalChain)

    ⏰ 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: test (1)
    • GitHub Check: test (2)
    🔇 Additional comments (4)
    e2e/tests/nodeDetailsPanel.spec.ts (4)

    61-78: Excellent refactoring of copy functionality test.

    The test has been improved significantly:

    • Uses FLASK_GRAPH for a more targeted test scenario
    • Leverages findNodeWithSpecificSrc to find a node with specific source content
    • Properly validates clipboard content against API response
    • The 2-second delay on line 71 helps with test stability

    This aligns well with the PR objectives of improving test reliability and targeting specific test scenarios.


    24-24: Great addition of setPageToFullScreen() for consistency.

    Adding await browser.setPageToFullScreen() to all tests ensures consistent UI layout and improves test reliability, which aligns perfectly with the PR objectives.

    Also applies to: 37-37, 51-51, 66-66, 83-83


    25-25: Improved graph selection with specific constants.

    Using distinct graph constants (GRAPHRAG_SDK and FLASK_GRAPH) instead of generic identifiers makes the tests more explicit and maintainable.

    Also applies to: 38-38, 52-52, 67-67, 84-84


    26-26: Good simplification with getGraphNodes() method.

    The change from getGraphDetails() to getGraphNodes() simplifies coordinate handling and makes the code more focused on the actual node data needed for testing.

    Also applies to: 39-39, 53-53, 68-68, 85-85

    @Naseem77 Naseem77 merged commit e67aeaf into main Jul 9, 2025
    8 checks passed
    @Naseem77 Naseem77 deleted the fix-tests branch July 9, 2025 11:40
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants