-
-
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
Changes from 16 commits
67b2ffc
4545805
31bca68
a3727f8
e8bc6f1
5a070b6
94aa944
3668ed4
68d10fc
5ec1071
1840336
c5851aa
6064b02
5d7cfa2
3954ee2
8d4b4c4
182e040
916f7c8
b72d198
57bcf7d
bf0652a
6454b9e
7176d49
f5de26b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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/ |
| 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" |
| 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" |
| 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" |
| 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" |
| 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" |
| 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" |
| 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> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||||||||||||||||||||||||||||||||||||
| 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> | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
15
to
26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix Suspense fallback text interpolation Same issue; braces are inside quotes. - <section className={`redis-item${itemIndex}-container`}>
- <Suspense fallback={<p className={`redis-item${itemIndex}-fallback`}>Waiting for the key "Item{itemIndex + 1}"</p>}>
+ <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>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // 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" | ||||||||||||||||||||||||||||||||||||||||
| {...(toggleContainerGetValueParam ? { getValue } : {})} | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
AbanoubGhadban marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||
| <ol className='redis-items-container'> | ||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||
| [0,1,2,3,4].map(index => <RedisItemWithWrapper key={index} getValue={getValue} itemIndex={index} />) | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| </ol> | ||||||||||||||||||||||||||||||||||||||||
| </UsedToggleContainer> | ||||||||||||||||||||||||||||||||||||||||
| </Suspense> | ||||||||||||||||||||||||||||||||||||||||
| </main> | ||||||||||||||||||||||||||||||||||||||||
| </ErrorBoundary> | ||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||
AbanoubGhadban marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| export default RedisReceiver; | ||||||||||||||||||||||||||||||||||||||||
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.
Fix JSX interpolation: avoid braces inside quotes
Renders literal
Item{itemIndex + 1}. Interpolate via template or split nodes.📝 Committable suggestion
🤖 Prompt for AI Agents