Skip to content

Commit

Permalink
clean out
Browse files Browse the repository at this point in the history
Signed-off-by: Anan <[email protected]>
  • Loading branch information
ananzh committed Jan 30, 2025
1 parent 4230fef commit 46d1ccb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import {
DatasetTypes,
INDEX_WITH_TIME_1,
INDEX_PATTERN_WITH_TIME_1,
SECONDARY_ENGINE,
Expand Down Expand Up @@ -88,7 +89,7 @@ export const runSharedLinksTests = () => {
}).forEach((config) => {
describe(`${config.testName}`, () => {
beforeEach(() => {
if (config.datasetType === 'INDEX_PATTERN') {
if (config.datasetType === DatasetTypes.INDEX_PATTERN.name) {
cy.createWorkspaceIndexPatterns({
workspaceName: workspaceName,
indexPattern: INDEX_WITH_TIME_1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import {
DatasetTypes,
INDEX_WITH_TIME_1,
INDEX_PATTERN_WITH_TIME_1,
SECONDARY_ENGINE,
Expand Down Expand Up @@ -173,7 +174,7 @@ export const runSideBarTests = () => {
}).forEach((config) => {
describe(`${config.testName}`, () => {
beforeEach(() => {
if (config.datasetType === 'INDEX_PATTERN') {
if (config.datasetType === DatasetTypes.INDEX_PATTERN.name) {
cy.createWorkspaceIndexPatterns({
workspaceName: workspaceName,
indexPattern: INDEX_WITH_TIME_1,
Expand All @@ -199,7 +200,7 @@ export const runSideBarTests = () => {
testData.simpleFields.expectedValues,
testData.pplQuery(config.dataset),
testData.sqlQuery(config.dataset),
config.datasetType === 'INDEX_PATTERN',
cconfig.datasetType === DatasetTypes.INDEX_PATTERN.name,
config
);
});
Expand All @@ -210,7 +211,7 @@ export const runSideBarTests = () => {
testData.nestedFields.expectedValues,
testData.pplQuery(config.dataset),
testData.sqlQuery(config.dataset),
config.datasetType === 'INDEX_PATTERN',
config.datasetType === DatasetTypes.INDEX_PATTERN.name,
config
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
*/

import {
DatasetTypes,
INDEX_WITH_TIME_1,
INDEX_WITHOUT_TIME_1,
INDEX_PATTERN_WITH_TIME_1,
INDEX_PATTERN_WITH_NO_TIME_1,
SECONDARY_ENGINE,
} from '../../../../../utils/constants';
import {
Expand Down Expand Up @@ -59,25 +62,24 @@ export const runTableTests = () => {
});

afterEach(() => {
cy.deleteWorkspaceByName(`${workspaceName}`);
cy.deleteWorkspaceByName(workspaceName);
cy.deleteDataSourceByName(datasourceName);
cy.deleteIndex('data_logs_small_time_1');
cy.window().then((win) => {
win.localStorage.clear();
win.sessionStorage.clear();
});
});

generateAllTestConfigurations(generateTableTestConfiguration, {
indexPattern: 'data_logs_small_time_1*',
index: 'data_logs_small_time_1',
indexPattern: INDEX_PATTERN_WITH_TIME_1,
index: INDEX_WITH_TIME_1,
}).forEach((config) => {
describe(`${config.testName}`, () => {
beforeEach(() => {
if (config.datasetType === 'INDEX_PATTERN') {
if (config.datasetType === DatasetTypes.INDEX_PATTERN.name) {
cy.createWorkspaceIndexPatterns({
workspaceName: workspaceName,
indexPattern: 'data_logs_small_time_1',
indexPattern: INDEX_WITH_TIME_1,
timefieldName: 'timestamp',
dataSource: datasourceName,
isEnhancement: true,
Expand All @@ -89,6 +91,9 @@ export const runTableTests = () => {
isEnhancement: true,
});
});
afterEach(() => {
cy.deleteIndex(INDEX_WITH_TIME_1);
});

it(`should allow expand multiple documents for ${config.testName}`, () => {
// Setup
Expand Down Expand Up @@ -127,15 +132,15 @@ export const runTableTests = () => {
});

generateIndexPatternTestConfigurations(generateTableTestConfiguration, {
indexPattern: 'data_logs_small_no_time_1*',
indexPattern: INDEX_PATTERN_WITH_NO_TIME_1,
supportedLanguages: [QueryLanguages.DQL, QueryLanguages.Lucene],
}).forEach((config) => {
describe(`${config.testName}`, () => {
beforeEach(() => {
if (config.datasetType === 'INDEX_PATTERN') {
if (config.datasetType === DatasetTypes.INDEX_PATTERN.name) {
cy.createWorkspaceIndexPatterns({
workspaceName: workspaceName,
indexPattern: 'data_logs_small_no_time_1',
indexPattern: INDEX_WITHOUT_TIME_1,
timefieldName: '',
indexPatternHasTimefield: false,
dataSource: datasourceName,
Expand All @@ -148,6 +153,9 @@ export const runTableTests = () => {
isEnhancement: true,
});
});
afterEach(() => {
cy.deleteIndex(INDEX_WITHOUT_TIME_1);
});
// TODO: Currently sort is not applicable for nested field. Should include and test nested field if sort can support.
const testFields = ['category', 'response_time'];

Expand Down
1 change: 1 addition & 0 deletions cypress/utils/apps/query_enhancements/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const INDEX_WITH_TIME_2 = 'data_logs_small_time_2';
export const INDEX_PATTERN_WITH_TIME = 'data_logs_small_time_*';
export const INDEX_PATTERN_WITH_NO_TIME = 'data_logs_small_no_time_*';
export const INDEX_PATTERN_WITH_TIME_1 = 'data_logs_small_time_1*';
export const INDEX_PATTERN_WITH_NO_TIME_1 = 'data_logs_small_no_time_1*';

/**
* The dataset type in discover
Expand Down

0 comments on commit 46d1ccb

Please sign in to comment.