browser_headless_screenshot_2.js (1227B)
1 "use strict"; 2 add_task(async function () { 3 const cwdScreenshotPath = PathUtils.join( 4 Services.dirsvc.get("CurWorkD", Ci.nsIFile).path, 5 "screenshot.png" 6 ); 7 8 // Test variations of the "screenshot" argument when a file path 9 // isn't specified. 10 await testFileCreationPositive( 11 [ 12 "-screenshot", 13 "http://mochi.test:8888/browser/browser/components/shell/test/headless.html", 14 ], 15 cwdScreenshotPath 16 ); 17 await testFileCreationPositive( 18 [ 19 "http://mochi.test:8888/browser/browser/components/shell/test/headless.html", 20 "-screenshot", 21 ], 22 cwdScreenshotPath 23 ); 24 await testFileCreationPositive( 25 [ 26 "--screenshot", 27 "http://mochi.test:8888/browser/browser/components/shell/test/headless.html", 28 ], 29 cwdScreenshotPath 30 ); 31 await testFileCreationPositive( 32 [ 33 "http://mochi.test:8888/browser/browser/components/shell/test/headless.html", 34 "--screenshot", 35 ], 36 cwdScreenshotPath 37 ); 38 39 // Test with additional command options 40 await testFileCreationPositive( 41 [ 42 "--screenshot", 43 "http://mochi.test:8888/browser/browser/components/shell/test/headless.html", 44 "-attach-console", 45 ], 46 cwdScreenshotPath 47 ); 48 });