Skip to content

Commit b7f636c

Browse files
committed
Fix shared state server test
1 parent f72a64b commit b7f636c

File tree

8 files changed

+18
-14
lines changed

8 files changed

+18
-14
lines changed

typescript-sdk/apps/dojo/e2e/featurePages/SharedStatePage.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ export class SharedStatePage {
4747
]);
4848
}
4949

50-
async awaitIngredientCard(name: string | RegExp) {
51-
return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name.toString}"])`);
50+
async awaitIngredientCard(name: string) {
51+
const selector = `.ingredient-card:has(input.ingredient-name-input[value="${name}"])`;
52+
const cardLocator = this.page.locator(selector);
53+
await expect(cardLocator).toBeVisible();
5254
}
5355

5456
async addNewIngredient(placeholderText: string) {

typescript-sdk/apps/dojo/e2e/tests/crewAITests/sharedStatePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Pasta');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);

typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/sharedStatePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Pasta');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);

typescript-sdk/apps/dojo/e2e/tests/langgraphTests/sharedStatePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Pasta');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);

typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/sharedStatePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Pasta');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);

typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/sharedStatePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Pasta');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);

typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/sharedStatePage.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Pasta');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);

typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/sharedStatePage.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test.describe("Shared State Feature", () => {
1515
await sharedStateAgent.openChat();
1616
await sharedStateAgent.sendMessage("give me recipe for pasta");
1717
await sharedStateAgent.loader();
18-
await sharedStateAgent.awaitIngredientCard(/Pasta/);
18+
await sharedStateAgent.awaitIngredientCard('Salt');
1919
await sharedStateAgent.getInstructionItems(
2020
sharedStateAgent.instructionsContainer
2121
);
@@ -48,10 +48,12 @@ test.describe("Shared State Feature", () => {
4848
await sharedStateAgent.sendMessage("Give me all the ingredients");
4949
await sharedStateAgent.loader();
5050

51-
// Verify chat response includes both existing and new ingredients
52-
await expect(sharedStateAgent.agentMessage.getByText(/Potatoes/)).toBeVisible();
53-
await expect(sharedStateAgent.agentMessage.getByText(/12/)).toBeVisible();
54-
await expect(sharedStateAgent.agentMessage.getByText(/Carrots/)).toBeVisible();
55-
await expect(sharedStateAgent.agentMessage.getByText(/All-Purpose Flour/)).toBeVisible();
51+
// Verify hardcoded ingredients
52+
await sharedStateAgent.awaitIngredientCard('chicken breast');
53+
await sharedStateAgent.awaitIngredientCard('chili powder');
54+
await sharedStateAgent.awaitIngredientCard('Salt');
55+
await sharedStateAgent.awaitIngredientCard('Lettuce leaves');
56+
57+
expect(await sharedStateAgent.getInstructionItems(sharedStateAgent.instructionsContainer)).toBe(3);
5658
});
5759
});

0 commit comments

Comments
 (0)