22
33import { join } from 'path'
44import { renderViaHTTP , findPort , launchApp , killApp } from 'next-test-utils'
5- import webdriver from 'next-webdriver'
65
76// test suits
87import hmr from './hmr'
@@ -21,54 +20,9 @@ describe('Basic Features', () => {
2120 context . server = await launchApp ( join ( __dirname , '../' ) , context . appPort , {
2221 env : { __NEXT_TEST_WITH_DEVTOOL : 1 } ,
2322 } )
24-
25- // pre-build all pages at the start
26- await Promise . all ( [
27- renderViaHTTP ( context . appPort , '/process-env' ) ,
28-
29- renderViaHTTP ( context . appPort , '/hmr/about' ) ,
30- renderViaHTTP ( context . appPort , '/hmr/style' ) ,
31- renderViaHTTP ( context . appPort , '/hmr/contact' ) ,
32- renderViaHTTP ( context . appPort , '/hmr/counter' ) ,
33- ] )
3423 } )
3524 afterAll ( ( ) => killApp ( context . server ) )
3625
37- it ( 'should polyfill Node.js modules' , async ( ) => {
38- const browser = await webdriver ( context . appPort , '/node-browser-polyfills' )
39-
40- console . error ( {
41- logs : await browser . log ( 'browser' ) ,
42- content : await browser . eval ( 'document.documentElement.innerHTML' ) ,
43- } )
44-
45- await browser . waitForCondition ( 'window.didRender' )
46-
47- const data = await browser
48- . waitForElementByCss ( '#node-browser-polyfills' )
49- . text ( )
50- const parsedData = JSON . parse ( data )
51-
52- expect ( parsedData . vm ) . toBe ( 105 )
53- expect ( parsedData . hash ) . toBe (
54- 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
55- )
56- expect ( parsedData . buffer ) . toBe ( 'hello world' )
57- expect ( parsedData . stream ) . toBe ( true )
58- expect ( parsedData . assert ) . toBe ( true )
59- expect ( parsedData . constants ) . toBe ( 7 )
60- expect ( parsedData . domain ) . toBe ( true )
61- expect ( parsedData . http ) . toBe ( true )
62- expect ( parsedData . https ) . toBe ( true )
63- expect ( parsedData . os ) . toBe ( '\n' )
64- expect ( parsedData . path ) . toBe ( '/hello/world/test.txt' )
65- expect ( parsedData . process ) . toBe ( 'browser' )
66- expect ( parsedData . querystring ) . toBe ( 'a=b' )
67- expect ( parsedData . stringDecoder ) . toBe ( true )
68- expect ( parsedData . sys ) . toBe ( true )
69- expect ( parsedData . timers ) . toBe ( true )
70- } )
71-
7226 dynamic ( context , ( p , q ) => renderViaHTTP ( context . appPort , p , q ) )
7327 hmr ( context , ( p , q ) => renderViaHTTP ( context . appPort , p , q ) )
7428 errorRecovery ( context , ( p , q ) => renderViaHTTP ( context . appPort , p , q ) )
0 commit comments