File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,25 @@ describe('Download', function() {
51
51
expect ( fs . readFileSync ( path ) . toString ( ) ) . toBe ( 'Hello world' ) ;
52
52
await page . close ( ) ;
53
53
} ) ;
54
+ it . fail ( WEBKIT ) ( 'should report non-navigation downloads' , async ( { browser, server} ) => {
55
+ // Our WebKit embedder does not download in this case.
56
+ server . setRoute ( '/download' , ( req , res ) => {
57
+ res . setHeader ( 'Content-Type' , 'application/octet-stream' ) ;
58
+ res . end ( `Hello world` ) ;
59
+ } ) ;
60
+
61
+ const page = await browser . newPage ( { acceptDownloads : true } ) ;
62
+ await page . goto ( server . EMPTY_PAGE ) ;
63
+ await page . setContent ( `<a download="file.txt" href="${ server . PREFIX } /download">download</a>` ) ;
64
+ const [ download ] = await Promise . all ( [
65
+ page . waitForEvent ( 'download' ) ,
66
+ page . click ( 'a' )
67
+ ] ) ;
68
+ const path = await download . path ( ) ;
69
+ expect ( fs . existsSync ( path ) ) . toBeTruthy ( ) ;
70
+ expect ( fs . readFileSync ( path ) . toString ( ) ) . toBe ( 'Hello world' ) ;
71
+ await page . close ( ) ;
72
+ } ) ;
54
73
it ( 'should delete file' , async ( { browser, server} ) => {
55
74
const page = await browser . newPage ( { acceptDownloads : true } ) ;
56
75
await page . setContent ( `<a download=true href="${ server . PREFIX } /download">download</a>` ) ;
You can’t perform that action at this time.
0 commit comments