Skip to content
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

fix: replay storybook scene rot #23383

Merged
merged 6 commits into from
Jul 2, 2024
Merged

fix: replay storybook scene rot #23383

merged 6 commits into from
Jul 2, 2024

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Jul 1, 2024

we don't snapshot the replay scenes and so they're falling out of sync with reality, a few fixes to remove some error toasts and console error noise when viewing them

@pauldambra pauldambra changed the title fix: replau storybook scene rot fix: replay storybook scene rot Jul 1, 2024
@pauldambra pauldambra requested a review from a team July 1, 2024 22:10
Copy link
Contributor

github-actions bot commented Jul 1, 2024

Size Change: +224 B (+0.02%)

Total Size: 1.06 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.06 MB +224 B (+0.02%)

compressed-size-action

@@ -621,7 +621,7 @@ export const sessionRecordingPlayerLogic = kea<sessionRecordingPlayerLogicType>(
// Check for the "t" search param in the url on first load
if (!cache.hasInitialized) {
cache.hasInitialized = true
const searchParams = fromParamsGivenUrl(window.location.search)
const searchParams = router.values.searchParams
Copy link
Member Author

Choose a reason for hiding this comment

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

window.location.search was picking up the storybook iframe searchparams not the applications apparent search params

@@ -736,6 +736,7 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
}
] => {
const params: Params = objectClean({
...router.values.searchParams,
Copy link
Member Author

Choose a reason for hiding this comment

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

this was replacing all search params which makes it hard to do things like add t when you know it should work

Copy link
Member Author

Choose a reason for hiding this comment

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

these playlist views are, I guess, broken only in these snapshots 🙈

Comment on lines 679 to 682
// KLUDGE: when loaded for visual regression tests we want to pause the player
// but only after it has had time to buffer and show the frame
actions.setPause()
}, 100)
Copy link
Member Author

Choose a reason for hiding this comment

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

a little yucky but it should let us have a test that proves we can render a recording without flapping 🤞

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use waitForSelector in the test instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Frustratingly if we start paused we never process the data so the player frame is just a black square. If we play (the default behaviour and then stop after its processed the data then we see the player screen and can assert that at least the full snapshot has been processed (i.e. we didn't completely break rrweb playback)

We have to be paused so that the visual regression snapshot doesn't flap because of the seekbar timestamp changing

And don't want to be at 0 so we can see that the sekbar at least paints the "played" portion of the recording correctly

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added more to the comment so that the future traveller who wants to avoid this slightly yucky reaching into implementation code from tests knows what I was thinking

Comment on lines 679 to 682
// KLUDGE: when loaded for visual regression tests we want to pause the player
// but only after it has had time to buffer and show the frame
actions.setPause()
}, 100)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use waitForSelector in the test instead?

@pauldambra pauldambra merged commit b77705d into master Jul 2, 2024
91 checks passed
@pauldambra pauldambra deleted the fix/replay-scenes branch July 2, 2024 09:17
fuziontech pushed a commit that referenced this pull request Jul 2, 2024
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
zlwaterfield pushed a commit that referenced this pull request Jul 2, 2024
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants