Skip to content

Commit

Permalink
add swith to datagrid table and fix ciGroup1
Browse files Browse the repository at this point in the history
Signed-off-by: Anan <ananzh@amazon.com>
  • Loading branch information
ananzh committed Feb 6, 2024
1 parent 1cc34cd commit c7ab082
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 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
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

0 comments on commit c7ab082

Please sign in to comment.