File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
lib/PuppeteerSharp.Tests/PageTests Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,28 @@ await page.SetViewportAsync(new ViewPortOptions
9090 }
9191 }
9292
93+ [ Fact ]
94+ public async Task ShouldClipElementsToTheViewport ( )
95+ {
96+ using ( var page = await Context . NewPageAsync ( ) )
97+ {
98+ await page . SetViewportAsync ( new ViewPortOptions { Width = 500 , Height = 500 } ) ;
99+ await page . GoToAsync ( TestConstants . ServerUrl + "/grid.html" ) ;
100+ var screenshot = await page . ScreenshotDataAsync ( new ScreenshotOptions
101+ {
102+ Clip = new Clip
103+ {
104+
105+ X = 50 ,
106+ Y = 600 ,
107+ Width = 100 ,
108+ Height = 100
109+ }
110+ } ) ;
111+ Assert . True ( ScreenshotHelper . PixelMatch ( "screenshot-offscreen-clip.png" , screenshot ) ) ;
112+ }
113+ }
114+
93115 [ Fact ]
94116 public async Task ShouldRunInParallel ( )
95117 {
@@ -148,12 +170,12 @@ public async Task ShouldRunInParallelInMultiplePages()
148170 var pageTasks = new List < Task < Page > > ( ) ;
149171 for ( var i = 0 ; i < n ; i ++ )
150172 {
151- Func < Task < Page > > func = async ( ) =>
173+ async Task < Page > func ( )
152174 {
153175 var page = await Context . NewPageAsync ( ) ;
154176 await page . GoToAsync ( TestConstants . ServerUrl + "/grid.html" ) ;
155177 return page ;
156- } ;
178+ }
157179
158180 pageTasks . Add ( func ( ) ) ;
159181 }
You can’t perform that action at this time.
0 commit comments