1
1
import { join } from 'path'
2
- import cheerio from 'cheerio'
3
- import {
4
- getBrowserBodyText ,
5
- renderViaHTTP ,
6
- retry ,
7
- waitFor ,
8
- } from 'next-test-utils'
2
+ import { getBrowserBodyText , retry , waitFor } from 'next-test-utils'
9
3
import { nextTestSetup } from 'e2e-utils'
10
4
11
5
export function runHotModuleReloadHmrTest ( nextConfig : {
@@ -197,13 +191,14 @@ export function runHotModuleReloadHmrTest(nextConfig: {
197
191
198
192
expect ( initialFontSize ) . toBe ( '100px' )
199
193
200
- const initialHtml = await renderViaHTTP (
201
- next . url ,
194
+ const initialHtml = await next . render (
202
195
basePath + '/hmr/style-dynamic-component'
203
196
)
204
197
expect ( initialHtml . includes ( '100px' ) ) . toBeTruthy ( )
205
198
206
- const $initialHtml = cheerio . load ( initialHtml )
199
+ const $initialHtml = await next . render$ (
200
+ basePath + '/hmr/style-dynamic-component'
201
+ )
207
202
const initialServerClassName =
208
203
$initialHtml ( '#dynamic-component' ) . attr ( 'class' )
209
204
@@ -229,12 +224,13 @@ export function runHotModuleReloadHmrTest(nextConfig: {
229
224
expect ( browserHtml . includes ( 'font-size:200px' ) ) . toBe ( true )
230
225
expect ( browserHtml . includes ( 'font-size:100px' ) ) . toBe ( false )
231
226
232
- const editedHtml = await renderViaHTTP (
233
- next . url ,
227
+ const editedHtml = await next . render (
234
228
basePath + '/hmr/style-dynamic-component'
235
229
)
236
230
expect ( editedHtml . includes ( '200px' ) ) . toBeTruthy ( )
237
- const $editedHtml = cheerio . load ( editedHtml )
231
+ const $editedHtml = await next . render$ (
232
+ basePath + '/hmr/style-dynamic-component'
233
+ )
238
234
const editedServerClassName =
239
235
$editedHtml ( '#dynamic-component' ) . attr ( 'class' )
240
236
0 commit comments