@@ -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