Skip to content

Commit 9406218

Browse files
committed
Address the Comments
Signed-off-by: Suchit Sahoo <[email protected]>
1 parent cd1dd84 commit 9406218

File tree

3 files changed

+13
-124
lines changed

3 files changed

+13
-124
lines changed

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/explore/04/traces.spec.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const workspaceName = getRandomizedWorkspaceName();
2121
const traceTestSuite = () => {
2222
let traceUrl;
2323
// Reenable it after updating the setup utils
24-
before.skip(() => {
24+
before(() => {
2525
// Setup workspace with both log and trace indices
2626
cy.explore.setupWorkspaceAndDataSourceWithTraces(workspaceName, [LOG_INDEX, TRACE_INDEX]);
2727

@@ -708,4 +708,6 @@ const traceTestSuite = () => {
708708
});
709709
};
710710

711-
prepareTestSuite('Traces', traceTestSuite);
711+
describe.skip('Traces Test Suite - SKIPPED', () => {
712+
prepareTestSuite('Traces', traceTestSuite);
713+
});

cypress/integration/core_opensearch_dashboards/opensearch_dashboards/apps/query_enhancements/02/saved_search_in_dashboards.spec.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import {
1414
getRandomizedWorkspaceName,
1515
setDatePickerDatesAndSearchIfRelevant,
16+
getRandomizedDatasetId,
1617
} from '../../../../../../utils/apps/query_enhancements/shared';
1718
import {
1819
postRequestSaveSearch,
@@ -21,13 +22,17 @@ import {
2122
loadSavedSearchFromDashboards,
2223
navigateToDashboardAndOpenSavedSearchPanel,
2324
} from '../../../../../../utils/apps/query_enhancements/saved';
24-
import { prepareTestSuite } from '../../../../../../utils/helpers';
25+
import {
26+
prepareTestSuite,
27+
createWorkspaceAndDatasetUsingEndpoint,
28+
} from '../../../../../../utils/helpers';
2529

2630
const workspaceName = getRandomizedWorkspaceName();
31+
const datasetId = getRandomizedDatasetId();
2732

2833
export const runSavedSearchTests = () => {
2934
// TODO: Since the top nav has been changed, this needs to be updated with the correct add to dashboards flow.
30-
describe('saved search in dashboards', () => {
35+
describe.skip('saved search in dashboards', () => {
3136
// TODO: Currently we cannot convert this into a "before" and "after" due to us grabbing several aliases that are required by postRequestSaveSearch()
3237
beforeEach(() => {
3338
cy.osd.setupEnvAndGetDataSource(DATASOURCE_NAME);
@@ -42,7 +47,7 @@ export const runSavedSearchTests = () => {
4247
['use-case-search'] // features
4348
);
4449

45-
cy.osd.grabDataSourceId(workspaceName, DATASOURCE_NAME);
50+
// cy.osd.grabDataSourceId(workspaceName, DATASOURCE_NAME);
4651
});
4752

4853
afterEach(() => {

cypress/utils/commands.osd.js

Lines changed: 1 addition & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ cy.osd.add('apiDeleteSavedQueryIfExists', (queryName, workspaceName, endpoint) =
854854

855855
cy.request({
856856
method: 'DELETE',
857-
url: `${baseUrl}/api/saved_objects/search/${savedQuery.id}`,
857+
url: `${baseUrl}/api/saved_objects/query/${savedQuery.id}`,
858858
headers: { 'osd-xsrf': true },
859859
failOnStatusCode: false,
860860
}).then((deleteResponse) => {
@@ -873,110 +873,6 @@ cy.osd.add('apiDeleteSavedQueryIfExists', (queryName, workspaceName, endpoint) =
873873
}
874874
});
875875
});
876-
877-
/**
878-
* Creates a dataset (index pattern) by making an API request to the endpoint
879-
* @param {string} datasetId The unique ID for the dataset to be created
880-
* @param {string} workspaceId The ID of the workspace where the dataset will be created
881-
* @param {string} datasourceId The ID of the data source to associate with the dataset
882-
* @param {Object} options Configuration options for the dataset
883-
* @param {string} options.title The title/name of the dataset
884-
* @param {string} [options.displayName] Optional display name for the dataset
885-
* @param {string} [options.signalType] Signal type for the dataset (default: "logs")
886-
* @param {string} options.timestamp The name of the time field
887-
* @param {Array} [options.fields] Optional fields array, defaults to defaultFieldsForDatasetCreation
888-
* @param {string} aliasName The alias name to save the dataset ID under (e.g., 'WorkSpace:DataSetId')
889-
* @param {string} [endpoint] Optional endpoint URL, defaults to baseUrl from Cypress config
890-
*/
891-
cy.osd.add(
892-
'createDatasetByEndpoint',
893-
(datasetId, workspaceId, datasourceId, options, aliasName, endpoint) => {
894-
const baseUrl = endpoint || Cypress.config('baseUrl') || '';
895-
const fields = options.fields || defaultFieldsForDatasetCreation;
896-
897-
// Build attributes object conditionally
898-
const attributes = {
899-
title: options.title,
900-
displayName: options.displayName || '',
901-
signalType: options.signalType || 'logs',
902-
fields: fields,
903-
schemaMappings: options.schemaMappings || '{}',
904-
};
905-
906-
// Only include timeFieldName if timestamp is provided
907-
if (options.timestamp) {
908-
attributes.timeFieldName = options.timestamp;
909-
}
910-
911-
cy.request({
912-
method: 'POST',
913-
url: `${baseUrl}/api/saved_objects/index-pattern/${datasourceId}::${datasetId}`,
914-
headers: {
915-
'osd-xsrf': true,
916-
},
917-
body: {
918-
attributes: attributes,
919-
references: [
920-
{
921-
id: datasourceId,
922-
type: 'OpenSearch',
923-
name: 'dataSource',
924-
},
925-
],
926-
workspaces: [workspaceId],
927-
},
928-
}).then((response) => {
929-
// Validate successful response
930-
expect(response.status).to.be.oneOf([200, 201]);
931-
expect(response.body).to.have.property('id');
932-
933-
// Log success
934-
cy.log(`Dataset created successfully: ${options.title} (ID: ${response.body.id})`);
935-
936-
// Save the dataset ID as an alias with WorkSpace:DataSetId format
937-
cy.wrap(response.body.id).as(aliasName);
938-
});
939-
}
940-
);
941-
942-
/**
943-
* Creates a workspace with a specific data source ID
944-
* @param {string} datasourceId The ID of the data source to associate with the workspace
945-
* @param {string} workspaceName The name for the workspace
946-
* @param {string} [endpoint] Optional endpoint URL, defaults to baseUrl from Cypress config
947-
* @param {string} [aliasName] Optional custom alias name, defaults to 'WORKSPACE_ID'
948-
*/
949-
cy.osd.add(
950-
'createWorkspaceWithDataSourceId',
951-
(datasourceId, workspaceName, useCase, aliasName = 'WORKSPACE_ID', endpoint) => {
952-
const baseUrl = endpoint || Cypress.config('baseUrl') || '';
953-
954-
cy.createWorkspaceWithEndpoint(baseUrl, {
955-
name: workspaceName,
956-
features: useCase || ['use-case-observability'],
957-
settings: {
958-
permissions: {
959-
library_write: { users: ['%me%'] },
960-
write: { users: ['%me%'] },
961-
},
962-
dataSources: [datasourceId],
963-
dataConnections: [],
964-
},
965-
}).then((response) => {
966-
// Validate successful response
967-
expect(response).to.have.property('id');
968-
969-
// Log success
970-
cy.log(`Workspace created successfully: ${workspaceName} (ID: ${response.id})`);
971-
972-
// Save the workspace ID as an alias (with custom name to avoid conflicts)
973-
cy.wrap(response.id).as(aliasName);
974-
975-
// Also store in Cypress env for persistence across runs
976-
Cypress.env(aliasName, response.id);
977-
});
978-
}
979-
);
980876
/*
981877
Create an No Auth Opensearch Datasource for tests
982878
*/
@@ -1135,17 +1031,3 @@ cy.osd.add('deleteWorkSpace', (workspaceName) => {
11351031
});
11361032
});
11371033
});
1138-
1139-
cy.osd.add(
1140-
'setExplorePage',
1141-
(datasourceId, workspaceId, timeRange, datasetId, datasetOptions, query, endpoint) => {
1142-
const baseUrl = endpoint || Cypress.config('baseUrl') || '';
1143-
1144-
const dataset = `(dataSource:(id:${datasourceId},title:dataConn,type:OpenSearch),id:${datasetId},timeFieldName:'${datasetOptions.timeField}',title:'${datasetOptions.title},type:INDEX_PATTERN)`;
1145-
const encodedQuery = encodeURIComponent(query);
1146-
1147-
cy.visit(
1148-
`${baseUrl}/w/${workspaceId}/app/explore/logs/#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:${timeRange.from},to:${timeRange.to}))&_q=(dataset:${dataset},language:PPL,query:'${encodedQuery}')`
1149-
);
1150-
}
1151-
);

0 commit comments

Comments
 (0)