forked from PostHog/posthog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: playwright 16 (PostHog#28994)
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
- Loading branch information
1 parent
179634a
commit b713e70
Showing
15 changed files
with
3,313 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import path from 'path' | ||
|
||
import { expect, test } from '../utils/playwright-test-base' | ||
|
||
test.describe('Events', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.route('/api/event/values?key=%24browser', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
body: JSON.stringify([{ name: '96' }, { name: '97' }]), | ||
}) | ||
) | ||
|
||
await page.route('/api/projects/@current/property_definitions/?limit=5000', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
path: path.resolve(__dirname, '../mocks/events/property_definitions.json'), | ||
}) | ||
) | ||
|
||
await page.route('/api/projects/*/property_definitions?is_feature_flag=false&search=&*', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
path: path.resolve(__dirname, '../mocks/events/property_definitions.json'), | ||
}) | ||
) | ||
|
||
await page.route('/api/projects/*/property_definitions?is_feature_flag=false&search=%24time*', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
path: path.resolve(__dirname, '../mocks/events/only_time_property_definition.json'), | ||
}) | ||
) | ||
|
||
await page.route('/api/projects/*/property_definitions?is_feature_flag=false&search=%24browser*', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
path: path.resolve(__dirname, '../mocks/events/only_browser_version_property_definition.json'), | ||
}) | ||
) | ||
|
||
await page.route('/api/projects/*/property_definitions?is_feature_flag=true*', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
path: path.resolve(__dirname, '../mocks/events/feature_flag_property_definition.json'), | ||
}) | ||
) | ||
|
||
await page.route('/api/event/values/?key=$browser_version', (route) => | ||
route.fulfill({ | ||
status: 200, | ||
body: JSON.stringify([{ name: '96' }, { name: '97' }]), | ||
}) | ||
) | ||
|
||
await page.goToMenuItem('activity') | ||
await page.waitForURL('**/activity/explore') | ||
}) | ||
|
||
/** works locally but not in CI - in CI the event list is never loading */ | ||
test.skip('Click on an event', async ({ page }) => { | ||
await expect(page.locator('.DataTable .DataTable__row').first()).toBeVisible() | ||
await page.locator('.DataTable .DataTable__row .LemonTable__toggle').first().click() | ||
await expect(page.locator('[data-attr=event-details]')).toBeVisible() | ||
}) | ||
|
||
test('Apply 1 overall filter', async ({ page }) => { | ||
await page.locator('[data-attr="new-prop-filter-EventPropertyFilters.0"]').click() | ||
await page.locator('[data-attr=taxonomic-filter-searchfield]').click() | ||
await page.locator('[data-attr=prop-filter-event_properties-0]').click() | ||
await page.locator('[data-attr=prop-val]').click({ force: true }) | ||
await page.waitForResponse('/api/event/values?key=%24browser') | ||
await page.locator('[data-attr=prop-val-0]').click() | ||
await expect(page.locator('.DataTable')).toBeVisible() | ||
}) | ||
|
||
test('Separates feature flag properties into their own tab', async ({ page }) => { | ||
await page.locator('[data-attr="new-prop-filter-EventPropertyFilters.0"]').click() | ||
await expect(page.locator('[data-attr="taxonomic-tab-event_feature_flags"]')).toContainText('Feature flags: 2') | ||
await page.locator('[data-attr="taxonomic-tab-event_feature_flags"]').click() | ||
await expect(page.locator('.taxonomic-list-row:visible')).toHaveCount(2) | ||
}) | ||
|
||
test('Use before and after with a DateTime property', async ({ page }) => { | ||
await page.locator('[data-attr="new-prop-filter-EventPropertyFilters.0"]').click() | ||
await page.locator('[data-attr=taxonomic-filter-searchfield]').type('$time') | ||
await expect(page.locator('.taxonomic-list-row')).toHaveCount(1) | ||
await page.locator('[data-attr=prop-filter-event_properties-0]').click({ force: true }) | ||
|
||
await page.locator('[data-attr="taxonomic-operator"]').click() | ||
await expect(page.getByRole('menuitem', { name: '> after' })).toBeVisible() | ||
await expect(page.getByRole('menuitem', { name: '< before' })).toBeVisible() | ||
}) | ||
|
||
test('Use less than and greater than with a numeric property', async ({ page }) => { | ||
await page.locator('[data-attr="new-prop-filter-EventPropertyFilters.0"]').click() | ||
await page.locator('[data-attr=taxonomic-filter-searchfield]').type('$browser_version') | ||
await expect(page.locator('.taxonomic-list-row')).toHaveCount(1) | ||
await page.locator('.taxonomic-list-row').click() | ||
|
||
await page.locator('[data-attr="taxonomic-operator"]').click() | ||
await expect(page.locator('.operator-value-option')).toHaveCount(11) // 10 + 1 for the label in the LemonSelect button | ||
await expect(page.getByRole('menuitem', { name: '< less than' })).toBeVisible() | ||
await expect(page.getByRole('menuitem', { name: '> greater than' })).toBeVisible() | ||
}) | ||
|
||
test('Adds and removes an additional column', async ({ page }) => { | ||
await page.locator('[data-attr=events-table-column-selector]').click() | ||
await page.locator('[data-attr=taxonomic-filter-searchfield]').type('$browser_version') | ||
await expect(page.locator('.taxonomic-list-row')).toHaveCount(1) | ||
await page.locator('.taxonomic-list-row').click() | ||
await expect(page.locator('.SelectedColumn')).toHaveCount(7) | ||
await page.locator('[data-attr=column-display-item-remove-icon]').last().click() | ||
await expect(page.locator('.SelectedColumn')).toHaveCount(6) | ||
}) | ||
|
||
test('Keeps the popup open after selecting an option', async ({ page }) => { | ||
await page.locator('[data-attr="new-prop-filter-EventPropertyFilters.0"]').click() | ||
await page.locator('[data-attr=taxonomic-filter-searchfield]').type('$browser_version') | ||
await expect(page.locator('.taxonomic-list-row')).toHaveCount(1) | ||
await page.locator('.taxonomic-list-row').click() | ||
|
||
await page.locator('[data-attr="taxonomic-operator"]').click() | ||
await page.getByRole('menuitem', { name: '> greater than' }).click() | ||
await expect(page.locator('[data-attr="taxonomic-operator"]')).toBeVisible() | ||
}) | ||
}) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
playwright/mocks/events/feature_flag_property_definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"count": 2, | ||
"next": null, | ||
"previous": null, | ||
"results": [ | ||
{ | ||
"id": "017dde0e-1cb5-0000-68b4-44835b7c894f", | ||
"name": "$feature/awesome-new-hidden-thing", | ||
"is_numerical": false, | ||
"query_usage_30_day": null, | ||
"property_type": null, | ||
"is_seen_on_filtered_events": null | ||
}, | ||
{ | ||
"id": "017dde0e-1cb5-0000-68b4-44835b7c894f", | ||
"name": "$feature/our-cool-experiment", | ||
"is_numerical": false, | ||
"query_usage_30_day": null, | ||
"property_type": null, | ||
"is_seen_on_filtered_events": null | ||
} | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
playwright/mocks/events/only_browser_version_property_definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"count": 1, | ||
"next": null, | ||
"previous": null, | ||
"results": [ | ||
{ | ||
"id": "017dde0e-1cb5-0000-68b4-44835b7c894f", | ||
"name": "$browser_version", | ||
"is_numerical": true, | ||
"query_usage_30_day": null, | ||
"property_type": null, | ||
"is_seen_on_filtered_events": null | ||
} | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
playwright/mocks/events/only_time_property_definition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"count": 1, | ||
"next": null, | ||
"previous": null, | ||
"results": [ | ||
{ | ||
"id": "017dde0e-1cc9-0000-ed91-26909937767f", | ||
"name": "$time", | ||
"is_numerical": true, | ||
"query_usage_30_day": null, | ||
"property_type": "DateTime", | ||
"is_seen_on_filtered_events": null | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"count": 2, | ||
"next": null, | ||
"previous": null, | ||
"results": [ | ||
{ | ||
"id": "017dde0e-1cb5-0000-68b4-44835b7c894f", | ||
"name": "$browser", | ||
"is_numerical": true, | ||
"query_usage_30_day": null, | ||
"property_type": null, | ||
"is_seen_on_filtered_events": null | ||
}, | ||
{ | ||
"id": "017dde0e-1cc9-0000-ed91-26909937767f", | ||
"name": "$time", | ||
"is_numerical": true, | ||
"query_usage_30_day": null, | ||
"property_type": "DateTime", | ||
"is_seen_on_filtered_events": null | ||
} | ||
] | ||
} |
Oops, something went wrong.