Skip to content

Commit 4dd7e99

Browse files
Separate new & old queries frame, use SHOW TRANSACTIONS instead of dbms.listQueries (#1752)
* Separate new & old queries frame & use SHOW TRANSACTIONS * Show error message rather than object object * Update tests
1 parent 1eaf9e4 commit 4dd7e99

File tree

5 files changed

+605
-266
lines changed

5 files changed

+605
-266
lines changed

e2e_tests/integration/auto-prefix.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ describe(':auto prefix in browser', () => {
4747
if (Cypress.config('serverVersion') >= 4.4) {
4848
it('shows help link when running CALL IN TRANSACTIONS without :auto', () => {
4949
cy.executeCommand(
50-
`MATCH (n) WITH n CALL {{} CALL db.ping() YIELD SUCCESS {}} IN TRANSACTIONS`
50+
`MATCH (n) WITH n CALL {{} CALL db.ping() YIELD success {}} IN TRANSACTIONS`
5151
)
5252
cy.getFrames().contains('ERROR')
5353
cy.getFrames().contains(':auto')
5454
})
5555

5656
it('adding :auto enables running CALL IN TRANSACTIONS', () => {
5757
cy.executeCommand(
58-
`:auto MATCH (n) WITH n CALL {{} CALL db.ping() YIELD SUCCESS {}} IN TRANSACTIONS`
58+
`:auto MATCH (n) WITH n CALL {{} CALL db.ping() YIELD success {}} IN TRANSACTIONS`
5959
)
6060
cy.getFrames().should('not.contain', 'ERROR')
6161
cy.getFrames().contains('(no changes, no records)')

e2e_tests/integration/loadcsv.spec.ts

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,46 @@ describe('LOAD CSV', () => {
3030
cy.connect('neo4j', password)
3131
})
3232
it('imports without periodic commit', () => {
33-
if (!Cypress.config('includeImportTests')) {
34-
return
35-
}
36-
cy.executeCommand(':clear')
37-
cy.executeCommand('MATCH (n) DETACH DELETE n')
38-
cy.executeCommand(`LOAD CSV WITH HEADERS FROM 'file:///import.csv' AS row{shift}{enter}
33+
if (Cypress.config('includeImportTests')) {
34+
cy.executeCommand(':clear')
35+
cy.executeCommand('MATCH (n) DETACH DELETE n')
36+
cy.executeCommand(`LOAD CSV WITH HEADERS FROM 'file:///import.csv' AS row{shift}{enter}
3937
CREATE (p:Person {{}name: row.name, born: toInteger(row.born), city: row.city, comment:row.comment});`)
4038

41-
cy.resultContains('Added 3 labels, created 3 nodes, set 11 properties,')
39+
cy.resultContains('Added 3 labels, created 3 nodes, set 11 properties,')
4240

43-
cy.executeCommand(
44-
'MATCH (n:Person {{}born: 2012}) RETURN n.city, n.comment'
45-
)
46-
cy.resultContains('"Borås"')
47-
cy.resultContains('"I like unicorns, and "flying unicorns""')
41+
cy.executeCommand(
42+
'MATCH (n:Person {{}born: 2012}) RETURN n.city, n.comment'
43+
)
44+
cy.resultContains('"Borås"')
45+
cy.resultContains('"I like unicorns, and "flying unicorns""')
46+
}
4847
})
4948
it('imports with periodic commit', () => {
5049
if (
51-
!Cypress.config('includeImportTests') &&
50+
Cypress.config('includeImportTests') &&
5251
Cypress.config('serverVersion') < 5
5352
) {
54-
return
55-
}
56-
const periodicQuery = `USING PERIODIC COMMIT 1{shift}{enter}
53+
const periodicQuery = `USING PERIODIC COMMIT 1{shift}{enter}
5754
LOAD CSV WITH HEADERS FROM 'file:///import.csv' AS row
5855
CREATE (p:Person {{}name: row.name, born: toInteger(row.born), city: row.city, comment:row.comment});`
5956

60-
// Let's see it fail when not using auto-committed tx's first
61-
cy.executeCommand(':clear')
62-
cy.executeCommand(periodicQuery)
63-
cy.resultContains('Neo.ClientError.Statement.SemanticError')
57+
// Let's see it fail when not using auto-committed tx's first
58+
cy.executeCommand(':clear')
59+
cy.executeCommand(periodicQuery)
60+
cy.resultContains('Neo.ClientError.Statement.SemanticError')
6461

65-
cy.executeCommand(':clear')
66-
cy.executeCommand('MATCH (n) DETACH DELETE n')
67-
cy.executeCommand(`:auto ${periodicQuery}`)
62+
cy.executeCommand(':clear')
63+
cy.executeCommand('MATCH (n) DETACH DELETE n')
64+
cy.executeCommand(`:auto ${periodicQuery}`)
6865

69-
cy.resultContains('Added 3 labels, created 3 nodes, set 11 properties,')
66+
cy.resultContains('Added 3 labels, created 3 nodes, set 11 properties,')
7067

71-
cy.executeCommand(
72-
'MATCH (n:Person {{}born: 2012}) RETURN n.city, n.comment'
73-
)
74-
cy.resultContains('"Borås"')
75-
cy.resultContains('"I like unicorns, and "flying unicorns""')
68+
cy.executeCommand(
69+
'MATCH (n:Person {{}born: 2012}) RETURN n.city, n.comment'
70+
)
71+
cy.resultContains('"Borås"')
72+
cy.resultContains('"I like unicorns, and "flying unicorns""')
73+
}
7674
})
7775
})

src/browser/modules/Stream/Queries/QueriesFrame.test.tsx renamed to src/browser/modules/Stream/Queries/LegacyQueriesFrame.test.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { fireEvent, render } from '@testing-library/react'
2121
import React from 'react'
2222
import { createBus } from 'suber'
2323

24-
import { QueriesFrame } from './QueriesFrame'
24+
import { LegacyQueriesFrame } from './LegacyQueriesFrame'
2525
import {
2626
CONNECTED_STATE,
2727
DISCONNECTED_STATE
@@ -41,7 +41,7 @@ it('shows error message in statusBar when not connected', () => {
4141
const props = {
4242
connectionState: DISCONNECTED_STATE
4343
} as any
44-
const { getByText } = render(<QueriesFrame {...props} />)
44+
const { getByText } = render(<LegacyQueriesFrame {...props} />)
4545

4646
expect(getByText(/Unable to connect to bolt server/i)).not.toBeNull()
4747
})
@@ -82,10 +82,12 @@ it('can list and kill queries', () => {
8282
isFullscreen: false,
8383
isCollapsed: false,
8484
isOnCausalCluster: false,
85-
canListQueries: true
85+
hasListQueriesProcedure: true,
86+
versionOverFive: false,
87+
frame: null
8688
}
8789

88-
const { getByText, getByTestId } = render(<QueriesFrame {...props} />)
90+
const { getByText, getByTestId } = render(<LegacyQueriesFrame {...props} />)
8991

9092
// Check that it's listed
9193
expect(getByText('neo4j://testhost.test')).not.toBeNull()

0 commit comments

Comments
 (0)