-
Notifications
You must be signed in to change notification settings - Fork 332
Playwright testing Enso 101, exercise 2 #13951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// First excercise in Enso Analytics 101 | |
// Second excercise in Enso Analytics 101 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also excercise
-> exercise
// If dropdown menu doesn't open, click groupBy again to avoid test flakyness | ||
if (!(await productBtn.isVisible())) { | ||
await groupBy.click() | ||
} |
There was a problem hiding this comment.
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?
await page | ||
.locator('div.WidgetTopLevelArgument', { hasText: 'columns' }) | ||
.getByRole('list') | ||
.filter({ hasText: /^$/ }) | ||
.getByLabel('Add a new item') | ||
.click() |
There was a problem hiding this comment.
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.
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() |
There was a problem hiding this comment.
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.
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:
aggregate
to count accounts by product type.sort
to rank top-performing products.cross_tab
for multi-dimensional analysis.set
to fix entry errors.Outcome
Tests the overall functionality of Exercise 2. Divided into separate objectives for better readability.