From 89db892d03b6221ed76822625b7d313fc752b316 Mon Sep 17 00:00:00 2001 From: MGJamJam Date: Tue, 23 Jul 2024 09:27:13 -0300 Subject: [PATCH] fix should send correct query for time series and table data --- e2e/queryEditor.spec.ts | 10 ++++++---- src/components/OrderByInput.tsx | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/e2e/queryEditor.spec.ts b/e2e/queryEditor.spec.ts index 6712b91..0d89b5d 100644 --- a/e2e/queryEditor.spec.ts +++ b/e2e/queryEditor.spec.ts @@ -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'); @@ -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; @@ -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 ({ diff --git a/src/components/OrderByInput.tsx b/src/components/OrderByInput.tsx index 601d12f..6860012 100644 --- a/src/components/OrderByInput.tsx +++ b/src/components/OrderByInput.tsx @@ -37,6 +37,7 @@ export function OrderByInput(props: Props) { width={30} /> props.onSortOrderChange(value)}