@@ -281,6 +281,44 @@ test.describe('Plots', { tag: [tags.PLOTS, tags.EDITOR] }, () => {
281
281
const data = await resembleCompareImages ( bufferAfterZoom , bufferBeforeZoom , options ) ;
282
282
expect ( data . rawMisMatchPercentage ) . toBeGreaterThan ( 0.0 ) ;
283
283
} ) ;
284
+
285
+ test ( 'Python - Verify Plot Zoom works (Fit vs. 200%)' , async function ( { app, contextMenu, openFile, python, page } , testInfo ) {
286
+ await openFile ( path . join ( 'workspaces' , 'python-plots' , 'matplotlib-zoom-example.py' ) ) ;
287
+ await test . step ( 'Run Python File in Console' , async ( ) => {
288
+ await app . workbench . editor . playButton . click ( ) ;
289
+ await app . workbench . plots . waitForCurrentPlot ( ) ;
290
+ } ) ;
291
+ const imgLocator = page . getByRole ( 'img' , { name : / % r u n / } ) ;
292
+ await contextMenu . triggerAndClick ( {
293
+ menuTrigger : page . getByLabel ( 'Fit' ) ,
294
+ menuItemLabel : 'Fit'
295
+ } ) ;
296
+ await page . waitForTimeout ( 300 ) ;
297
+ const bufferFit1 = await imgLocator . screenshot ( ) ;
298
+ await contextMenu . triggerAndClick ( {
299
+ menuTrigger : page . getByLabel ( 'Fit' ) ,
300
+ menuItemLabel : '200%'
301
+ } ) ;
302
+ await page . waitForTimeout ( 2000 ) ;
303
+ const bufferZoom = await imgLocator . screenshot ( ) ;
304
+ // Compare: Fit vs 200%
305
+ const resultZoom = await resembleCompareImages ( bufferFit1 , bufferZoom , options ) ;
306
+ await testInfo . attach ( 'fit-vs-zoom' , {
307
+ body : resultZoom . getBuffer ( true ) ,
308
+ contentType : 'image/png'
309
+ } ) ;
310
+ expect ( resultZoom . rawMisMatchPercentage ) . toBeGreaterThan ( 2 ) ; // should be large diff
311
+ await contextMenu . triggerAndClick ( {
312
+ menuTrigger : page . getByLabel ( '200%' ) ,
313
+ menuItemLabel : 'Fit'
314
+ } ) ;
315
+ await page . waitForTimeout ( 2000 ) ;
316
+ const bufferFit2 = await imgLocator . screenshot ( ) ;
317
+ // Compare: Fit vs Fit again
318
+ const resultBack = await resembleCompareImages ( bufferFit1 , bufferFit2 , options ) ;
319
+ expect ( resultBack . rawMisMatchPercentage ) . toBeLessThan ( 0.5 ) ; // should be small diff
320
+ } ) ;
321
+
284
322
} ) ;
285
323
286
324
test . describe ( 'R Plots' , {
0 commit comments