Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Nov 26, 2023
1 parent a2bb880 commit bd61611
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
19 changes: 19 additions & 0 deletions docs/modules/ROOT/pages/neo4j-arc/i18n.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,22 @@ const App = (): JSX.Element => {
}
export default AppInit
----


== Troubleshooting

=== Switching Browser Lanauage Does Not Alter the Displayed Language in Neo4j Browser

Please make sure the i18n is either

1. set up with fixed language, for example

[source,typescript]
----
i18n.use(initReactI18next).init({
...
lng: 'zh'
})
----

2. or, if auto language detection is enabled, try clearing browser cookie and try again.
45 changes: 45 additions & 0 deletions e2e_tests/integration/i18n.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Jiaqi Liu
*
* 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/>.
*/

describe('Internationalization', () => {
before(function () {
cy.visit(Cypress.config('url'), {
onBeforeLoad(win) {
Object.defineProperty(win.navigator, 'language', { value: 'zh-CN' })
Object.defineProperty(win.navigator, 'languages', { value: ['zh'] })
Object.defineProperty(win.navigator, 'accept_languages', {
value: ['zh']
})
}
})
.title()
.should('include', 'Neo4j Browser')
cy.wait(3000)
cy.ensureConnection()
})

it('supports Chinese', () => {
cy.executeCommand(':clear')
cy.executeCommand(`CREATE (a:TestLabel {name: 'testNode'}) RETURN a`, {
parseSpecialCharSequences: false
})

cy.get('[data-testid="vizInspector"]').contains('节点类型')

cy.executeCommand('MATCH (n) DETACH DELETE n')
})
})
2 changes: 0 additions & 2 deletions e2e_tests/integration/viz.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { should } from 'chai'

/* global Cypress, cy, before */

const GREY = 'rgb(165, 171, 182)' // Default color for nodes and relationships
Expand Down

0 comments on commit bd61611

Please sign in to comment.