|
1 | 1 | /* global jasmine, describe, it, expect, beforeAll, afterAll */
|
2 | 2 |
|
3 |
| -import fetch from 'node-fetch' |
4 | 3 | import { join } from 'path'
|
5 | 4 | import {
|
6 | 5 | nextServer,
|
|
9 | 8 | stopApp,
|
10 | 9 | renderViaHTTP
|
11 | 10 | } from 'next-test-utils'
|
| 11 | +import webdriver from 'next-webdriver' |
12 | 12 |
|
13 | 13 | const appDir = join(__dirname, '../')
|
14 | 14 | let appPort
|
@@ -37,32 +37,16 @@ describe('Production Usage', () => {
|
37 | 37 | })
|
38 | 38 | })
|
39 | 39 |
|
40 |
| - describe('JSON pages', () => { |
41 |
| - describe('when asked for a normal page', () => { |
42 |
| - it('should serve the normal page', async () => { |
43 |
| - const url = `http://localhost:${appPort}/_next/${app.renderOpts.buildId}/pages` |
44 |
| - const res = await fetch(url, { compress: false }) |
45 |
| - expect(res.headers.get('Content-Encoding')).toBeNull() |
| 40 | + describe('With navigation', () => { |
| 41 | + it('should navigate via client side', async () => { |
| 42 | + const browser = await webdriver(appPort, '/') |
| 43 | + const text = await browser |
| 44 | + .elementByCss('a').click() |
| 45 | + .waitForElementByCss('.about-page') |
| 46 | + .elementByCss('div').text() |
46 | 47 |
|
47 |
| - const page = await res.json() |
48 |
| - expect(page.component).toBeDefined() |
49 |
| - }) |
50 |
| - }) |
51 |
| - |
52 |
| - describe('when asked for a page with an unknown encoding', () => { |
53 |
| - it('should serve the normal page', async () => { |
54 |
| - const url = `http://localhost:${appPort}/_next/${app.renderOpts.buildId}/pages` |
55 |
| - const res = await fetch(url, { |
56 |
| - compress: false, |
57 |
| - headers: { |
58 |
| - 'Accept-Encoding': 'br' |
59 |
| - } |
60 |
| - }) |
61 |
| - expect(res.headers.get('Content-Encoding')).toBeNull() |
62 |
| - |
63 |
| - const page = await res.json() |
64 |
| - expect(page.component).toBeDefined() |
65 |
| - }) |
| 48 | + expect(text).toBe('About Page') |
| 49 | + browser.close() |
66 | 50 | })
|
67 | 51 | })
|
68 | 52 | })
|
0 commit comments