Skip to content

Commit e140873

Browse files
authored
Feat(Builder/tutorial): Updates to fix tutorial (#8655)
Feat(Builder/tutorial): Updates to fix tutorial
1 parent dd0081a commit e140873

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

autogpt_platform/frontend/src/components/tutorial.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const startTutorial = (
112112
function handleMouseUp(event: { target: any }) {
113113
const target = event.target;
114114
const validConnectionPoint = document.querySelector(
115-
'[data-id="custom-node-2"] [data-handlepos="left"]',
115+
'[data-testid^="rf__node-"]:nth-child(2) [data-id$="-a-target"]',
116116
);
117117

118118
if (validConnectionPoint && !validConnectionPoint.contains(target)) {
@@ -394,7 +394,7 @@ export const startTutorial = (
394394
id: "copy-paste-block",
395395
title: "Copy and Paste the Block",
396396
text: "Let’s duplicate this block. Click and hold the block with your mouse, then press Ctrl+C (Cmd+C on Mac) to copy and Ctrl+V (Cmd+V on Mac) to paste.",
397-
attachTo: { element: '[data-id^="custom-node-"]', on: "top" },
397+
attachTo: { element: '[data-testid^="rf__node-"]', on: "top" },
398398
buttons: [
399399
{
400400
text: "Back",
@@ -404,7 +404,7 @@ export const startTutorial = (
404404
when: {
405405
show: () => {
406406
fitViewToScreen();
407-
waitForElement('[data-id="custom-node-2"]').then(() => {
407+
waitForElement('[data-testid^="rf__node-"]:nth-child(2)').then(() => {
408408
tour.next();
409409
});
410410
},
@@ -415,9 +415,9 @@ export const startTutorial = (
415415
id: "focus-second-block",
416416
title: "Focus on the New Block",
417417
text: "This is your copied Calculator Block. Now, let’s move it to the side of the first block.",
418-
attachTo: { element: `[data-id^="custom-node-"][data-id$="2"]`, on: "top" },
418+
attachTo: { element: '[data-testid^="rf__node-"]:nth-child(2)', on: "top" },
419419
beforeShowPromise: () =>
420-
waitForElement('[data-id^="custom-node-"][data-id$="2"]'),
420+
waitForElement('[data-testid^="rf__node-"]:nth-child(2)'),
421421
buttons: [
422422
{
423423
text: "Next",
@@ -432,7 +432,7 @@ export const startTutorial = (
432432
text: "Now, let's connect the output of the first Calculator Block to the input of the second Calculator Block. Drag from the output pin of the first block to the input pin (A) of the second block.",
433433
attachTo: {
434434
element:
435-
'[data-id^="1-"][data-id$="-result-source"]:not([data-id="1-2-result-source"])',
435+
'[data-testid^="rf__node-"]:first-child [data-id$="-result-source"]',
436436
on: "bottom",
437437
},
438438

@@ -444,24 +444,24 @@ export const startTutorial = (
444444
],
445445
beforeShowPromise: () => {
446446
return waitForElement(
447-
'[data-id^="1-"][data-id$="-result-source"]:not([data-id="1-2-result-source"])',
448-
).then(() => {});
447+
'[data-testid^="rf__node-"]:first-child [data-id$="-result-source"]',
448+
);
449449
},
450450
when: {
451451
show: () => {
452452
fitViewToScreen();
453453
resetConnectionState(); // Reset state when revisiting this step
454454
tour.modal.show();
455455
const outputPin = document.querySelector(
456-
'[data-id^="1-"][data-id$="-result-source"]:not([data-id="1-2-result-source"])',
456+
'[data-testid^="rf__node-"]:first-child [data-id$="-result-source"]',
457457
);
458458
if (outputPin) {
459459
outputPin.addEventListener("mousedown", handleMouseDown);
460460
}
461461
},
462462
hide: () => {
463463
const outputPin = document.querySelector(
464-
'[data-id^="1-"][data-id$="-result-source"]:not([data-id="1-2-result-source"])',
464+
'[data-testid^="rf__node-"]:first-child [data-id$="-result-source"]',
465465
);
466466
if (outputPin) {
467467
outputPin.removeEventListener("mousedown", handleMouseDown);
@@ -475,12 +475,14 @@ export const startTutorial = (
475475
title: "Connect the Blocks: Input",
476476
text: "Now, connect the output to the input pin of the second block (A).",
477477
attachTo: {
478-
element: '[data-id="1-2-a-target"]',
478+
element: '[data-testid^="rf__node-"]:nth-child(2) [data-id$="-a-target"]',
479479
on: "top",
480480
},
481481
buttons: [],
482482
beforeShowPromise: () => {
483-
return waitForElement('[data-id="1-2-a-target"]').then(() => {
483+
return waitForElement(
484+
'[data-testid^="rf__node-"]:nth-child(2) [data-id$="-a-target"]',
485+
).then(() => {
484486
detectConnection();
485487
});
486488
},

0 commit comments

Comments
 (0)