portal tests WIP

This commit is contained in:
SPRINX0\prochazka
2025-01-07 09:32:18 +01:00
parent 8d2c2cd62d
commit bf92943a6a
10 changed files with 15925 additions and 18 deletions

View File

@@ -1,8 +1,54 @@
describe('Run as portal', () => {
it('successfully loads', () => {
cy.visit('http://localhost:3000');
cy.contains('MySql');
cy.contains('Postgres');
cy.contains('MySql-connection');
cy.contains('Postgres-connection');
});
it('Delete chinook', () => {
cy.visit('http://localhost:3000');
cy.contains('MySql-connection').rightclick();
cy.contains('New Query (server)').click();
cy.realType('drop database if exists Chinook');
cy.realPress('F5');
cy.contains('Query execution finished');
cy.contains('Postgres-connection').rightclick();
cy.contains('New Query (server)').click();
cy.realType('drop database if exists "Chinook"');
cy.realPress('F5');
cy.contains('Query execution finished');
// cy.realPress('F1');
// cy.realType('Close all');
// cy.realPress('Enter');
});
it('Create Chinook', () => {
cy.visit('http://localhost:3000');
cy.contains('MySql-connection').click();
cy.contains('MySql-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', () => {
cy.visit('http://localhost:3000');
cy.contains('MySql-connection').click();
cy.contains('Chinook').rightclick();
cy.contains('Restore/import SQL dump').click();
cy.get('#uploadFileButton').selectFile('data/chinook-mysql.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', () => {

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
CONNECTIONS=mysql,postgres
LABEL_mysql=MySql
LABEL_mysql=MySql-connection
SERVER_mysql=mariadb
USER_mysql=root
PASSWORD_mysql=Pwd2020Db
PORT_mysql=3306
ENGINE_mysql=mysql@dbgate-plugin-mysql
LABEL_postgres=Postgres
LABEL_postgres=Postgres-connection
SERVER_postgres=postgres
USER_postgres=postgres
PASSWORD_postgres=Pwd2020Db

View File

@@ -1,13 +1,13 @@
CONNECTIONS=mysql,postgres
LABEL_mysql=MySql
LABEL_mysql=MySql-connection
SERVER_mysql=localhost
USER_mysql=root
PASSWORD_mysql=Pwd2020Db
PORT_mysql=16004
ENGINE_mysql=mysql@dbgate-plugin-mysql
LABEL_postgres=Postgres
LABEL_postgres=Postgres-connection
SERVER_postgres=localhost
USER_postgres=postgres
PASSWORD_postgres=Pwd2020Db

View File

@@ -97,7 +97,7 @@ function packagedPluginsDir() {
// }
}
if (processArgs.runE2eTests) {
return path.resolve('packer/build/plugins');
return path.resolve('packer/build/plugins');
}
return null;
}
@@ -113,7 +113,7 @@ function getPluginBackendPath(packageName) {
return path.join(packagedPluginsDir(), packageName, 'dist', 'backend.js');
}
const res = path.join(pluginsdir(), packageName, 'dist', 'backend.js')
const res = path.join(pluginsdir(), packageName, 'dist', 'backend.js');
if (fs.existsSync(res)) {
return res;
}

View File

@@ -1,3 +1,5 @@
const path = require('path');
function getNamedArg(name) {
const argIndex = process.argv.indexOf(name);
if (argIndex > 0) {
@@ -20,13 +22,15 @@ function getPassArgs() {
const res = [];
if (global['PLUGINS_DIR']) {
res.push('--plugins-dir', global['PLUGINS_DIR']);
} else if (runE2eTests) {
res.push('--plugins-dir', path.resolve('packer/build/plugins'));
}
if (listenApiChild) {
res.push('listen-api-child');
}
if (runE2eTests) {
res.push('--run-e2e-tests');
}
// if (runE2eTests) {
// res.push('--run-e2e-tests');
// }
return res;
}

View File

@@ -113,8 +113,18 @@
</div>
<svelte:fragment slot="footer">
<FormSubmit value="Run import" on:click={e => handleSubmit(e.detail)} disabled={!inputFile} />
<FormStyledButton type="button" value="Cancel" on:click={closeCurrentModal} />
<FormSubmit
value="Run import"
on:click={e => handleSubmit(e.detail)}
disabled={!inputFile}
data-testid="ImportDatabaseDumpModal_runImport"
/>
<FormStyledButton
type="button"
value="Cancel"
on:click={closeCurrentModal}
data-testid="ImportDatabaseDumpModal_cancel"
/>
</svelte:fragment>
</ModalBase>
</FormProvider>

View File

@@ -25,11 +25,11 @@
{header}
</svelte:fragment>
<FormTextField {label} name="value" focused />
<FormTextField {label} name="value" focused data-testid="InputTextModal_value" />
<svelte:fragment slot="footer">
<FormSubmit value="OK" on:click={e => handleSubmit(e.detail)} />
<FormStyledButton type="button" value="Cancel" on:click={closeCurrentModal} />
<FormSubmit value="OK" on:click={e => handleSubmit(e.detail)} data-testid="InputTextModal_ok" />
<FormStyledButton type="button" value="Cancel" on:click={closeCurrentModal} data-testid="InputTextModal_cancel" />
</svelte:fragment>
</ModalBase>
</FormProvider>

View File

@@ -77,9 +77,9 @@
<svelte:fragment slot="footer">
{#if isRunning}
<FormStyledButton value="Stop" on:click={handleStop} />
<FormStyledButton value="Stop" on:click={handleStop} data-testid="RunScriptModal_stop" />
{:else}
<FormStyledButton value="Close" on:click={handleClose} />
<FormStyledButton value="Close" on:click={handleClose} data-testid="RunScriptModal_close" />
{/if}
{#if onOpenResult && !isRunning}

View File

@@ -116,6 +116,7 @@
title: 'Query #',
icon: 'img sql-file',
tabComponent: 'QueryTab',
focused: true,
props: {
conid,
database,