Skip to content

Commit

Permalink
Add swith to datagrid table and fix ciGroup1 (#5816)
Browse files Browse the repository at this point in the history
* add swith to datagrid table and fix ciGroup1

Signed-off-by: Anan <ananzh@amazon.com>

* fix ciGroup7

Signed-off-by: Anan Z <ananzh@amazon.com>

* fix ciGroup6

Signed-off-by: Anan Z <ananzh@amazon.com>

---------

Signed-off-by: Anan <ananzh@amazon.com>
Signed-off-by: Anan Z <ananzh@amazon.com>
  • Loading branch information
ananzh authored Feb 6, 2024
1 parent cea4d2f commit 55b7756
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/functional/apps/context/_context_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
for (const [columnName, value] of TEST_FILTER_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItemDetails(columnName);
await PageObjects.discover.clickFieldListPlusFilter(columnName, value);
Expand Down
2 changes: 2 additions & 0 deletions test/functional/apps/context/_date_nanos.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default function ({ getService, getPageObjects }) {

describe('context view for date_nanos', () => {
before(async function () {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await security.testUser.setRoles([
'opensearch_dashboards_admin',
'opensearch_dashboards_date_nanos',
Expand Down
1 change: 1 addition & 0 deletions test/functional/apps/context/_discover_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function ({ getService, getPageObjects }) {
before(async () => {
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');

for (const columnName of TEST_COLUMN_NAMES) {
await PageObjects.discover.clickFieldListItemAdd(columnName);
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/context/_filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ export default function ({ getService, getPageObjects }) {
const browser = getService('browser');
const testSubjects = getService('testSubjects');

const PageObjects = getPageObjects(['common', 'context']);
const PageObjects = getPageObjects(['common', 'context', 'discover']);

describe('context filters', function contextSize() {
beforeEach(async function () {
await browser.refresh();
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await PageObjects.context.navigateTo(TEST_INDEX_PATTERN, TEST_ANCHOR_ID, {
columns: TEST_COLUMN_NAMES,
});
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/context/_size.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ export default function ({ getService, getPageObjects }) {
const opensearchDashboardsServer = getService('opensearchDashboardsServer');
const retry = getService('retry');
const dataGrid = getService('dataGrid');
const PageObjects = getPageObjects(['context']);
const PageObjects = getPageObjects(['common', 'context', 'discover']);
let expectedRowLength = 2 * TEST_DEFAULT_CONTEXT_SIZE + 1;

describe('context size', function contextSize() {
before(async function () {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await opensearchDashboardsServer.uiSettings.update({
'context:defaultSize': `${TEST_DEFAULT_CONTEXT_SIZE}`,
'context:step': `${TEST_STEP_SIZE}`,
Expand Down
3 changes: 1 addition & 2 deletions test/functional/apps/home/_sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await pieChart.expectPieSliceCount(4);
log.debug('Checking area, bar and heatmap charts rendered');
await dashboardExpect.seriesElementCount(15);
// The saved search of data explorer now renders 100 lines max
log.debug('Checking saved searches rendered');
await dashboardExpect.savedSearchRowCount(100);
await dashboardExpect.savedSearchRowCountFromLegacyTable(100);
log.debug('Checking input controls rendered');
await dashboardExpect.inputControlItemCount(3);
log.debug('Checking tag cloud rendered');
Expand Down
4 changes: 4 additions & 0 deletions test/functional/apps/management/_scripted_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default function ({ getService, getPageObjects }) {
const fromTime = 'Sep 17, 2015 @ 06:31:44.000';
const toTime = 'Sep 18, 2015 @ 18:31:44.000';
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await PageObjects.discover.selectIndexPattern('logstash-*');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);

Expand Down Expand Up @@ -279,6 +280,7 @@ export default function ({ getService, getPageObjects }) {
const fromTime = 'Sep 17, 2015 @ 06:31:44.000';
const toTime = 'Sep 18, 2015 @ 18:31:44.000';
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await PageObjects.discover.selectIndexPattern('logstash-*');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);

Expand Down Expand Up @@ -375,6 +377,7 @@ export default function ({ getService, getPageObjects }) {
const fromTime = 'Sep 17, 2015 @ 06:31:44.000';
const toTime = 'Sep 18, 2015 @ 18:31:44.000';
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await PageObjects.discover.selectIndexPattern('logstash-*');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);

Expand Down Expand Up @@ -473,6 +476,7 @@ export default function ({ getService, getPageObjects }) {
const fromTime = 'Sep 17, 2015 @ 19:22:00.000';
const toTime = 'Sep 18, 2015 @ 07:00:00.000';
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.switchDiscoverTable('new');
await PageObjects.discover.selectIndexPattern('logstash-*');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);

Expand Down
26 changes: 26 additions & 0 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,32 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
`Could not find a clickable list item for column "${columnName}" with list item "${title}".`
);
}

public async switchDiscoverTable(tableType: string) {
await retry.try(async () => {
const switchButton = await testSubjects.find('datagridTableButton');
const buttonText = await switchButton.getVisibleText();

if (tableType === 'new' && buttonText.includes('Try new Discover')) {
await switchButton.click();
} else if (tableType === 'legacy' && buttonText.includes('Use legacy Discover')) {
await switchButton.click();
}
});

// Wait for the query input to be visible
await this.waitForQueryInput();
}

async waitForQueryInput() {
// Wait for the query input to be visible
await retry.try(async () => {
const queryInputVisible = await testSubjects.exists('queryInput');
if (!queryInputVisible) {
throw new Error('Query input not yet visible');
}
});
}
}

return new DiscoverPage();
Expand Down
11 changes: 11 additions & 0 deletions test/functional/services/dashboard/expectations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ export function DashboardExpectProvider({ getService, getPageObjects }: FtrProvi
});
}

async savedSearchRowCountFromLegacyTable(expectedCount: number) {
log.debug(`DashboardExpect.savedSearchRowCount(${expectedCount})`);
await retry.try(async () => {
const savedSearchRows = await testSubjects.findAll(
'docTableExpandToggleColumn',
findTimeout
);
expect(savedSearchRows.length).to.be(expectedCount);
});
}

async seriesElementCount(expectedCount: number) {
log.debug(`DashboardExpect.seriesElementCount(${expectedCount})`);
await retry.try(async () => {
Expand Down

0 comments on commit 55b7756

Please sign in to comment.