fe421ffc55
Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { mkdtempSync, rmSync, existsSync } from 'fs'
|
|
import { join } from 'path'
|
|
import { tmpdir } from 'os'
|
|
import { test, expect } from '@playwright/test'
|
|
import { launchApp, skipOnboarding } from './helpers'
|
|
|
|
test.describe('Auto update', () => {
|
|
let userDataDir: string
|
|
|
|
test.beforeEach(() => {
|
|
userDataDir = mkdtempSync(join(tmpdir(), 'bilin-e2e-update-'))
|
|
})
|
|
|
|
test.afterEach(() => {
|
|
if (userDataDir && existsSync(userDataDir)) {
|
|
try {
|
|
rmSync(userDataDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 200 })
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|
|
})
|
|
|
|
test('E2E-UPDATE-02: mock update shows banner and download flow', async () => {
|
|
const app = await launchApp(userDataDir, {
|
|
BILIN_MOCK_UPDATE: '1',
|
|
BILIN_MOCK_UPDATE_VERSION: '9.9.9'
|
|
})
|
|
const page = await app.firstWindow()
|
|
await skipOnboarding(page)
|
|
await expect(page.getByTestId('update-banner')).toBeVisible({ timeout: 15_000 })
|
|
await page.getByTestId('update-download').click()
|
|
await expect(page.getByTestId('update-install')).toBeVisible({ timeout: 15_000 })
|
|
await app.close()
|
|
})
|
|
})
|