|
| 1 | +/* |
| 2 | + * Copyright (c) Neo4j |
| 3 | + * Neo4j Sweden AB [http://neo4j.com] |
| 4 | + * |
| 5 | + * This file is part of Neo4j. |
| 6 | + * |
| 7 | + * Neo4j is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +import { isAura } from '../support/utils' |
| 22 | + |
| 23 | +describe('composite database', () => { |
| 24 | + before(function () { |
| 25 | + cy.visit(Cypress.config('url')).title().should('include', 'Neo4j Browser') |
| 26 | + cy.wait(3000) |
| 27 | + cy.ensureConnection() |
| 28 | + }) |
| 29 | + |
| 30 | + if (Cypress.config('serverVersion') >= 5.0 && !isAura()) { |
| 31 | + it('can query composite db and show results', () => { |
| 32 | + cy.executeCommand(':clear') |
| 33 | + const query = `create database compdb1;create database compdb2;use compdb1 create (:Poke {{}name: "Treecko"{}})-[:EVOLVES_INTO]->(:Poke {{}name: "Grovyle"{}});CREATE COMPOSITE DATABASE both;CREATE ALIAS both.cd1 FOR DATABASE compdb1;CREATE ALIAS both.cd2 FOR DATABASE compdb2;` |
| 34 | + |
| 35 | + cy.executeCommand(query) |
| 36 | + cy.get('[data-testid="multi-statement-list-icon"]') |
| 37 | + .last() |
| 38 | + .invoke('attr', 'title') |
| 39 | + .should('equal', 'Status: success') |
| 40 | + |
| 41 | + cy.executeCommand('SHOW DATABASES') |
| 42 | + cy.contains('both') |
| 43 | + cy.resultContains('"both"') |
| 44 | + |
| 45 | + cy.executeCommand(':use both') |
| 46 | + cy.executeCommand(':clear') |
| 47 | + cy.executeCommand( |
| 48 | + "CALL {{} USE both.cd1 MATCH path=(p:Poke)-[:EVOLVES_INTO]->(m) where p.name = 'Treecko' return path as p limit 10 {}} return p;" |
| 49 | + ) |
| 50 | + cy.waitForCommandResult() |
| 51 | + |
| 52 | + cy.get('[data-testid="vizInspector"]', { timeout: 5000 }).contains( |
| 53 | + 'EVOLVES_INTO' |
| 54 | + ) |
| 55 | + |
| 56 | + cy.get('circle.b-outline', { timeout: 10000 }).eq(0).should('be.visible') |
| 57 | + |
| 58 | + // cleanup |
| 59 | + cy.executeCommand(` |
| 60 | + drop alias both.cd1 for database; |
| 61 | + drop alias both.cd2 for database; |
| 62 | + drop database compdb1; |
| 63 | + drop database compdb2; |
| 64 | + drop database both; |
| 65 | + `) |
| 66 | + |
| 67 | + cy.executeCommand(':use neo4j') |
| 68 | + cy.executeCommand(':clear') |
| 69 | + }) |
| 70 | + } |
| 71 | +}) |
0 commit comments