Skip to content

Commit c67da74

Browse files
opensearch-trigger-bot[bot]ps48
andauthoredFeb 5, 2025
Update notebooks and traces tests with dynamic wait (#1693) (#1695)
* Fix flaky notebook, traces tests Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> * waits for reporting panel to appear Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> * wait for paragraph to run Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> * update reporting context menu interaction Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> * wait for all notebooks to be loaded Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> --------- Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> (cherry picked from commit 68eb31f) Co-authored-by: Shenoy Pratik <sgguruda@amazon.com>
1 parent 578cc7c commit c67da74

File tree

2 files changed

+46
-29
lines changed

2 files changed

+46
-29
lines changed
 

‎cypress/integration/plugins/observability-dashboards/2_trace_analytics_services.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ describe('Testing services table', () => {
3131
});
3232

3333
it('Opens service flyout', () => {
34+
cy.contains('6.42').should('exist');
3435
cy.get('button[data-test-subj^="service-flyout-action-btn"]')
3536
.first()
3637
.click();

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

+45-29
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,46 @@ const makePopulatedParagraph = () => {
5252
cy.get('textarea[data-test-subj="editorArea-0"]').focus();
5353
cy.get('textarea[data-test-subj="editorArea-0"]').type(MARKDOWN_TEXT);
5454
cy.get('button[data-test-subj="runRefreshBtn-0"]').click();
55+
cy.get('textarea[data-test-subj="editorArea-0"]').should('not.exist');
56+
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
57+
cy.get('code').contains('POST').should('exist');
5558
};
5659

57-
const deleteNotebook = (notebookName) => {
58-
moveToNotebookHome();
60+
const deleteNotebook = () => {
61+
cy.get('button[data-test-subj="notebook-delete-icon"]').click();
62+
cy.get('input[data-test-subj="delete-notebook-modal-input"]').type('delete');
63+
cy.get('button[data-test-subj="delete-notebook-modal-delete-button"]').should(
64+
'not.be.disabled'
65+
);
66+
cy.get(
67+
'button[data-test-subj="delete-notebook-modal-delete-button"]'
68+
).click();
69+
};
5970

60-
cy.contains('.euiTableRow', notebookName)
61-
.find('input[type="checkbox"]')
62-
.check();
71+
const deleteAllNotebooks = () => {
72+
cy.intercept(
73+
'DELETE',
74+
'/api/observability/notebooks/note/savedNotebook/*'
75+
).as('deleteNotebook');
76+
moveToNotebookHome();
6377

64-
cy.get('[data-test-subj="deleteSelectedNotebooks"]').click();
78+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
6579

66-
cy.get('input[data-test-subj="delete-notebook-modal-input"]').focus();
80+
cy.get('input[data-test-subj="checkboxSelectAll"]').should('exist');
81+
cy.get('input[data-test-subj="checkboxSelectAll"]').click();
82+
cy.get('button[data-test-subj="deleteSelectedNotebooks"]')
83+
.contains('Delete 4 notebooks')
84+
.should('exist');
85+
cy.get('button[data-test-subj="deleteSelectedNotebooks"]').click();
6786
cy.get('input[data-test-subj="delete-notebook-modal-input"]').type('delete');
6887
cy.get('button[data-test-subj="delete-notebook-modal-delete-button"]').should(
6988
'not.be.disabled'
7089
);
7190
cy.get(
7291
'button[data-test-subj="delete-notebook-modal-delete-button"]'
7392
).click();
74-
moveToNotebookHome();
7593

76-
cy.contains('.euiTableRow', notebookName).should('not.exist');
94+
cy.wait('@deleteNotebook').its('response.statusCode').should('eq', 200);
7795
};
7896

7997
describe('Testing notebook actions', () => {
@@ -83,9 +101,7 @@ describe('Testing notebook actions', () => {
83101
});
84102

85103
afterEach(() => {
86-
cy.get('@notebook').then((notebook) => {
87-
deleteNotebook(notebook.name);
88-
});
104+
deleteNotebook();
89105
});
90106

91107
it('Creates a code paragraph', () => {
@@ -99,9 +115,6 @@ describe('Testing notebook actions', () => {
99115

100116
it('Renders markdown', () => {
101117
makePopulatedParagraph();
102-
cy.get('textarea[data-test-subj="editorArea-0"]').should('not.exist');
103-
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
104-
cy.get('code').contains('POST').should('exist');
105118
cy.get('td').contains('b2').should('exist');
106119
});
107120
});
@@ -114,35 +127,39 @@ describe('Test reporting integration if plugin installed', () => {
114127
skipOn($body.find('#reportingActionsButton').length <= 0);
115128
});
116129
makePopulatedParagraph();
130+
cy.get('.euiContextMenuPanel').should('not.exist');
131+
cy.get('button[data-test-subj="reporting-actions-button"]').should(
132+
'be.visible'
133+
);
134+
cy.get('button[data-test-subj="reporting-actions-button"]').click();
117135
});
118136

119-
afterEach(() => {
120-
cy.get('@notebook').then((notebook) => {
121-
deleteNotebook(notebook.name);
122-
});
137+
after(() => {
138+
deleteAllNotebooks();
123139
});
124140

125141
it('Create in-context PDF report from notebook', () => {
126-
cy.get('#reportingActionsButton').click();
127142
cy.get('button.euiContextMenuItem:nth-child(1)')
128143
.contains('Download PDF')
129-
.click();
130-
cy.get('body').contains('Please continue report generation in the new tab');
144+
.click({ force: true });
145+
cy.get('body')
146+
.contains('Please continue report generation in the new tab')
147+
.should('exist');
131148
});
132149

133150
it('Create in-context PNG report from notebook', () => {
134-
cy.get('#reportingActionsButton').click();
135151
cy.get('button.euiContextMenuItem:nth-child(2)')
136152
.contains('Download PNG')
137-
.click();
138-
cy.get('body').contains('Please continue report generation in the new tab');
153+
.click({ force: true });
154+
cy.get('body')
155+
.contains('Please continue report generation in the new tab')
156+
.should('exist');
139157
});
140158

141159
it('Create on-demand report definition from context menu', () => {
142-
cy.get('#reportingActionsButton').click();
143160
cy.get('button.euiContextMenuItem:nth-child(3)')
144161
.contains('Create report definition')
145-
.click();
162+
.click({ force: true });
146163
cy.location('pathname', { timeout: delayTime * 3 }).should(
147164
'include',
148165
'/reports-dashboards'
@@ -152,10 +169,9 @@ describe('Test reporting integration if plugin installed', () => {
152169
});
153170

154171
it('View reports homepage from context menu', () => {
155-
cy.get('#reportingActionsButton').click();
156172
cy.get('button.euiContextMenuItem:nth-child(4)')
157173
.contains('View reports')
158-
.click();
174+
.click({ force: true });
159175
cy.location('pathname', { timeout: delayTime * 3 }).should(
160176
'include',
161177
'/reports-dashboards'

0 commit comments

Comments
 (0)