Skip to content

Conversation

@ktx-akshay
Copy link
Collaborator

@ktx-akshay ktx-akshay commented Oct 8, 2025

PR Type

Enhancement, Tests


Description

  • Add filter config to variable creation

  • Improve save/close stability with waits

  • Add helper to await dependent API calls

  • New e2e test for filtered variables


Diagram Walkthrough

flowchart LR
  varsJS["dashboard-variables.js"]
  testJS["dashboard-streaming.spec.js"]
  feature["Filter config for variables"]
  stability["Stability and wait improvements"]
  helper["Dependent API calls wait helper"]
  e2e["E2E test for filtered variables"]

  varsJS -- "implement" --> feature
  varsJS -- "add" --> stability
  varsJS -- "introduce" --> helper
  testJS -- "use" --> feature
  testJS -- "validate" --> helper
  testJS -- "verify streaming behavior" --> e2e
Loading

File Walkthrough

Relevant files
Enhancement
dashboard-variables.js
Variable creation gains filter support and waits                 

tests/ui-testing/pages/dashboardPages/dashboard-variables.js

  • Extend addDashboardVariable with filterConfig param.
  • Add robust waits and save/close handling.
  • Implement waitForDependentVariablesToLoad helper.
  • Improve selectors and option picking with visibility checks.
+96/-19 
Tests
dashboard-streaming.spec.js
Streaming test validates filtered variable dependencies   

tests/ui-testing/playwright-tests/dashboards/dashboard-streaming.spec.js

  • Add test for variables with filter chains.
  • Track streaming values API responses.
  • Assert dependent calls and statuses.
  • Create panel and verify variable-driven filtering.
+203/-0 

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

PR Reviewer Guide 🔍

(Review updated until commit adda1c2)

Here are some key observations to aid the review process:

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

Selector Robustness

The operator option selection uses a chained locator with nth(2) which may be brittle across UI changes; verify the DOM structure is stable or prefer a more specific selector or exact role/name matching to avoid flakiness.

const operatorOption = this.page.getByRole("option", { name: filterConfig.operator, exact: true }).locator("div").nth(2);
await operatorOption.waitFor({ state: "visible", timeout: 10000 });
await operatorOption.click();
Close Mechanism

Using page.evaluate to click the close button may bypass Playwright's actionability checks and mask timing issues; consider using a locator click with proper waiting or ensure the element is interactable to prevent hidden races.

await this.page.evaluate(() => {
  const closeBtn = document.querySelector('[data-test="dashboard-settings-close-btn"]');
  if (closeBtn) closeBtn.click();
});
Flaky Timing

Custom polling for network calls mixes timeouts and manual waits; ensure deterministic waiting (e.g., waitForResponse with stricter URL predicates) to reduce flakiness, and consider limiting listeners or clearing arrays between phases.

const waitForMinimumNewCalls = async (minCalls, timeoutMs = 15000) => {
  const startCount = noOfPreviousCalls;
  const startTime = Date.now();
  let lastLoggedCount = 0;

  while (true) {
    const currentNewCalls = valuesResponses.length - startCount;
    const elapsed = Date.now() - startTime;

    // Log progress when new calls arrive
    if (currentNewCalls > lastLoggedCount) {
      lastLoggedCount = currentNewCalls;
    }

    // Success: we have enough calls and they've been stable for 500ms
    if (currentNewCalls >= minCalls) {
      await page.waitForTimeout(500); // Stability buffer
      const finalCount = valuesResponses.length - startCount;
      if (finalCount >= minCalls) {
        return finalCount;
      }
    }

    // Timeout: return what we have
    if (elapsed >= timeoutMs) {
      return currentNewCalls;
    }

    // Wait a bit before checking again
    await page.waitForTimeout(100);
  }
};

@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2025

PR Code Suggestions ✨

Latest suggestions up to adda1c2
Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use stable operator selection

Avoid selecting the operator option via a nested div with a hardcoded index, which
is brittle and can click the wrong element. Select the option directly by role/name
and click it, or use a data-test selector if available. This prevents flakiness when
the list structure changes.

tests/ui-testing/pages/dashboardPages/dashboard-variables.js [85-87]

