Skip to content

Commit

Permalink
typescript fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Sep 22, 2024
1 parent 636cd1f commit c59321b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/fixtures.mts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as base from '@playwright/test';
import { _electron as electron } from 'playwright';
import {_electron as electron, Page, ElectronApplication} from 'playwright';
import { join } from 'path';
import { main } from '../package.json';
import TestUtil from './testUtil.mjs';

let appElectron;
let page;
let appElectron: ElectronApplication;
let page: Page;

const __cwd = process.cwd();
const __isCiProcess = process.env.CI === 'true';
Expand Down Expand Up @@ -52,7 +52,7 @@ export const beforeAll = async () => {
};
});

await base.expect(evaluateResult.packaged, 'app is not packaged').toBe(false);
base.expect(evaluateResult.packaged, 'app is not packaged').toBe(false);
};

export const afterAll = async () => {
Expand Down
8 changes: 4 additions & 4 deletions tests/testUtil.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default class TestUtil {

_testScreenshotPath: string;

constructor(page, testInfo, testScreenshotPath) {
constructor(page: Page, testInfo: TestInfo, testScreenshotPath: string) {
this._page = page;
this._testInfo = testInfo;
this._testScreenshotPath = testScreenshotPath;
}

async captureScreenshot(pageInstance, screenshotName) {
async captureScreenshot(pageInstance: Page, screenshotName: string) {
if (!pageInstance) {
return;
}
Expand All @@ -28,13 +28,13 @@ export default class TestUtil {
}
}

async onTestError(error) {
async onTestError(error: Error) {
const titleLists = [...this._testInfo.titlePath];
titleLists.shift();
const title = titleLists.join('-');

await this.captureScreenshot(this._page, `${title}_${Date.now()}`);

return new Error(error);
return new Error(error.message);
}
}

0 comments on commit c59321b

Please sign in to comment.