Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
__pycache__/
*.pyc
node_modules/
playwright-report/
test-results/
79 changes: 79 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "app",
"version": "1.0.0",
"description": "**Description:** A powerful, universal desktop application for converting between 50+ image and metadata formats (including RAW, HDR, Web, and GIS formats). Built with Python and Tkinter, and powered by ImageMagick to provide the broadest possible format support while maintaining a highly responsive UI during batch operations.",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/GameProgram7777/image-converter.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"bugs": {
"url": "https://github.com/GameProgram7777/image-converter/issues"
},
"homepage": "https://github.com/GameProgram7777/image-converter#readme",
"devDependencies": {
"@playwright/test": "^1.61.1"
}
}
19 changes: 19 additions & 0 deletions playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { defineConfig, devices } = require('@playwright/test');

module.exports = defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
});
Binary file added tests/fixtures/dummy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/fixtures/dummy1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions tests/zip-generation.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const { test, expect } = require('@playwright/test');
const path = require('path');
const fs = require('fs');

test('batch conversion zip generation failure increments failCount', async ({ page }) => {
// Use file:// protocol for reading local files instead of mocking localhost
const indexPath = path.resolve(__dirname, '../docs/index.html');

// Need to intercept the wasm initialization to prevent network requests,
// intercept jszip to mock failure, and intercept format_database.json for local resolution.
await page.route('**/*', async (route) => {
const url = route.request().url();
if (url.includes('format_database.json')) {
await route.fulfill({
body: fs.readFileSync(path.resolve(__dirname, '../docs/format_database.json'), 'utf8'),
contentType: 'application/json'
});
} else if (url.includes('jszip.min.js')) {
await route.fulfill({
body: `window.JSZip = class { file() {} generateAsync() { return Promise.reject(new Error("Mock failure")); } };`,
contentType: 'application/javascript'
});
} else {
await route.continue();
}
});

await page.goto(`file://${indexPath}`);

await page.waitForSelector('#convertBtn:not([disabled])', { timeout: 10000 });

const fileInput = await page.$('#fileInput');
await fileInput.setInputFiles([
path.resolve(__dirname, 'fixtures/dummy.png'),
path.resolve(__dirname, 'fixtures/dummy1.png')
]);

await page.click('#convertBtn');

await page.waitForFunction(() => {
const status = document.getElementById('status').textContent;
return status.includes('Job complete!');
}, { timeout: 10000 });

const statusText = await page.locator('#status').textContent();
expect(statusText).toContain('Failed: 2');
});