diff options
Diffstat (limited to 'tests/captive-portal.spec.mjs')
| -rw-r--r-- | tests/captive-portal.spec.mjs | 14 |
1 files changed, 7 insertions, 7 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 | ||