mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
portal test - import Chinook DB
This commit is contained in:
@@ -5,27 +5,27 @@ describe('Run as portal', () => {
|
|||||||
cy.contains('Postgres-connection');
|
cy.contains('Postgres-connection');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Delete chinook', () => {
|
// it('Delete chinook', () => {
|
||||||
cy.visit('http://localhost:3000');
|
// cy.visit('http://localhost:3000');
|
||||||
|
|
||||||
cy.contains('MySql-connection').rightclick();
|
// cy.contains('MySql-connection').rightclick();
|
||||||
cy.contains('New Query (server)').click();
|
// cy.contains('New Query (server)').click();
|
||||||
cy.realType('drop database if exists Chinook');
|
// cy.realType('drop database if exists Chinook');
|
||||||
cy.realPress('F5');
|
// cy.realPress('F5');
|
||||||
cy.contains('Query execution finished');
|
// cy.contains('Query execution finished');
|
||||||
|
|
||||||
cy.contains('Postgres-connection').rightclick();
|
// cy.contains('Postgres-connection').rightclick();
|
||||||
cy.contains('New Query (server)').click();
|
// cy.contains('New Query (server)').click();
|
||||||
cy.realType('drop database if exists "Chinook"');
|
// cy.realType('drop database if exists "Chinook"');
|
||||||
cy.realPress('F5');
|
// cy.realPress('F5');
|
||||||
cy.contains('Query execution finished');
|
// cy.contains('Query execution finished');
|
||||||
|
|
||||||
// cy.realPress('F1');
|
// // cy.realPress('F1');
|
||||||
// cy.realType('Close all');
|
// // cy.realType('Close all');
|
||||||
// cy.realPress('Enter');
|
// // cy.realPress('Enter');
|
||||||
});
|
// });
|
||||||
|
|
||||||
it('Create Chinook', () => {
|
it('Create Chinook MySQL', () => {
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
|
|
||||||
cy.contains('MySql-connection').click();
|
cy.contains('MySql-connection').click();
|
||||||
@@ -35,10 +35,21 @@ describe('Run as portal', () => {
|
|||||||
cy.get('[data-testid=InputTextModal_ok]').click();
|
cy.get('[data-testid=InputTextModal_ok]').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Create Chinook Postgres', () => {
|
||||||
|
cy.visit('http://localhost:3000');
|
||||||
|
|
||||||
it('Import Chinook', () => {
|
cy.contains('Postgres-connection').click();
|
||||||
|
cy.contains('Postgres-connection').rightclick();
|
||||||
|
cy.contains('Create database').click();
|
||||||
|
cy.get('[data-testid=InputTextModal_value]').clear().type('Chinook');
|
||||||
|
cy.get('[data-testid=InputTextModal_ok]').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('Import Chinook MySQL', () => {
|
||||||
cy.visit('http://localhost:3000');
|
cy.visit('http://localhost:3000');
|
||||||
cy.contains('MySql-connection').click();
|
cy.contains('MySql-connection').click();
|
||||||
|
cy.get('[data-testid=DatabaseAppObject_Chinook]').rightclick();
|
||||||
cy.contains('Chinook').rightclick();
|
cy.contains('Chinook').rightclick();
|
||||||
cy.contains('Restore/import SQL dump').click();
|
cy.contains('Restore/import SQL dump').click();
|
||||||
cy.get('#uploadFileButton').selectFile('data/chinook-mysql.sql', { force: true });
|
cy.get('#uploadFileButton').selectFile('data/chinook-mysql.sql', { force: true });
|
||||||
@@ -51,6 +62,21 @@ describe('Run as portal', () => {
|
|||||||
cy.contains('Album');
|
cy.contains('Album');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Import Chinook Potgres', () => {
|
||||||
|
cy.visit('http://localhost:3000');
|
||||||
|
cy.contains('Postgres-connection').click();
|
||||||
|
cy.get('[data-testid=DatabaseAppObject_Chinook]').rightclick();
|
||||||
|
cy.contains('Restore/import SQL dump').click();
|
||||||
|
cy.get('#uploadFileButton').selectFile('data/chinook-postgres.sql', { force: true });
|
||||||
|
cy.wait(500);
|
||||||
|
cy.get('[data-testid=ImportDatabaseDumpModal_runImport]').click();
|
||||||
|
cy.contains('Importing database');
|
||||||
|
cy.contains('Finished job script');
|
||||||
|
cy.get('[data-testid=RunScriptModal_close]').click();
|
||||||
|
cy.contains('Chinook').click();
|
||||||
|
cy.contains('album');
|
||||||
|
});
|
||||||
|
|
||||||
// it('import chinook DB', () => {
|
// it('import chinook DB', () => {
|
||||||
// cy.visit('http://localhost:3000');
|
// cy.visit('http://localhost:3000');
|
||||||
// cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
|
// cy.get('[data-testid=ConnectionTab_buttonConnect]').click();
|
||||||
|
|||||||
@@ -22,4 +22,8 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// -- This will overwrite an existing command --
|
// -- This will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||||
|
|
||||||
|
Cypress.Commands.add('testid', (testId, options = {}) => {
|
||||||
|
return cy.get(`[data-testid="${testId}"]`, options);
|
||||||
|
});
|
||||||
|
|||||||
@@ -14,9 +14,31 @@
|
|||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands'
|
import './commands';
|
||||||
|
|
||||||
// Alternatively you can use CommonJS syntax:
|
// Alternatively you can use CommonJS syntax:
|
||||||
// require('./commands')
|
// require('./commands')
|
||||||
|
|
||||||
import "cypress-real-events";
|
import 'cypress-real-events';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
// Replace 'my-database-name' with the actual IndexedDB name
|
||||||
|
cy.window().then(win => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const request = win.indexedDB.deleteDatabase('localforage');
|
||||||
|
request.onsuccess = () => {
|
||||||
|
// Database successfully deleted
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
request.onerror = () => {
|
||||||
|
// Some error occurred
|
||||||
|
reject(request.error);
|
||||||
|
};
|
||||||
|
request.onblocked = () => {
|
||||||
|
// Might happen if there are open connections
|
||||||
|
console.warn('IndexedDB deletion blocked');
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
15845
e2e-tests/data/chinook-postgres.sql
Normal file
15845
e2e-tests/data/chinook-postgres.sql
Normal file
File diff suppressed because it is too large
Load Diff
32
e2e-tests/init/portal.js
Normal file
32
e2e-tests/init/portal.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const dbgateApi = require('dbgate-api');
|
||||||
|
dbgateApi.initializeApiEnvironment();
|
||||||
|
const dbgatePluginMysql = require('dbgate-plugin-mysql');
|
||||||
|
dbgateApi.registerPlugins(dbgatePluginMysql);
|
||||||
|
const dbgatePluginPostgres = require('dbgate-plugin-postgres');
|
||||||
|
dbgateApi.registerPlugins(dbgatePluginPostgres);
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
await dbgateApi.executeQuery({
|
||||||
|
connection: {
|
||||||
|
server: process.env.SERVER_mysql,
|
||||||
|
user: process.env.USER_mysql,
|
||||||
|
password: process.env.PASSWORD_mysql,
|
||||||
|
port: process.env.PORT_mysql,
|
||||||
|
engine: 'mysql@dbgate-plugin-mysql',
|
||||||
|
},
|
||||||
|
sql: 'drop database if exists Chinook',
|
||||||
|
});
|
||||||
|
|
||||||
|
await dbgateApi.executeQuery({
|
||||||
|
connection: {
|
||||||
|
server: process.env.SERVER_postgres,
|
||||||
|
user: process.env.USER_postgres,
|
||||||
|
password: process.env.PASSWORD_postgres,
|
||||||
|
port: process.env.PORT_postgres,
|
||||||
|
engine: 'postgres@dbgate-plugin-postgres',
|
||||||
|
},
|
||||||
|
sql: 'drop database if exists "Chinook"',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dbgateApi.runScript(run);
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
"start:add-connection": "cd .. && node packer/build/bundle.js --listen-api --run-e2e-tests",
|
"start:add-connection": "cd .. && node packer/build/bundle.js --listen-api --run-e2e-tests",
|
||||||
|
|
||||||
"start:portal:local": "cd .. && env-cmd -f e2e-tests/env/portal-local/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
"start:portal:local": "cd .. && env-cmd -f e2e-tests/env/portal-local/.env node e2e-tests/init/portal.js && env-cmd -f e2e-tests/env/portal-local/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
||||||
"start:portal:ci": "cd .. && env-cmd -f e2e-tests/env/portal-ci/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
"start:portal:ci": "cd .. && env-cmd -f e2e-tests/env/portal-ci/.env node e2e-tests/init/portal.js && env-cmd -f e2e-tests/env/portal-ci/.env node packer/build/bundle.js --listen-api --run-e2e-tests",
|
||||||
|
|
||||||
"test:ci": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection:ci && start-server-and-test start:portal:ci http://localhost:3000 cy:run:portal:ci",
|
"test:ci": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection:ci && start-server-and-test start:portal:ci http://localhost:3000 cy:run:portal:ci",
|
||||||
"test:local": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection:local && start-server-and-test start:portal:local http://localhost:3000 cy:run:portal:local"
|
"test:local": "start-server-and-test start:add-connection http://localhost:3000 cy:run:add-connection:local && start-server-and-test start:portal:local http://localhost:3000 cy:run:portal:local"
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
export let disableBoldScroll = false;
|
export let disableBoldScroll = false;
|
||||||
export let filter = null;
|
export let filter = null;
|
||||||
export let disableHover = false;
|
export let disableHover = false;
|
||||||
|
export let divProps = {};
|
||||||
|
|
||||||
$: isChecked =
|
$: isChecked =
|
||||||
checkedObjectsStore && $checkedObjectsStore.find(x => module?.extractKey(data) == module?.extractKey(x));
|
checkedObjectsStore && $checkedObjectsStore.find(x => module?.extractKey(data) == module?.extractKey(x));
|
||||||
@@ -109,6 +110,7 @@
|
|||||||
on:dragend
|
on:dragend
|
||||||
on:drop
|
on:drop
|
||||||
bind:this={domDiv}
|
bind:this={domDiv}
|
||||||
|
{...divProps}
|
||||||
>
|
>
|
||||||
{#if checkedObjectsStore}
|
{#if checkedObjectsStore}
|
||||||
<CheckboxField
|
<CheckboxField
|
||||||
|
|||||||
@@ -575,4 +575,7 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify(
|
|||||||
isChoosed={data.connection?._id == $focusedConnectionOrDatabase?.conid &&
|
isChoosed={data.connection?._id == $focusedConnectionOrDatabase?.conid &&
|
||||||
data.name == $focusedConnectionOrDatabase?.database}
|
data.name == $focusedConnectionOrDatabase?.database}
|
||||||
disableBoldScroll={!!$focusedConnectionOrDatabase}
|
disableBoldScroll={!!$focusedConnectionOrDatabase}
|
||||||
|
divProps={{
|
||||||
|
'data-testid': `DatabaseAppObject_${data.name}`,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export const openedConnections = writable([]);
|
|||||||
export const temporaryOpenedConnections = writable([]);
|
export const temporaryOpenedConnections = writable([]);
|
||||||
export const openedSingleDatabaseConnections = writable([]);
|
export const openedSingleDatabaseConnections = writable([]);
|
||||||
export const expandedConnections = writable([]);
|
export const expandedConnections = writable([]);
|
||||||
export const currentDatabase = writableWithForage(null, 'currentDatabase');
|
export const currentDatabase = writableWithStorage(null, 'currentDatabase');
|
||||||
export const openedTabs = writableWithForage<TabDefinition[]>([], getOpenedTabsStorageName(), x => [...(x || [])]);
|
export const openedTabs = writableWithForage<TabDefinition[]>([], getOpenedTabsStorageName(), x => [...(x || [])]);
|
||||||
export const copyRowsFormat = writableWithStorage('textWithoutHeaders', 'copyRowsFormat');
|
export const copyRowsFormat = writableWithStorage('textWithoutHeaders', 'copyRowsFormat');
|
||||||
export const extensions = writable<ExtensionsDirectory>(null);
|
export const extensions = writable<ExtensionsDirectory>(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user