Skip to content

Commit

Permalink
Add import saved object mds test
Browse files Browse the repository at this point in the history
Signed-off-by: yujin-emma <[email protected]>
  • Loading branch information
yujin-emma committed Jun 3, 2024
1 parent 4ddffc9 commit fd321fb
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 4,603 deletions.
17 changes: 5 additions & 12 deletions cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"viewportHeight": 1320,
"env": {
"openSearchUrl": "http://localhost:9200",
"remoteDataSourceNoAuthUrl": "https://search-md-bug-bash-no-auth-7lvre4fioe3ikmdznjmhjrmsga.us-west-2.es.amazonaws.com",
"remoteDataSourceBasicAuthUrl": "https://search-sddd-nj2nc32tf7wspntbyvzjn5emwu.us-east-1.es.amazonaws.com",
"remoteDataSourceBasicAuthUsername": "Admin",
"remoteDataSourceBasicAuthPassword": "Admin_123",
"remoteDataSourceNoAuthUrl": "http://localhost:9201",
"remoteDataSourceBasicAuthUrl": "https://localhost:9202",
"remoteDataSourceBasicAuthUsername": "admin",
"remoteDataSourceBasicAuthPassword": "admin",
"SECURITY_ENABLED": false,
"AGGREGATION_VIEW": false,
"MULTITENANCY_ENABLED": true,
Expand All @@ -29,16 +29,9 @@
"DASHBOARDS_ASSISTANT_ENABLED": false,
"WORKSPACE_ENABLED": false,
"SAVED_OBJECTS_PERMISSION_ENABLED": false,
"DISABLE_LOCAL_CLUSTER": false,
"browserPermissions": {
"clipboard": "allow"
}
}
}








This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
import { CURRENT_TENANT } from '../../../utils/commands';
import 'cypress-file-upload';

const miscUtils = new MiscUtils(cy);

if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
let dataSourceTitle;

describe('import saved object test', () => {
before(() => {
// Go to the saved object page
cy.deleteAllDataSources();
cy.wait(1000);

cy.deleteAllSavedObjects();
miscUtils.visitPage('app/management/opensearch-dashboards/objects');

CURRENT_TENANT.newTenant = 'global';
cy.wait(1000);

// create data source
cy.createDataSourceNoAuth().then((result) => {
dataSourceTitle = result[1];
});
cy.reload(true);
cy.wait(1000);
});

after(() => {
cy.deleteAllSavedObjects();
});

it('can import saved objects from ndjson file and create new copies', () => {
cy.uploadSavedObjectsToDataSource(
'createNewCopiesEnabled',
'',
dataSourceTitle
);
});
it('can import saved objects from ndjson file and automatically override conflict', () => {
cy.uploadSavedObjectsToDataSource(
'createNewCopiesDisabled',
'overwriteEnabled',
dataSourceTitle
);
});

it('can import saved objects from ndjson file and request action when conflict exit', () => {
cy.uploadSavedObjectsToDataSource(
'createNewCopiesDisabled',
'overwriteDisabled',
dataSourceTitle
);
});
});
}
26 changes: 26 additions & 0 deletions cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,16 @@ Cypress.Commands.add(
}
);

// Cypress.Commands.add(
// 'selectDataSourceForImport',
// (dataSourceTitle, dataSourceId) => {
// cy.getElementByTestId('dataSourceSelectorComboBox').click();
// cy.get('.euiFilterSelectItem')
// .contains(dataSourceTitle) // Find the element containing dataSourceTitle
// .click();
// }
// );

Cypress.Commands.add('viewData', (sampleData) => {
cy.get(`button[data-test-subj="launchSampleDataSet${sampleData}"]`)
.should('be.visible')
Expand Down Expand Up @@ -676,3 +686,19 @@ Cypress.Commands.add('removeSampleDataFromDataSource', (dataSourceTitle) => {
.should('be.visible')
.click();
});

// Cypress.Commands.add('deleteAllSavedObjects', () => {
// cy.wait(1000);
// cy.deleteSavedObjectByType('dashboard');
// cy.wait(1000);
// cy.deleteSavedObjectByType('index-pattern');
// cy.wait(1000);
// cy.deleteSavedObjectByType('search');
// cy.wait(1000);
// cy.deleteSavedObjectByType('visualization');
// cy.wait(1000);
// cy.deleteSavedObjectByType('metrics');
// cy.wait(1000);
// cy.deleteSavedObjectByType('vega');

// });
1 change: 1 addition & 0 deletions cypress/utils/dashboards/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import './vis_type_table/commands';
import './vis_type_vega/commands';
import './vis-augmenter/commands';
import './data_explorer/commands';
import './saved_objects_management/commands';

Cypress.Commands.add('waitForLoader', () => {
const opts = { log: false };
Expand Down
Loading

0 comments on commit fd321fb

Please sign in to comment.