Skip to content

Commit ee74be8

Browse files
Fivedotzero e2e tests (#1745)
* rebase master * Simplify metaduck * update tests * update tests
1 parent e65be7a commit ee74be8

File tree

74 files changed

+598
-966
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+598
-966
lines changed

e2e_tests/integration/auto-prefix.spec.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,37 @@ describe(':auto prefix in browser', () => {
2828
cy.executeCommand(':clear')
2929
})
3030

31-
it('shows help link when running period commit without :auto', () => {
32-
cy.executeCommand('USING PERIODIC COMMIT RETURN "Verdanturf"')
33-
cy.getFrames().contains('ERROR')
34-
cy.getFrames().contains(':auto')
35-
})
31+
if (Cypress.config('serverVersion') < 5) {
32+
it('shows help link when running period commit without :auto', () => {
33+
cy.executeCommand('USING PERIODIC COMMIT RETURN "Verdanturf"')
34+
cy.getFrames().contains('ERROR')
35+
cy.getFrames().contains(':auto')
36+
})
3637

37-
it('adding :auto enables running periodic commit', () => {
38-
cy.executeCommand(':auto USING PERIODIC COMMIT RETURN "Laverre";')
39-
// the only valid PERIODIC COMMIT queries require csv files on
40-
// the server, so as a shortcut we're just looking for a new error message
41-
cy.getFrames().contains('ERROR')
42-
cy.getFrames().contains(/LOAD/i)
43-
})
38+
it('adding :auto enables running periodic commit', () => {
39+
cy.executeCommand(':auto USING PERIODIC COMMIT RETURN "Laverre";')
40+
// the only valid PERIODIC COMMIT queries require csv files on
41+
// the server, so as a shortcut we're just looking for a new error message
42+
cy.getFrames().contains('ERROR')
43+
cy.getFrames().contains(/LOAD/i)
44+
})
45+
}
4446

4547
if (Cypress.config('serverVersion') >= 4.4) {
4648
it('shows help link when running CALL IN TRANSACTIONS without :auto', () => {
4749
cy.executeCommand(
48-
'CALL {{} return "Dendemille" } IN TRANSACTIONS return "Dendemille";'
50+
`MATCH (n) WITH n CALL {{} CALL db.ping() YIELD SUCCESS {}} IN TRANSACTIONS`
4951
)
5052
cy.getFrames().contains('ERROR')
5153
cy.getFrames().contains(':auto')
5254
})
5355

5456
it('adding :auto enables running CALL IN TRANSACTIONS', () => {
5557
cy.executeCommand(
56-
':auto CALL {{} return "Undella" } IN TRANSACTIONS return "Undella";'
58+
`:auto MATCH (n) WITH n CALL {{} CALL db.ping() YIELD SUCCESS {}} IN TRANSACTIONS`
5759
)
5860
cy.getFrames().should('not.contain', 'ERROR')
59-
cy.getFrames().contains('"Undella"')
61+
cy.getFrames().contains('(no changes, no records)')
6062
})
6163
}
6264

e2e_tests/integration/data-export.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ describe('Data export', () => {
4343
})
4444
const tests = [
4545
{ panel: 'Visualization', expected: ['PNG', 'SVG'] },
46-
{ panel: 'Plan', expected: ['PNG', 'SVG'] }, // This test will fail in 5.0 -> one more option is enabled then
46+
{
47+
panel: 'Plan',
48+
expected: [
49+
...(Cypress.config('serverVersion') >= 5.0 ? ['TXT'] : []),
50+
'PNG',
51+
'SVG'
52+
]
53+
},
4754
{ panel: 'Table', expected: ['CSV', 'JSON'] },
4855
{ panel: 'Ascii', expected: ['CSV', 'JSON'] },
4956
{ panel: 'Code', expected: ['CSV', 'JSON'] }

e2e_tests/integration/debug-command.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
import { isAura } from '../support/utils'
2424

2525
describe(':debug command', () => {
26-
before(function() {
27-
cy.visit(Cypress.config('url'))
28-
.title()
29-
.should('include', 'Neo4j Browser')
26+
before(function () {
27+
cy.visit(Cypress.config('url')).title().should('include', 'Neo4j Browser')
3028
cy.wait(3000)
3129
})
3230
it('can `:debug` command when not connected', () => {
@@ -39,7 +37,6 @@ describe(':debug command', () => {
3937
frame
4038
.should('have.length', 1)
4139
.should('contain', 'serverConfig')
42-
.should('contain', '"proceduresReadable": false')
4340
.should('contain', '"serverConfigReadable": false')
4441
.should('contain', '"browser.allow_outgoing_connections": false')
4542
})
@@ -61,7 +58,6 @@ describe(':debug command', () => {
6158
frame
6259
.should('have.length', 1)
6360
.should('contain', 'serverConfig')
64-
.should('contain', '"proceduresReadable": true')
6561
.should('contain', '"serverConfigReadable": true')
6662
.should('contain', '"dbms.security.auth_enabled": true')
6763
})

e2e_tests/integration/loadcsv.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
/* global Cypress, cy, before */
2222

2323
describe('LOAD CSV', () => {
24-
before(function() {
25-
cy.visit(Cypress.config('url'))
26-
.title()
27-
.should('include', 'Neo4j Browser')
24+
before(function () {
25+
cy.visit(Cypress.config('url')).title().should('include', 'Neo4j Browser')
2826
cy.wait(3000)
2927
})
3028
it('can connect', () => {
@@ -49,7 +47,10 @@ describe('LOAD CSV', () => {
4947
cy.resultContains('"I like unicorns, and "flying unicorns""')
5048
})
5149
it('imports with periodic commit', () => {
52-
if (!Cypress.config('includeImportTests')) {
50+
if (
51+
!Cypress.config('includeImportTests') &&
52+
Cypress.config('serverVersion') < 5
53+
) {
5354
return
5455
}
5556
const periodicQuery = `USING PERIODIC COMMIT 1{shift}{enter}

e2e_tests/integration/plan.spec.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ import { isEnterpriseEdition } from '../support/utils'
2323
/* global Cypress, cy, before, after */
2424

2525
describe('Plan output', () => {
26-
before(function() {
27-
cy.visit(Cypress.config('url'))
28-
.title()
29-
.should('include', 'Neo4j Browser')
26+
before(function () {
27+
cy.visit(Cypress.config('url')).title().should('include', 'Neo4j Browser')
3028
cy.wait(3000)
3129
const password = Cypress.config('password')
3230
cy.connect('neo4j', password)
@@ -96,17 +94,16 @@ describe('Plan output', () => {
9694
cy.executeCommand(':clear')
9795
cy.executeCommand('CREATE (:Tag)')
9896
cy.executeCommand(':clear')
99-
cy.executeCommand(`PROFILE MATCH (tag:Tag){shift}{enter}
100-
WHERE tag.name IN ["Eutheria"]
101-
WITH tag
102-
MATCH (publication)-[:HAS_TAG]->(tag)
103-
WHERE SIZE((publication)-[:HAS_TAG]->()) = 1
104-
WITH publication, tag
105-
MATCH (expert)-[:PUBLISHED]->(publication)
106-
WITH expert, collect(DISTINCT publication) AS publications, count(DISTINCT publication) AS relevantNumberOfPublications
107-
RETURN expert.name, publications, relevantNumberOfPublications, 1 AS relevantNumberOfTags
108-
ORDER BY relevantNumberOfPublications DESC
109-
LIMIT 50;`)
97+
cy.executeCommand(`PROFILE MATCH (tag:Tag){shift}{enter}WHERE tag.name IN ["Eutheria"]
98+
WITH tag
99+
MATCH (publication)-[:HAS_TAG]->(tag)
100+
WHERE SIZE([(publication)-[:HAS_TAG]->() | publication]) = 1
101+
WITH publication, tag
102+
MATCH (expert)-[:PUBLISHED]->(publication)
103+
WITH expert, collect(DISTINCT publication) AS publications, count(DISTINCT publication) AS relevantNumberOfPublications
104+
RETURN expert.name, publications, relevantNumberOfPublications, 1 AS relevantNumberOfTags
105+
ORDER BY relevantNumberOfPublications DESC
106+
LIMIT 50;`)
110107
cy.get('[data-testid="planExpandButton"]', { timeout: 10000 }).click()
111108
const el = cy.get('[data-testid="planSvg"]', { timeout: 10000 })
112109
el.then($el => {
@@ -136,7 +133,7 @@ describe('Plan output', () => {
136133

137134
cy.executeCommand(':clear')
138135
cy.executeCommand(
139-
'profile match (n:Person) with n where size ( (n)-[:Follows]->()) > 6 return n;'
136+
'profile match (n:Person) with n where size ([(n)-[:Follows]->() | n]) > 6 return n;'
140137
)
141138
cy.get('[data-testid="planExpandButton"]', { timeout: 10000 }).click()
142139
const el2 = cy.get('[data-testid="planSvg"]', { timeout: 10000 })

e2e_tests/integration/schema-frame.spec.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@
2121
/* global Cypress, cy, before */
2222

2323
describe('Schema Frame', () => {
24-
before(function() {
25-
cy.visit(Cypress.config('url'))
26-
.title()
27-
.should('include', 'Neo4j Browser')
24+
before(function () {
25+
cy.visit(Cypress.config('url')).title().should('include', 'Neo4j Browser')
2826
cy.wait(3000)
2927
})
3028
it('can connect', () => {
3129
const password = Cypress.config('password')
3230
cy.connect('neo4j', password)
3331
})
3432
describe('renders schema', () => {
35-
before(function() {
33+
before(function () {
3634
cy.executeCommand(
3735
'CREATE (n:SchemaTest {{}prop1: "foo", prop2: "bar"{}})'
3836
)
@@ -45,20 +43,30 @@ describe('Schema Frame', () => {
4543
cy.executeCommand('CREATE INDEX ON :SchemaTest(prop1, prop2)')
4644
}
4745

48-
cy.executeCommand(
49-
'CREATE CONSTRAINT ON (n:SchemaTest) ASSERT n.prop1 IS UNIQUE'
50-
)
46+
if (Cypress.config('serverVersion') >= 5.0) {
47+
cy.executeCommand(
48+
'CREATE CONSTRAINT testConstraint FOR (n:SchemaTest) REQUIRE n.prop1 IS UNIQUE'
49+
)
50+
} else {
51+
cy.executeCommand(
52+
'CREATE CONSTRAINT ON (n:SchemaTest) ASSERT n.prop1 IS UNIQUE'
53+
)
54+
}
5155
})
52-
after(function() {
56+
after(function () {
5357
if (Cypress.config('serverVersion') >= 4.0) {
5458
cy.executeCommand('DROP INDEX compositeIndex')
5559
} else {
5660
cy.executeCommand('DROP INDEX ON :SchemaTest(prop1, prop2)')
5761
}
5862

59-
cy.executeCommand(
60-
'DROP CONSTRAINT ON (n:SchemaTest) ASSERT n.prop1 IS UNIQUE'
61-
)
63+
if (Cypress.config('serverVersion') >= 5.0) {
64+
cy.executeCommand('DROP CONSTRAINT testConstraint')
65+
} else {
66+
cy.executeCommand(
67+
'DROP CONSTRAINT ON (n:SchemaTest) ASSERT n.prop1 IS UNIQUE'
68+
)
69+
}
6270
cy.executeCommand('MATCH (n:SchemaTest ) DETACH DELETE n')
6371
})
6472

src/browser/components/ManualLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import semver from 'semver'
2424
import { DrawerExternalLink } from './drawer/drawer-styled'
2525
import { formatDocVersion } from 'browser/modules/Sidebar/docsUtils'
2626
import { GlobalState } from 'project-root/src/shared/globalState'
27-
import { getVersion } from 'shared/modules/dbMeta/state'
27+
import { getRawVersion } from 'shared/modules/dbMeta/dbMetaDuck'
2828

2929
const movedPages: { [key: string]: { oldPage: string; oldContent: string } } = {
3030
'/administration/indexes-for-search-performance/': {
@@ -86,7 +86,7 @@ export function ManualLink({
8686
}
8787

8888
const mapStateToProps = (state: GlobalState) => ({
89-
neo4jVersion: getVersion(state)
89+
neo4jVersion: getRawVersion(state)
9090
})
9191

9292
export default connect(mapStateToProps)(ManualLink)

src/browser/modules/App/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import {
7373
getEdition,
7474
isServerConfigDone,
7575
shouldAllowOutgoingConnections
76-
} from 'shared/modules/dbMeta/state'
76+
} from 'shared/modules/dbMeta/dbMetaDuck'
7777
import {
7878
CONNECTION_ID,
7979
INJECTED_DISCOVERY

src/browser/modules/DBMSInfo/DBMSInfo.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
} from 'shared/modules/commands/commandsDuck'
3838
import { getUseDb } from 'shared/modules/connections/connectionsDuck'
3939
import { getCurrentUser } from 'shared/modules/currentUser/currentUserDuck'
40-
import { getDatabases } from 'shared/modules/dbMeta/state'
40+
import { getDatabases } from 'shared/modules/dbMeta/dbMetaDuck'
4141
import { getGraphStyleData } from 'shared/modules/grass/grassDuck'
4242

4343
export function DBMSInfo(props: any): JSX.Element {
@@ -79,7 +79,7 @@ export function DBMSInfo(props: any): JSX.Element {
7979
/>
8080
<LabelItems
8181
count={nodes}
82-
labels={labels.slice(0, maxLabelsCount).map((l: any) => l.val)}
82+
labels={labels.slice(0, maxLabelsCount)}
8383
totalNumItems={labels.length}
8484
onItemClick={onItemClick}
8585
onMoreClick={onMoreLabelsClick}
@@ -88,19 +88,15 @@ export function DBMSInfo(props: any): JSX.Element {
8888
/>
8989
<RelationshipItems
9090
count={relationships}
91-
relationshipTypes={relationshipTypes
92-
.slice(0, maxRelationshipsCount)
93-
.map((l: any) => l.val)}
91+
relationshipTypes={relationshipTypes.slice(0, maxRelationshipsCount)}
9492
onItemClick={onItemClick}
9593
totalNumItems={relationshipTypes.length}
9694
onMoreClick={onMoreRelationshipsClick}
9795
moreStep={moreStep}
9896
graphStyleData={props.graphStyleData}
9997
/>
10098
<PropertyItems
101-
properties={properties
102-
.slice(0, maxPropertiesCount)
103-
.map((l: any) => l.val)}
99+
properties={properties.slice(0, maxPropertiesCount)}
104100
onItemClick={onItemClick}
105101
totalNumItems={properties.length}
106102
onMoreClick={onMorePropertiesClick}

src/browser/modules/DBMSInfo/DatabaseKernelInfo.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ import {
4545
getDatabases,
4646
getEdition,
4747
getStoreSize,
48-
getVersion
49-
} from 'shared/modules/dbMeta/state'
48+
getRawVersion
49+
} from 'shared/modules/dbMeta/dbMetaDuck'
5050
import { getUsedDbName } from 'shared/modules/features/versionedFeatures'
5151

5252
type DatabaseKernelInfo = {
@@ -134,7 +134,7 @@ export const DatabaseKernelInfo = ({
134134

135135
const mapStateToProps = (state: any) => {
136136
return {
137-
version: getVersion(state),
137+
version: getRawVersion(state),
138138
edition: getEdition(state),
139139
dbName: getUsedDbName(state),
140140
storeSize: getStoreSize(state),

0 commit comments

Comments
 (0)