Skip to content

Commit c87551e

Browse files
committed
Fix type handling and remove eslint-disable comments
1 parent 15088f0 commit c87551e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

e2e/import-export.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import SiteContent from './page-objects/site-content';
66
import WhatsNewModal from './page-objects/whats-new-modal';
77
import type { MessageBoxOptions } from 'electron';
88

9+
const global = globalThis as unknown as {
10+
testDialogCalls?: MessageBoxOptions[];
11+
};
12+
913
test.describe( 'Import / Export', () => {
1014
const session = new E2ESession();
1115
const defaultSiteName = 'My WordPress Website';
@@ -55,15 +59,13 @@ test.describe( 'Import / Export', () => {
5559
// See: https://github.com/microsoft/playwright/issues/21432
5660
await session.electronApp.evaluate( ( { dialog } ) => {
5761
// Create storage for dialog calls
58-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
59-
( global as any ).testDialogCalls = [];
62+
global.testDialogCalls = [];
6063

6164
// Mock the function to track calls
62-
dialog.showMessageBox = async ( ...args: any[] ) => {
65+
dialog.showMessageBox = async ( ...args: unknown[] ) => {
6366
// Store the call details
64-
const options = args.length === 2 ? args[ 1 ] : args[ 0 ];
65-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
66-
( global as any ).testDialogCalls.push( options );
67+
const options = ( args.length === 2 ? args[ 1 ] : args[ 0 ] ) as MessageBoxOptions;
68+
global.testDialogCalls?.push( options );
6769

6870
// Auto-confirm by clicking the first button
6971
return { response: 0, checkboxChecked: false };
@@ -77,15 +79,13 @@ test.describe( 'Import / Export', () => {
7779
await importExportTab.uploadFile( invalidSqlPath );
7880

7981
// Wait for the error dialog to be shown (after the confirmation dialog)
80-
let dialogCalls: MessageBoxOptions[] = [];
8182
let errorDialog: MessageBoxOptions | undefined;
8283
await expect
8384
.poll(
8485
async () => {
85-
dialogCalls = await session.electronApp.evaluate( () => {
86-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
87-
return ( global as any ).testDialogCalls || [];
88-
} );
86+
const dialogCalls: MessageBoxOptions[] = await session.electronApp.evaluate(
87+
() => global.testDialogCalls || []
88+
);
8989
// Look for the error dialog specifically
9090
errorDialog = dialogCalls.find(
9191
( call ) =>

0 commit comments

Comments
 (0)