22
33runner = Applitools ::ClassicRunner . new
44eyes = Applitools ::Images ::Eyes . new ( runner : runner )
5- batch = Applitools ::BatchInfo . new ( 'Applitools Screenshot example ' )
5+ batch = Applitools ::BatchInfo . new ( 'Demo Batch - Images - Ruby ' )
66
77eyes . batch = batch
88
1111end
1212
1313begin
14- file_path = './PNG_IMG1 .png'
14+ file_path = './applitools .png'
1515 image_bytes = File . read ( file_path )
1616 image = Applitools ::Screenshot . from_datastream ( image_bytes )
1717
18- # Classic API
19- eyes . open ( app_name : 'Screenshot example app' , test_name : 'Screenshot example classic api' )
20- eyes . check_image ( tag : 'By file path' , image_path : file_path )
21- eyes . check_image ( tag : 'By image bytes' , image_bytes : image_bytes )
22- eyes . check_image ( tag : 'By Applitools Screenshot' , image : image )
23- eyes . check_region ( tag : 'Check region example' , image : image , region : Applitools ::Region . new ( 200 , 200 , 100 , 100 ) )
24- eyes . close
25-
26- # Fluent API
27- eyes . open ( app_name : 'Screenshot example app' , test_name : 'Screenshot example fluent api' )
18+ eyes . open ( app_name : 'Demo App - Images Ruby' , test_name : 'Smoke Test - Images Ruby' )
19+
2820 eyes . check ( 'By file path' , Applitools ::Images ::Target . path ( file_path ) )
2921 eyes . check ( 'By image bytes' , Applitools ::Images ::Target . blob ( image_bytes ) )
3022 eyes . check ( 'By Applitools Screenshot' , Applitools ::Images ::Target . screenshot ( image ) )
31- eyes . check (
32- 'Check region example' ,
33- Applitools ::Images ::Target . screenshot ( image ) . region ( Applitools ::Region . new ( 200 , 200 , 100 , 100 ) )
34- )
23+
3524 eyes . close
3625rescue => e
3726 puts e . message
3827 eyes . abort
3928ensure
4029 puts runner . get_all_test_results
41- end
42-
43-
30+ end
0 commit comments