Skip to content

Commit

Permalink
Make field display filtering use randomized datasource name
Browse files Browse the repository at this point in the history
Signed-off-by: Argus Li <[email protected]>
  • Loading branch information
ArgusLi committed Jan 31, 2025
1 parent 94270d4 commit 57c9f63
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {
DATASOURCE_NAME,
INDEX_PATTERN_WITH_TIME,
INDEX_WITH_TIME_1,
} from '../../../../../utils/apps/constants';
import { INDEX_PATTERN_WITH_TIME, INDEX_WITH_TIME_1 } from '../../../../../utils/apps/constants';
import * as docTable from '../../../../../utils/apps/query_enhancements/doc_table.js';
import { generateFieldDisplayFilteringTestConfiguration } from '../../../../../utils/apps/query_enhancements/field_display_filtering.js';
import { SECONDARY_ENGINE, BASE_PATH } from '../../../../../utils/constants';
import { NEW_SEARCH_BUTTON } from '../../../../../utils/dashboards/data_explorer/elements.js';
import {
generateAllTestConfigurations,
getRandomizedWorkspaceName,
getRandomizedDatasourceName,
setDatePickerDatesAndSearchIfRelevant,
} from '../../../../../utils/apps/query_enhancements/shared';

const workspace = getRandomizedWorkspaceName();
const workspaceName = getRandomizedWorkspaceName();
const datasourceName = getRandomizedDatasourceName();

describe('filter for value spec', () => {
beforeEach(() => {
Expand All @@ -31,44 +29,44 @@ describe('filter for value spec', () => {

// Add data source
cy.addDataSource({
name: DATASOURCE_NAME,
name: datasourceName,
url: SECONDARY_ENGINE.url,
authType: 'no_auth',
});
// Create workspace
cy.deleteWorkspaceByName(workspace);
cy.deleteWorkspaceByName(workspaceName);
cy.visit('/app/home');
cy.osd.createInitialWorkspaceWithDataSource(DATASOURCE_NAME, workspace);
cy.osd.createInitialWorkspaceWithDataSource(datasourceName, workspaceName);
cy.wait(2000);
cy.createWorkspaceIndexPatterns({
workspaceName: workspace,
workspaceName: workspaceName,
indexPattern: INDEX_PATTERN_WITH_TIME.replace('*', ''),
timefieldName: 'timestamp',
indexPatternHasTimefield: true,
dataSource: DATASOURCE_NAME,
dataSource: datasourceName,
isEnhancement: true,
});

cy.navigateToWorkSpaceSpecificPage({
url: BASE_PATH,
workspaceName: workspace,
workspaceName: workspaceName,
page: 'discover',
isEnhancement: true,
});
cy.getElementByTestId(NEW_SEARCH_BUTTON).click();
});

afterEach(() => {
cy.deleteWorkspaceByName(workspace);
cy.deleteDataSourceByName(DATASOURCE_NAME);
cy.deleteWorkspaceByName(workspaceName);
cy.deleteDataSourceByName(datasourceName);
// TODO: Modify deleteIndex to handle an array of index and remove hard code
cy.deleteIndex(INDEX_WITH_TIME_1);
});

generateAllTestConfigurations(generateFieldDisplayFilteringTestConfiguration).forEach(
(config) => {
it(`filter actions in table field for ${config.testName}`, () => {
cy.setDataset(config.dataset, DATASOURCE_NAME, config.datasetType);
cy.setDataset(config.dataset, datasourceName, config.datasetType);
cy.setQueryLanguage(config.language);
setDatePickerDatesAndSearchIfRelevant(config.language);

Expand Down Expand Up @@ -189,7 +187,7 @@ describe('filter for value spec', () => {
);
};

cy.setDataset(config.dataset, DATASOURCE_NAME, config.datasetType);
cy.setDataset(config.dataset, datasourceName, config.datasetType);
cy.setQueryLanguage(config.language);
setDatePickerDatesAndSearchIfRelevant(config.language);

Expand Down

0 comments on commit 57c9f63

Please sign in to comment.