Skip to content

Commit f45cdf7

Browse files
authored
notebooks add index refresh, remove SQL check in paragraph (#1065)
Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
1 parent 63d2e75 commit f45cdf7

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

cypress/integration/plugins/observability-dashboards/6_notebooks.spec.js

+22-20
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@
66
/// <reference types="cypress" />
77

88
import {
9-
SAMPLE_SQL_QUERY,
109
TEST_NOTEBOOK,
1110
SAMPLE_URL,
1211
BASE_PATH,
1312
delayTime,
1413
MARKDOWN_TEXT,
14+
OBSERVABILITY_INDEX_NAME,
1515
} from '../../../utils/constants';
1616

1717
import { skipOn } from '@cypress/skip-test';
1818

19+
let loadedOnce = 0;
20+
1921
const moveToNotebookHome = () => {
2022
cy.visit(`${BASE_PATH}/app/observability-notebooks#/`);
2123
};
@@ -25,8 +27,25 @@ const moveToTestNotebook = () => {
2527
timeout: delayTime * 3,
2628
});
2729

28-
// Reload page to load notebooks if they are not flushed in OpenSearch index yet.
29-
cy.reload();
30+
// Force refresh the observablity index and reload page to load notebooks.
31+
if (loadedOnce === 0) {
32+
cy.request({
33+
method: 'POST',
34+
failOnStatusCode: false,
35+
form: false,
36+
url: 'api/console/proxy',
37+
headers: {
38+
'content-type': 'application/json;charset=UTF-8',
39+
'osd-xsrf': true,
40+
},
41+
qs: {
42+
path: `${OBSERVABILITY_INDEX_NAME}/_refresh`,
43+
method: 'POST',
44+
},
45+
});
46+
cy.reload();
47+
loadedOnce = 1;
48+
}
3049

3150
cy.get('.euiTableCellContent')
3251
.contains(TEST_NOTEBOOK, {
@@ -77,23 +96,6 @@ describe('Testing notebook actions', () => {
7796
cy.get('code').contains('POST').should('exist');
7897
cy.get('td').contains('b2').should('exist');
7998
});
80-
81-
it('Adds a SQL query paragraph', () => {
82-
cy.get('button[data-test-subj="AddParagraphButton"]').click();
83-
cy.get('button[data-test-subj="AddCodeBlockBtn"]').click();
84-
85-
cy.get('textarea[data-test-subj="editorArea-1"]').clear();
86-
cy.get('textarea[data-test-subj="editorArea-1"]').focus();
87-
cy.get('textarea[data-test-subj="editorArea-1"]').type(SAMPLE_SQL_QUERY);
88-
cy.get('button[data-test-subj="runRefreshBtn-1"]').click();
89-
90-
cy.get('textarea[data-test-subj="editorArea-1"]').should('not.exist');
91-
cy.get('div[data-test-subj="queryOutputText"]')
92-
.contains('select 1')
93-
.should('exist');
94-
95-
cy.get('.euiDataGrid__overflow').should('exist');
96-
});
9799
});
98100

99101
describe('Test reporting integration if plugin installed', () => {

cypress/utils/plugins/observability-dashboards/constants.js

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
import { BASE_PATH } from '../../base_constants';
66

7+
export const OBSERVABILITY_INDEX_NAME = '.opensearch-observability';
78
export const delayTime = 1500;
89

910
//Datasources API Constants

0 commit comments

Comments
 (0)