Skip to content

Commit 1719274

Browse files
Abubakar-01tylerslaton
authored andcommitted
feat: add stable test IDs for E2E test reliability
1 parent 94554d0 commit 1719274

File tree

5 files changed

+50
-14
lines changed

5 files changed

+50
-14
lines changed

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/agentic_generative_ui/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ const Chat = () => {
4747

4848
return (
4949
<div className="flex">
50-
<div className={`relative rounded-xl w-[700px] p-6 shadow-lg backdrop-blur-sm ${
50+
<div
51+
data-testid="task-progress"
52+
className={`relative rounded-xl w-[700px] p-6 shadow-lg backdrop-blur-sm ${
5153
theme === "dark"
5254
? "bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 text-white border border-slate-700/50 shadow-2xl"
5355
: "bg-gradient-to-br from-white via-gray-50 to-white text-gray-800 border border-gray-200/80"
@@ -132,7 +134,9 @@ const Chat = () => {
132134

133135
{/* Step Content */}
134136
<div className="flex-1 min-w-0">
135-
<div className={`font-semibold transition-all duration-300 text-sm ${
137+
<div
138+
data-testid="task-step-text"
139+
className={`font-semibold transition-all duration-300 text-sm ${
136140
isCompleted
137141
? theme === "dark" ? "text-green-300" : "text-green-700"
138142
: isCurrentPending

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/human_in_the_loop/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ interface Step {
3434

3535
// Shared UI Components
3636
const StepContainer = ({ theme, children }: { theme?: string; children: React.ReactNode }) => (
37-
<div className="flex">
37+
<div
38+
data-testid="select-steps"
39+
className="flex">
3840
<div className={`relative rounded-xl w-[600px] p-6 shadow-lg backdrop-blur-sm ${
3941
theme === "dark"
4042
? "bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 text-white border border-slate-700/50 shadow-2xl"
@@ -114,7 +116,9 @@ const StepItem = ({
114116
? "bg-slate-800/30 border border-slate-600/30"
115117
: "bg-gray-50/50 border border-gray-200/40"
116118
}`}>
117-
<label className="flex items-center cursor-pointer w-full">
119+
<label
120+
data-testid="step-item"
121+
className="flex items-center cursor-pointer w-full">
118122
<div className="relative">
119123
<input
120124
type="checkbox"
@@ -137,7 +141,9 @@ const StepItem = ({
137141
)}
138142
</div>
139143
</div>
140-
<span className={`ml-3 font-medium transition-all duration-300 ${
144+
<span
145+
data-testid="step-text"
146+
className={`ml-3 font-medium transition-all duration-300 ${
141147
step.status !== "enabled" && status != "inProgress"
142148
? `line-through ${theme === "dark" ? "text-slate-500" : "text-gray-400"}`
143149
: theme === "dark" ? "text-white" : "text-gray-800"

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/predictive_state_updates/page.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,15 @@ interface ConfirmChangesProps {
303303
function ConfirmChanges({ args, respond, status, onReject, onConfirm }: ConfirmChangesProps) {
304304
const [accepted, setAccepted] = useState<boolean | null>(null);
305305
return (
306-
<div className="bg-white p-6 rounded shadow-lg border border-gray-200 mt-5 mb-5">
306+
<div
307+
data-testid="confirm-changes-modal"
308+
className="bg-white p-6 rounded shadow-lg border border-gray-200 mt-5 mb-5">
307309
<h2 className="text-lg font-bold mb-4">Confirm Changes</h2>
308310
<p className="mb-6">Do you want to accept the changes?</p>
309311
{accepted === null && (
310312
<div className="flex justify-end space-x-4">
311313
<button
314+
data-testid="reject-button"
312315
className={`bg-gray-200 text-black py-2 px-4 rounded disabled:opacity-50 ${
313316
status === "executing" ? "cursor-pointer" : "cursor-default"
314317
}`}
@@ -324,6 +327,7 @@ function ConfirmChanges({ args, respond, status, onReject, onConfirm }: ConfirmC
324327
Reject
325328
</button>
326329
<button
330+
data-testid="confirm-button"
327331
className={`bg-black text-white py-2 px-4 rounded disabled:opacity-50 ${
328332
status === "executing" ? "cursor-pointer" : "cursor-default"
329333
}`}
@@ -342,7 +346,9 @@ function ConfirmChanges({ args, respond, status, onReject, onConfirm }: ConfirmC
342346
)}
343347
{accepted !== null && (
344348
<div className="flex justify-end">
345-
<div className="mt-4 bg-gray-200 text-black py-2 px-4 rounded inline-block">
349+
<div
350+
data-testid="status-display"
351+
className="mt-4 bg-gray-200 text-black py-2 px-4 rounded inline-block">
346352
{accepted ? "✓ Accepted" : "✗ Rejected"}
347353
</div>
348354
</div>

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/shared_state/page.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,9 @@ function Recipe() {
366366
};
367367

368368
return (
369-
<form className="recipe-card">
369+
<form
370+
data-testid="recipe-card"
371+
className="recipe-card">
370372
{/* Recipe Title */}
371373
<div className="recipe-header">
372374
<input
@@ -452,13 +454,23 @@ function Recipe() {
452454
{changedKeysRef.current.includes("ingredients") && <Ping />}
453455
<div className="section-header">
454456
<h2 className="section-title">Ingredients</h2>
455-
<button type="button" className="add-button" onClick={addIngredient}>
457+
<button
458+
data-testid="add-ingredient-button"
459+
type="button"
460+
className="add-button"
461+
onClick={addIngredient}
462+
>
456463
+ Add Ingredient
457464
</button>
458465
</div>
459-
<div className="ingredients-container">
466+
<div
467+
data-testid="ingredients-container"
468+
className="ingredients-container"
469+
>
460470
{recipe.ingredients.map((ingredient, index) => (
461-
<div key={index} className="ingredient-card">
471+
<div key={index}
472+
data-testid="ingredient-card"
473+
className="ingredient-card">
462474
<div className="ingredient-icon">{getProperIcon(ingredient.icon)}</div>
463475
<div className="ingredient-content">
464476
<input
@@ -498,7 +510,9 @@ function Recipe() {
498510
+ Add Step
499511
</button>
500512
</div>
501-
<div className="instructions-container">
513+
<div
514+
data-testid="instructions-container"
515+
className="instructions-container">
502516
{recipe.instructions.map((instruction, index) => (
503517
<div key={index} className="instruction-item">
504518
{/* Number Circle */}
@@ -555,6 +569,7 @@ function Recipe() {
555569
{/* Improve with AI Button */}
556570
<div className="action-container">
557571
<button
572+
data-testid="improve-button"
558573
className={isLoading ? "improve-button loading" : "improve-button"}
559574
type="button"
560575
onClick={() => {

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/tool_based_generative_ui/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,12 @@ const VALID_IMAGE_NAMES = [
177177

178178
function HaikuCard({generatedHaiku, setHaikus, haikus} : HaikuCardProps) {
179179
return (
180-
<div className="suggestion-card text-left rounded-md p-4 mt-4 mb-4 flex flex-col bg-gray-100">
180+
<div
181+
data-testid="haiku-card"
182+
className="suggestion-card text-left rounded-md p-4 mt-4 mb-4 flex flex-col bg-gray-100">
181183
<div className="mb-4 pb-4">
182184
{generatedHaiku?.japanese?.map((line, index) => (
183-
<div className="flex items-center gap-3 mb-2" key={index}>
185+
<div className="flex items-center gap-3 mb-2" data-testid="haiku-line" key={index}>
184186
<p className="text-lg font-bold">{line}</p>
185187
<p className="text-sm font-light">
186188
{generatedHaiku.english?.[index]}
@@ -340,6 +342,7 @@ function Haiku() {
340342
{generatedHaikus.map((haiku, index) => (
341343
<div
342344
key={index}
345+
data-testid="thumbnail-haiku"
343346
className={`haiku-card animated-fade-in mb-4 cursor-pointer ${index === activeIndex ? 'active' : ''}`}
344347
style={{
345348
width: '80px',
@@ -395,6 +398,7 @@ function Haiku() {
395398
}).map((haiku, index) => (
396399
<div
397400
key={index}
401+
data-testid="main-haiku-display"
398402
className={`haiku-card animated-fade-in ${isJustApplied && index === activeIndex ? 'applied-flash' : ''} ${index === activeIndex ? 'active' : ''}`}
399403
style={{
400404
zIndex: index === activeIndex ? haikus.length : index,
@@ -403,6 +407,7 @@ function Haiku() {
403407
>
404408
{haiku.japanese.map((line, lineIndex) => (
405409
<div
410+
data-testid="main-haiku-line"
406411
className={`flex items-start mb-4 haiku-line ${
407412
isMobile
408413
? 'flex-col gap-1'

0 commit comments

Comments
 (0)