-const operatorOption = this.page.getByRole("option", { name: filterConfig.operator, exact: true }).locator("div").nth(2);
+const operatorOption = this.page.getByRole("option", { name: filterConfig.operator, exact: true });
 await operatorOption.waitFor({ state: "visible", timeout: 10000 });
 await operatorOption.click();
Suggestion importance[1-10]: 7

__

Why: Removing the brittle .locator("div").nth(2) makes the selector more robust and less flaky, and the improved_code correctly reflects the intended change on the same lines.

Medium
General
Use locator for close action

Replace the evaluate-based click with a locator click to avoid cross-context issues
and ensure proper waiting for actionability. Also wait for the close button to be
visible before clicking to reduce flakiness.

tests/ui-testing/pages/dashboardPages/dashboard-variables.js [132-138]

 await this.page.waitForLoadState("networkidle");
 
-// Use JavaScript evaluation to click the close button to avoid DOM instability issues
-await this.page.evaluate(() => {
-  const closeBtn = document.querySelector('[data-test="dashboard-settings-close-btn"]');
-  if (closeBtn) closeBtn.click();
-});
+const closeBtn = this.page.locator('[data-test="dashboard-settings-close-btn"]');
+await closeBtn.waitFor({ state: "visible", timeout: 10000 });
+await closeBtn.click();
Suggestion importance[1-10]: 6

__

Why: Using a locator with visibility wait improves reliability over page.evaluate and aligns with Playwright best practices; the code maps directly to the new hunk lines.

Low
Enforce exact filter match

Ensure exact match when selecting the filter name to prevent accidental selection of
similarly named options. Adding exact: true makes the selection deterministic and
avoids mis-clicks.

tests/ui-testing/pages/dashboardPages/dashboard-variables.js [75-77]

-const filterNameOption = this.page.getByRole("option", { name: filterConfig.filterName });
+const filterNameOption = this.page.getByRole("option", { name: filterConfig.filterName, exact: true });
 await filterNameOption.waitFor({ state: "visible", timeout: 10000 });
 await filterNameOption.click();
Suggestion importance[1-10]: 6

__

Why: Adding exact: true reduces the chance of picking a wrong option with similar text; the suggested change cleanly applies to the corresponding lines.

Low

Previous suggestions

Suggestions up to commit fe0fbdb
CategorySuggestion                                                                                                                                    Impact
Possible issue
Validate inputs and await options

Guard against partial or empty filterConfig to prevent runtime errors when
properties are missing. Also verify the target option exists before clicking to
avoid flaky tests when DOM content is delayed.

tests/ui-testing/pages/dashboardPages/dashboard-variables.js [62-87]

