From c59321b5a3c9b463b37f6280363c6b264dffe990 Mon Sep 17 00:00:00 2001 From: leejooy96 Date: Sun, 22 Sep 2024 10:13:46 +0900 Subject: [PATCH] typescript fix --- tests/fixtures.mts | 8 ++++---- tests/testUtil.mts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/fixtures.mts b/tests/fixtures.mts index e6f12ad..a6ff7f7 100644 --- a/tests/fixtures.mts +++ b/tests/fixtures.mts @@ -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'; @@ -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 () => { diff --git a/tests/testUtil.mts b/tests/testUtil.mts index b036933..2846581 100644 --- a/tests/testUtil.mts +++ b/tests/testUtil.mts @@ -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; } @@ -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); } }