@@ -18,24 +18,38 @@ describe('frowser', () => {
18
18
} )
19
19
20
20
describe ( '.takeScreenshot' , ( ) => {
21
- it ( 'png' , ( ) =>
22
- frowser . takeScreenshot ( 'http://example.com' ) . then ( tmpStream => {
23
- should ( fs . readFileSync ( tmpStream . path ) ) . be . eql (
24
- fs . readFileSync ( 'test/example.png' )
25
- )
26
- should ( path . extname ( tmpStream . path ) ) . be . equal ( '.png' )
27
- tmpStream . cleanupSync ( )
28
- } ) )
29
-
30
- it ( 'jpeg' , ( ) =>
31
- frowser
32
- . takeScreenshot ( 'http://example.com' , { type : 'jpeg' } )
33
- . then ( tmpStream => {
21
+ describe ( 'format' , ( ) => {
22
+ it ( 'png' , ( ) =>
23
+ frowser . takeScreenshot ( 'http://example.com' ) . then ( tmpStream => {
34
24
should ( fs . readFileSync ( tmpStream . path ) ) . be . eql (
35
- fs . readFileSync ( 'test/example.jpeg ' )
25
+ fs . readFileSync ( 'test/example.png ' )
36
26
)
37
- should ( path . extname ( tmpStream . path ) ) . be . equal ( '.jpeg ' )
27
+ should ( path . extname ( tmpStream . path ) ) . be . equal ( '.png ' )
38
28
tmpStream . cleanupSync ( )
39
29
} ) )
30
+
31
+ it ( 'jpeg' , ( ) =>
32
+ frowser
33
+ . takeScreenshot ( 'http://example.com' , { type : 'jpeg' } )
34
+ . then ( tmpStream => {
35
+ should ( fs . readFileSync ( tmpStream . path ) ) . be . eql (
36
+ fs . readFileSync ( 'test/example.jpeg' )
37
+ )
38
+ should ( path . extname ( tmpStream . path ) ) . be . equal ( '.jpeg' )
39
+ tmpStream . cleanupSync ( )
40
+ } ) )
41
+ } )
42
+
43
+ describe ( 'devices' , ( ) => {
44
+ it ( 'iPhone 6' , ( ) =>
45
+ frowser
46
+ . takeScreenshot ( 'http://example.com' , { device : 'iPhone 6' } )
47
+ . then ( tmpStream => {
48
+ should ( fs . readFileSync ( tmpStream . path ) ) . be . eql (
49
+ fs . readFileSync ( 'test/example-iphone.png' )
50
+ )
51
+ tmpStream . cleanupSync ( )
52
+ } ) )
53
+ } )
40
54
} )
41
55
} )
0 commit comments