-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Junqiu Lei <[email protected]> (cherry picked from commit e06a6f2) Co-authored-by: Junqiu Lei <[email protected]>
- Loading branch information
1 parent
3849394
commit b937972
Showing
10 changed files
with
172 additions
and
55 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
cypress/fixtures/plugins/custom-import-map-dashboards/sample_geo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "FeatureCollection", | ||
"name": "sample", | ||
"features": [ | ||
{ "type": "Feature", "properties": { "iso2": "IN", "iso3": "IND", "name": "Abc" }, "geometry": { "type": "MultiPolygon", "coordinates": [[[[70.6640625,39.639537564366684],[69.78515625,37.020098201368114],[69.60937499999999,33.7243396617476],[69.9609375,29.99300228455108],[69.2578125,27.839076094777816],[69.60937499999999,26.588527147308614],[70.6640625,25.799891182088334],[70.13671875,24.206889622398023],[67.67578124999999,23.885837699862005],[69.78515625,21.616579336740603],[73.30078125,17.644022027872726],[75.76171875,13.581920900545844],[76.2890625,10.487811882056695],[77.51953125,8.233237111274565],[79.453125,11.178401873711785],[80.15625,16.97274101999902],[85.78125,19.973348786110602],[90.703125,21.616579336740603],[95.80078125,21.616579336740603],[96.85546875,26.27371402440643],[97.3828125,28.613459424004414],[92.98828125,30.14512718337613],[88.9453125,29.6880527498568],[83.84765625,30.14512718337613],[80.33203125,34.161818161230386],[81.2109375,37.020098201368114],[76.2890625,38.272688535980976],[71.54296874999999,39.774769485295465],[70.6640625,39.639537564366684]]]] } }, | ||
{ "type": "Feature", "properties": { "iso2": "CN", "iso3": "CHN", "name": "Xyz" }, "geometry": { "type": "MultiPolygon", "coordinates": [[ [ [ 113.36476, 22.1579 ], [ 113.35401, 22.13085 ], [ 113.33619, 22.10049 ], [ 113.31365, 22.0764 ], [ 113.28907, 22.06851 ], [ 113.27914, 22.07469 ], [ 113.26881, 22.08832 ], [ 113.26417, 22.10493 ], [ 113.27174, 22.12002 ], [ 113.27914, 22.1232 ], [ 113.28972, 22.12547 ], [ 113.29868, 22.12857 ], [ 113.30274, 22.13398 ], [ 113.30421, 22.14183 ], [ 113.30844, 22.14863 ], [ 113.31495, 22.154 ], [ 113.32309, 22.1579 ], [ 113.32797, 22.14582 ], [ 113.33546, 22.14887 ], [ 113.34718, 22.15644 ], [ 113.36476, 22.1579 ] ] ], [ [ [ 113.59352, 22.78482 ], [ 113.60288, 22.77245 ], [ 113.60279, 22.76264 ], [ 113.59457, 22.75609 ], [ 113.57984, 22.75373 ], [ 113.55828, 22.75788 ], [ 113.54461, 22.76878 ], [ 113.53566, 22.78433 ], [ 113.52858, 22.80215 ], [ 113.52117, 22.78791 ], [ 113.50611, 22.79804 ], [ 113.49529, 22.81387 ], [ 113.4808, 22.84931 ], [ 113.47397, 22.84931 ], [ 113.47316, 22.82538 ], [ 113.4559, 22.83076 ], [ 113.43409, 22.84907 ], [ 113.40211, 22.88288 ], [ 113.39617, 22.8981 ], [ 113.40512, 22.90811 ], [ 113.43295, 22.91201 ], [ 113.4756, 22.9007 ], [ 113.4878, 22.89281 ], [ 113.52703, 22.84663 ], [ 113.54672, 22.83487 ], [ 113.57301, 22.83006 ], [ 113.57643, 22.82392 ], [ 113.58766, 22.79462 ], [ 113.59352, 22.78482 ] ] ] ] } } | ||
] | ||
} |
34 changes: 34 additions & 0 deletions
34
cypress/integration/plugins/custom-import-map-dashboards/0_add_saved_object.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { BASE_PATH } from '../../../utils/constants'; | ||
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
import { CURRENT_TENANT } from '../../../utils/commands'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
|
||
describe('Add flights dataset saved object', () => { | ||
before(() => { | ||
CURRENT_TENANT.newTenant = 'global'; | ||
cy.deleteAllIndices(); | ||
miscUtils.addSampleData(); | ||
cy.wait(10000); | ||
}); | ||
|
||
after(() => { | ||
miscUtils.removeSampleData(); | ||
}); | ||
|
||
it('check if maps saved object of flights dataset can be found and open', () => { | ||
cy.visit(`${BASE_PATH}/app/maps-dashboards`); | ||
cy.contains( | ||
'[Flights] Flights Status on Maps Destination Location' | ||
).click(); | ||
cy.get('[data-test-subj="layerControlPanel"]').should( | ||
'contain', | ||
'Flights On Time' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
cypress/integration/plugins/custom-import-map-dashboards/5_add_map_to_dashboard.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { BASE_PATH } from '../../../utils/constants'; | ||
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
import { CURRENT_TENANT } from '../../../utils/commands'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
|
||
describe('Add map to dashboard', () => { | ||
before(() => { | ||
CURRENT_TENANT.newTenant = 'global'; | ||
cy.deleteAllIndices(); | ||
miscUtils.addSampleData(); | ||
cy.wait(15000); | ||
}); | ||
|
||
it('Add new map to dashboard', () => { | ||
const testMapName = 'saved-map-' + Date.now().toString(); | ||
cy.visit(`${BASE_PATH}/app/dashboards`); | ||
cy.get('[data-test-subj="newItemButton"]').click(); | ||
cy.get('button[data-test-subj="dashboardAddNewPanelButton"]').click(); | ||
cy.get('button[data-test-subj="visType-customImportMap"]').click(); | ||
cy.wait(5000).get('button[data-test-subj="mapSaveButton"]').click(); | ||
cy.wait(5000).get('[data-test-subj="savedObjectTitle"]').type(testMapName); | ||
cy.wait(5000) | ||
.get('[data-test-subj="confirmSaveSavedObjectButton"]') | ||
.click(); | ||
cy.get('.embPanel__titleText').should('contain', testMapName); | ||
}); | ||
|
||
after(() => { | ||
miscUtils.removeSampleData(); | ||
}); | ||
}); |
48 changes: 48 additions & 0 deletions
48
cypress/integration/plugins/custom-import-map-dashboards/6_geojson_file_upload.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { BASE_PATH } from '../../../utils/constants'; | ||
import { CURRENT_TENANT } from '../../../utils/commands'; | ||
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
import 'cypress-file-upload'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
|
||
describe('Verify successful custom geojson file upload', () => { | ||
before(() => { | ||
CURRENT_TENANT.newTenant = 'global'; | ||
cy.deleteAllIndices(); | ||
miscUtils.addSampleData(); | ||
cy.wait(15000); | ||
|
||
// Load region map visualization with sample data opensearch_dashboards_sample_data_flights | ||
cy.visit( | ||
`${BASE_PATH}/app/visualize#/create?type=region_map&indexPattern=d3d7af60-4c81-11e8-b3d7-01146121b73d`, | ||
{ | ||
retryOnStatusCodeFailure: true, | ||
timeout: 60000, | ||
} | ||
); | ||
}); | ||
|
||
it('checks if the file uploaded successfully', () => { | ||
// Click on "Import Vector Map" tab, which is part of customImportMap plugin | ||
cy.contains('Import Vector Map').click({ force: true }); | ||
|
||
cy.get('[data-testId="filePicker"]').attachFile( | ||
'plugins/custom-import-map-dashboards/sample_geo.json' | ||
); | ||
cy.get('[data-testId="customIndex"]').type('sample'); | ||
cy.contains('Import file').click({ force: true }); | ||
cy.contains( | ||
'Successfully added 2 features to sample-map. Refresh to visualize the uploaded map.', | ||
{ timeout: 240000 } | ||
); | ||
}); | ||
|
||
after(() => { | ||
miscUtils.removeSampleData(); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters