-
-
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 14 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,54 @@ | ||||||||||||||||||||||||||||||||||||||||
| 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 RedisItem = async ({ getValue, itemIndex }) => { | |
| const value = await getValue(`Item${itemIndex}`); | |
| return <li className={`redis-item${itemIndex}`}>Value of "Item{itemIndex + 1}": {value}</li> | |
| } | |
| const RedisItem = async ({ getValue, itemIndex }) => { | |
| const value = await getValue(`Item${itemIndex}`); | |
| return ( | |
| <li className={`redis-item${itemIndex}`}> | |
| {`Value of "Item${itemIndex + 1}": ${String(value)}`} | |
| </li> | |
| ); | |
| } |
🤖 Prompt for AI Agents
In
react_on_rails_pro/spec/dummy/client/app/ror-auto-load-components/RedisReceiver.jsx
around lines 6 to 9, the JSX is rendering the literal text Item{itemIndex + 1}
because the braces are inside a quoted string; change the node so the
interpolation is evaluated — e.g. replace the quoted "Item{itemIndex + 1}" with
a JSX expression such as {`Item${itemIndex + 1}`} or {"Item" + (itemIndex + 1)}
so the correct item number is displayed (keep the rest of the element as-is).
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 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
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 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> | |
| 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> | |
| ) |
🤖 Prompt for AI Agents
In
react_on_rails_pro/spec/dummy/client/app/ror-auto-load-components/RedisReceiver.jsx
around lines 11 to 16, the Suspense fallback text uses literal braces inside a
quoted string ("Item{itemIndex + 1}") so it renders the braces instead of
interpolating the expression; change the fallback to use a JSX expression that
interpolates itemIndex (for example wrap a template literal or concatenation in
curly braces) so it renders the evaluated Item number while keeping the existing
className template literal unchanged.
Uh oh!
There was an error while loading. Please reload this page.