1+ import { createDB2 } from '../../fixtures/cypher_queries' ;
2+ import { Page } from '../../Page' ;
3+
4+ const CARD_SELECTOR = 'main .react-grid-item:eq(2)' ;
5+ const page = new Page ( CARD_SELECTOR ) ;
6+
7+ // Ignore warnings that may appear when using the Cypress dev server
8+ Cypress . on ( 'uncaught:exception' , ( err , runnable ) => {
9+ console . log ( err , runnable ) ;
10+ return false ;
11+ } ) ;
12+
13+ describe ( 'Tests for change all db button' , ( ) => {
14+ beforeEach ( 'open neodash' , ( ) => {
15+ page . init ( ) . createNewDashboard ( ) . connectToNeo4j ( ) ;
16+ cy . wait ( 100 ) ;
17+ } ) ;
18+
19+ it ( 'Testing menu population' , ( ) => {
20+ //Create a second db
21+ page . createReportOfType ( 'Table' , createDB2 , true , true ) ;
22+
23+ //Check menus are populated
24+ page . selectReportDatabase ( 'db2' )
25+ cy . get ( '[style="padding-bottom: 6px; width: 440px; height: 430px; position: absolute; transform: translate(460px, 10px);"] > .n-bg-neutral-bg-weak > .MuiCollapse-entered > .MuiCollapse-wrapper > .MuiCollapse-wrapperInner > .MuiPaper-root > .card-view > .MuiCardHeader-root > .MuiCardHeader-action > .ndl-icon-btn' )
26+ . should ( 'be.visible' )
27+ . click ( )
28+ cy . get ( '.ndl-btn' ) . should ( 'be.visible' ) . click ( )
29+ cy . contains ( 'db2' )
30+ } ) ;
31+
32+ it ( 'Testing changing the dbs for all cards' , ( ) => {
33+ //Create a second db
34+ page . createReportOfType ( 'Table' , createDB2 , true , true ) ;
35+
36+ //Change all db button
37+ cy . get ( '.ndl-btn' ) . should ( 'be.visible' ) . click ( )
38+ cy . contains ( 'db2' ) . should ( 'be.visible' ) . click ( )
39+ cy . contains ( 'Continue' ) . should ( 'be.visible' ) . click ( )
40+ cy . get ( '[style="border-width: 1px; border-style: solid; color: rgb(var(--palette-primary-bg-strong)); border-color: rgb(var(--palette-primary-bg-strong)); border-radius: 8px;"] > .n-flex-row > .n-flex > .ndl-menu-item-title' )
41+ . should ( 'contain' , 'db2' )
42+
43+ //Check reports
44+ cy . get ( '[data-testid="popover-backdrop"]' ) . click ( )
45+
46+ //Report 1
47+ cy . get ( '[style="padding-bottom: 6px; transform: translate(909px, 10px); width: 440px; height: 430px; position: absolute;"] > .n-bg-neutral-bg-weak > .MuiCollapse-entered > .MuiCollapse-wrapper > .MuiCollapse-wrapperInner > .MuiPaper-root > .card-view > .MuiCardHeader-root > .MuiCardHeader-action > .ndl-icon-btn' )
48+ . should ( 'be.visible' )
49+ . click ( )
50+ cy . get ( '[data-test="database-dropdown"] > .css-b62m3t-container > .css-19x0je5-control > .css-1fdsijx-ValueContainer > .css-4zo8aq-Input' )
51+ . should ( 'be.visible' )
52+ . click ( )
53+ cy . get ( '#react-select-11-option-0' ) . should ( 'be.visible' ) . should ( 'contain' , 'db2' )
54+ cy . get ( '[style="padding-bottom: 6px; transform: translate(909px, 10px); width: 440px; height: 430px; position: absolute;"] > .n-bg-neutral-bg-weak > .MuiCollapse-entered > .MuiCollapse-wrapper > .MuiCollapse-wrapperInner > .MuiPaper-root > .card-view > .MuiCardHeader-root > .MuiCardHeader-action > .ndl-icon-btn' )
55+ . should ( 'be.visible' )
56+ . click ( )
57+
58+ //Report 2
59+ cy . get ( '[style="padding-bottom: 6px; width: 440px; height: 430px; position: absolute; transform: translate(460px, 10px);"] > .n-bg-neutral-bg-weak > .MuiCollapse-entered > .MuiCollapse-wrapper > .MuiCollapse-wrapperInner > .MuiPaper-root > .card-view > .MuiCardHeader-root > .MuiCardHeader-action > .ndl-icon-btn' )
60+ . should ( 'be.visible' )
61+ . click ( )
62+ cy . get ( '[style="padding-bottom: 6px; width: 440px; height: 430px; position: absolute; transform: translate(460px, 10px);"] > .n-bg-neutral-bg-weak > .MuiCollapse-entered > .MuiCollapse-wrapper > .MuiCollapse-wrapperInner > .MuiPaper-root > .card-view > .sc-bcXHqe > .MuiCardContent-root > [data-test="database-dropdown"] > .css-b62m3t-container > .css-19x0je5-control > .css-1fdsijx-ValueContainer > .css-4zo8aq-Input' )
63+ . should ( 'be.visible' )
64+ . click ( )
65+ cy . get ( '#react-select-15-option-0' ) . should ( 'be.visible' ) . should ( 'contain' , 'db2' )
66+ } ) ;
67+
68+ it ( 'Test no popover' , ( ) => {
69+ //Create a second db
70+ page . createReportOfType ( 'Table' , createDB2 , true , true ) ;
71+
72+ //Check menus are populated
73+ cy . get ( '.ndl-btn' ) . should ( 'be.visible' ) . click ( )
74+ cy . contains ( 'db2' ) . should ( 'be.visible' ) . click ( )
75+ cy . get ( '.ndl-form-item-label > input' ) . should ( 'be.visible' ) . click ( )
76+ cy . contains ( 'Continue' ) . should ( 'be.visible' ) . click ( )
77+ cy . get ( '[data-testid="popover-backdrop"]' ) . click ( )
78+
79+ //Click without popover
80+ cy . get ( '.ndl-btn' ) . should ( 'be.visible' ) . click ( )
81+ cy . get ( '[style=""] > .n-flex-row > .n-flex > .ndl-menu-item-title' ) . contains ( 'neo4j' ) . should ( 'be.visible' ) . click ( )
82+
83+ } ) ;
84+ } ) ;
0 commit comments