Skip to content

Commit

Permalink
Merge pull request #1098 from oskarhane/bump-deps
Browse files Browse the repository at this point in the history
Support new bolt schemes
  • Loading branch information
oskarhane authored May 20, 2020
2 parents 6a30bfc + e896114 commit f17502d
Show file tree
Hide file tree
Showing 29 changed files with 2,462 additions and 1,812 deletions.
105 changes: 105 additions & 0 deletions e2e_tests/integration/connect-form.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2002-2020 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { isAura, isEnterpriseEdition, stripScheme } from '../support/utils'

/* global Cypress, cy, test, expect, before */

const getBoltUrlField = () => cy.get('input[data-testid="boltaddress"]')
const getBoltSchemeSelect = () =>
cy.get('select[data-testid="bolt-scheme-select"]')
const getFirstFrameStatusbar = () =>
cy.get('[data-testid="frameStatusbar"]').first()
const getFirstFrameCommand = () =>
cy.get('[data-testid="frameCommand"]').first()

describe('Connect form', () => {
before(function() {
cy.visit(Cypress.config('url'))
.title()
.should('include', 'Neo4j Browser')
cy.wait(3000)
})

it('extracts the scheme from the bolt url entered', () => {
const scheme = 'bolt://'
const host = 'localhost:1212'
getBoltUrlField()
.clear()
.type(scheme + host)

getBoltUrlField().should('have.value', host)
getBoltSchemeSelect().should('have.value', scheme)
})
it('extracts the scheme from the bolt url entered with encryption flag', () => {
const scheme = 'neo4j+s://'
const nonSecureScheme = 'neo4j://'
const host = 'localhost:7687'
getBoltUrlField()
.clear()
.type(scheme + host)

getBoltUrlField().should('have.value', host)
getBoltSchemeSelect().should('have.value', nonSecureScheme)
})
it('aliases bolt+routing:// to neo4j://', () => {
getBoltSchemeSelect().select('bolt://')
const scheme = 'bolt+routing://'
const aliasScheme = 'neo4j://'
const host = 'localhost:7687'
getBoltUrlField()
.clear()
.type(scheme + host)

getBoltUrlField().should('have.value', host)
getBoltSchemeSelect().should('have.value', aliasScheme)
})

it('can connect with bolt:// protocol', () => {
cy.executeCommand(':clear')
const boltUrl = 'bolt://' + stripScheme(Cypress.config('boltUrl'))
cy.connect('neo4j', Cypress.config('password'), boltUrl)
cy.executeCommand(':server disconnect')
})
// Check auto switching protocols for non supporting neo4j://
if (Cypress.config('serverVersion') < 4.0) {
it('browser auto-connects with bolt:// protocol after neo4j:// failed with routing issues', () => {
cy.executeCommand(':clear')
const boltUrl = 'neo4j://' + stripScheme(Cypress.config('boltUrl'))
cy.connect('neo4j', Cypress.config('password'), boltUrl, false)
getFirstFrameStatusbar().should(
'contain',
'Automatic retry using the "bolt://"'
)
cy.wait(7000) // auto retry is in 5 secs
getFirstFrameCommand().should('contain', ':play start')
cy.executeCommand(':server disconnect')
cy.executeCommand(':clear')
})
}
if (Cypress.config('serverVersion') >= 4.0) {
it('can connect with the neo4j:// scheme', () => {
cy.executeCommand(':clear')
const boltUrl = 'neo4j://' + stripScheme(Cypress.config('boltUrl'))
cy.connect('neo4j', Cypress.config('password'), boltUrl)
cy.executeCommand(':server disconnect')
})
}
})
6 changes: 5 additions & 1 deletion e2e_tests/integration/multi-db.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ describe('Multi database', () => {

cy.executeCommand('STOP DATABASE test1')
cy.wait(1000)
cy.resultContains('no changes, no records')
if (Cypress.config('serverVersion') >= 4.1) {
cy.resultContains('1 system update, no records')
} else {
cy.resultContains('no changes, no records')
}

cy.executeCommand('DROP DATABASE test1')
cy.executeCommand(':clear')
Expand Down
8 changes: 8 additions & 0 deletions e2e_tests/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,11 @@ const getBoltConfig = (config, type) => {
}
return obj
}

export const stripScheme = url => {
const [_scheme, ...rest] = (url || '').split('://')
if (!rest || !rest.length) {
return _scheme
}
return rest.join('://')
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"build": "NODE_ENV=\"production\" webpack --config ./build_scripts/webpack.config.js",
"dev": "jest --watch",
"e2e": "cypress run",
"e2e-open": "cypress open",
"e2e-aura": "CYPRESS_E2E_TEST_ENV=\"aura\" cypress run",
"e2e-local": "CYPRESS_E2E_TEST_ENV=\"local\" cypress run",
"e2e-local-open": "CYPRESS_E2E_TEST_ENV=\"local\" cypress open",
Expand Down Expand Up @@ -146,7 +147,7 @@
"jszip": "^3.2.2",
"lodash-es": "^4.17.15",
"mockdate": "^2.0.5",
"neo4j-driver": "4.0.1",
"neo4j-driver": "^4.0.2",
"prop-types": "^15.7.2",
"react": "^16.9.0",
"react-addons-pure-render-mixin": "^15.0.2",
Expand Down
Loading

0 comments on commit f17502d

Please sign in to comment.