From bd61611d693e952ec983d141484456caf0bdecdf Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 26 Nov 2023 11:26:52 +0800 Subject: [PATCH] Add tests --- docs/modules/ROOT/pages/neo4j-arc/i18n.adoc | 19 +++++++++ e2e_tests/integration/i18n.spec.ts | 45 +++++++++++++++++++++ e2e_tests/integration/viz.spec.ts | 2 - 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 e2e_tests/integration/i18n.spec.ts diff --git a/docs/modules/ROOT/pages/neo4j-arc/i18n.adoc b/docs/modules/ROOT/pages/neo4j-arc/i18n.adoc index 125000109b1..a1f625f6045 100644 --- a/docs/modules/ROOT/pages/neo4j-arc/i18n.adoc +++ b/docs/modules/ROOT/pages/neo4j-arc/i18n.adoc @@ -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. diff --git a/e2e_tests/integration/i18n.spec.ts b/e2e_tests/integration/i18n.spec.ts new file mode 100644 index 00000000000..f78c14403ec --- /dev/null +++ b/e2e_tests/integration/i18n.spec.ts @@ -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 . + */ + +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') + }) +}) diff --git a/e2e_tests/integration/viz.spec.ts b/e2e_tests/integration/viz.spec.ts index 5fdb21d4355..1e28453d6c4 100644 --- a/e2e_tests/integration/viz.spec.ts +++ b/e2e_tests/integration/viz.spec.ts @@ -18,8 +18,6 @@ * along with this program. If not, see . */ -import { should } from 'chai' - /* global Cypress, cy, before */ const GREY = 'rgb(165, 171, 182)' // Default color for nodes and relationships