How to test any dashboard with api #31709
Replies: 1 comment 3 replies
-
Hello @ZerotoZer! I'm here to help you with your dashboard automation questions. Let's work together to find a solution. To automate the process of testing a dashboard using the API and retrieve filter values from a Here's a basic example of how you might set up a Cypress test to retrieve filter values: // Import necessary functions
import { interceptFiltering, setFilter } from 'cypress/e2e/dashboard/utils';
// Function to test retrieving filter values
function testRetrieveFilterValues() {
// Intercept the filtering API call
interceptFiltering();
// Set a filter value (e.g., for a filter named 'Country')
setFilter('Country', 'United States');
// Wait for the filtering API call to complete
cy.wait('@filtering').then((interception) => {
// Access the response to verify filter values
const filterValues = interception.response.body.result;
// Perform assertions or further processing with filterValues
expect(filterValues).to.include('United States');
});
}
// Call the function in your test suite
describe('Dashboard Filter Test', () => {
it('should retrieve filter values from filter_box chart', () => {
testRetrieveFilterValues();
});
}); This code sets up an intercept for the filtering API call, applies a filter, and waits for the API response to verify the filter values. Adjust the filter name and expected values as needed for your specific dashboard setup [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
-
Hello! I was trying to automate this process using api(using api/v1/chart/{pk}/data) by sending request without filters and with filters. For now i am using api to get all charts of dashboard and their data but struggling with filters. I am getting data from charts with filters applied and not applied. While i can get filter values from dashboard metadata, i can't get them if they are charts with type filter_box.
How to automate it in better way?
How to get filter values from filter box chart?
Beta Was this translation helpful? Give feedback.
All reactions