@@ -52,28 +52,46 @@ const makePopulatedParagraph = () => {
52
52
cy . get ( 'textarea[data-test-subj="editorArea-0"]' ) . focus ( ) ;
53
53
cy . get ( 'textarea[data-test-subj="editorArea-0"]' ) . type ( MARKDOWN_TEXT ) ;
54
54
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' ) ;
55
58
} ;
56
59
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
+ } ;
59
70
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 ( ) ;
63
77
64
- cy . get ( '[data-test-subj="deleteSelectedNotebooks "]' ) . click ( ) ;
78
+ cy . get ( '[data-test-subj="globalLoadingIndicator "]' ) . should ( 'not.exist' ) ;
65
79
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 ( ) ;
67
86
cy . get ( 'input[data-test-subj="delete-notebook-modal-input"]' ) . type ( 'delete' ) ;
68
87
cy . get ( 'button[data-test-subj="delete-notebook-modal-delete-button"]' ) . should (
69
88
'not.be.disabled'
70
89
) ;
71
90
cy . get (
72
91
'button[data-test-subj="delete-notebook-modal-delete-button"]'
73
92
) . click ( ) ;
74
- moveToNotebookHome ( ) ;
75
93
76
- cy . contains ( '.euiTableRow' , notebookName ) . should ( 'not.exist' ) ;
94
+ cy . wait ( '@deleteNotebook' ) . its ( 'response.statusCode' ) . should ( 'eq' , 200 ) ;
77
95
} ;
78
96
79
97
describe ( 'Testing notebook actions' , ( ) => {
@@ -83,9 +101,7 @@ describe('Testing notebook actions', () => {
83
101
} ) ;
84
102
85
103
afterEach ( ( ) => {
86
- cy . get ( '@notebook' ) . then ( ( notebook ) => {
87
- deleteNotebook ( notebook . name ) ;
88
- } ) ;
104
+ deleteNotebook ( ) ;
89
105
} ) ;
90
106
91
107
it ( 'Creates a code paragraph' , ( ) => {
@@ -99,9 +115,6 @@ describe('Testing notebook actions', () => {
99
115
100
116
it ( 'Renders markdown' , ( ) => {
101
117
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' ) ;
105
118
cy . get ( 'td' ) . contains ( 'b2' ) . should ( 'exist' ) ;
106
119
} ) ;
107
120
} ) ;
@@ -114,35 +127,39 @@ describe('Test reporting integration if plugin installed', () => {
114
127
skipOn ( $body . find ( '#reportingActionsButton' ) . length <= 0 ) ;
115
128
} ) ;
116
129
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 ( ) ;
117
135
} ) ;
118
136
119
- afterEach ( ( ) => {
120
- cy . get ( '@notebook' ) . then ( ( notebook ) => {
121
- deleteNotebook ( notebook . name ) ;
122
- } ) ;
137
+ after ( ( ) => {
138
+ deleteAllNotebooks ( ) ;
123
139
} ) ;
124
140
125
141
it ( 'Create in-context PDF report from notebook' , ( ) => {
126
- cy . get ( '#reportingActionsButton' ) . click ( ) ;
127
142
cy . get ( 'button.euiContextMenuItem:nth-child(1)' )
128
143
. 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' ) ;
131
148
} ) ;
132
149
133
150
it ( 'Create in-context PNG report from notebook' , ( ) => {
134
- cy . get ( '#reportingActionsButton' ) . click ( ) ;
135
151
cy . get ( 'button.euiContextMenuItem:nth-child(2)' )
136
152
. 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' ) ;
139
157
} ) ;
140
158
141
159
it ( 'Create on-demand report definition from context menu' , ( ) => {
142
- cy . get ( '#reportingActionsButton' ) . click ( ) ;
143
160
cy . get ( 'button.euiContextMenuItem:nth-child(3)' )
144
161
. contains ( 'Create report definition' )
145
- . click ( ) ;
162
+ . click ( { force : true } ) ;
146
163
cy . location ( 'pathname' , { timeout : delayTime * 3 } ) . should (
147
164
'include' ,
148
165
'/reports-dashboards'
@@ -152,10 +169,9 @@ describe('Test reporting integration if plugin installed', () => {
152
169
} ) ;
153
170
154
171
it ( 'View reports homepage from context menu' , ( ) => {
155
- cy . get ( '#reportingActionsButton' ) . click ( ) ;
156
172
cy . get ( 'button.euiContextMenuItem:nth-child(4)' )
157
173
. contains ( 'View reports' )
158
- . click ( ) ;
174
+ . click ( { force : true } ) ;
159
175
cy . location ( 'pathname' , { timeout : delayTime * 3 } ) . should (
160
176
'include' ,
161
177
'/reports-dashboards'
0 commit comments