Skip to content

Commit f543db0

Browse files
authored
Merge branch '2.x' into run-all-test-base-2.x
2 parents 38854c1 + d09d168 commit f543db0

File tree

36 files changed

+563
-108
lines changed

36 files changed

+563
-108
lines changed

.github/workflows/assistant-release-e2e-workflow.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ jobs:
1515
tests:
1616
- 'cypress/**/dashboards-assistant/**'
1717
18-
tests:
18+
tests-with-security:
1919
needs: changes
2020
if: ${{ needs.changes.outputs.tests == 'true' }}
2121
uses: ./.github/workflows/release-e2e-workflow-template.yml
2222
with:
2323
test-name: dashboards assistant
2424
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
25-
osd-serve-args: --assistant.chat.enabled=true --assistant.chat.rootAgentName="Cypress test agent"
25+
osd-serve-args: --assistant.chat.enabled=true
26+
27+
tests-without-security:
28+
needs: changes
29+
if: ${{ needs.changes.outputs.tests == 'true' }}
30+
uses: ./.github/workflows/release-e2e-workflow-template.yml
31+
with:
32+
test-name: dashboards assistant
33+
test-command: env CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/*'
34+
osd-serve-args: --assistant.chat.enabled=true
35+
security-enabled: false

cypress/fixtures/plugins/dashboards-assistant/cluster_settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"persistent": {
33
"plugins.ml_commons.only_run_on_ml_node": false,
44
"plugins.ml_commons.memory_feature_enabled": true,
5+
"plugins.ml_commons.agent_framework_enabled": true,
56
"plugins.ml_commons.trusted_connector_endpoints_regex": [
67
"^http://127.0.0.1:3000$"
78
]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/**
7+
* This file should be somewhere else like plugins/security but as assistant is the only consumer of the content
8+
* Would be better to keep within the directory of dashboards-assistant.
9+
*/
10+
11+
export const certPublicKeyContent = `
12+
-----BEGIN CERTIFICATE-----
13+
MIIEmDCCA4CgAwIBAgIUZjrlDPP8azRDPZchA/XEsx0X2iYwDQYJKoZIhvcNAQEL
14+
BQAwgY8xEzARBgoJkiaJk/IsZAEZFgNjb20xFzAVBgoJkiaJk/IsZAEZFgdleGFt
15+
cGxlMRkwFwYDVQQKDBBFeGFtcGxlIENvbSBJbmMuMSEwHwYDVQQLDBhFeGFtcGxl
16+
IENvbSBJbmMuIFJvb3QgQ0ExITAfBgNVBAMMGEV4YW1wbGUgQ29tIEluYy4gUm9v
17+
dCBDQTAeFw0yMzA4MjkyMDA2MzdaFw0zMzA4MjYyMDA2MzdaME0xCzAJBgNVBAYT
18+
AmRlMQ0wCwYDVQQHDAR0ZXN0MQ8wDQYDVQQKDAZjbGllbnQxDzANBgNVBAsMBmNs
19+
aWVudDENMAsGA1UEAwwEa2lyazCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
20+
ggEBAJVcOAQlCiuB9emCljROAXnlsPbG7PE3kNz2sN+BbGuw686Wgyl3uToVHvVs
21+
paMmLUqm1KYz9wMSWTIBZgpJ9hYaIbGxD4RBb7qTAJ8Q4ddCV2f7T4lxao/6ixI+
22+
O0l/BG9E3mRGo/r0w+jtTQ3aR2p6eoxaOYbVyEMYtFI4QZTkcgGIPGxm05y8xonx
23+
vV5pbSW9L7qAVDzQC8EYGQMMI4ccu0NcHKWtmTYJA/wDPE2JwhngHwbcIbc4cDz6
24+
cG0S3FmgiKGuuSqUy35v/k3y7zMHQSdx7DSR2tzhH/bBL/9qGvpT71KKrxPtaxS0
25+
bAqPcEkKWDo7IMlGGW7LaAWfGg8CAwEAAaOCASswggEnMAwGA1UdEwEB/wQCMAAw
26+
DgYDVR0PAQH/BAQDAgXgMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMIHPBgNVHSME
27+
gccwgcSAFBeH36Ba62YSp9XQ+LoSRTy3KwCcoYGVpIGSMIGPMRMwEQYKCZImiZPy
28+
LGQBGRYDY29tMRcwFQYKCZImiZPyLGQBGRYHZXhhbXBsZTEZMBcGA1UECgwQRXhh
29+
bXBsZSBDb20gSW5jLjEhMB8GA1UECwwYRXhhbXBsZSBDb20gSW5jLiBSb290IENB
30+
MSEwHwYDVQQDDBhFeGFtcGxlIENvbSBJbmMuIFJvb3QgQ0GCFHfkrz782p+T9k0G
31+
xGeM4+BrehWKMB0GA1UdDgQWBBSjMS8tgguX/V7KSGLoGg7K6XMzIDANBgkqhkiG
32+
9w0BAQsFAAOCAQEANMwD1JYlwAh82yG1gU3WSdh/tb6gqaSzZK7R6I0L7slaXN9m
33+
y2ErUljpTyaHrdiBFmPhU/2Kj2r+fIUXtXdDXzizx/JdmueT0nG9hOixLqzfoC9p
34+
fAhZxM62RgtyZoaczQN82k1/geMSwRpEndFe3OH7arkS/HSbIFxQhAIy229eWe5d
35+
1bUzP59iu7f3r567I4ob8Vy7PP+Ov35p7Vv4oDHHwgsdRzX6pvL6mmwVrQ3BfVec
36+
h9Dqprr+ukYmjho76g6k5cQuRaB6MxqldzUg+2E7IHQP8MCF+co51uZq2nl33mtp
37+
RGr6JbdHXc96zsLTL3saJQ8AWEfu1gbTVrwyRA==
38+
-----END CERTIFICATE-----
39+
`;
40+
41+
export const certPrivateKeyContent = `
42+
-----BEGIN PRIVATE KEY-----
43+
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCVXDgEJQorgfXp
44+
gpY0TgF55bD2xuzxN5Dc9rDfgWxrsOvOloMpd7k6FR71bKWjJi1KptSmM/cDElky
45+
AWYKSfYWGiGxsQ+EQW+6kwCfEOHXQldn+0+JcWqP+osSPjtJfwRvRN5kRqP69MPo
46+
7U0N2kdqenqMWjmG1chDGLRSOEGU5HIBiDxsZtOcvM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5gR+DfGyQubvvtcg1K3GHu9u2l8FwLj87sRzAoGAflQF
63+
RHuRiG+/AngTPnZAhc0Zq0kwLkpH2Rid6IrFZhGLy8AUL/O6aa0IGoaMDLpSWUJp
64+
nBY2S57MSM11/MVslrEgGmYNnI4r1K25xlaqV6K6ztEJv6n69327MS4NG8L/gCU5
65+
3pEm38hkUi8pVYU7in7rx4TCkrq94OkzWJYurAkCgYATQCL/rJLQAlJIGulp8s6h
66+
mQGwy8vIqMjAdHGLrCS35sVYBXG13knS52LJHvbVee39AbD5/LlWvjJGlQMzCLrw
67+
F7oILW5kXxhb8S73GWcuMbuQMFVHFONbZAZgn+C9FW4l7XyRdkrbR1MRZ2km8YMs
68+
/AHmo368d4PSNRMMzLHw8Q==
69+
-----END PRIVATE KEY-----
70+
`;
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import {
7+
MiscUtils,
8+
TestFixtureHandler,
9+
} from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
10+
import { CURRENT_TENANT } from '../../../../../utils/commands';
11+
12+
const miscUtils = new MiscUtils(cy);
13+
const testFixtureHandler = new TestFixtureHandler(
14+
cy,
15+
Cypress.env('openSearchUrl')
16+
);
17+
18+
describe('Data source selector', () => {
19+
before(() => {
20+
CURRENT_TENANT.newTenant = 'global';
21+
testFixtureHandler.importJSONMapping(
22+
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/index_pattern_without_timefield/mappings.json.txt'
23+
);
24+
testFixtureHandler.importJSONDoc(
25+
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/index_pattern_without_timefield/data.json.txt'
26+
);
27+
28+
miscUtils.visitPage('app/data-explorer/discover#/');
29+
cy.waitForLoader();
30+
});
31+
32+
after(() => {
33+
testFixtureHandler.clearJSONMapping(
34+
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/index_pattern_without_timefield/mappings.json.txt'
35+
);
36+
cy.deleteSavedObjectByType('index-pattern');
37+
});
38+
39+
it('displays all data sources by default', () => {
40+
cy.get('[data-test-subj="dataExplorerDSSelect"]').click();
41+
cy.get('.euiComboBoxOptionsList').should('exist');
42+
cy.get('.euiComboBoxOption__content').should('have.length', 2);
43+
});
44+
45+
it('filters options based on user input', () => {
46+
cy.get('[data-test-subj="dataExplorerDSSelect"] input').type('without', {
47+
force: true,
48+
});
49+
cy.get('.euiComboBoxOption__content').should('have.length', 1);
50+
cy.get('.euiComboBoxOption__content')
51+
.first()
52+
.should('contain', 'without-timefield');
53+
});
54+
55+
it('updates the visual length of the dropdown based on filtered results', () => {
56+
cy.get('[data-test-subj="dataExplorerDSSelect"] input').clear({
57+
force: true,
58+
});
59+
cy.get('[data-test-subj="dataExplorerDSSelect"] input').type(
60+
'without-timefield',
61+
{
62+
force: true,
63+
}
64+
);
65+
cy.get('.euiComboBoxOptionsList').then(($listAfterFilter) => {
66+
const heightAfterFilter = $listAfterFilter.height();
67+
cy.get('[data-test-subj="dataExplorerDSSelect"] input').clear({
68+
force: true,
69+
});
70+
cy.get('.euiComboBoxOptionsList').should(($listAll) => {
71+
expect($listAll.height()).to.be.greaterThan(heightAfterFilter);
72+
});
73+
});
74+
});
75+
76+
it('selects the correct option when clicked', () => {
77+
cy.get('[data-test-subj="dataExplorerDSSelect"] input').type(
78+
'with-timefield',
79+
{
80+
force: true,
81+
}
82+
);
83+
84+
cy.contains('.euiComboBoxOption__content', 'with-timefield').click();
85+
cy.get('[data-test-subj="dataExplorerDSSelect"] .euiComboBoxPill').should(
86+
'contain',
87+
'with-timefield'
88+
);
89+
});
90+
});

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('date_nanos', () => {
3434
});
3535
miscUtils.visitPage('app/data-explorer/discover#/');
3636
cy.waitForLoader();
37+
cy.switchDiscoverTable('new');
3738