-if (filterConfig) {
+if (filterConfig && filterConfig.filterName && filterConfig.operator && filterConfig.value) {
   await this.page
     .locator('[data-test="dashboard-query-values-filter-name-selector"]')
     .click();
   await this.page
     .locator('[data-test="dashboard-query-values-filter-name-selector"]')
     .fill(filterConfig.filterName);
+
   await this.page
     .locator('[data-test="dashboard-query-values-filter-operator-selector"]')
     .click();
-  await this.page
-    .getByRole("option", { name: filterConfig.operator, exact: true })
-    .locator("div")
-    .nth(2)
-    .click();
-  await this.page
-    .locator('[data-test="common-auto-complete"]')
-    .click();
-  await this.page
-    .locator('[data-test="common-auto-complete"]')
-    .fill(filterConfig.value);
-  await this.page
+  const operatorOption = this.page.getByRole("option", { name: filterConfig.operator, exact: true });
+  await operatorOption.first().waitFor({ state: "visible" });
+  await operatorOption.click();
+
+  const autoComplete = this.page.locator('[data-test="common-auto-complete"]');
+  await autoComplete.click();
+  await autoComplete.fill(filterConfig.value);
+
+  const valueOption = this.page
     .locator('[data-test="variable-tab-panels-default"]')
-    .getByText(filterConfig.value, { exact: true })
-    .click();
+    .getByText(filterConfig.value, { exact: true });
+  await valueOption.first().waitFor({ state: "visible" });
+  await valueOption.first().click();
 }
Suggestion importance[1-10]: 7

__

Why: Adds defensive checks for filterConfig fields and waits for options to be visible, reducing flakiness and runtime errors; aligns with the new hunk code, though impact is moderate.

Medium
General
Scope and wait for field option

Narrow the text selector to the dropdown panel to avoid clicking unintended elements
sharing the same text. Also wait for the option to appear to reduce flakiness in
slower environments.

tests/ui-testing/pages/dashboardPages/dashboard-variables.js [53-60]

 await this.page
   .locator('[data-test="dashboard-variable-field-select"]')
   .click();
 await this.page
   .locator('[data-test="dashboard-variable-field-select"]')
   .fill(field);
-await this.page.getByText(field).click();
+const fieldOption = this.page
+  .locator('[data-test="dashboard-variable-field-select-options"]')
+  .getByText(field, { exact: true });
+await fieldOption.first().waitFor({ state: "visible" });
+await fieldOption.first().click();
Suggestion importance[1-10]: 6

__

Why: Improves selector specificity and stability by scoping to an options container and waiting for visibility; beneficial but assumes existence of [data-test="dashboard-variable-field-select-options"].

Low
Remove brittle positional selector

Avoid fragile chained locators with positional .nth(2) which may break if markup
changes. Click the option element directly by role/name for stability.

tests/ui-testing/pages/dashboardPages/dashboard-variables.js [70-76]

 await this.page
   .locator('[data-test="dashboard-query-values-filter-operator-selector"]')
   .click();
-await this.page
-  .getByRole("option", { name: filterConfig.operator, exact: true })
-  .locator("div")
-  .nth(2)
-  .click();
+await this.page.getByRole("option", { name: filterConfig.operator, exact: true }).first().click();
Suggestion importance[1-10]: 6

__

Why: Replaces a fragile .locator("div").nth(2) chain with a direct option click, improving robustness; a reasonable stability enhancement with moderate impact.

Low

@ktx-akshay ktx-akshay changed the title test : add dashboard variable test cases test : add dashboard variable testcases Oct 9, 2025
@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: c03112c

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 280 245 1 19 15 88% 16m 57s

Test Failure Analysis

  1. dashboard-streaming.spec.js: Timeout errors due to element visibility issues
    1. dashboard streaming testcases should add dashboard variable with filter configuration: Locator timeout waiting for '[data-test="dashboard-back-btn"]' to be visible.

Root Cause Analysis

  • The timeout issue in the test is likely caused by recent changes in the dashboard-variables.js file that may affect element visibility.

Recommended Actions

  1. Increase the timeout duration in the backToDashboardList method in dashboard-create.js to allow more time for the button to become visible.
  2. Ensure that the '[data-test="dashboard-back-btn"]' element is present and correctly rendered before the test attempts to interact with it.
  3. Review the recent changes in dashboard-variables.js to confirm they do not inadvertently affect the visibility of dashboard elements.

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 107caa6

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 155 138 1 11 5 89% 47m 13s

Test Failure Analysis

  1. alerts-import.spec.js: Assertion failure due to multiple elements matching the expected text
    1. Alerts Import/Export Destination Import from URL and File: 'Successfully imported' resolved to 2 elements, causing visibility check to fail.

Root Cause Analysis

  • The recent changes in dashboard-variables.js and dashboard-streaming.spec.js introduced additional waits that may not directly address the visibility issue in alerts-import.spec.js.

Recommended Actions

  1. Modify the assertion in alerts-import.spec.js to specify the exact text needed to avoid ambiguity. 2. Review the notification messages to ensure they are unique or adjust the test to handle multiple messages. 3. Increase the timeout for the visibility check if necessary to accommodate slower responses.

View Detailed Results

@Shrinath-O2 Shrinath-O2 changed the title test : add dashboard variable testcases test: add dashboard variable testcases Oct 13, 2025
@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: Shrinath Rao | Branch: e2e-dashbaord-variable-testcase | Commit: e32ce49

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 333 0 19 13 91% 5m 0s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: Shrinath Rao | Branch: e2e-dashbaord-variable-testcase | Commit: 5d27ac1

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 335 0 19 11 92% 5m 1s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 400aa3a

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 218 201 1 8 8 92% 5m 0s

Test Failure Analysis

  1. dashboard.spec.js: Assertion failure due to unexpected canvas count
    1. dashboard UI testcases should update the line chart correctly when used camel case in custom sql query: Expected canvas count to be greater than 0, but received 0.

Root Cause Analysis

  • The changes in dashboard-variables.js may have introduced instability affecting the canvas count.

Recommended Actions

  1. Investigate the impact of the timeout change in dashboard-variables.js on the canvas rendering. 2. Ensure the custom SQL query returns valid data to populate the line chart correctly. 3. Add logging to verify the canvas count before the assertion in dashboard.spec.js.

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 400aa3a

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 218 199 0 8 11 91% 5m 3s

View Detailed Results

@ktx-akshay ktx-akshay force-pushed the e2e-dashbaord-variable-testcase branch from 400aa3a to ac5a112 Compare October 14, 2025 09:59
@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: ac5a112

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 292 264 1 17 10 90% 4m 18s

Test Failure Analysis

  1. dashboard.spec.js: Assertion failure due to unexpected canvas count
    1. dashboard UI testcases should update the line chart correctly when used camel case in custom sql query: Expected canvas count to be greater than 0, but received 0.

Root Cause Analysis

  • The changes in dashboard-variables.js may have introduced instability affecting the canvas count.

Recommended Actions

  1. Investigate the impact of the timeout change in dashboard-variables.js on the canvas rendering. 2. Ensure that the custom SQL query returns valid data before asserting on canvas count. 3. Add additional logging to track the canvas count before the assertion in dashboard.spec.js.

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 39d815f

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 326 0 19 20 89% 5m 0s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 280f479

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 336 0 19 10 92% 5m 2s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 280f479

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 336 0 19 10 92% 5m 2s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 0554f4b

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 203 177 1 14 11 87% 4m 40s

Test Failure Analysis

  1. dashboard-streaming.spec.js: Timeout issues while waiting for elements to be visible
    1. dashboard streaming testcases should add dashboard variable with filter configuration: Timeout waiting for option 'ziox' to be visible.

Root Cause Analysis

  • The code changes in dashboard-variables.js introduced additional waits for element visibility, which may have contributed to the timeout error.

Recommended Actions

  1. Increase the timeout duration in dashboard-variables.js from 10000ms to a higher value to accommodate slower loading elements. 2. Review the filter configuration logic to ensure that the expected options are available before attempting to select them. 3. Implement additional logging to capture the state of the page before the timeout occurs for better debugging.

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 430698b

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 251 231 1 15 4 92% 4m 28s

Test Failure Analysis

  1. dashboard-streaming.spec.js: Assertion failure due to unexpected API call count
    1. dashboard streaming testcases should add dashboard variable with filter configuration: Expected 3 API calls but received 5.

Root Cause Analysis

  • The failure is linked to the changes in dashboard-streaming.spec.js where the API call count assertion was not met due to the new waiting method in dashboard-variables.js.

Recommended Actions

  1. Review the API call logic to ensure only 3 calls are made for the test case in dashboard-streaming.spec.js.
  2. Adjust the expected call count in the assertion to match actual behavior if 5 calls are valid.
  3. Investigate the implementation of waitForDependentVariablesToLoad in dashboard-variables.js for potential logic errors.

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 430698b

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 251 232 0 15 4 92% 3m 29s

View Detailed Results

@testdino-playwright-reporter
Copy link

Test Run Failed

Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: eae8f55

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 128 122 1 5 0 95% 4m 26s

Test Failure Analysis

  1. dashboard-streaming.spec.js: Assertion failure due to unexpected number of API responses
    1. dashboard streaming testcases should add dashboard variable with filter configuration: Expected 3 API responses but received 4.

Root Cause Analysis

  • The code change in dashboard-streaming.spec.js altered the time range setting, potentially affecting API response counts.

Recommended Actions

  1. Review the logic in the API response handling to ensure it matches the expected count of 3.
  2. Investigate the impact of changing the time range to '6-w' on the number of API calls.
  3. Add additional assertions to validate the contents of valuesResponses for better debugging.

View Detailed Results

@ktx-akshay ktx-akshay force-pushed the e2e-dashbaord-variable-testcase branch from 771752a to 7574f44 Compare October 15, 2025 10:19
@testdino-playwright-reporter
Copy link

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 2 2 0 0 0 100% 51.1s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 1bdb33f

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 334 0 19 12 92% 4m 39s

View Detailed Results

@testdino-playwright-reporter
Copy link

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 2 2 0 0 0 100% 51.2s

View Detailed Results

@testdino-playwright-reporter
Copy link

Test Run Failed

Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: fe2c4f6

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 2 1 1 0 0 50% 3m 31s

Test Failure Analysis

  1. dashboard-streaming.spec.js: Assertion failure due to unexpected API call count
    1. dashboard streaming testcases should add dashboard variable with filter configuration: Expected 3 API calls but received 5.

Root Cause Analysis

  • The code changes in dashboard-streaming.spec.js and dashboard-variables.js may have altered the expected number of API calls.

Recommended Actions

  1. Review the logic in dashboard-variables.js to ensure it correctly triggers the expected API calls. 2. Adjust the assertion in dashboard-streaming.spec.js to match the new expected API call count if the changes are intentional. 3. Investigate the impact of removing the timeout in dashboard-variables.js to ensure it doesn't affect API call timing.

View Detailed Results

@testdino-playwright-reporter
Copy link

Test Run Failed

Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: 6885d4c

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
1 test failed 3 1 1 1 0 33% 3m 56s

Test Failure Analysis

  1. dashboard-streaming.spec.js: Assertion failure due to unexpected API call count
    1. dashboard streaming testcases should add dashboard variable with filter configuration: Expected 3 API calls but received 6.

Root Cause Analysis

  • The failure in dashboard-streaming.spec.js is due to an assertion expecting 3 API calls, but 6 were received, indicating potential misconfiguration or timing issues in the test logic.

Recommended Actions

  1. Review the filter configurations for 'variablename12' and 'variablename123' to ensure they trigger the expected API calls. 2. Investigate potential caching issues that may cause unexpected API call counts. 3. Add logging to track API call counts and responses for better debugging.

View Detailed Results

@testdino-playwright-reporter
Copy link

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 3 3 0 0 0 100% 55.9s

View Detailed Results

@ktx-akshay ktx-akshay force-pushed the e2e-dashbaord-variable-testcase branch from a73aef3 to 18a869e Compare October 21, 2025 09:10
@testdino-playwright-reporter
Copy link

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 0 0 0 0 0 0% 4.4s

View Detailed Results

…h filter support and enhanced API call tracking
@ktx-akshay ktx-akshay force-pushed the e2e-dashbaord-variable-testcase branch from 18a869e to adda1c2 Compare October 21, 2025 09:28
@testdino-playwright-reporter
Copy link

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 0 0 0 0 0 0% 4.8s

View Detailed Results

@testdino-playwright-reporter
Copy link

⚠️ Test Run Unstable


Author: ktx-akshay | Branch: e2e-dashbaord-variable-testcase | Commit: adda1c2

Testdino Test Results

Status Total Passed Failed Skipped Flaky Pass Rate Duration
All tests passed 365 342 0 19 4 94% 4m 39s

View Detailed Results

@ktx-akshay ktx-akshay marked this pull request as ready for review October 21, 2025 09:55
@github-actions
Copy link
Contributor

Persistent review updated to latest commit adda1c2

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

Adds filter configuration support to dashboard variables, enabling dependent variable relationships where one variable's values can be filtered based on another variable's selection.

Key changes:

  • Extended addDashboardVariable method with optional filterConfig parameter to support filter name, operator, and value selection
  • Added waitForDependentVariablesToLoad helper method for tracking API calls during dependent variable updates
  • New comprehensive test case validates the filter configuration flow and verifies dependent variable API calls trigger correctly
  • Refactored save/close logic to always execute regardless of customValueSearch flag

Minor issues:

  • Commented-out code blocks should be removed for cleaner codebase
  • Test variable extraction loop doesn't use the extracted values

Confidence Score: 4/5

  • Safe to merge with minor cleanup recommended
  • Functional implementation is solid with proper wait mechanisms and comprehensive test coverage, but contains commented-out code and unused variables that should be cleaned up before merge
  • Both files have minor style issues with commented code that should be cleaned up

Important Files Changed

File Analysis

Filename Score Overview
tests/ui-testing/pages/dashboardPages/dashboard-variables.js 4/5 Adds optional filter configuration support to dashboard variables with proper waiting mechanisms and new helper method for API call tracking
tests/ui-testing/playwright-tests/dashboards/dashboard-streaming.spec.js 4/5 New comprehensive test case for dashboard variables with filter configuration and dependent variable API call validation

Sequence Diagram

sequenceDiagram
    participant Test as Test Case
    participant PM as PageManager
    participant DV as DashboardVariables
    participant UI as UI Elements
    participant API as Backend API

    Test->>PM: Create dashboard with variables
    Test->>DV: addDashboardVariable("variablename")
    DV->>UI: Configure base variable (no filter)
    DV->>UI: Save and close
    
    Test->>DV: addDashboardVariable("variablename12", filterConfig)
    DV->>UI: Configure variable with filter
    Note over DV,UI: filterName: kubernetes_container_name<br/>operator: =<br/>value: $variablename
    DV->>UI: Fill filter configuration
    DV->>UI: Save and close
    
    Test->>DV: addDashboardVariable("variablename123", filterConfig)
    DV->>UI: Configure dependent variable
    Note over DV,UI: filterName: kubernetes_namespace_name<br/>operator: =<br/>value: $variablename12
    DV->>UI: Save and close
    
    Test->>DV: selectValueFromVariableDropDown("variablename", "ziox")
    DV->>UI: Change base variable value
    UI->>API: Request new values for variablename12
    UI->>API: Request new values for variablename123
    UI->>API: Refresh panel data
    API-->>UI: Return filtered results
    
    Test->>Test: Verify >= 3 API calls made
    Test->>Test: Assert all responses status 200
    Test->>Test: Verify streaming parameters present
Loading

2 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +95 to +98
// await this.page
// .locator('[data-test="common-auto-complete-option"]')
// .getByText(filterConfig.value, { exact: true })
// .click();
Copy link
Contributor

Choose a reason for hiding this comment

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

style: commented-out code left in production

Suggested change
// await this.page
// .locator('[data-test="common-auto-complete-option"]')
// .getByText(filterConfig.value, { exact: true })
// .click();
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/ui-testing/pages/dashboardPages/dashboard-variables.js
Line: 95:98

Comment:
**style:** commented-out code left in production

```suggestion
    }
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +124 to +139
// Save Variable and Close Settings (skip if customValueSearch is true)
// if (!customValueSearch) {
const saveBtn = this.page.locator('[data-test="dashboard-variable-save-btn"]');
await saveBtn.waitFor({ state: "visible", timeout: 10000 });
await saveBtn.click();

// Wait for the save action to complete and DOM to stabilize
// await this.page.waitForTimeout(3000);
await this.page.waitForLoadState("networkidle");

// Use JavaScript evaluation to click the close button to avoid DOM instability issues
await this.page.evaluate(() => {
const closeBtn = document.querySelector('[data-test="dashboard-settings-close-btn"]');
if (closeBtn) closeBtn.click();
});
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

style: commented-out conditional logic and cleanup note - remove or implement properly

Suggested change
// Save Variable and Close Settings (skip if customValueSearch is true)
// if (!customValueSearch) {
const saveBtn = this.page.locator('[data-test="dashboard-variable-save-btn"]');
await saveBtn.waitFor({ state: "visible", timeout: 10000 });
await saveBtn.click();
// Wait for the save action to complete and DOM to stabilize
// await this.page.waitForTimeout(3000);
await this.page.waitForLoadState("networkidle");
// Use JavaScript evaluation to click the close button to avoid DOM instability issues
await this.page.evaluate(() => {
const closeBtn = document.querySelector('[data-test="dashboard-settings-close-btn"]');
if (closeBtn) closeBtn.click();
});
// }
// Save Variable and Close Settings
const saveBtn = this.page.locator('[data-test="dashboard-variable-save-btn"]');
await saveBtn.waitFor({ state: "visible", timeout: 10000 });
await saveBtn.click();
// Wait for the save action to complete and DOM to stabilize
await this.page.waitForLoadState("networkidle");
// Use JavaScript evaluation to click the close button to avoid DOM instability issues
await this.page.evaluate(() => {
const closeBtn = document.querySelector('[data-test="dashboard-settings-close-btn"]');
if (closeBtn) closeBtn.click();
});
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/ui-testing/pages/dashboardPages/dashboard-variables.js
Line: 124:139

Comment:
**style:** commented-out conditional logic and cleanup note - remove or implement properly

```suggestion
    // Save Variable and Close Settings
    const saveBtn = this.page.locator('[data-test="dashboard-variable-save-btn"]');
    await saveBtn.waitFor({ state: "visible", timeout: 10000 });
    await saveBtn.click();

    // Wait for the save action to complete and DOM to stabilize
    await this.page.waitForLoadState("networkidle");

    // Use JavaScript evaluation to click the close button to avoid DOM instability issues
    await this.page.evaluate(() => {
      const closeBtn = document.querySelector('[data-test="dashboard-settings-close-btn"]');
      if (closeBtn) closeBtn.click();
    });
```

How can I resolve this? If you propose a fix, please make it concise.

}
);

// Add second variable with filter configuration
Copy link
Contributor

Choose a reason for hiding this comment

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

style: comment says "Add second variable" but this is actually the third variable - update to "Add third variable with filter configuration"

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/ui-testing/playwright-tests/dashboards/dashboard-streaming.spec.js
Line: 218:218

Comment:
**style:** comment says "Add second variable" but this is actually the third variable - update to "Add third variable with filter configuration"

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +323 to +327
const newCalls = valuesResponses.slice(noOfPreviousCalls);
newCalls.forEach((call, idx) => {
const urlParts = call.url.split('/');
const relevantPart = urlParts[urlParts.length - 1] || urlParts[urlParts.length - 2];
});
Copy link
Contributor

Choose a reason for hiding this comment

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

style: variables extracted but never used - remove unused code

Suggested change
const newCalls = valuesResponses.slice(noOfPreviousCalls);
newCalls.forEach((call, idx) => {
const urlParts = call.url.split('/');
const relevantPart = urlParts[urlParts.length - 1] || urlParts[urlParts.length - 2];
});
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/ui-testing/playwright-tests/dashboards/dashboard-streaming.spec.js
Line: 323:327

Comment:
**style:** variables extracted but never used - remove unused code

```suggestion
```

How can I resolve this? If you propose a fix, please make it concise.

@ktx-akshay ktx-akshay merged commit 0a4a2a4 into main Oct 21, 2025
33 checks passed
@ktx-akshay ktx-akshay deleted the e2e-dashbaord-variable-testcase branch October 21, 2025 10:09
uddhavdave pushed a commit that referenced this pull request Oct 27, 2025
### **PR Type**
Enhancement, Tests


___

### **Description**
- Add filter config to variable creation

- Improve save/close stability with waits

- Add helper to await dependent API calls

- New e2e test for filtered variables


___

### Diagram Walkthrough


```mermaid
flowchart LR
  varsJS["dashboard-variables.js"]
  testJS["dashboard-streaming.spec.js"]
  feature["Filter config for variables"]
  stability["Stability and wait improvements"]
  helper["Dependent API calls wait helper"]
  e2e["E2E test for filtered variables"]

  varsJS -- "implement" --> feature
  varsJS -- "add" --> stability
  varsJS -- "introduce" --> helper
  testJS -- "use" --> feature
  testJS -- "validate" --> helper
  testJS -- "verify streaming behavior" --> e2e
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>dashboard-variables.js</strong><dd><code>Variable
creation gains filter support and waits</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

tests/ui-testing/pages/dashboardPages/dashboard-variables.js

<ul><li>Extend addDashboardVariable with filterConfig param.<br> <li>
Add robust waits and save/close handling.<br> <li> Implement
waitForDependentVariablesToLoad helper.<br> <li> Improve selectors and
option picking with visibility checks.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8767/files#diff-67d38d39bb67f4a0cbfa473ee81ad50b1fffebc40c635417e58905f3c865a6e2">+96/-19</a>&nbsp;
</td>

</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>

<summary><strong>dashboard-streaming.spec.js</strong><dd><code>Streaming
test validates filtered variable dependencies</code>&nbsp; &nbsp;
</dd></summary>
<hr>

tests/ui-testing/playwright-tests/dashboards/dashboard-streaming.spec.js

<ul><li>Add test for variables with filter chains.<br> <li> Track
streaming values API responses.<br> <li> Assert dependent calls and
statuses.<br> <li> Create panel and verify variable-driven
filtering.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8767/files#diff-92f44296937f53cb448371d1c61510c8c910fbecab83b02b8e89490d5832be19">+203/-0</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

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

3 participants