diff --git a/e2e/apps.test.ts b/e2e/apps.test.ts new file mode 100644 index 000000000..67d3564e8 --- /dev/null +++ b/e2e/apps.test.ts @@ -0,0 +1,352 @@ +import { createServer, type IncomingMessage, type Server, type ServerResponse } from 'node:http' +import type { AddressInfo } from 'node:net' +import { mkdtemp, realpath, rm } from 'node:fs/promises' +import os from 'node:os' +import path from 'node:path' +import { expect, test, type ElectronApplication } from '@playwright/test' +import { launchApp, type AppContext } from './launchApp' +import { WebContentsPage } from './support/cdpPages' +import { getShellOpenExternalCalls } from './support/devHooks' +import { claimsOf, FakeCloud, reply, type BearerClaims } from './support/fakeCloud' + +const SIDEBAR_APPS = '[data-testid="app-sidebar-apps"]' +const APPS_GRID = '[data-testid="apps-grid"]' +const CUTOUT_CARD = '[data-testid="app-card-remove-background"]' +const DOWN_CARD = '[data-testid="app-card-down-for-now"]' +const APP_HOST = '[data-testid="app-page-host"]' +const SIDEBAR = '[data-testid="app-sidebar"]' +const APP_FAILED = '[data-testid="app-page-failed"]' +const APP_RETRY = '[data-testid="app-page-retry"]' +const CUTOUT_PAGE = '/apps/remove-background/desktop.html' +const DOWN_PAGE = '/apps/down-for-now/desktop.html' +const OUTSIDE_LINK = 'https://docs.example.test/pricing' +const LONG_WAIT = { timeout: 20_000 } + +function appPageHtml(title: string, cloudUrl: string): string { + return ` + +
pending
+ + + + Pricing + + +` +} + +class FakeAppsSite { + downPageAnswers = 503 + port = 0 + private server: Server | null = null + + constructor(private readonly cloudUrl: () => string) {} + + get url(): string { + return `http://127.0.0.1:${this.port}` + } + + async start(): Promise