Skip to content

Commit

Permalink
fix tests on windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
ze-kel committed Sep 28, 2024
1 parent 6407ceb commit e08f517
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build:renderer": "cd ./packages/renderer && vite build",
"compile": "cross-env MODE=production npm run build && electron-builder build --config .electron-builder.config.js --dir --config.asar=false",
"test": "npm run build && npx playwright test --workers=1",
"watch": "node scripts/watch.mjs",
"dev": "node scripts/watch.mjs",
"lint": "eslint . --ext js,mjs,cjs,ts,mts,cts,vue",
"typecheck:main": "tsc --noEmit -p packages/main/tsconfig.json",
"typecheck:preload": "tsc --noEmit -p packages/preload/tsconfig.json",
Expand Down Expand Up @@ -85,4 +85,4 @@
"vue": "3.3.13",
"zod": "^3.22.4"
}
}
}
5 changes: 4 additions & 1 deletion tests/2. Files & Folders Watchers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ test.beforeAll(async () => {

test.afterAll(async () => await afterTest(electronApp, workingPath));

test.beforeEach(() => {
resetFolder();
});

test('File tree watcher', async () => {
const page = await electronApp.firstWindow();
const L = getLocators(page);
Expand Down Expand Up @@ -52,7 +56,6 @@ test('Folder watcher', async () => {
const page = await electronApp.firstWindow();
const L = getLocators(page);

resetFolder();
//wait for reset to appear
await expect(L.fileTreeItems).toContainText(['1wbkk']);
await L.fileTreeItems.nth(1).click();
Expand Down
5 changes: 4 additions & 1 deletion tests/3. Tags Watcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ test.beforeAll(async () => {
({ electronApp, workingPath, booksPath, resetFolder } = await setupTest({ originalPath }));
});

test.beforeEach(() => {
resetFolder();
});

test.afterAll(async () => await afterTest(electronApp, workingPath));

test('Tag editing', async () => {
Expand Down Expand Up @@ -71,7 +75,6 @@ test('Tag page', async () => {
const page = await electronApp.firstWindow();
const L = getLocators(page);

resetFolder();
//wait for reset
await expect(L.tagTreeItem).toHaveCount(3);

Expand Down
4 changes: 2 additions & 2 deletions tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const setupTest = async ({
}

const resetFolder = () => {
fs.rmSync(filesFolder, { recursive: true, force: true });
fs.rmSync(filesFolder2, { recursive: true, force: true });
fs.emptyDirSync(filesFolder);
fs.emptyDirSync(filesFolder2);
fs.ensureDirSync(filesFolder);
fs.ensureDirSync(filesFolder2);
fs.copySync(originalPath, filesFolder);
Expand Down

0 comments on commit e08f517

Please sign in to comment.