first commit
This commit is contained in:
1 parent
18d31d5dcf
commit
77a5f5248c
31 files changed
+6637
-30
No files matched your search
+59
-15
@@ -40,7 +40,7 @@ test.beforeAll(async () => {
|
||||
await startXvfbOnLinux()
|
||||
|
||||
electronApp = await electron.launch({
|
||||
args: ['.', '--no-sandbox'],
|
||||
args: ['.', '--no-sandbox', `--user-data-dir=${path.join(root, 'test-results', `electron-${process.pid}`)}`],
|
||||
cwd: root,
|
||||
env: { ...process.env, NODE_ENV: 'development' },
|
||||
})
|
||||
@@ -68,28 +68,72 @@ test.afterAll(async () => {
|
||||
}
|
||||
})
|
||||
|
||||
test.describe('[electron-vite-react] e2e tests', () => {
|
||||
test.describe('[escape-reserve] e2e tests', () => {
|
||||
test('startup', async () => {
|
||||
const title = await page.title()
|
||||
expect(title).toBe('Electron + Vite + React')
|
||||
expect(title).toBe('ESCAPE / RESERVE')
|
||||
})
|
||||
|
||||
test('should be home page is load correctly', async () => {
|
||||
const h1 = await page.$('h1')
|
||||
const title = await h1?.textContent()
|
||||
expect(title).toBe('A sharp starter with Tailwind-first styling.')
|
||||
test('loads the reservation desk', async () => {
|
||||
await expect(page.locator('h1')).toHaveText('방을 고르고, 탈출을 예약하세요.')
|
||||
})
|
||||
|
||||
test('should be count button can click', async () => {
|
||||
const countButton = await page.$('button:has-text("Increment counter")')
|
||||
const countValue = await page.$('div.text-5xl')
|
||||
test('exposes the reservation bridge', async () => {
|
||||
const methods = await page.evaluate(() => Object.keys(window.reservationApi).sort())
|
||||
expect(methods).toEqual([
|
||||
'armAutoReservation', 'configureClock', 'disarmAutoReservation', 'getAutoReservationState',
|
||||
'getBranches', 'getClockState', 'getThemeDetail', 'getThemes', 'getTimes',
|
||||
'openCaptcha', 'prepare', 'runTimingTest', 'startClockMonitor',
|
||||
'stopClockMonitor', 'submit', 'subscribeAutoState', 'subscribeClock',
|
||||
])
|
||||
})
|
||||
|
||||
const valueBeforeClick = await countValue?.textContent()
|
||||
expect(valueBeforeClick).toBe('0')
|
||||
test('loads live branches and themes without submitting', async () => {
|
||||
const branch = page.getByLabel('지점')
|
||||
await expect.poll(() => branch.locator('option').count()).toBeGreaterThan(1)
|
||||
await branch.selectOption({ label: 'STATION' })
|
||||
|
||||
await countButton?.click()
|
||||
const theme = page.getByLabel('테마')
|
||||
await expect.poll(() => theme.locator('option').count(), {
|
||||
timeout: 15_000,
|
||||
}).toBeGreaterThan(1)
|
||||
})
|
||||
|
||||
const valueAfterClick = await countValue?.textContent()
|
||||
expect(valueAfterClick).toBe('1')
|
||||
test('monitors live server time and runs a safe timing probe', async () => {
|
||||
await page.getByRole('button', { name: '자동 예약' }).click()
|
||||
await page.getByRole('button', { name: '모니터 시작' }).click()
|
||||
await expect(page.getByRole('button', { name: '모니터 중지' })).toBeVisible({ timeout: 10_000 })
|
||||
await expect(page.getByLabel('관측 서버시간 값')).toContainText(':')
|
||||
|
||||
await page.getByRole('button', { name: '정밀 보정 설정' }).click()
|
||||
await expect(page.getByText('경계 측정 간격 (ms)')).toBeVisible()
|
||||
await page.getByRole('button', { name: '기본값' }).click()
|
||||
await page.getByRole('button', { name: '설정 적용' }).click()
|
||||
|
||||
await page.getByRole('button', { name: '3초 테스트' }).click()
|
||||
await expect(page.getByText('arrival error')).toBeVisible({ timeout: 10_000 })
|
||||
})
|
||||
|
||||
test('arms and disarms an automatic reservation without submitting', async () => {
|
||||
const theme = page.getByLabel('테마')
|
||||
await theme.selectOption({ index: 1 })
|
||||
await expect(page.locator('button.time-slot').first()).toBeVisible({ timeout: 15_000 })
|
||||
await page.locator('button.time-slot').first().click()
|
||||
|
||||
await page.getByPlaceholder('홍길동').fill('테스트')
|
||||
await page.getByPlaceholder('010-0000-0000').fill('010-1234-5678')
|
||||
await page.getByLabel('캡차 토큰').fill('x'.repeat(100))
|
||||
await page.getByRole('checkbox').check()
|
||||
|
||||
const target = await page.evaluate(() => {
|
||||
const value = new Date(Date.now() + 30_000 + 9 * 60 * 60 * 1_000)
|
||||
return value.toISOString().slice(0, -1)
|
||||
})
|
||||
await page.getByLabel('실행 시각 (KST, ms)').fill(target)
|
||||
await page.getByRole('button', { name: '자동 예약 무장' }).click()
|
||||
await expect(page.getByText('armed', { exact: true })).toBeVisible({ timeout: 10_000 })
|
||||
|
||||
await page.getByRole('button', { name: '자동 예약 해제' }).click()
|
||||
await expect(page.getByText('cancelled', { exact: true })).toBeVisible()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user