Skip to content

Commit a0a1ec8

Browse files
committed
fix: add truncated test
1 parent 11390dc commit a0a1ec8

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

tests/suites/tenant/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Long running query for tests
22
// May cause Memory exceed on real database
33

4-
const simpleQuery = 'SELECT 1;';
4+
export const simpleQuery = 'SELECT 1;';
5+
export const longTableSelect = 'SELECT * FROM `.sys/pg_class`';
56

67
// 400 is pretty enough
78
export const longRunningQuery = new Array(400).fill(simpleQuery).join('');

tests/suites/tenant/queryEditor/QueryEditor.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ export class SettingsDialog {
104104
await this.page.waitForTimeout(1000);
105105
}
106106

107+
async changeLimitRows(limitRows: number) {
108+
const limitRowsInput = this.dialog.locator('.ydb-query-settings-dialog__limit-rows input');
109+
await limitRowsInput.fill(limitRows.toString());
110+
await this.page.waitForTimeout(1000);
111+
}
112+
107113
async clickButton(buttonName: ButtonNames) {
108114
const button = this.dialog.getByRole('button', {name: buttonName});
109115
await button.waitFor({state: 'visible', timeout: VISIBILITY_TIMEOUT});

tests/suites/tenant/queryEditor/queryEditor.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {expect, test} from '@playwright/test';
22

33
import {tenantName} from '../../../utils/constants';
44
import {NavigationTabs, TenantPage, VISIBILITY_TIMEOUT} from '../TenantPage';
5-
import {createTableQuery, longRunningQuery} from '../constants';
5+
import {createTableQuery, longRunningQuery, longTableSelect} from '../constants';
66

77
import {
88
ButtonNames,
@@ -392,4 +392,14 @@ test.describe('Test Query Editor', async () => {
392392
await page.waitForTimeout(1000);
393393
await expect(queryEditor.resultTable.isResultHeaderHidden()).resolves.toBe(true);
394394
});
395+
396+
test('Truncated head value is 1 for 1 row truncated result', async ({page}) => {
397+
const queryEditor = new QueryEditor(page);
398+
await queryEditor.setQuery(longTableSelect);
399+
await queryEditor.clickGearButton();
400+
await queryEditor.settingsDialog.changeLimitRows(1);
401+
await queryEditor.settingsDialog.clickButton(ButtonNames.Save);
402+
await queryEditor.clickRunButton();
403+
await expect(queryEditor.resultTable.getResultHeadText()).resolves.toBe('Truncated(1)');
404+
});
395405
});

0 commit comments

Comments
 (0)