generate screenshots

This commit is contained in:
SPRINX0\prochazka
2025-01-30 08:07:27 +01:00
parent 9309f25126
commit 93dc48c22c
8 changed files with 75 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ name: Run tests with screenshots PREMIUM
- develop - develop
- feature/** - feature/**
jobs: jobs:
test: alltests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Use Node.js 18.x - name: Use Node.js 18.x
@@ -61,7 +61,7 @@ jobs:
- name: Copy screenshots - name: Copy screenshots
run: | run: |
mkdir screenshots mkdir screenshots
cp ../dbgate-merged/e2e-tests/cypress/screenshots/**/*.png screenshots/ cp ../dbgate-merged/e2e-tests/screenshots/*.png screenshots/
- name: Upload E2E screenshots - name: Upload E2E screenshots
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:

View File

@@ -9,7 +9,7 @@ name: Run tests
- develop - develop
- feature/** - feature/**
jobs: jobs:
test: e2etest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Use Node.js 18.x - name: Use Node.js 18.x

View File

@@ -3,10 +3,12 @@ const killPort = require('kill-port');
const { clearTestingData } = require('./e2eTestTools'); const { clearTestingData } = require('./e2eTestTools');
const waitOn = require('wait-on'); const waitOn = require('wait-on');
const { exec } = require('child_process'); const { exec } = require('child_process');
const fs = require('fs');
const path = require('path');
module.exports = defineConfig({ module.exports = defineConfig({
e2e: { e2e: {
trashAssetsBeforeRuns: false, // trashAssetsBeforeRuns: false,
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
// implement node event listeners here // implement node event listeners here
@@ -41,6 +43,15 @@ module.exports = defineConfig({
}); });
} }
}); });
on('after:screenshot', details => {
fs.renameSync(details.path, path.resolve(__dirname, `screenshots/${details.name}.png`));
});
// on('task', {
// renameFile({ from, to }) {
// fs.renameSync(from, to);
// },
// });
}, },
}, },
}); });

View File

@@ -158,7 +158,7 @@ describe('Data browser data', () => {
cy.themeshot('query'); cy.themeshot('query');
}); });
it.only('Query editor - join wizard', () => { it('Query editor - join wizard', () => {
cy.contains('MySql-connection').click(); cy.contains('MySql-connection').click();
cy.contains('MyChinook').click(); cy.contains('MyChinook').click();
cy.testid('TabsPanel_buttonNewQuery').click(); cy.testid('TabsPanel_buttonNewQuery').click();
@@ -170,4 +170,21 @@ describe('Data browser data', () => {
cy.contains('INNER JOIN Customer ON Invoice.CustomerId = Customer.CustomerId'); cy.contains('INNER JOIN Customer ON Invoice.CustomerId = Customer.CustomerId');
cy.themeshot('joinwizard'); cy.themeshot('joinwizard');
}); });
it.only('Mongo JSON data view', () => {
cy.contains('Mongo-connection').click();
cy.contains('MgChinook').click();
cy.contains('Customer').click();
cy.testid('DataFilterControl_input_CustomerId').type('<=10{enter}');
// test filter
cy.contains('Rows: 10');
cy.contains('Helena').rightclick();
cy.contains('Open query').click();
cy.wait(1000);
cy.contains('Execute').click();
cy.testid('WidgetIconPanel_cell-data').click();
// test JSON view
cy.contains('Country: "Brazil"');
cy.themeshot('mongoquery');
});
}); });

View File

@@ -1,3 +1,5 @@
const path = require('path');
// *********************************************** // ***********************************************
// This example commands.js shows you how to // This example commands.js shows you how to
// create various custom commands and overwrite // create various custom commands and overwrite
@@ -33,11 +35,45 @@ Cypress.Commands.add('themeshot', file => {
win.__changeCurrentTheme('theme-dark'); win.__changeCurrentTheme('theme-dark');
}); });
// cy.screenshot(`${file}-dark`, {
// onAfterScreenshot: (doc, props) => {
// cy.task('renameFile', {
// from: props.path,
// to: path.resolve(__dirname, `../../screenshots/${file}-dark.png`),
// });
// // fs.rename(props.path, path.resolve(path.join(__dirname, `../../screenshots/${file}-dark.png`)));
// },
// });
cy.screenshot(`${file}-dark`); cy.screenshot(`${file}-dark`);
// .then(props => {
// return cy.task('renameFile', {
// from: props.path,
// to: path.resolve(__dirname, `../../screenshots/${file}-dark.png`),
// });
// });
cy.window().then(win => { cy.window().then(win => {
win.__changeCurrentTheme('theme-light'); win.__changeCurrentTheme('theme-light');
}); });
cy.screenshot(`${file}-light`); cy.screenshot(`${file}-light`);
// .then(props => {
// return cy.task('renameFile', {
// from: props.path,
// to: path.resolve(__dirname, `../../screenshots/${file}-light.png`),
// });
// });
// cy.screenshot(`${file}-light`, {
// onAfterScreenshot: (doc, props) => {
// cy.task('renameFile', {
// from: props.path,
// to: path.resolve(__dirname, `../../screenshots/${file}-light.png`),
// });
// // fs.rename(props.path, path.resolve(path.join(__dirname, `../../screenshots/${file}-light.png`)));
// },
// });
}); });

View File

@@ -287,6 +287,7 @@
class:isError class:isError
class:isOk class:isOk
{placeholder} {placeholder}
data-testid={`DataFilterControl_input_${uniqueName}`}
/> />
{#if customCommandIcon && onCustomCommand} {#if customCommandIcon && onCustomCommand}
<InlineButton on:click={onCustomCommand} title={customCommandTooltip} narrow square> <InlineButton on:click={onCustomCommand} title={customCommandTooltip} narrow square>

View File

@@ -8,7 +8,7 @@ on:
- 'feature/**' - 'feature/**'
jobs: jobs:
test: alltests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -53,7 +53,7 @@ jobs:
- name: Copy screenshots - name: Copy screenshots
run: | run: |
mkdir screenshots mkdir screenshots
cp ../dbgate-merged/e2e-tests/cypress/screenshots/**/*.png screenshots/ cp ../dbgate-merged/e2e-tests/screenshots/*.png screenshots/
- name: Upload E2E screenshots - name: Upload E2E screenshots
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@@ -8,7 +8,7 @@ on:
- 'feature/**' - 'feature/**'
jobs: jobs:
test: e2etest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps: