Skip to content

Conversation

otulach
Copy link
Contributor

@otulach otulach commented Sep 8, 2025

Pull Request Description

This PR adds Playwright tests for Exercise 2 of the Enso Analytics 101 walkthrough:
https://community.ensoanalytics.com/c/enso-analytics-101/sections/637012/lessons/2410664


Exercise 2: Data Aggregation & Pivoting

Includes:

  • Aggregation with aggregate to count accounts by product type.
  • Sorting with sort to rank top-performing products.
  • Cross-tabulation with cross_tab for multi-dimensional analysis.
  • Data cleaning with set to fix entry errors.

Outcome
Tests the overall functionality of Exercise 2. Divided into separate objectives for better readability.

@otulach otulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Sep 8, 2025
Copy link
Contributor

@vitvakatu vitvakatu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, except for a suspicious interactions with productBtn

visualizeData,
} from './electronTest'

// First excercise in Enso Analytics 101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// First excercise in Enso Analytics 101
// Second excercise in Enso Analytics 101

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also excercise -> exercise

Comment on lines +73 to +76
// If dropdown menu doesn't open, click groupBy again to avoid test flakyness
if (!(await productBtn.isVisible())) {
await groupBy.click()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we avoid a flaky test here. Why does it not work on the first attempt? Perhaps we can wait for some visual indication that it is ready? Or is there some bug that prevents it from working?

Comment on lines +84 to +89
await page
.locator('div.WidgetTopLevelArgument', { hasText: 'columns' })
.getByRole('list')
.filter({ hasText: /^$/ })
.getByLabel('Add a new item')
.click()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are three repetitions of this action; let’s extract it to a function.

Comment on lines +165 to +171
await crossTab.hover()
await page.mouse.down()
const box = await crossTab.boundingBox()
if (box) {
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2 + 200)
}
await page.mouse.up()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an easier way to do dragging. Check out moveNode in collapsingAndEntering.spec.ts:

function moveNode(page: Page, binding: string, relativePos: RelativePos) {
    return grabNode(page, binding).dragTo(grabNode(page, relativePos.relativeTo ?? binding), {
      force: true,
      targetPosition: relativePos,
    })
  }

grabNode can be replaced with graphNodeIcon, it’s an oversight on my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants