import { test as base } from '@playwright/test';

// All e2e specs run hermetically against the mock transport. Neutralise the real
// telegram-web-app.js (the app loads it dynamically — see lib/telegram.ts loadTelegramSDK) so the
// suite never reaches telegram.org, which is unreachable from the CI runner. Specs that exercise
// the Telegram launch inject their own window.Telegram via addInitScript before navigating, so the
// dynamic load short-circuits on the already-present SDK.
export const test = base.extend({
  page: async ({ page }, use) => {
    await page.route('**/telegram-web-app.js*', (route) =>
      route.fulfill({ status: 200, contentType: 'application/javascript', body: '' }),
    );
    await use(page);
  },
});

export { expect } from '@playwright/test';
export type { Page } from '@playwright/test';
