1+ import { defaultCypherQuery , tableCypherQuery } from "../fixtures/cypher_queries"
2+
3+ describe ( 'The Dashboard Page' , ( ) => {
4+ beforeEach ( ( ) => {
5+ // Navigate to index
6+ cy . visit ( '/' )
7+ cy . get ( '#form-dialog-title' ) . should ( 'contain' , 'NeoDash - Neo4j Dashboard Builder' )
8+
9+ // Create new dashboard
10+ cy . contains ( 'New Dashboard' ) . click ( )
11+ cy . wait ( 300 )
12+ cy . get ( '#form-dialog-title' ) . should ( 'contain' , 'Connect to Neo4j' )
13+
14+ // Connect to Neo4j database
15+ cy . get ( '#protocol' ) . click ( )
16+ cy . contains ( 'neo4j+s' ) . click ( )
17+ cy . get ( '#url' ) . clear ( ) . type ( 'demo.neo4jlabs.com' )
18+ cy . get ( '#database' ) . type ( 'movies' )
19+ cy . get ( '#dbusername' ) . clear ( ) . type ( 'movies' )
20+ cy . get ( '#dbpassword' ) . type ( 'movies' )
21+ cy . get ( 'button' ) . contains ( 'Connect' ) . click ( )
22+ } )
23+
24+ it ( 'initializes the dashboard' , ( ) => {
25+ // Check the starter cards
26+ cy . get ( 'main .MuiGrid-item:eq(0)' ) . should ( 'contain' , "This is your first dashboard!" )
27+ cy . get ( 'main .MuiGrid-item:eq(1) .force-graph-container canvas' ) . should ( 'be.visible' )
28+ cy . get ( 'main .MuiGrid-item:eq(2) button' ) . should ( 'have.attr' , 'aria-label' , 'add' )
29+ } )
30+
31+ it ( 'creates a new card' , ( ) => {
32+ cy . get ( 'main .MuiGrid-item:eq(2) button' ) . click ( )
33+ cy . get ( 'main .MuiGrid-item:eq(2)' ) . should ( 'contain' , 'No query specified.' )
34+ } )
35+
36+ // Test each type of card
37+ it ( 'creates a table report' , ( ) => {
38+ cy . get ( 'main .MuiGrid-item:eq(2) button' ) . click ( )
39+ cy . get ( 'main .MuiGrid-item:eq(2) button[aria-label="settings"]' ) . click ( )
40+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiInputLabel-root' ) . contains ( "Type" ) . next ( ) . should ( 'contain' , 'Table' )
41+ cy . get ( 'main .MuiGrid-item:eq(2) .ReactCodeMirror' ) . type ( tableCypherQuery )
42+ cy . get ( 'main .MuiGrid-item:eq(2) button[aria-label="save"]' ) . click ( )
43+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiDataGrid-columnHeaders' ) . should ( 'contain' , 'title' ) . and ( 'contain' , 'released' )
44+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiDataGrid-virtualScroller .MuiDataGrid-row' ) . should ( 'have.length' , 5 )
45+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiDataGrid-footerContainer' ) . should ( 'contain' , '1–5 of 8' )
46+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiDataGrid-footerContainer button[aria-label="Go to next page"]' ) . click ( )
47+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiDataGrid-virtualScroller .MuiDataGrid-row' ) . should ( 'have.length' , 3 )
48+ cy . get ( 'main .MuiGrid-item:eq(2) .MuiDataGrid-footerContainer' ) . should ( 'contain' , '6–8 of 8' )
49+ } )
50+
51+ // Test card deletion
52+
53+ // Test create/delete new page
54+
55+ // Test load dashboard from file
56+ // Niels to provide file test case
57+
58+ // Test opening existing dashboard ?
59+ } )
0 commit comments