Skip to content

Commit 2ec71fd

Browse files
authored
Fix issue with dropdown interactions (#6444)
1 parent b58582b commit 2ec71fd

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

e2e/tests/dashboard/behaviours.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
rowLink,
1717
expectMetricValues,
1818
dropdown,
19+
expectDropdownClosed,
1920
detailsLink,
2021
modal,
2122
closeModalButton,
@@ -792,6 +793,7 @@ test('props breakdown', async ({ page, request }) => {
792793
})
793794

794795
await test.step('loading more', async () => {
796+
await expectDropdownClosed(report)
795797
await propsTabButton.click()
796798
const showMoreButton = dropdown(report).getByRole('button', {
797799
name: 'Show 1 more'
@@ -938,8 +940,14 @@ test('funnels', async ({ page, request }) => {
938940
})
939941

940942
await test.step('loading more', async () => {
943+
await expectDropdownClosed(report)
941944
await funnelsTabButton.click()
942-
await dropdown(report).getByRole('button', { name: 'Show 1 more' }).click()
945+
const showMoreButton = dropdown(report).getByRole('button', {
946+
name: 'Show 1 more'
947+
})
948+
await showMoreButton.click()
949+
await expect(showMoreButton).toBeHidden()
950+
await expect(dropdown(report).getByRole('button')).toHaveCount(11)
943951
await dropdown(report)
944952
.getByRole('button', { name: 'Shopping 1 Funnel' })
945953
.click()
@@ -948,6 +956,7 @@ test('funnels', async ({ page, request }) => {
948956
})
949957

950958
await test.step('searching', async () => {
959+
await expectDropdownClosed(report)
951960
await funnelsTabButton.click()
952961
await searchInput(report).fill('Shopping 1')
953962

e2e/tests/test-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ export const expectMetricValues = async (
6363
export const dropdown = (report: Locator) =>
6464
report.getByTestId('dropdown-items')
6565

66+
// Needed before opening dropdown again right after it closes (usually, when picking an item).
67+
// There's a leave transition for the dropdown and interacting with the dropdown opener
68+
// during the transition may mean that the dropdown doesn't actually open.
69+
export const expectDropdownClosed = async (report: Locator) =>
70+
expect(dropdown(report)).toHaveCount(0)
71+
6672
export const searchInput = (report: Locator) =>
6773
report.getByTestId('search-input')
6874

0 commit comments

Comments
 (0)