Skip to content

Commit

Permalink
fix should send correct query for time series and table data
Browse files Browse the repository at this point in the history
  • Loading branch information
MGJamJam committed Jul 23, 2024
1 parent 63bad25 commit 89db892
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions e2e/queryEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ test('should trigger correct number of queries with correct payload', async ({
await page.locator('#query-editor_add-order-by-button').click(); // request triggered
await page.locator('#query-editor_order-by-select').click();
await page.getByText('FUNCTION', { exact: true }).click(); // request triggered
await page.getByTitle('Sort by descending').click(); // request triggered
// The actual button element is not in the right place to be clicked (because of grafana ui library magic), that's why the
// sibling label element ('+ label') is fetched and clicked here
await page.locator('#option-DESC-query-editor_order-by-button-group').locator('+ label').click();

// add limit
await page.locator('#query-editor_limit-input').fill('10');
Expand Down Expand Up @@ -268,9 +270,9 @@ test('should send correct query for percentile selection', async ({

// select percentile aggregation && add percentile value
const queryPromise = page.waitForRequest('*/**/analytics/queries/percentile');
await page.locator('#query-editor_aggregation-method-select').click(); // request triggere
await page.locator('#query-editor_aggregation-method-select').click(); // request triggered
await page.getByText('percentile', { exact: true }).click();
await page.locator('#query-editor_percentile-value-input').fill('95'); // request triggered
await page.locator('#query-editor_percentile-value-input').fill('50'); // request triggered
await page.locator('#query-editor_percentile-value-input').blur();
const queryRequest = await queryPromise;

Expand All @@ -287,7 +289,7 @@ test('should send correct query for percentile selection', async ({
expect(queryRequest.postDataJSON().interval).toBe('MINUTE');
expect(queryRequest.postDataJSON().start).not.toBeUndefined();
expect(queryRequest.postDataJSON().end).not.toBeUndefined();
expect(queryRequest.postDataJSON().percentile).toBe(95);
expect(queryRequest.postDataJSON().percentile).toBe(50);
});

test('should add, edit and delete filters correctly', async ({
Expand Down
1 change: 1 addition & 0 deletions src/components/OrderByInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function OrderByInput(props: Props) {
width={30}
/>
<RadioButtonGroup
id="query-editor_order-by-button-group"
options={sortOrderOption}
value={props.sortOrder}
onChange={(value) => props.onSortOrderChange(value)}
Expand Down

0 comments on commit 89db892

Please sign in to comment.