Skip to content

Commit f880666

Browse files
bastienhubert“Bastiennielsdejong
authored
Add possibility to hide Y axes and grid lines in BarChart (#895)
* Add possibility to hide Y axes and grid lines in BarChart * Add Husky prepare stage * Fix stacked grouped function test * Fix pie chart e2e test in start_page.cy * Add Bar chart Y axis e2e tests * Add Cypress support in eslintrc.json * Create Page helper class for Cypress * Update browserlist * Fix e2e bar tests by removing within --------- Co-authored-by: “Bastien <“[email protected]”> Co-authored-by: Niels de Jong <[email protected]>
1 parent 455ee42 commit f880666

File tree

15 files changed

+492
-648
lines changed

15 files changed

+492
-648
lines changed

.eslintrc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"extends": ["eslint:recommended", "prettier", "plugin:@typescript-eslint/recommended"], // this is optional
55
"env": {
66
"browser": true,
7-
"node": true
7+
"node": true,
8+
"jest": true
89
},
910
"settings": {
1011
"react": {
@@ -166,5 +167,9 @@
166167
],
167168
"symbol-description": "error",
168169
"yoda": "error"
170+
},
171+
"globals": {
172+
"cy": "readonly",
173+
"Cypress": "readonly"
169174
}
170175
}

cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default defineConfig({
55
projectId: 'a8nh14',
66
video: false,
77
e2e: {
8+
defaultCommandTimeout: 20000,
89
experimentalMemoryManagement: true,
910
numTestsKeptInMemory: 0,
1011
baseUrl: 'http://localhost:3000',

cypress/Page.js

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
const DB_URL = 'localhost';
2+
const DB_USERNAME = 'neo4j';
3+
const DB_PASSWORD = 'test1234';
4+
5+
export class Page {
6+
constructor(cardSelector) {
7+
this.cardSelector = cardSelector;
8+
}
9+
10+
init() {
11+
cy.viewport(1920, 1080);
12+
cy.visit('/', {
13+
onBeforeLoad(win) {
14+
win.localStorage.clear();
15+
},
16+
});
17+
return this;
18+
}
19+
20+
createNewDashboard() {
21+
cy.get('#form-dialog-title').then(($div) => {
22+
const text = $div.text();
23+
if (text == 'NeoDash - Neo4j Dashboard Builder') {
24+
cy.wait(100);
25+
// Create new dashboard
26+
cy.contains('New Dashboard').click();
27+
}
28+
});
29+
return this;
30+
}
31+
32+
connectToNeo4j() {
33+
cy.get('#form-dialog-title', { timeout: 20000 }).should('contain', 'Connect to Neo4j');
34+
cy.get('#url').clear().type(DB_URL);
35+
cy.get('#dbusername').clear().type(DB_USERNAME);
36+
cy.get('#dbpassword').type(DB_PASSWORD);
37+
cy.get('button').contains('Connect').click();
38+
cy.wait(100);
39+
return this;
40+
}
41+
42+
enableReportActions() {
43+
cy.get('main button[aria-label="Extensions').should('be.visible').click();
44+
cy.get('#checkbox-actions').scrollIntoView();
45+
cy.get('#checkbox-actions').should('be.visible').click();
46+
cy.get('.ndl-dialog-close').scrollIntoView().should('be.visible').click();
47+
cy.wait(100);
48+
return this;
49+
}
50+
51+
enableAdvancedVisualizations() {
52+
cy.get('main button[aria-label="Extensions').should('be.visible').click();
53+
cy.get('#checkbox-advanced-charts').should('be.visible').click();
54+
cy.get('.ndl-dialog-close').scrollIntoView().should('be.visible').click();
55+
cy.wait(100);
56+
return this;
57+
}
58+
59+
enableFormsExtension() {
60+
cy.get('main button[aria-label="Extensions').should('be.visible').click();
61+
cy.get('#checkbox-forms').scrollIntoView();
62+
cy.get('#checkbox-forms').should('be.visible').click();
63+
cy.get('.ndl-dialog-close').scrollIntoView().should('be.visible').click();
64+
cy.wait(100);
65+
return this;
66+
}
67+
68+
selectReportOfType(type) {
69+
cy.get('main .react-grid-item button[aria-label="add report"]').should('be.visible').click();
70+
cy.get('main .react-grid-item')
71+
.contains('No query specified.')
72+
.parentsUntil('.react-grid-item')
73+
.find('button[aria-label="settings"]', { timeout: 2000 })
74+
.should('be.visible')
75+
.click();
76+
cy.get(`${this.cardSelector} #type`, { timeout: 2000 }).should('be.visible').click();
77+
cy.contains(type).click();
78+
cy.wait(100);
79+
return this;
80+
}
81+
82+
createReportOfType(type, query, fast = false, run = true) {
83+
this.selectReportOfType(type);
84+
if (fast) {
85+
cy.get(`${this.cardSelector} .ReactCodeMirror`).type(query, {
86+
delay: 1,
87+
parseSpecialCharSequences: false,
88+
});
89+
} else {
90+
cy.get(`${this.cardSelector} .ReactCodeMirror`).type(query, { parseSpecialCharSequences: false });
91+
}
92+
cy.wait(400);
93+
94+
if (run) {
95+
this.closeSettings();
96+
}
97+
98+
cy.wait(100);
99+
return this;
100+
}
101+
102+
openSettings() {
103+
cy.get(this.cardSelector).find('button[aria-label="settings"]', { WAITING_TIME: 2000 }).click();
104+
cy.wait(100);
105+
return this;
106+
}
107+
108+
closeSettings() {
109+
cy.get(`${this.cardSelector} button[aria-label="run"]`).click();
110+
cy.wait(100);
111+
return this;
112+
}
113+
114+
openAdvancedSettings() {
115+
this.openSettings();
116+
cy.get(this.cardSelector).contains('Advanced settings').click();
117+
cy.wait(100);
118+
return this;
119+
}
120+
121+
closeAdvancedSettings() {
122+
cy.get(this.cardSelector).contains('Advanced settings').click();
123+
this.closeSettings();
124+
return this;
125+
}
126+
127+
openReportActionsMenu() {
128+
this.openSettings();
129+
cy.get(this.cardSelector).find('button[aria-label="custom actions"]').click();
130+
cy.wait(100);
131+
return this;
132+
}
133+
134+
updateDropdownAdvancedSetting(settingLabel, targetValue) {
135+
this.openAdvancedSettings();
136+
cy.get(`${this.cardSelector} .ndl-dropdown`).contains(settingLabel).siblings('div').click();
137+
cy.contains(targetValue).click();
138+
this.closeAdvancedSettings();
139+
return this;
140+
}
141+
142+
updateChartQuery(query) {
143+
this.openSettings();
144+
145+
cy.get(this.cardSelector)
146+
.find('.ndl-cypher-editor div[role="textbox"]')
147+
.should('be.visible')
148+
.click()
149+
.clear()
150+
.type(query);
151+
cy.wait(100);
152+
153+
this.closeSettings();
154+
return this;
155+
}
156+
}

0 commit comments

Comments
 (0)