mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): address coderabbit review comments on builder e2e tests
- Use exact regex matching in getBlockCardByName to avoid partial name collisions - Add waitForSaveComplete() to createDummyAgent to prevent race conditions
This commit is contained in:
@@ -67,10 +67,11 @@ export class BuildPage extends BasePage {
|
||||
}
|
||||
|
||||
private getBlockCardByName(name: string): Locator {
|
||||
// Match block card button that contains the exact block name in its title span
|
||||
const escapedName = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const exactName = new RegExp(`^\\s*${escapedName}\\s*$`);
|
||||
return this.page
|
||||
.locator('[data-id^="block-card-"]')
|
||||
.filter({ has: this.page.locator("span", { hasText: name }) })
|
||||
.filter({ has: this.page.locator("span", { hasText: exactName }) })
|
||||
.first();
|
||||
}
|
||||
|
||||
@@ -304,5 +305,6 @@ export class BuildPage extends BasePage {
|
||||
await this.addBlockByClick("Add to Dictionary");
|
||||
await this.waitForNodeOnCanvas(1);
|
||||
await this.saveAgent("Test Agent", "Test Description");
|
||||
await this.waitForSaveComplete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user