@@ -73,12 +73,6 @@ describe('Dashboards', () => {
7373
7474 cy . getByTestID ( 'dashboard-card' ) . should ( 'contain' , newName )
7575
76- // Open Export overlay
77- cy . getByTestID ( 'context-menu-dashboard' ) . click ( )
78- cy . getByTestID ( 'context-export-dashboard' ) . click ( )
79- cy . getByTestID ( 'export-overlay--text-area' ) . should ( 'exist' )
80- cy . get ( '.cf-overlay--dismiss' ) . click ( )
81-
8276 // Create from header
8377 cy . getByTestID ( 'add-resource-dropdown--button' ) . click ( )
8478 cy . getByTestID ( 'add-resource-dropdown--new' ) . click ( )
@@ -150,105 +144,6 @@ describe('Dashboards', () => {
150144 cy . getByTestID ( 'empty-dashboards-list' ) . should ( 'exist' )
151145 } )
152146
153- it ( 'can import as JSON or file' , ( ) => {
154- const checkImportedDashboard = ( ) => {
155- // wait for importing done
156- cy . intercept ( 'POST' , '/api/v2/dashboards/*/cells' ) . as ( 'createCells' )
157- // create cell 1
158- cy . wait ( '@createCells' )
159- // create cell 2
160- cy . wait ( '@createCells' )
161- cy . getByTestID ( 'dashboard-card--name' )
162- . should ( 'contain' , 'IMPORT dashboard' )
163- . click ( )
164- cy . getByTestID ( 'cell Name this Cell' ) . within ( ( ) => {
165- cy . get ( '.markdown-cell--contents' ) . should (
166- 'contain' ,
167- 'Note about no tea'
168- )
169- } )
170- cy . getByTestID ( 'cell cellll' ) . should ( 'exist' )
171-
172- // return to previous page
173- cy . fixture ( 'routes' ) . then ( ( { orgs} ) => {
174- cy . get < Organization > ( '@org' ) . then ( ( { id} : Organization ) => {
175- cy . visit ( `${ orgs } /${ id } /dashboards-list` )
176- cy . getByTestID ( 'tree-nav' )
177- } )
178- } )
179- }
180-
181- // import dashboard from file
182- cy . getByTestID ( 'add-resource-dropdown--button' )
183- . first ( )
184- . click ( )
185- cy . getByTestID ( 'add-resource-dropdown--import' ) . click ( )
186-
187- cy . getByTestID ( 'drag-and-drop--input' ) . attachFile ( {
188- filePath : 'dashboard-import.json' ,
189- } )
190-
191- cy . getByTestID ( 'submit-button Dashboard' ) . click ( )
192- checkImportedDashboard ( )
193-
194- // delete dashboard before reimport
195- cy . getByTestID ( 'dashboard-card' )
196- . first ( )
197- . trigger ( 'mouseover' )
198- . within ( ( ) => {
199- cy . getByTestID ( 'context-delete-menu--button' ) . click ( )
200- } )
201- cy . getByTestID ( 'context-delete-menu--confirm-button' ) . click ( )
202-
203- // dashboard no longer exists
204- cy . getByTestID ( 'dashboard-card' ) . should ( 'not.exist' )
205-
206- // import dashboard as json
207- cy . getByTestID ( 'add-resource-dropdown--button' )
208- . first ( )
209- . click ( )
210- cy . getByTestID ( 'add-resource-dropdown--import' ) . click ( )
211-
212- cy . getByTestID ( 'select-group' )
213- . contains ( 'Paste' )
214- . click ( )
215-
216- cy . fixture ( 'dashboard-import.json' ) . then ( json => {
217- cy . getByTestID ( 'import-overlay--textarea' )
218- . should ( 'be.visible' )
219- . click ( )
220- . type ( JSON . stringify ( json ) , { parseSpecialCharSequences : false } )
221- } )
222-
223- cy . getByTestID ( 'submit-button Dashboard' ) . click ( )
224- checkImportedDashboard ( )
225- } )
226-
227- it ( 'keeps user input in text area when attempting to import invalid JSON' , ( ) => {
228- cy . getByTestID ( 'page-control-bar' ) . within ( ( ) => {
229- cy . getByTestID ( 'add-resource-dropdown--button' ) . click ( )
230- } )
231-
232- cy . getByTestID ( 'add-resource-dropdown--import' ) . click ( )
233- cy . contains ( 'Paste' ) . click ( )
234- cy . getByTestID ( 'import-overlay--textarea' )
235- . click ( )
236- . type ( 'this is invalid JSON' )
237- cy . get ( 'button[title*="Import JSON"]' ) . click ( )
238- cy . getByTestID ( 'import-overlay--textarea--error' ) . should ( 'have.length' , 1 )
239- cy . getByTestID ( 'import-overlay--textarea' ) . should ( $s =>
240- expect ( $s ) . to . contain ( 'this is invalid JSON' )
241- )
242- cy . getByTestID ( 'import-overlay--textarea' ) . type (
243- '{backspace}{backspace}{backspace}{backspace}{backspace}'
244- )
245- cy . get ( 'button[title*="Import JSON"]' ) . click ( )
246- cy . getByTestID ( 'import-overlay--textarea--error' ) . should ( 'have.length' , 1 )
247- cy . getByTestID ( 'import-overlay--textarea' ) . should ( $s =>
248- expect ( $s ) . to . contain ( 'this is invalid' )
249- )
250- } )
251-
252147 describe ( 'cloning' , ( ) => {
253148 const localDashName = 'Happy Dashboard'
254149 const labelName = 'bark'
@@ -691,34 +586,8 @@ describe('Dashboards', () => {
691586 cy . getByTestID ( 'save-note--button' ) . click ( ) // note added to add content to be downloaded in the JSON file
692587 cy . getByTestID ( 'nav-item-dashboards' ) . click ( )
693588 cy . getByTestID ( 'dashboard-card' ) . invoke ( 'hover' )
694- cy . getByTestID ( 'context-menu-dashboard' ) . click ( )
695- cy . getByTestID ( 'context-export-dashboard' ) . click ( )
696- cy . getByTestID ( 'form-container' ) . should ( 'be.visible' )
697- cy . getByTestID ( 'export-overlay--text-area' ) . should ( 'be.visible' )
698- cy . getByTestID ( 'button' ) . click ( )
699- // readFile has a 4s timeout before the test fails
700- cy . readFile ( 'cypress/downloads/dashboard.json' ) . should ( 'not.be.null' )
701589 } )
702590
703- it ( 'copies to clipboard' , ( ) => {
704- cy . get < Organization > ( '@org' ) . then ( ( { id : orgID } : Organization ) => {
705- cy . createDashboard ( orgID ) . then ( ( { body} ) => {
706- cy . fixture ( 'routes' ) . then ( ( { orgs} ) => {
707- cy . visit ( `${ orgs } /${ orgID } /dashboards/${ body . id } ` )
708- } )
709- } )
710- } )
711- cy . getByTestID ( 'tree-nav' )
712- cy . window ( ) . then ( win => {
713- cy . stub ( win , 'prompt' ) . returns ( 'DISABLED WINDOW PROMPT' ) // disable pop-up prompt
714- } )
715- cy . getByTestID ( 'nav-item-dashboards' ) . click ( )
716- cy . getByTestID ( 'dashboard-card' ) . invoke ( 'hover' )
717- cy . getByTestID ( 'context-menu-dashboard' ) . click ( )
718- cy . getByTestID ( 'context-export-dashboard' ) . click ( )
719- cy . getByTestID ( 'button-copy' ) . click ( )
720- cy . getByTestID ( 'notification-success--children' ) . should ( 'be.visible' )
721- } )
722591 it ( 'changes time range' , ( ) => {
723592 const dashName = 'dashboard'
724593 const newDate = new Date ( )
0 commit comments