3839
cy.setTopNavDate(fromTime, toTime);
3940
cy.waitForSearch();

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos_mixed.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ describe('date_nanos_mixed', () => {
3131
});
3232
miscUtils.visitPage('app/data-explorer/discover#/');
3333
cy.waitForLoader();
34+
cy.switchDiscoverTable('new');
3435

3536
const fromTime = 'Jan 1, 2019 @ 00:00:00.000';
3637
const toTime = 'Jan 1, 2019 @ 23:59:59.999';

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ const indexSet = [
2626

2727
describe('discover app', { scrollBehavior: false }, () => {
2828
before(() => {
29+
if (Cypress.env('SECURITY_ENABLED')) {
30+
/**
31+
* Security plugin is using private tenant as default.
32+
* So here we'd need to set global tenant as default manually.
33+
*/
34+
cy.changeDefaultTenant({
35+
multitenancy_enabled: true,
36+
private_tenant_enabled: true,
37+
default_tenant: 'global',
38+
});
39+
}
2940
CURRENT_TENANT.newTenant = 'global';
3041
// import logstash functional
3142
testFixtureHandler.importJSONDocIfNeeded(
@@ -51,6 +62,7 @@ describe('discover app', { scrollBehavior: false }, () => {
5162
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
5263
);
5364
cy.waitForLoader();
65+
cy.switchDiscoverTable('new');
5466
cy.waitForSearch();
5567
});
5668

@@ -59,6 +71,9 @@ describe('discover app', { scrollBehavior: false }, () => {
5971
describe('save search', () => {
6072
const saveSearch1 = 'Save Search # 1';
6173
const saveSearch2 = 'Modified Save Search # 1';
74+
beforeEach(() => {
75+
cy.switchDiscoverTable('new');
76+
});
6277

6378
it('should show correct time range string by timepicker', function () {
6479
cy.verifyTimeConfig(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
@@ -135,6 +150,7 @@ describe('discover app', { scrollBehavior: false }, () => {
135150
const toTime = 'Jun 12, 1999 @ 11:21:04.000';
136151

137152
before(() => {
153+
cy.switchDiscoverTable('new');
138154
cy.setTopNavDate(fromTime, toTime);
139155
});
140156

@@ -248,6 +264,10 @@ describe('discover app', { scrollBehavior: false }, () => {
248264
});
249265

250266
describe('refresh interval', function () {
267+
beforeEach(() => {
268+
cy.switchDiscoverTable('new');
269+
});
270+
251271
it('should refetch when autofresh is enabled', () => {
252272
cy.getElementByTestId('openInspectorButton').click();
253273
cy.getElementByTestId('inspectorPanel')
@@ -265,12 +285,15 @@ describe('discover app', { scrollBehavior: false }, () => {
265285
.should('be.visible')
266286
.clear()
267287
.type('2');
288+
289+
cy.makeDatePickerMenuOpen();
268290
cy.getElementByTestId('superDatePickerToggleRefreshButton').click();
269291

270292
// Let auto refresh run
271293
cy.wait(100);
272294

273295
// Close the auto refresh
296+
cy.makeDatePickerMenuOpen();
274297
cy.getElementByTestId('superDatePickerToggleRefreshButton').click();
275298

276299
// Check the timestamp of the last request, it should be different than the first timestamp

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/doc_navigation.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('doc link in discover', () => {
4646
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
4747
);
4848
cy.waitForLoader();
49+
cy.switchDiscoverTable('new');
4950
cy.waitForSearch();
5051
});
5152

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/doc_table.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('discover doc table', () => {
4646
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
4747
);
4848
cy.waitForLoader();
49+
cy.switchDiscoverTable('new');
4950
cy.waitForSearch();
5051
});
5152

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/field_data.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ describe('discover tab', () => {
4646
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
4747
);
4848
cy.waitForLoader();
49+
cy.switchDiscoverTable('new');
4950
cy.waitForSearch();
5051
});
5152

5253
after(() => {});
5354

5455
describe('field data', function () {
56+
before(() => {
57+
cy.switchDiscoverTable('new');
58+
});
59+
5560
it('search php should show the correct hit count', function () {
5661
const expectedHitCount = '445';
5762
cy.setTopNavQuery('php');
@@ -65,12 +70,18 @@ describe('discover tab', () => {
6570
});
6671

6772
it('search type:apache should show the correct hit count', () => {
73+
// add this line to address flakiness in Cypress:
74+
// ensures stable switching to the new Discover table format.
75+
cy.switchDiscoverTable('new');
6876
const expectedHitCount = '11,156';
6977
cy.setTopNavQuery('type:apache');
7078
cy.verifyHitCount(expectedHitCount);
7179
});
7280

7381
it('doc view should show Time and _source columns', function () {
82+
// add this line to address flakiness in Cypress:
83+
// ensures stable switching to the new Discover table format.
84+
cy.switchDiscoverTable('new');
7485
cy.getElementByTestId('dataGridHeaderCell-@timestamp').should(
7586
'be.visible'
7687
);

0 commit comments

Comments
 (0)