Skip to content

Commit 593afed

Browse files
rodrigosf672jthomasmockisabelizimmjmcphersposit-jenkins-enterprise[bot]
authored
e2e test - zoom plot (#8370)
Verify that plot zoom works. ### QA Notes @:web @:win @:plots - [x] default play button based on defined - [ ] await for plot before timeout? - [ ] uncomment R (and put it under the R tests) - [x] {language} - {description} - [ ] UI that gives away that the plot has actually loaded (since relying on element doesn't work) --------- Signed-off-by: Austin Dickey <austin3spammy@gmail.com> Signed-off-by: Wasim Lorgat <mwlorgat@gmail.com> Signed-off-by: Wes McKinney <wesm@apache.org> Signed-off-by: Rodrigo Silva Ferreira <129895386+rodrigosf672@users.noreply.github.com> Co-authored-by: Tom Mock <j.thomasmock@gmail.com> Co-authored-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com> Co-authored-by: Jonathan <jonathan@rstudio.com> Co-authored-by: posit-jenkins-enterprise[bot] <203673010+posit-jenkins-enterprise[bot]@users.noreply.github.com> Co-authored-by: Austin Dickey <austin3spammy@gmail.com> Co-authored-by: positron-bot[bot] <173392469+positron-bot[bot]@users.noreply.github.com> Co-authored-by: Joe Cheng <joe@posit.co> Co-authored-by: Nick Strayer <nick.strayer@posit.co> Co-authored-by: Marie Idleman <marie.idleman@posit.co> Co-authored-by: Davis Vaughan <davis@rstudio.com> Co-authored-by: Christopher Mead <chrisrmead@comcast.net> Co-authored-by: Brian Lambert <brianlambert@gmail.com> Co-authored-by: Wasim Lorgat <mwlorgat@gmail.com> Co-authored-by: Sam Clark <samclark2015@users.noreply.github.com> Co-authored-by: Matthew Lynch <matthew.lynch@posit.co> Co-authored-by: sharon <sharon-wang@users.noreply.github.com> Co-authored-by: Tim Mok <timtmok@users.noreply.github.com> Co-authored-by: Jon Vanausdeln <jon.vanausdeln@posit.co> Co-authored-by: Melissa Barca <5323711+melissa-barca@users.noreply.github.com> Co-authored-by: Wes McKinney <wes@posit.co>
1 parent 90c8d46 commit 593afed

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/e2e/tests/plots/plots.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,44 @@ test.describe('Plots', { tag: [tags.PLOTS, tags.EDITOR] }, () => {
281281
const data = await resembleCompareImages(bufferAfterZoom, bufferBeforeZoom, options);
282282
expect(data.rawMisMatchPercentage).toBeGreaterThan(0.0);
283283
});
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: /%run/ });
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+
284322
});
285323

286324
test.describe('R Plots', {

0 commit comments

Comments
 (0)