@@ -7,7 +7,7 @@ const { expect } = require("../helpers/playwright-custom-expects");
7
7
const config = require ( "../fixtures/simple-config-other/webpack.config" ) ;
8
8
const port = require ( "../ports-map" ) [ "compress-option" ] ;
9
9
10
- describe ( "compress option" , { tag : "@flaky" } , ( ) => {
10
+ describe ( "compress option" , { tag : [ "@flaky" , "@fails" ] } , ( ) => {
11
11
describe ( "enabled by default when not specified" , ( ) => {
12
12
let compiler ;
13
13
let server ;
@@ -44,13 +44,11 @@ describe("compress option", { tag: "@flaky" }, () => {
44
44
45
45
expect ( response . status ( ) ) . toMatchSnapshotWithArray ( ) ;
46
46
47
- expect (
48
- response . headers ( ) [ "content-encoding" ] )
49
- . toMatchSnapshotWithArray ( ) ;
47
+ expect ( response . headers ( ) [ "content-encoding" ] ) . toMatchSnapshotWithArray ( ) ;
50
48
51
49
expect (
52
- consoleMessages . map ( ( message ) => message . text ( ) ) )
53
- . toMatchSnapshotWithArray ( ) ;
50
+ consoleMessages . map ( ( message ) => message . text ( ) ) ,
51
+ ) . toMatchSnapshotWithArray ( ) ;
54
52
55
53
expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
56
54
} ) ;
@@ -98,13 +96,11 @@ describe("compress option", { tag: "@flaky" }, () => {
98
96
99
97
expect ( response . status ( ) ) . toMatchSnapshotWithArray ( ) ;
100
98
101
- expect (
102
- response . headers ( ) [ "content-encoding" ] )
103
- . toMatchSnapshotWithArray ( ) ;
99
+ expect ( response . headers ( ) [ "content-encoding" ] ) . toMatchSnapshotWithArray ( ) ;
104
100
105
101
expect (
106
- consoleMessages . map ( ( message ) => message . text ( ) ) )
107
- . toMatchSnapshotWithArray ( ) ;
102
+ consoleMessages . map ( ( message ) => message . text ( ) ) ,
103
+ ) . toMatchSnapshotWithArray ( ) ;
108
104
109
105
expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
110
106
} ) ;
@@ -137,35 +133,44 @@ describe("compress option", { tag: "@flaky" }, () => {
137
133
await server . stop ( ) ;
138
134
} ) ;
139
135
140
- test ( "should handle GET request to bundle file" , {
141
- annotation : {
142
- type : "fails" ,
143
- description : "https://github.com/webpack/webpack-dev-server/issues/4630#issuecomment-1588211112"
144
- }
145
- } , async ( { page } ) => {
146
- page
147
- . on ( "console" , ( message ) => {
148
- consoleMessages . push ( message ) ;
149
- } )
150
- . on ( "pageerror" , ( error ) => {
151
- pageErrors . push ( error ) ;
136
+ test (
137
+ "should handle GET request to bundle file" ,
138
+ {
139
+ tag : [ "@flaky" ] ,
140
+ annotation : {
141
+ type : "issue" ,
142
+ description :
143
+ "https://github.com/webpack/webpack-dev-server/blob/master/test/e2e/__snapshots__/compress.test.js.snap.webpack5#L7" ,
144
+ } ,
145
+ } ,
146
+ async ( { page } ) => {
147
+ page
148
+ . on ( "console" , ( message ) => {
149
+ consoleMessages . push ( message ) ;
150
+ } )
151
+ . on ( "pageerror" , ( error ) => {
152
+ pageErrors . push ( error ) ;
153
+ } ) ;
154
+
155
+ const response = await page . goto ( `http://127.0.0.1:${ port } /main.js` , {
156
+ waitUntil : "networkidle0" ,
152
157
} ) ;
153
158
154
- const response = await page . goto ( `http://127.0.0.1:${ port } /main.js` , {
155
- waitUntil : "networkidle0" ,
156
- } ) ;
159
+ expect ( response . status ( ) ) . toMatchSnapshotWithArray ( ) ;
157
160
158
- expect ( response . status ( ) ) . toMatchSnapshotWithArray ( ) ;
161
+ // the response sometimes is []
162
+ // and sometimes {"accept-ranges": "bytes", "connection": "keep-alive", "content-length": "276518", "content-type": "application/javascript; charset=utf-8", "date": "Wed, 24 Jul 2024 12:49:54 GMT", "keep-alive": "timeout=5", "x-powered-by": "Express"}
163
+ // the thing is that the content-encoding does not exist in the response headers object
164
+ expect (
165
+ response . headers ( ) [ "content-encoding" ] ,
166
+ ) . toMatchSnapshotWithArray ( ) ;
159
167
160
- expect (
161
- response . headers ( ) [ "content-encoding" ] )
162
- . toMatchSnapshotWithArray ( ) ;
168
+ expect (
169
+ consoleMessages . map ( ( message ) => message . text ( ) ) ,
170
+ ) . toMatchSnapshotWithArray ( ) ;
163
171
164
- expect (
165
- consoleMessages . map ( ( message ) => message . text ( ) ) )
166
- . toMatchSnapshotWithArray ( ) ;
167
-
168
- expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
169
- } ) ;
172
+ expect ( pageErrors ) . toMatchSnapshotWithArray ( ) ;
173
+ } ,
174
+ ) ;
170
175
} ) ;
171
176
} ) ;
0 commit comments