feat(mobile): connect Android and IDE to browser account login

This commit is contained in:
yilsem committed 2026-09-08 21:10:49 +03:00
1 parent b66daed07a
commit c1929957a2
8 files changed
+109 -8

No files matched your search

+18 -1
View File
@@ -23,6 +23,23 @@ try {
await page.getByRole('heading', { name: 'Fikrini konuş. Birlikte geliştir.' }).waitFor()
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false)
assert.ok((await page.getByRole('button', { name: 'Eşleştirme kodu oluştur' }).boundingBox()).height >= 48)
// UI wiring only: real account authentication is covered by gateway HTTP/DB
// tests. Never submit a credential to the live portal from this smoke test.
const loginCalls = []
await page.route('https://turkservis.online/v1/aiturk/mobile-auth/**', async route => {
const action = new URL(route.request().url()).pathname.split('/').at(-1); loginCalls.push(action)
const result = action === 'start' ? { deviceCode: 'tsml_fixture', userCode: 'ABCDEFGH',
verificationUri: 'https://turkservis.online/account/aiturk/mobile-login/11111111-1111-4111-8111-111111111111' }
: action === 'poll' ? { state: 'approved', accountToken: 'tsml_fixture' } : { revoked: true }
await route.fulfill({ status: 200, contentType: 'application/json', headers: { 'Access-Control-Allow-Origin': '*' }, body: JSON.stringify(result) })
})
await page.getByRole('button', { name: 'AITURK hesabımla giriş yap' }).click()
await page.getByText('Yalnız kendi hesabınızda bu kodu onaylayın: ABCDEFGH').waitFor()
await page.getByRole('button', { name: 'Girişi kontrol et' }).click()
await page.getByText('Hesaba giriş yapıldı.', { exact: true }).waitFor()
await page.getByRole('button', { name: 'Bu uygulamadaki hesaptan çık' }).click()
await page.getByText('Bu uygulamanın oturumu kapatıldı.', { exact: false }).waitFor()
assert.deepEqual(loginCalls, ['start', 'poll', 'logout'])
await mkdir('test-results', { recursive: true })
await page.screenshot({ path: 'test-results/android-onboarding.png', fullPage: true })
const result = await page.evaluate(async () => {
@@ -50,5 +67,5 @@ try {
})
assert.equal(result.length, result.expected); assert.equal(result.dtls, 'connected'); assert.equal(result.action, 'session.history')
assert.deepEqual(errors, [])
console.log(JSON.stringify({ onboarding: 'passed', realWebRTC: result, errors }))
console.log(JSON.stringify({ onboarding: 'passed', mockedLoginUi: 'passed', realWebRTC: result, errors }))
} finally { await browser.close(); server.close() }