-
-
Notifications
You must be signed in to change notification settings - Fork 638
Replace streaming flaky tests with Playwright E2E tests #1869
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
Merged
AbanoubGhadban
merged 24 commits into
master
from
abanoubghadban/ror1866/fix-streaming-flaky-tests
Oct 21, 2025
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
67b2ffc
revert this: making some variations to the streaming tests to check t…
AbanoubGhadban 4545805
Revert "revert this: making some variations to the streaming tests to…
AbanoubGhadban 31bca68
initial installation of playwright
AbanoubGhadban a3727f8
add redis receiver component and add a e2e test for it
AbanoubGhadban e8bc6f1
move playwright tests from reat_on_rails_pro to spec/dummy directory
AbanoubGhadban 5a070b6
set proper names and description for the test file
AbanoubGhadban 94aa944
add streaming tests
AbanoubGhadban 3668ed4
add Toggle button to the snapshots
AbanoubGhadban 68d10fc
testing behavior when there is an async client component
AbanoubGhadban 5ec1071
add tests for rsc payload fetching
AbanoubGhadban 1840336
add dummy-app-node-renderer-e2-tests to the ci workflow
AbanoubGhadban c5851aa
remove replaced integration specs at rails
AbanoubGhadban 6064b02
fix node renderer build
AbanoubGhadban 5d7cfa2
fix CI failure and other tiny improvements
AbanoubGhadban 3954ee2
tiny fixes
AbanoubGhadban 8d4b4c4
improve redis tear down
AbanoubGhadban 182e040
tiny fixes
AbanoubGhadban 916f7c8
linting
AbanoubGhadban b72d198
increase redis timeout
AbanoubGhadban 57bcf7d
Empty commit
AbanoubGhadban bf0652a
fix config issue at eslint ts configs
AbanoubGhadban 6454b9e
store capybara screenshots and html for failed tests
AbanoubGhadban 7176d49
adjust eslint config to work with e2e-tests
AbanoubGhadban f5de26b
update path to tsconfig at the typescript check command
AbanoubGhadban File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,2 +1,9 @@ | ||
| # React on Rails Pro license file | ||
| config/react_on_rails_pro_license.key | ||
|
|
||
| # Playwright | ||
| /test-results/ | ||
| /playwright-report/ | ||
| /blob-report/ | ||
| /playwright/.cache/ | ||
| /playwright/.auth/ |
9 changes: 9 additions & 0 deletions
9
react_on_rails_pro/spec/dummy/__snapshots__/streaming.spec.ts/stage0.aria.yml
This file contains hidden or 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,9 @@ | ||
| - main: | ||
| - heading "A list of items received from Redis:" [level=1] | ||
| - button "Hide Redis Items" | ||
| - list: | ||
| - paragraph: Waiting for the key "Item1" | ||
| - paragraph: Waiting for the key "Item2" | ||
| - paragraph: Waiting for the key "Item3" | ||
| - paragraph: Waiting for the key "Item4" | ||
| - paragraph: Waiting for the key "Item5" |
9 changes: 9 additions & 0 deletions
9
react_on_rails_pro/spec/dummy/__snapshots__/streaming.spec.ts/stage1.aria.yml
This file contains hidden or 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,9 @@ | ||
| - main: | ||
| - heading "A list of items received from Redis:" [level=1] | ||
| - button "Hide Redis Items" | ||
| - list: | ||
| - listitem: "Value of \"Item1\": Incremental Value1" | ||
| - paragraph: Waiting for the key "Item2" | ||
| - paragraph: Waiting for the key "Item3" | ||
| - paragraph: Waiting for the key "Item4" | ||
| - paragraph: Waiting for the key "Item5" |
9 changes: 9 additions & 0 deletions
9
react_on_rails_pro/spec/dummy/__snapshots__/streaming.spec.ts/stage2.aria.yml
This file contains hidden or 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,9 @@ | ||
| - main: | ||
| - heading "A list of items received from Redis:" [level=1] | ||
| - button "Hide Redis Items" | ||
| - list: | ||
| - listitem: "Value of \"Item1\": Incremental Value1" | ||
| - paragraph: Waiting for the key "Item2" | ||
| - paragraph: Waiting for the key "Item3" | ||
| - listitem: "Value of \"Item4\": Incremental Value4" | ||
| - paragraph: Waiting for the key "Item5" |
9 changes: 9 additions & 0 deletions
9
react_on_rails_pro/spec/dummy/__snapshots__/streaming.spec.ts/stage3.aria.yml
This file contains hidden or 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,9 @@ | ||
| - main: | ||
| - heading "A list of items received from Redis:" [level=1] | ||
| - button "Hide Redis Items" | ||
| - list: | ||
| - listitem: "Value of \"Item1\": Incremental Value1" | ||
| - listitem: "Value of \"Item2\": Incremental Value2" | ||
| - paragraph: Waiting for the key "Item3" | ||
| - listitem: "Value of \"Item4\": Incremental Value4" | ||
| - paragraph: Waiting for the key "Item5" |
9 changes: 9 additions & 0 deletions
9
react_on_rails_pro/spec/dummy/__snapshots__/streaming.spec.ts/stage4.aria.yml
This file contains hidden or 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,9 @@ | ||
| - main: | ||
| - heading "A list of items received from Redis:" [level=1] | ||
| - button "Hide Redis Items" | ||
| - list: | ||
| - listitem: "Value of \"Item1\": Incremental Value1" | ||
| - listitem: "Value of \"Item2\": Incremental Value2" | ||
| - listitem: "Value of \"Item3\": Incremental Value3" | ||
| - listitem: "Value of \"Item4\": Incremental Value4" | ||
| - paragraph: Waiting for the key "Item5" |
9 changes: 9 additions & 0 deletions
9
react_on_rails_pro/spec/dummy/__snapshots__/streaming.spec.ts/stage5.aria.yml
This file contains hidden or 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,9 @@ | ||
| - main: | ||
| - heading "A list of items received from Redis:" [level=1] | ||
| - button "Hide Redis Items" | ||
| - list: | ||
| - listitem: "Value of \"Item1\": Incremental Value1" | ||
| - listitem: "Value of \"Item2\": Incremental Value2" | ||
| - listitem: "Value of \"Item3\": Incremental Value3" | ||
| - listitem: "Value of \"Item4\": Incremental Value4" | ||
| - listitem: "Value of \"Item5\": Incremental Value5" |
This file contains hidden or 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
8 changes: 8 additions & 0 deletions
8
react_on_rails_pro/spec/dummy/app/views/pages/redis_receiver.html.erb
This file contains hidden or 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,8 @@ | ||
| <%= stream_react_component("RedisReceiver", | ||
| props: { requestId: @request_id, asyncToggleContainer: params[:async_toggle_container] }, | ||
| prerender: true, | ||
| trace: true, | ||
| id: "RedisReceiver-react-component-0") %> | ||
| <hr/> | ||
|
|
||
| <h1>React Rails Server Streaming Redis Receiver</h1> |
6 changes: 5 additions & 1 deletion
6
react_on_rails_pro/spec/dummy/app/views/pages/server_router.html.erb
This file contains hidden or 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 hidden or 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 hidden or 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
63 changes: 63 additions & 0 deletions
63
react_on_rails_pro/spec/dummy/client/app/ror-auto-load-components/RedisReceiver.jsx
This file contains hidden or 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,63 @@ | ||
| import React, { Suspense } from 'react'; | ||
| import ToggleContainer from '../components/RSCPostsPage/ToggleContainerForServerComponents'; | ||
| import { listenToRequestData } from '../utils/redisReceiver'; | ||
| import { ErrorBoundary } from '../components/ErrorBoundary'; | ||
|
|
||
| const RedisItem = async ({ getValue, itemIndex }) => { | ||
| const value = await getValue(`Item${itemIndex}`); | ||
| return ( | ||
| <li className={`redis-item${itemIndex}`}> | ||
| Value of "Item{itemIndex + 1}": {value} | ||
| </li> | ||
| ); | ||
| }; | ||
|
|
||
| const RedisItemWithWrapper = ({ getValue, itemIndex }) => ( | ||
| <section className={`redis-item${itemIndex}-container`}> | ||
| <Suspense | ||
| fallback={ | ||
| <p className={`redis-item${itemIndex}-fallback`}> | ||
| Waiting for the key "Item{itemIndex + 1}" | ||
| </p> | ||
| } | ||
| > | ||
| <RedisItem getValue={getValue} itemIndex={itemIndex} /> | ||
| </Suspense> | ||
| </section> | ||
| ); | ||
|
|
||
| // Convert it to async component and make tests control when it's rendered | ||
| // To test the page behavior when a client component is rendered asynchronously at the page | ||
| const AsyncToggleContainer = async ({ children, childrenTitle, getValue }) => { | ||
| await getValue('ToggleContainer'); | ||
| return <ToggleContainer childrenTitle={childrenTitle}>{children}</ToggleContainer>; | ||
| }; | ||
|
|
||
| const RedisReceiver = ({ requestId, asyncToggleContainer }, railsContext) => { | ||
| const { getValue, close } = listenToRequestData(requestId); | ||
|
|
||
| if ('addPostSSRHook' in railsContext) { | ||
| railsContext.addPostSSRHook(close); | ||
| } | ||
AbanoubGhadban marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const UsedToggleContainer = asyncToggleContainer ? AsyncToggleContainer : ToggleContainer; | ||
|
|
||
| return () => ( | ||
| <ErrorBoundary> | ||
| <main className="redis-receiver-container"> | ||
| <h1 className="redis-receiver-header">A list of items received from Redis:</h1> | ||
| <Suspense fallback={<div>Loading ToggleContainer</div>}> | ||
| <UsedToggleContainer childrenTitle="Redis Items" {...(asyncToggleContainer ? { getValue } : {})}> | ||
| <ol className="redis-items-container"> | ||
| {[0, 1, 2, 3, 4].map((index) => ( | ||
| <RedisItemWithWrapper key={index} getValue={getValue} itemIndex={index} /> | ||
| ))} | ||
| </ol> | ||
| </UsedToggleContainer> | ||
| </Suspense> | ||
| </main> | ||
| </ErrorBoundary> | ||
| ); | ||
| }; | ||
|
|
||
| export default RedisReceiver; | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🛠️ Refactor suggestion | 🟠 Major
Combine duplicate configuration blocks.
Both blocks target the same file pattern. Merge them into a single configuration to reduce duplication and improve maintainability.
Apply this diff to consolidate the blocks:
{ files: ['spec/dummy/e2e-tests/*'], rules: { 'no-empty-pattern': [ 'error', { allowObjectPatternsAsParameters: true, }, ], - }, - }, - { - files: ['spec/dummy/e2e-tests/*'], - rules: { 'react-hooks/rules-of-hooks': ['off'], }, },📝 Committable suggestion
🤖 Prompt for AI Agents