Skip to content

Commit ad4239a

Browse files
authored
Enable run maps tests when security enabled (#1044)
* Enable run maps tests when security enabled Signed-off-by: Junqiu Lei <[email protected]> * Fix test order by adding files name with number Signed-off-by: Junqiu Lei <[email protected]> * Update maps-dashboards CI workflow Signed-off-by: Junqiu Lei <[email protected]> --------- Signed-off-by: Junqiu Lei <[email protected]>
1 parent 07e25c4 commit ad4239a

File tree

8 files changed

+177
-185
lines changed

8 files changed

+177
-185
lines changed

.github/workflows/custom-import-map-dashboards-release-e2e-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
if: ${{ needs.changes.outputs.tests == 'true' }}
2121
uses: ./.github/workflows/release-e2e-workflow-template.yml
2222
with:
23-
test-name: Observability
24-
test-command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/custom-import-map-dashboards/*'
23+
test-name: Maps Dashboards
24+
test-command: yarn cypress:run-with-security --browser electron --spec 'cypress/integration/plugins/custom-import-map-dashboards/*'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { BASE_PATH } from '../../../utils/constants';
7+
8+
describe('Default OpenSearch base map layer', () => {
9+
before(() => {
10+
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`, {
11+
retryOnStatusCodeFailure: true,
12+
timeout: 60000,
13+
});
14+
cy.get('div[data-test-subj="sampleDataSetCardflights"]', {
15+
timeout: 60000,
16+
})
17+
.contains(/(Add|View) data/)
18+
.click();
19+
cy.wait(60000);
20+
});
21+
22+
it('check if default OpenSearch map layer can be open', () => {
23+
cy.visit(`${BASE_PATH}/app/maps-dashboards`);
24+
cy.contains('Create map').click();
25+
cy.get('[data-test-subj="layerControlPanel"]').should(
26+
'contain',
27+
'Default map'
28+
);
29+
cy.get('canvas.maplibregl-canvas').trigger('mousemove', {
30+
x: 100,
31+
y: 100,
32+
force: true,
33+
});
34+
cy.get('canvas.maplibregl-canvas').trigger('mousemove', {
35+
x: 200,
36+
y: 200,
37+
force: true,
38+
});
39+
for (let i = 0; i < 21; i++) {
40+
cy.wait(1000)
41+
.get('canvas.maplibregl-canvas')
42+
.trigger('dblclick', { force: true });
43+
}
44+
cy.get('[data-test-subj="mapStatusBar"]').should('contain', 'zoom: 22');
45+
});
46+
47+
after(() => {
48+
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory`);
49+
cy.get('button[data-test-subj="removeSampleDataSetflights"]')
50+
.should('be.visible')
51+
.click();
52+
});
53+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { BASE_PATH } from '../../../utils/constants';
7+
8+
describe('Add flights dataset saved object', () => {
9+
before(() => {
10+
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`, {
11+
retryOnStatusCodeFailure: true,
12+
timeout: 60000,
13+
});
14+
cy.get('div[data-test-subj="sampleDataSetCardflights"]', {
15+
timeout: 60000,
16+
})
17+
.contains(/Add data/)
18+
.click();
19+
cy.wait(60000);
20+
});
21+
22+
after(() => {
23+
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory`);
24+
cy.get('button[data-test-subj="removeSampleDataSetflights"]')
25+
.should('be.visible')
26+
.click();
27+
});
28+
29+
it('check if maps saved object of flights dataset can be found and open', () => {
30+
cy.visit(`${BASE_PATH}/app/maps-dashboards`);
31+
cy.contains(
32+
'[Flights] Flights Status on Maps Destination Location'
33+
).click();
34+
cy.get('[data-test-subj="layerControlPanel"]').should(
35+
'contain',
36+
'Flights On Time'
37+
);
38+
});
39+
});
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { BASE_PATH } from '../../../utils/constants';
7+
8+
describe('Documents layer', () => {
9+
before(() => {
10+
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory/sampleData`, {
11+
retryOnStatusCodeFailure: true,
12+
timeout: 60000,
13+
});
14+
cy.get('div[data-test-subj="sampleDataSetCardflights"]', {
15+
timeout: 60000,
16+
})
17+
.contains(/(Add|View) data/)
18+
.click();
19+
cy.wait(60000);
20+
});
21+
22+
const uniqueName = 'saved-map-' + Date.now().toString();
23+
24+
it('Add new documents layer with configuration', () => {
25+
cy.visit(`${BASE_PATH}/app/maps-dashboards`);
26+
cy.contains('Create map').click();
27+
cy.get("button[data-test-subj='addLayerButton']").click();
28+
cy.contains('Documents').click();
29+
cy.contains('Select data source', { timeout: 60000 }).click({
30+
force: true,
31+
});
32+
cy.wait(5000).contains('opensearch_dashboards_sample_data_flights').click();
33+
cy.contains('Select data field', { timeout: 60000 }).click({
34+
force: true,
35+
});
36+
cy.wait(5000).contains('DestLocation').click();
37+
cy.get('[data-test-subj="indexPatternSelect"]').should(
38+
'contain',
39+
'opensearch_dashboards_sample_data_flights'
40+
);
41+
cy.get('[data-test-subj="geoFieldSelect"]').should(
42+
'contain',
43+
'DestLocation'
44+
);
45+
cy.get(`button[testSubj="styleTab"]`).click();
46+
cy.contains('Fill color').click();
47+
cy.get(`button[aria-label="Select #E7664C as the color"]`).click();
48+
cy.wait(1000).contains('Border color').click();
49+
cy.get(`button[aria-label="Select #DA8B45 as the color"]`).click();
50+
cy.wait(1000).get(`button[testSubj="settingsTab"]`).click();
51+
cy.get('[name="layerName"]').clear().type('Documents layer 1');
52+
cy.get(`button[data-test-subj="updateButton"]`).click();
53+
cy.get('[data-test-subj="layerControlPanel"]').should(
54+
'contain',
55+
'Documents layer 1'
56+
);
57+
cy.wait(5000).get('[data-test-subj="top-nav"]').click();
58+
cy.wait(5000).get('[data-test-subj="savedObjectTitle"]').type(uniqueName);
59+
cy.wait(5000)
60+
.get('[data-test-subj="confirmSaveSavedObjectButton"]')
61+
.click();
62+
cy.wait(5000)
63+
.get('[data-test-subj="breadcrumb last"]')
64+
.should('contain', uniqueName);
65+
});
66+
67+
it('Open saved map with documents layer', () => {
68+
cy.visit(`${BASE_PATH}/app/maps-dashboards`);
69+
cy.get('[data-test-subj="mapListingPage"]').should('contain', uniqueName);
70+
cy.contains(uniqueName).click();
71+
cy.get('[data-test-subj="layerControlPanel"]').should(
72+
'contain',
73+
'Documents layer 1'
74+
);
75+
});
76+
77+
after(() => {
78+
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory`);
79+
cy.get('button[data-test-subj="removeSampleDataSetflights"]')
80+
.should('be.visible')
81+
.click();
82+
});
83+
});

cypress/integration/plugins/custom-import-map-dashboards/add_saved_object.spec.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

cypress/integration/plugins/custom-import-map-dashboards/documentsLayer.spec.js

Lines changed: 0 additions & 87 deletions
This file was deleted.

cypress/integration/plugins/custom-import-map-dashboards/opensearchMapLayer.spec.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)