diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/captive-portal.spec.mjs | 14 | ||||
| -rw-r--r-- | tests/phase2.mjs | 3 |
2 files changed, 7 insertions, 10 deletions
diff --git a/tests/captive-portal.spec.mjs b/tests/captive-portal.spec.mjs index acd2a40..bc7a1fa 100644 --- a/tests/captive-portal.spec.mjs +++ b/tests/captive-portal.spec.mjs | |||
| @@ -32,18 +32,18 @@ test.describe('Captive Portal - Phase 2', () => { | |||
| 32 | await expect(btn).toHaveText(/Pay/); | 32 | await expect(btn).toHaveText(/Pay/); |
| 33 | }); | 33 | }); |
| 34 | 34 | ||
| 35 | test('captive detection URIs return 302 redirect', async ({ request }) => { | 35 | test('captive detection URIs return portal HTML (200)', async ({ request }) => { |
| 36 | const uris = ['/generate_204', '/hotspot-detect.html', '/canonical.html', '/success.txt']; | 36 | const uris = ['/generate_204', '/hotspot-detect.html', '/canonical.html', '/success.txt']; |
| 37 | for (const uri of uris) { | 37 | for (const uri of uris) { |
| 38 | const resp = await request.fetch(`${PORTAL_URL}${uri}`, { maxRedirects: 0, ignoreHTTPSErrors: true }); | 38 | const resp = await request.fetch(`${PORTAL_URL}${uri}`); |
| 39 | expect(resp.status()).toBe(302); | 39 | expect(resp.status()).toBe(200); |
| 40 | const location = resp.headers()['location']; | 40 | const body = await resp.text(); |
| 41 | expect(location).toBe('http://192.168.4.1/'); | 41 | expect(body).toContain('TollGate'); |
| 42 | } | 42 | } |
| 43 | }); | 43 | }); |
| 44 | 44 | ||
| 45 | test('captive detection redirects to portal page', async ({ page }) => { | 45 | test('catch-all URIs redirect to portal page', async ({ page }) => { |
| 46 | await page.goto(`${PORTAL_URL}/generate_204`); | 46 | await page.goto(`${PORTAL_URL}/some-random-page`); |
| 47 | await expect(page.locator('h1')).toHaveText('TollGate'); | 47 | await expect(page.locator('h1')).toHaveText('TollGate'); |
| 48 | }); | 48 | }); |
| 49 | 49 | ||
diff --git a/tests/phase2.mjs b/tests/phase2.mjs index 5ee08f7..b3d347b 100644 --- a/tests/phase2.mjs +++ b/tests/phase2.mjs | |||
| @@ -84,9 +84,6 @@ if (TEST_TOKEN) { | |||
| 84 | } catch { | 84 | } catch { |
| 85 | pingOk = false; | 85 | pingOk = false; |
| 86 | } | 86 | } |
| 87 | try { | ||
| 88 | execSync(`echo '${sudoPw}' | sudo -S ip route del default via 192.168.4.1 dev wlp59s0 metric 50 2>/dev/null`, { encoding: 'utf8', timeout: 5000 }); | ||
| 89 | } catch {} | ||
| 90 | assert(pingOk, 'Internet works'); | 87 | assert(pingOk, 'Internet works'); |
| 91 | 88 | ||
| 92 | // Test 20: Spent token | 89 | // Test 20: Spent token |