diff --git a/typescript-sdk/apps/dojo/e2e/pages/mastraPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/featurePages/AgenticChatPage.ts similarity index 53% rename from typescript-sdk/apps/dojo/e2e/pages/mastraPages/AgenticChatPage.ts rename to typescript-sdk/apps/dojo/e2e/featurePages/AgenticChatPage.ts index 18fa245b4..3bb6d34d4 100644 --- a/typescript-sdk/apps/dojo/e2e/pages/mastraPages/AgenticChatPage.ts +++ b/typescript-sdk/apps/dojo/e2e/featurePages/AgenticChatPage.ts @@ -6,6 +6,7 @@ export class AgenticChatPage { readonly agentGreeting: Locator; readonly chatInput: Locator; readonly sendButton: Locator; + readonly chatBackground: Locator; readonly agentMessage: Locator; readonly userMessage: Locator; @@ -25,6 +26,10 @@ export class AgenticChatPage { .locator('[data-test-id="copilot-chat-ready"]') .or(page.getByRole("button", { name: /send/i })) .or(page.locator('button[type="submit"]')); + this.chatBackground = page + .locator('div[style*="background"]') + .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) + .or(page.locator('body')); this.agentMessage = page .locator(".copilotKitAssistantMessage"); this.userMessage = page @@ -49,6 +54,59 @@ export class AgenticChatPage { } } + async getBackground( + property: "backgroundColor" | "backgroundImage" = "backgroundColor" + ): Promise { + // Wait a bit for background to apply + await this.page.waitForTimeout(500); + + // Try multiple selectors for the background element + const selectors = [ + 'div[style*="background"]', + 'div[style*="background-color"]', + '.flex.justify-center.items-center.h-full.w-full', + 'div.flex.justify-center.items-center.h-full.w-full', + '[class*="bg-"]', + 'div[class*="background"]' + ]; + + for (const selector of selectors) { + try { + const element = this.page.locator(selector).first(); + if (await element.isVisible({ timeout: 1000 })) { + const value = await element.evaluate( + (el, prop) => { + // Check inline style first + if (el.style.background) return el.style.background; + if (el.style.backgroundColor) return el.style.backgroundColor; + // Then computed style + return getComputedStyle(el)[prop as any]; + }, + property + ); + if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { + console.log(`[${selector}] ${property}: ${value}`); + return value; + } + } + } catch (e) { + continue; + } + } + + // Fallback to original element + const value = await this.chatBackground.first().evaluate( + (el, prop) => getComputedStyle(el)[prop as any], + property + ); + console.log(`[Fallback] ${property}: ${value}`); + return value; + } + + async getGradientButtonByName(name: string | RegExp) { + return this.page.getByRole("button", { name }); + } + async assertUserMessageVisible(text: string | RegExp) { await expect(this.userMessage.getByText(text)).toBeVisible(); } @@ -60,20 +118,25 @@ export class AgenticChatPage { await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); } + async assertAgentReplyContains(expectedText: string) { + const agentMessage = this.page.locator(".copilotKitAssistantMessage").last(); + await expect(agentMessage).toContainText(expectedText, { timeout: 10000 }); + } + async assertWeatherResponseStructure() { const agentMessage = this.page.locator(".copilotKitAssistantMessage").last(); - + // Check for main weather response structure await expect(agentMessage).toContainText("The current weather in Islamabad is as follows:", { timeout: 10000 }); - + // Check for temperature information - await expect(agentMessage).toContainText("Temperature:", { timeout: 5000 }); + await expect(agentMessage).toContainText("Temperature:", { timeout: 5000 }); // Check for humidity await expect(agentMessage).toContainText("Humidity:", { timeout: 5000 }); - + // Check for wind speed await expect(agentMessage).toContainText("Wind Speed:", { timeout: 5000 }); // Check for conditions await expect(agentMessage).toContainText("Conditions:", { timeout: 5000 }); } -} \ No newline at end of file +} diff --git a/typescript-sdk/apps/dojo/e2e/pages/llamaIndexPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/featurePages/SharedStatePage.ts similarity index 85% rename from typescript-sdk/apps/dojo/e2e/pages/llamaIndexPages/SharedStatePage.ts rename to typescript-sdk/apps/dojo/e2e/featurePages/SharedStatePage.ts index 807b61bd6..a46a2edda 100644 --- a/typescript-sdk/apps/dojo/e2e/pages/llamaIndexPages/SharedStatePage.ts +++ b/typescript-sdk/apps/dojo/e2e/featurePages/SharedStatePage.ts @@ -23,6 +23,7 @@ export class SharedStatePage { this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); this.agentMessage = page.locator('.copilotKitAssistantMessage'); this.userMessage = page.locator('.copilotKitUserMessage'); + this.ingredientCards = page.locator('.ingredient-card'); } async openChat() { @@ -46,16 +47,18 @@ export class SharedStatePage { ]); } - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); + async awaitIngredientCard(name: string) { + const selector = `.ingredient-card:has(input.ingredient-name-input[value="${name}"])`; + const cardLocator = this.page.locator(selector); + await expect(cardLocator).toBeVisible(); } - async addNewIngredient(placeholderText) { + async addNewIngredient(placeholderText: string) { this.addIngredient.click(); this.page.locator(`input[placeholder="${placeholderText}"]`); } - async getInstructionItems(containerLocator) { + async getInstructionItems(containerLocator: Locator ) { const count = await containerLocator.locator('.instruction-item').count(); if (count <= 0) { throw new Error('No instruction items found in the container.'); @@ -63,7 +66,7 @@ export class SharedStatePage { console.log(`βœ… Found ${count} instruction items.`); return count; } - + async assertAgentReplyVisible(expectedText: RegExp) { await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); } diff --git a/typescript-sdk/apps/dojo/e2e/pages/agnoPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/featurePages/ToolBaseGenUIPage.ts similarity index 100% rename from typescript-sdk/apps/dojo/e2e/pages/agnoPages/ToolBaseGenUIPage.ts rename to typescript-sdk/apps/dojo/e2e/featurePages/ToolBaseGenUIPage.ts diff --git a/typescript-sdk/apps/dojo/e2e/pages/agnoPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/agnoPages/AgenticChatPage.ts deleted file mode 100644 index c46329528..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/agnoPages/AgenticChatPage.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } - - async assertAgentReplyContains(expectedText: string) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage").last(); - await expect(agentMessage).toContainText(expectedText, { timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/SharedStatePage.ts deleted file mode 100644 index 807b61bd6..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/SharedStatePage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class SharedStatePage { - readonly page: Page; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentGreeting: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - readonly promptResponseLoader: Locator; - readonly ingredientCards: Locator; - readonly instructionsContainer: Locator; - readonly addIngredient: Locator; - - constructor(page: Page) { - this.page = page; - // Remove iframe references and use actual greeting text - this.agentGreeting = page.getByText("Hi πŸ‘‹ How can I help with your recipe?"); - this.chatInput = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.promptResponseLoader = page.getByRole('button', { name: 'Please Wait...', disabled: true }); - this.instructionsContainer = page.locator('.instructions-container'); - this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); - this.agentMessage = page.locator('.copilotKitAssistantMessage'); - this.userMessage = page.locator('.copilotKitUserMessage'); - } - - async openChat() { - await this.agentGreeting.isVisible(); - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - await this.sendButton.click(); - } - - async loader() { - const timeout = (ms) => new Promise((_, reject) => { - setTimeout(() => reject(new Error("Timeout waiting for promptResponseLoader to become visible")), ms); - }); - - await Promise.race([ - this.promptResponseLoader.isVisible(), - timeout(5000) // 5 seconds timeout - ]); - } - - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); - } - - async addNewIngredient(placeholderText) { - this.addIngredient.click(); - this.page.locator(`input[placeholder="${placeholderText}"]`); - } - - async getInstructionItems(containerLocator) { - const count = await containerLocator.locator('.instruction-item').count(); - if (count <= 0) { - throw new Error('No instruction items found in the container.'); - } - console.log(`βœ… Found ${count} instruction items.`); - return count; - } - - async assertAgentReplyVisible(expectedText: RegExp) { - await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); - } - - async assertUserMessageVisible(message: string) { - await expect(this.page.getByText(message)).toBeVisible(); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/ToolBaseGenUIPage.ts deleted file mode 100644 index f2d648a5e..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/crewAIPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - } - - async checkGeneratedHaiku() { - await this.page.locator('[data-testid="haiku-card"]').last().isVisible(); - const mostRecentCard = this.page.locator('[data-testid="haiku-card"]').last(); - await mostRecentCard.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - let chatHaikuContainer; - let chatHaikuLines; - - for (let cardIndex = cardCount - 1; cardIndex >= 0; cardIndex--) { - chatHaikuContainer = allHaikuCards.nth(cardIndex); - chatHaikuLines = chatHaikuContainer.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount > 0) { - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - break; - } catch (error) { - continue; - } - } - } - - if (!chatHaikuLines) { - throw new Error('No haiku cards with visible lines found'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - expect(chatHaikuContent.length).toBeGreaterThan(0); - return; - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/SharedStatePage.ts deleted file mode 100644 index 807b61bd6..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/SharedStatePage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class SharedStatePage { - readonly page: Page; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentGreeting: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - readonly promptResponseLoader: Locator; - readonly ingredientCards: Locator; - readonly instructionsContainer: Locator; - readonly addIngredient: Locator; - - constructor(page: Page) { - this.page = page; - // Remove iframe references and use actual greeting text - this.agentGreeting = page.getByText("Hi πŸ‘‹ How can I help with your recipe?"); - this.chatInput = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.promptResponseLoader = page.getByRole('button', { name: 'Please Wait...', disabled: true }); - this.instructionsContainer = page.locator('.instructions-container'); - this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); - this.agentMessage = page.locator('.copilotKitAssistantMessage'); - this.userMessage = page.locator('.copilotKitUserMessage'); - } - - async openChat() { - await this.agentGreeting.isVisible(); - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - await this.sendButton.click(); - } - - async loader() { - const timeout = (ms) => new Promise((_, reject) => { - setTimeout(() => reject(new Error("Timeout waiting for promptResponseLoader to become visible")), ms); - }); - - await Promise.race([ - this.promptResponseLoader.isVisible(), - timeout(5000) // 5 seconds timeout - ]); - } - - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); - } - - async addNewIngredient(placeholderText) { - this.addIngredient.click(); - this.page.locator(`input[placeholder="${placeholderText}"]`); - } - - async getInstructionItems(containerLocator) { - const count = await containerLocator.locator('.instruction-item').count(); - if (count <= 0) { - throw new Error('No instruction items found in the container.'); - } - console.log(`βœ… Found ${count} instruction items.`); - return count; - } - - async assertAgentReplyVisible(expectedText: RegExp) { - await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); - } - - async assertUserMessageVisible(message: string) { - await expect(this.page.getByText(message)).toBeVisible(); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/ToolBaseGenUIPage.ts deleted file mode 100644 index 71ec39310..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/langGraphFastAPIPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async checkGeneratedHaiku() { - await this.page.locator('[data-testid="haiku-card"]').last().isVisible(); - const mostRecentCard = this.page.locator('[data-testid="haiku-card"]').last(); - await mostRecentCard.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - - const expectedCardCount = await this.getExpectedHaikuCount(); - - if (cardCount < expectedCardCount) { - throw new Error(`Expected ${expectedCardCount} haiku cards but found ${cardCount} - haiku generation may have failed`); - } - - const mostRecentCard = allHaikuCards.last(); - const chatHaikuLines = mostRecentCard.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount === 0) { - throw new Error('Most recent haiku card has no visible lines - haiku generation failed'); - } - - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - } catch (error) { - throw new Error('Most recent haiku card lines are not visible - haiku generation failed'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - private haikuGenerationCount = 0; - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - this.haikuGenerationCount++; - } - - async getExpectedHaikuCount(): Promise { - return this.haikuGenerationCount; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - throw new Error('Main display haiku content is empty - haiku was not properly generated or applied'); - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - if (updatedMainContent === '') { - throw new Error('Main display haiku content is still empty after additional wait - haiku generation failed'); - } - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/SharedStatePage.ts deleted file mode 100644 index 807b61bd6..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/SharedStatePage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class SharedStatePage { - readonly page: Page; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentGreeting: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - readonly promptResponseLoader: Locator; - readonly ingredientCards: Locator; - readonly instructionsContainer: Locator; - readonly addIngredient: Locator; - - constructor(page: Page) { - this.page = page; - // Remove iframe references and use actual greeting text - this.agentGreeting = page.getByText("Hi πŸ‘‹ How can I help with your recipe?"); - this.chatInput = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.promptResponseLoader = page.getByRole('button', { name: 'Please Wait...', disabled: true }); - this.instructionsContainer = page.locator('.instructions-container'); - this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); - this.agentMessage = page.locator('.copilotKitAssistantMessage'); - this.userMessage = page.locator('.copilotKitUserMessage'); - } - - async openChat() { - await this.agentGreeting.isVisible(); - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - await this.sendButton.click(); - } - - async loader() { - const timeout = (ms) => new Promise((_, reject) => { - setTimeout(() => reject(new Error("Timeout waiting for promptResponseLoader to become visible")), ms); - }); - - await Promise.race([ - this.promptResponseLoader.isVisible(), - timeout(5000) // 5 seconds timeout - ]); - } - - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); - } - - async addNewIngredient(placeholderText) { - this.addIngredient.click(); - this.page.locator(`input[placeholder="${placeholderText}"]`); - } - - async getInstructionItems(containerLocator) { - const count = await containerLocator.locator('.instruction-item').count(); - if (count <= 0) { - throw new Error('No instruction items found in the container.'); - } - console.log(`βœ… Found ${count} instruction items.`); - return count; - } - - async assertAgentReplyVisible(expectedText: RegExp) { - await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); - } - - async assertUserMessageVisible(message: string) { - await expect(this.page.getByText(message)).toBeVisible(); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/ToolBaseGenUIPage.ts deleted file mode 100644 index 71ec39310..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/langGraphPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async checkGeneratedHaiku() { - await this.page.locator('[data-testid="haiku-card"]').last().isVisible(); - const mostRecentCard = this.page.locator('[data-testid="haiku-card"]').last(); - await mostRecentCard.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - - const expectedCardCount = await this.getExpectedHaikuCount(); - - if (cardCount < expectedCardCount) { - throw new Error(`Expected ${expectedCardCount} haiku cards but found ${cardCount} - haiku generation may have failed`); - } - - const mostRecentCard = allHaikuCards.last(); - const chatHaikuLines = mostRecentCard.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount === 0) { - throw new Error('Most recent haiku card has no visible lines - haiku generation failed'); - } - - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - } catch (error) { - throw new Error('Most recent haiku card lines are not visible - haiku generation failed'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - private haikuGenerationCount = 0; - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - this.haikuGenerationCount++; - } - - async getExpectedHaikuCount(): Promise { - return this.haikuGenerationCount; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - throw new Error('Main display haiku content is empty - haiku was not properly generated or applied'); - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - if (updatedMainContent === '') { - throw new Error('Main display haiku content is still empty after additional wait - haiku generation failed'); - } - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/llamaIndexPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/llamaIndexPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/llamaIndexPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/SharedStatePage.ts deleted file mode 100644 index 807b61bd6..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/SharedStatePage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class SharedStatePage { - readonly page: Page; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentGreeting: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - readonly promptResponseLoader: Locator; - readonly ingredientCards: Locator; - readonly instructionsContainer: Locator; - readonly addIngredient: Locator; - - constructor(page: Page) { - this.page = page; - // Remove iframe references and use actual greeting text - this.agentGreeting = page.getByText("Hi πŸ‘‹ How can I help with your recipe?"); - this.chatInput = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.promptResponseLoader = page.getByRole('button', { name: 'Please Wait...', disabled: true }); - this.instructionsContainer = page.locator('.instructions-container'); - this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); - this.agentMessage = page.locator('.copilotKitAssistantMessage'); - this.userMessage = page.locator('.copilotKitUserMessage'); - } - - async openChat() { - await this.agentGreeting.isVisible(); - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - await this.sendButton.click(); - } - - async loader() { - const timeout = (ms) => new Promise((_, reject) => { - setTimeout(() => reject(new Error("Timeout waiting for promptResponseLoader to become visible")), ms); - }); - - await Promise.race([ - this.promptResponseLoader.isVisible(), - timeout(5000) // 5 seconds timeout - ]); - } - - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); - } - - async addNewIngredient(placeholderText) { - this.addIngredient.click(); - this.page.locator(`input[placeholder="${placeholderText}"]`); - } - - async getInstructionItems(containerLocator) { - const count = await containerLocator.locator('.instruction-item').count(); - if (count <= 0) { - throw new Error('No instruction items found in the container.'); - } - console.log(`βœ… Found ${count} instruction items.`); - return count; - } - - async assertAgentReplyVisible(expectedText: RegExp) { - await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); - } - - async assertUserMessageVisible(message: string) { - await expect(this.page.getByText(message)).toBeVisible(); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/ToolBaseGenUIPage.ts deleted file mode 100644 index f2d648a5e..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/mastraAgentLocalPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - } - - async checkGeneratedHaiku() { - await this.page.locator('[data-testid="haiku-card"]').last().isVisible(); - const mostRecentCard = this.page.locator('[data-testid="haiku-card"]').last(); - await mostRecentCard.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - let chatHaikuContainer; - let chatHaikuLines; - - for (let cardIndex = cardCount - 1; cardIndex >= 0; cardIndex--) { - chatHaikuContainer = allHaikuCards.nth(cardIndex); - chatHaikuLines = chatHaikuContainer.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount > 0) { - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - break; - } catch (error) { - continue; - } - } - } - - if (!chatHaikuLines) { - throw new Error('No haiku cards with visible lines found'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - expect(chatHaikuContent.length).toBeGreaterThan(0); - return; - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/mastraPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/mastraPages/ToolBaseGenUIPage.ts deleted file mode 100644 index f2d648a5e..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/mastraPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - } - - async checkGeneratedHaiku() { - await this.page.locator('[data-testid="haiku-card"]').last().isVisible(); - const mostRecentCard = this.page.locator('[data-testid="haiku-card"]').last(); - await mostRecentCard.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - let chatHaikuContainer; - let chatHaikuLines; - - for (let cardIndex = cardCount - 1; cardIndex >= 0; cardIndex--) { - chatHaikuContainer = allHaikuCards.nth(cardIndex); - chatHaikuLines = chatHaikuContainer.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount > 0) { - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - break; - } catch (error) { - continue; - } - } - } - - if (!chatHaikuLines) { - throw new Error('No haiku cards with visible lines found'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - expect(chatHaikuContent.length).toBeGreaterThan(0); - return; - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/middlewareStarterPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/middlewareStarterPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/middlewareStarterPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/SharedStatePage.ts deleted file mode 100644 index 807b61bd6..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/SharedStatePage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class SharedStatePage { - readonly page: Page; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentGreeting: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - readonly promptResponseLoader: Locator; - readonly ingredientCards: Locator; - readonly instructionsContainer: Locator; - readonly addIngredient: Locator; - - constructor(page: Page) { - this.page = page; - // Remove iframe references and use actual greeting text - this.agentGreeting = page.getByText("Hi πŸ‘‹ How can I help with your recipe?"); - this.chatInput = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.promptResponseLoader = page.getByRole('button', { name: 'Please Wait...', disabled: true }); - this.instructionsContainer = page.locator('.instructions-container'); - this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); - this.agentMessage = page.locator('.copilotKitAssistantMessage'); - this.userMessage = page.locator('.copilotKitUserMessage'); - } - - async openChat() { - await this.agentGreeting.isVisible(); - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - await this.sendButton.click(); - } - - async loader() { - const timeout = (ms) => new Promise((_, reject) => { - setTimeout(() => reject(new Error("Timeout waiting for promptResponseLoader to become visible")), ms); - }); - - await Promise.race([ - this.promptResponseLoader.isVisible(), - timeout(5000) // 5 seconds timeout - ]); - } - - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); - } - - async addNewIngredient(placeholderText) { - this.addIngredient.click(); - this.page.locator(`input[placeholder="${placeholderText}"]`); - } - - async getInstructionItems(containerLocator) { - const count = await containerLocator.locator('.instruction-item').count(); - if (count <= 0) { - throw new Error('No instruction items found in the container.'); - } - console.log(`βœ… Found ${count} instruction items.`); - return count; - } - - async assertAgentReplyVisible(expectedText: RegExp) { - await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); - } - - async assertUserMessageVisible(message: string) { - await expect(this.page.getByText(message)).toBeVisible(); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/ToolBaseGenUIPage.ts deleted file mode 100644 index f2d648a5e..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/pydanticAIPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - } - - async checkGeneratedHaiku() { - await this.page.locator('[data-testid="haiku-card"]').last().isVisible(); - const mostRecentCard = this.page.locator('[data-testid="haiku-card"]').last(); - await mostRecentCard.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - let chatHaikuContainer; - let chatHaikuLines; - - for (let cardIndex = cardCount - 1; cardIndex >= 0; cardIndex--) { - chatHaikuContainer = allHaikuCards.nth(cardIndex); - chatHaikuLines = chatHaikuContainer.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount > 0) { - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - break; - } catch (error) { - continue; - } - } - } - - if (!chatHaikuLines) { - throw new Error('No haiku cards with visible lines found'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - expect(chatHaikuContent.length).toBeGreaterThan(0); - return; - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/SharedStatePage.ts b/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/SharedStatePage.ts deleted file mode 100644 index 807b61bd6..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/SharedStatePage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class SharedStatePage { - readonly page: Page; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly agentGreeting: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - readonly promptResponseLoader: Locator; - readonly ingredientCards: Locator; - readonly instructionsContainer: Locator; - readonly addIngredient: Locator; - - constructor(page: Page) { - this.page = page; - // Remove iframe references and use actual greeting text - this.agentGreeting = page.getByText("Hi πŸ‘‹ How can I help with your recipe?"); - this.chatInput = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.promptResponseLoader = page.getByRole('button', { name: 'Please Wait...', disabled: true }); - this.instructionsContainer = page.locator('.instructions-container'); - this.addIngredient = page.getByRole('button', { name: '+ Add Ingredient' }); - this.agentMessage = page.locator('.copilotKitAssistantMessage'); - this.userMessage = page.locator('.copilotKitUserMessage'); - } - - async openChat() { - await this.agentGreeting.isVisible(); - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - await this.sendButton.click(); - } - - async loader() { - const timeout = (ms) => new Promise((_, reject) => { - setTimeout(() => reject(new Error("Timeout waiting for promptResponseLoader to become visible")), ms); - }); - - await Promise.race([ - this.promptResponseLoader.isVisible(), - timeout(5000) // 5 seconds timeout - ]); - } - - async getIngredientCard(name) { - return this.page.locator(`.ingredient-card:has(input.ingredient-name-input[value="${name}"])`); - } - - async addNewIngredient(placeholderText) { - this.addIngredient.click(); - this.page.locator(`input[placeholder="${placeholderText}"]`); - } - - async getInstructionItems(containerLocator) { - const count = await containerLocator.locator('.instruction-item').count(); - if (count <= 0) { - throw new Error('No instruction items found in the container.'); - } - console.log(`βœ… Found ${count} instruction items.`); - return count; - } - - async assertAgentReplyVisible(expectedText: RegExp) { - await expect(this.agentMessage.getByText(expectedText)).toBeVisible(); - } - - async assertUserMessageVisible(message: string) { - await expect(this.page.getByText(message)).toBeVisible(); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/ToolBaseGenUIPage.ts b/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/ToolBaseGenUIPage.ts deleted file mode 100644 index a5c452e24..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/serverStarterAllFeaturesPages/ToolBaseGenUIPage.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { Page, Locator, expect } from '@playwright/test'; - -export class ToolBaseGenUIPage { - readonly page: Page; - readonly haikuAgentIntro: Locator; - readonly messageBox: Locator; - readonly sendButton: Locator; - readonly applyButton: Locator; - readonly appliedButton: Locator; - readonly haikuBlock: Locator; - readonly japaneseLines: Locator; - private haikuGenerationCount = 0; - - constructor(page: Page) { - this.page = page; - this.haikuAgentIntro = page.getByText("I'm a haiku generator πŸ‘‹. How can I help you?"); - this.messageBox = page.getByRole('textbox', { name: 'Type a message...' }); - this.sendButton = page.locator('[data-test-id="copilot-chat-ready"]'); - this.haikuBlock = page.locator('[data-testid="haiku-card"]'); - this.applyButton = page.getByRole('button', { name: 'Apply' }); - this.japaneseLines = page.locator('[data-testid="haiku-line"]'); - } - - async generateHaiku(message: string) { - await this.messageBox.click(); - await this.messageBox.fill(message); - await this.sendButton.click(); - this.haikuGenerationCount++; - } - - async checkGeneratedHaiku() { - const cardWithContent = this.page.locator('[data-testid="haiku-card"]:has([data-testid="haiku-line"])').last(); - await cardWithContent.waitFor({ state: 'visible', timeout: 10000 }); - await cardWithContent.locator('[data-testid="haiku-line"]').first().waitFor({ state: 'visible', timeout: 10000 }); - } - - async extractChatHaikuContent(page: Page): Promise { - await page.waitForTimeout(3000); - await page.locator('[data-testid="haiku-card"]').first().waitFor({ state: 'visible' }); - const allHaikuCards = page.locator('[data-testid="haiku-card"]'); - const cardCount = await allHaikuCards.count(); - let chatHaikuContainer; - let chatHaikuLines; - - for (let cardIndex = cardCount - 1; cardIndex >= 0; cardIndex--) { - chatHaikuContainer = allHaikuCards.nth(cardIndex); - chatHaikuLines = chatHaikuContainer.locator('[data-testid="haiku-line"]'); - const linesCount = await chatHaikuLines.count(); - - if (linesCount > 0) { - try { - await chatHaikuLines.first().waitFor({ state: 'visible', timeout: 5000 }); - break; - } catch (error) { - continue; - } - } - } - - if (!chatHaikuLines) { - throw new Error('No haiku cards with visible lines found'); - } - - const count = await chatHaikuLines.count(); - const lines: string[] = []; - - for (let i = 0; i < count; i++) { - const haikuLine = chatHaikuLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - - const chatHaikuContent = lines.join('').replace(/\s/g, ''); - return chatHaikuContent; - } - - async extractMainDisplayHaikuContent(page: Page): Promise { - const mainDisplayLines = page.locator('[data-testid="main-haiku-line"]'); - const mainCount = await mainDisplayLines.count(); - const lines: string[] = []; - - if (mainCount > 0) { - for (let i = 0; i < mainCount; i++) { - const haikuLine = mainDisplayLines.nth(i); - const japaneseText = await haikuLine.locator('p').first().innerText(); - lines.push(japaneseText); - } - } - - const mainHaikuContent = lines.join('').replace(/\s/g, ''); - return mainHaikuContent; - } - - async checkHaikuDisplay(page: Page): Promise { - const chatHaikuContent = await this.extractChatHaikuContent(page); - - await page.waitForTimeout(5000); - - const mainHaikuContent = await this.extractMainDisplayHaikuContent(page); - - if (mainHaikuContent === '') { - expect(chatHaikuContent.length).toBeGreaterThan(0); - return; - } - - if (chatHaikuContent === mainHaikuContent) { - expect(mainHaikuContent).toBe(chatHaikuContent); - } else { - await page.waitForTimeout(3000); - - const updatedMainContent = await this.extractMainDisplayHaikuContent(page); - - expect(updatedMainContent).toBe(chatHaikuContent); - } - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/serverStarterPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/serverStarterPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/serverStarterPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/pages/vercelAISdkPages/AgenticChatPage.ts b/typescript-sdk/apps/dojo/e2e/pages/vercelAISdkPages/AgenticChatPage.ts deleted file mode 100644 index 85be9da44..000000000 --- a/typescript-sdk/apps/dojo/e2e/pages/vercelAISdkPages/AgenticChatPage.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Page, Locator, expect } from "@playwright/test"; - -export class AgenticChatPage { - readonly page: Page; - readonly openChatButton: Locator; - readonly agentGreeting: Locator; - readonly chatInput: Locator; - readonly sendButton: Locator; - readonly chatBackground: Locator; - readonly agentMessage: Locator; - readonly userMessage: Locator; - - constructor(page: Page) { - this.page = page; - this.openChatButton = page.getByRole("button", { - name: /chat/i, - }); - this.agentGreeting = page - .getByText("Hi, I'm an agent. Want to chat?"); - this.chatInput = page - .getByRole("textbox", { name: "Type a message..." }) - .or(page.getByRole("textbox")) - .or(page.locator('input[type="text"]')) - .or(page.locator('textarea')); - this.sendButton = page - .locator('[data-test-id="copilot-chat-ready"]') - .or(page.getByRole("button", { name: /send/i })) - .or(page.locator('button[type="submit"]')); - this.chatBackground = page - .locator('div[style*="background"]') - .or(page.locator('.flex.justify-center.items-center.h-full.w-full')) - .or(page.locator('body')); - this.agentMessage = page - .locator(".copilotKitAssistantMessage"); - this.userMessage = page - .locator(".copilotKitUserMessage"); - } - - async openChat() { - try { - await this.openChatButton.click({ timeout: 3000 }); - } catch (error) { - // Chat might already be open - } - } - - async sendMessage(message: string) { - await this.chatInput.click(); - await this.chatInput.fill(message); - try { - await this.sendButton.click(); - } catch (error) { - await this.chatInput.press("Enter"); - } - } - - async getBackground( - property: "backgroundColor" | "backgroundImage" = "backgroundColor" -): Promise { - // Wait a bit for background to apply - await this.page.waitForTimeout(500); - - // Try multiple selectors for the background element - const selectors = [ - 'div[style*="background"]', - 'div[style*="background-color"]', - '.flex.justify-center.items-center.h-full.w-full', - 'div.flex.justify-center.items-center.h-full.w-full', - '[class*="bg-"]', - 'div[class*="background"]' - ]; - - for (const selector of selectors) { - try { - const element = this.page.locator(selector).first(); - if (await element.isVisible({ timeout: 1000 })) { - const value = await element.evaluate( - (el, prop) => { - // Check inline style first - if (el.style.background) return el.style.background; - if (el.style.backgroundColor) return el.style.backgroundColor; - // Then computed style - return getComputedStyle(el)[prop as any]; - }, - property - ); - if (value && value !== "rgba(0, 0, 0, 0)" && value !== "transparent") { - console.log(`[${selector}] ${property}: ${value}`); - return value; - } - } - } catch (e) { - continue; - } - } - - // Fallback to original element - const value = await this.chatBackground.first().evaluate( - (el, prop) => getComputedStyle(el)[prop as any], - property - ); - console.log(`[Fallback] ${property}: ${value}`); - return value; -} - - async getGradientButtonByName(name: string | RegExp) { - return this.page.getByRole("button", { name }); - } - - async assertUserMessageVisible(text: string | RegExp) { - await expect(this.userMessage.getByText(text)).toBeVisible(); - } - - async assertAgentReplyVisible(expectedText: RegExp) { - const agentMessage = this.page.locator(".copilotKitAssistantMessage", { - hasText: expectedText, - }); - await expect(agentMessage.last()).toBeVisible({ timeout: 10000 }); - } -} \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/tests/agnoTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/agnoTests/agenticChatPage.spec.ts index 7f921d5cd..c91995c25 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/agnoTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/agnoTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/agnoPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; const appleAsk = "What is the current stock price of AAPL? Please respond in the format of 'The current stock price of Apple Inc. (AAPL) is {{price}}'" diff --git a/typescript-sdk/apps/dojo/e2e/tests/agnoTests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/agnoTests/toolBasedGenUIPage.spec.ts index 5b5d88ba5..10380d93a 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/agnoTests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/agnoTests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/agnoPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/agno/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/crewAITests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/crewAITests/agenticChatPage.spec.ts index efabfc306..cb6820d30 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/crewAITests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/crewAITests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/crewAIPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[CrewAI] Agentic Chat sends and receives a message", async ({ page, diff --git a/typescript-sdk/apps/dojo/e2e/tests/crewAITests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/crewAITests/sharedStatePage.spec.ts index b406b0ae5..847d3e569 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/crewAITests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/crewAITests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/crewAIPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[CrewAI] should interact with the chat to get a recipe on prompt", async ({ @@ -13,9 +13,9 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Pasta'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); @@ -34,7 +34,7 @@ test.describe("Shared State Feature", () => { // Add new ingredient via UI await sharedStateAgent.addIngredient.click(); - + // Fill in the new ingredient details const newIngredientCard = page.locator('.ingredient-card').last(); await newIngredientCard.locator('.ingredient-name-input').fill('Potatoes'); diff --git a/typescript-sdk/apps/dojo/e2e/tests/crewAITests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/crewAITests/toolBasedGenUIPage.spec.ts index c98a8a3c5..398a1b80b 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/crewAITests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/crewAITests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/crewAIPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/crewai/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/agenticChatPage.spec.ts index 7806f9544..2ac0d2853 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/langGraphFastAPIPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[LangGraph FastAPI] Agentic Chat sends and receives a message", async ({ page, @@ -42,7 +42,7 @@ test("[LangGraph FastAPI] Agentic Chat changes background on message and reset", // Store initial background color const initialBackground = await chat.getBackground(); console.log("Initial background color:", initialBackground); - + // 1. Send message to change background to blue await chat.sendMessage("Hi change the background color to blue"); await chat.assertUserMessageVisible( diff --git a/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/sharedStatePage.spec.ts index a80c763d3..084aaeca0 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/langGraphFastAPIPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[LangGraph FastAPI] should interact with the chat to get a recipe on prompt", async ({ @@ -13,9 +13,9 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Pasta'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); diff --git a/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/toolBasedGenUIPage.spec.ts index 4624ee995..053d4715e 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/langgraphFastAPITests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/langGraphFastAPIPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/langgraph-fastapi/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/agenticChatPage.spec.ts index 0a8b225f4..c39e5a92e 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/langGraphPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[LangGraph] Agentic Chat sends and receives a message", async ({ page, @@ -42,7 +42,7 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async ( // Store initial background color const initialBackground = await chat.getBackground(); console.log("Initial background color:", initialBackground); - + // 1. Send message to change background to blue await chat.sendMessage("Hi change the background color to blue"); await chat.assertUserMessageVisible( diff --git a/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/sharedStatePage.spec.ts index ed758be36..2cccfcf88 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/langGraphPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[LangGraph] should interact with the chat to get a recipe on prompt", async ({ @@ -13,9 +13,9 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Pasta'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); @@ -34,7 +34,7 @@ test.describe("Shared State Feature", () => { // Add new ingredient via UI await sharedStateAgent.addIngredient.click(); - + // Fill in the new ingredient details const newIngredientCard = page.locator('.ingredient-card').last(); await newIngredientCard.locator('.ingredient-name-input').fill('Potatoes'); diff --git a/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/toolBasedGenUIPage.spec.ts index 5c03599de..13d7d7e3d 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/langgraphTests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/langGraphPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/langgraph/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/agenticChatPage.spec.ts index 75a730c8d..0a9a262c2 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/llamaIndexPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[LlamaIndex] Agentic Chat sends and receives a message", async ({ page, @@ -42,7 +42,7 @@ test("[LlamaIndex] Agentic Chat changes background on message and reset", async // Store initial background color const initialBackground = await chat.getBackground(); console.log("Initial background color:", initialBackground); - + // 1. Send message to change background to blue await chat.sendMessage("Hi change the background color to blue"); await chat.assertUserMessageVisible( diff --git a/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/sharedStatePage.spec.ts index 8ab2b0875..b0d9740d7 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/llamaIndexTests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/llamaIndexPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[LlamaIndex] should interact with the chat to get a recipe on prompt", async ({ @@ -13,9 +13,9 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Pasta'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); @@ -34,7 +34,7 @@ test.describe("Shared State Feature", () => { // Add new ingredient via UI await sharedStateAgent.addIngredient.click(); - + // Fill in the new ingredient details const newIngredientCard = page.locator('.ingredient-card').last(); await newIngredientCard.locator('.ingredient-name-input').fill('Potatoes'); diff --git a/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/agenticChatPage.spec.ts index 8826a05f1..2c3c2ac35 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/llamaIndexPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[MastraAgentLocal] Agentic Chat sends and receives a message", async ({ page, @@ -42,7 +42,7 @@ test("[MastraAgentLocal] Agentic Chat changes background on message and reset", // Store initial background color const initialBackground = await chat.getBackground(); console.log("Initial background color:", initialBackground); - + // 1. Send message to change background to blue await chat.sendMessage("Hi change the background color to blue"); await chat.assertUserMessageVisible( diff --git a/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/sharedStatePage.spec.ts index 5da363d8e..16ff216ea 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/mastraAgentLocalPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[MastraAgentLocal] should interact with the chat to get a recipe on prompt", async ({ @@ -13,9 +13,9 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Pasta'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); @@ -34,7 +34,7 @@ test.describe("Shared State Feature", () => { // Add new ingredient via UI await sharedStateAgent.addIngredient.click(); - + // Fill in the new ingredient details const newIngredientCard = page.locator('.ingredient-card').last(); await newIngredientCard.locator('.ingredient-name-input').fill('Potatoes'); diff --git a/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/toolBasedGenUIPage.spec.ts index 133cc1c53..c73388faf 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/mastraAgentLocalTests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/mastraAgentLocalPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/mastra-agent-local/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/mastraTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/mastraTests/agenticChatPage.spec.ts index f22220243..e8b910165 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/mastraTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/mastraTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/mastraPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[Mastra] Agentic Chat sends and receives a greeting message", async ({ page, @@ -71,7 +71,7 @@ test("[Mastra] Agentic Chat retains memory of previous questions", async ({ await chat.sendMessage("What was my first question"); await chat.assertUserMessageVisible("What was my first question"); await waitForAIResponse(page); - + // Check if the agent remembers the first question about weather await chat.assertAgentReplyVisible(/weather|Islamabad/i); }); diff --git a/typescript-sdk/apps/dojo/e2e/tests/mastraTests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/mastraTests/toolBasedGenUIPage.spec.ts index 2296b4f7f..d9787d8e5 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/mastraTests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/mastraTests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/mastraPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/mastra/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/middlewareStarterTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/middlewareStarterTests/agenticChatPage.spec.ts index 6e598d8ad..5666a33c0 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/middlewareStarterTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/middlewareStarterTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/middlewareStarterPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[Middleware Starter] Testing Agentic Chat", async ({ page, diff --git a/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/agenticChatPage.spec.ts index 8c5b9d4c3..df8ab753f 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/pydanticAIPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[PydanticAI] Agentic Chat sends and receives a message", async ({ page, @@ -42,7 +42,7 @@ test("[PydanticAI] Agentic Chat changes background on message and reset", async // Store initial background color const initialBackground = await chat.getBackground(); console.log("Initial background color:", initialBackground); - + // 1. Send message to change background to blue await chat.sendMessage("Hi change the background color to blue"); await chat.assertUserMessageVisible( diff --git a/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/sharedStatePage.spec.ts index 5be1b4dda..51aae72de 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/pydanticAIPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[PydanticAI] should interact with the chat to get a recipe on prompt", async ({ @@ -13,9 +13,9 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Pasta'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); @@ -34,7 +34,7 @@ test.describe("Shared State Feature", () => { // Add new ingredient via UI await sharedStateAgent.addIngredient.click(); - + // Fill in the new ingredient details const newIngredientCard = page.locator('.ingredient-card').last(); await newIngredientCard.locator('.ingredient-name-input').fill('Potatoes'); diff --git a/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/toolBasedGenUIPage.spec.ts index 556aa390d..3a21d88bc 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/pydanticAITests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/pydanticAIPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/pydantic-ai/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/agenticChatPage.spec.ts index 30d6ca45c..00f423305 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/serverStarterAllFeaturesPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[Server Starter all features] Agentic Chat displays countdown from 10 to 1 with tick mark", async ({ page, @@ -24,13 +24,13 @@ test("[Server Starter all features] Agentic Chat displays countdown from 10 to 1 const countdownMessage = page .locator('.copilotKitAssistantMessage') .filter({ hasText: 'counting down:' }); - + await expect(countdownMessage).toBeVisible({ timeout: 30000 }); - + // Wait for countdown to complete by checking for the tick mark await expect(countdownMessage.locator('.copilotKitMarkdownElement')) .toContainText('βœ“', { timeout: 15000 }); - + const countdownText = await countdownMessage .locator('.copilotKitMarkdownElement') .textContent(); diff --git a/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/sharedStatePage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/sharedStatePage.spec.ts index 87cef99d1..5700d9b8b 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/sharedStatePage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/sharedStatePage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { SharedStatePage } from "../../pages/serverStarterAllFeaturesPages/SharedStatePage"; +import { SharedStatePage } from "../../featurePages/SharedStatePage"; test.describe("Shared State Feature", () => { test("[Server Starter all features] should interact with the chat to get a recipe on prompt", async ({ @@ -13,16 +13,16 @@ test.describe("Shared State Feature", () => { ); await sharedStateAgent.openChat(); - await sharedStateAgent.sendMessage("give me recipe for pasta"); + await sharedStateAgent.sendMessage('Please give me a pasta recipe of your choosing, but one of the ingredients should be "Pasta"'); await sharedStateAgent.loader(); - await sharedStateAgent.getIngredientCard(/Pasta/); + await sharedStateAgent.awaitIngredientCard('Salt'); await sharedStateAgent.getInstructionItems( sharedStateAgent.instructionsContainer ); }); // Fails. Issue with the test, most likely - test.fixme("[Server Starter all features] should share state between UI and chat", async ({ + test("[Server Starter all features] should share state between UI and chat", async ({ page, }) => { const sharedStateAgent = new SharedStatePage(page); @@ -48,10 +48,12 @@ test.describe("Shared State Feature", () => { await sharedStateAgent.sendMessage("Give me all the ingredients"); await sharedStateAgent.loader(); - // Verify chat response includes both existing and new ingredients - await expect(sharedStateAgent.agentMessage.getByText(/Potatoes/)).toBeVisible(); - await expect(sharedStateAgent.agentMessage.getByText(/12/)).toBeVisible(); - await expect(sharedStateAgent.agentMessage.getByText(/Carrots/)).toBeVisible(); - await expect(sharedStateAgent.agentMessage.getByText(/All-Purpose Flour/)).toBeVisible(); + // Verify hardcoded ingredients + await sharedStateAgent.awaitIngredientCard('chicken breast'); + await sharedStateAgent.awaitIngredientCard('chili powder'); + await sharedStateAgent.awaitIngredientCard('Salt'); + await sharedStateAgent.awaitIngredientCard('Lettuce leaves'); + + expect(await sharedStateAgent.getInstructionItems(sharedStateAgent.instructionsContainer)).toBe(3); }); }); \ No newline at end of file diff --git a/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/toolBasedGenUIPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/toolBasedGenUIPage.spec.ts index 56080aac0..34598e4ce 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/toolBasedGenUIPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/serverStarterAllFeaturesTests/toolBasedGenUIPage.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { ToolBaseGenUIPage } from "../../pages/serverStarterAllFeaturesPages/ToolBaseGenUIPage"; +import { ToolBaseGenUIPage } from "../../featurePages/ToolBaseGenUIPage"; const pageURL = "/server-starter-all-features/feature/tool_based_generative_ui"; diff --git a/typescript-sdk/apps/dojo/e2e/tests/serverStarterTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/serverStarterTests/agenticChatPage.spec.ts index 9d4e0f9c7..a83903c87 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/serverStarterTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/serverStarterTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/serverStarterPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[Server Starter] Testing Agentic Chat", async ({ page, diff --git a/typescript-sdk/apps/dojo/e2e/tests/vercelAISdkTests/agenticChatPage.spec.ts b/typescript-sdk/apps/dojo/e2e/tests/vercelAISdkTests/agenticChatPage.spec.ts index 265d3deb1..640fb9f9f 100644 --- a/typescript-sdk/apps/dojo/e2e/tests/vercelAISdkTests/agenticChatPage.spec.ts +++ b/typescript-sdk/apps/dojo/e2e/tests/vercelAISdkTests/agenticChatPage.spec.ts @@ -4,7 +4,7 @@ import { waitForAIResponse, retryOnAIFailure, } from "../../test-isolation-helper"; -import { AgenticChatPage } from "../../pages/vercelAISdkPages/AgenticChatPage"; +import { AgenticChatPage } from "../../featurePages/AgenticChatPage"; test("[verceAISdkPages] Agentic Chat sends and receives a message", async ({ page, @@ -42,7 +42,7 @@ test("[Vercel AI SDK] Agentic Chat changes background on message and reset", asy // Store initial background color const initialBackground = await chat.getBackground(); console.log("Initial background color:", initialBackground); - + // 1. Send message to change background to blue await chat.sendMessage("Hi change the background color to blue"); await chat.assertUserMessageVisible( diff --git a/typescript-sdk/apps/dojo/src/mastra/index.ts b/typescript-sdk/apps/dojo/src/mastra/index.ts index 27db6463d..abc55418a 100644 --- a/typescript-sdk/apps/dojo/src/mastra/index.ts +++ b/typescript-sdk/apps/dojo/src/mastra/index.ts @@ -9,38 +9,41 @@ import { createTool } from "@mastra/core"; import { z } from "zod"; -let storage: LibSQLStore | DynamoDBStore -if (process.env.DYNAMODB_TABLE_NAME) { - storage = new DynamoDBStore({ - name: "dynamodb", - config: { - tableName: process.env.DYNAMODB_TABLE_NAME - }, -}); -} else { - storage = new LibSQLStore({ url: "file::memory:" }); +function getStorage(): LibSQLStore | DynamoDBStore { + if (process.env.DYNAMODB_TABLE_NAME) { + return new DynamoDBStore({ + name: "dynamodb", + config: { + tableName: process.env.DYNAMODB_TABLE_NAME + }, + }); + } else { + return new LibSQLStore({ url: "file::memory:" }); + } } + + export const mastra = new Mastra({ agents: { agentic_chat: new Agent({ name: "agentic_chat", instructions: ` You are a helpful weather assistant that provides accurate weather information. - + Your primary function is to help users get weather details for specific locations. When responding: - Always ask for a location if none is provided - If the location name isn’t in English, please translate it - If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York") - Include relevant details like humidity, wind conditions, and precipitation - Keep responses concise but informative - + Use the weatherTool to fetch current weather data. `, model: openai("gpt-4o"), memory: new Memory({ - storage: storage, + storage: getStorage(), options: { workingMemory: { enabled: true, @@ -54,7 +57,7 @@ export const mastra = new Mastra({ shared_state: new Agent({ name: "shared_state", instructions: ` - You are a helpful assistant for creating recipes. + You are a helpful assistant for creating recipes. IMPORTANT: 1. Create a recipe using the existing ingredients and instructions. Make sure the recipe is complete. @@ -63,11 +66,11 @@ export const mastra = new Mastra({ 4. 'ingredients' is always an array of objects with 'icon', 'name', and 'amount' fields 5. 'instructions' is always an array of strings - If you have just created or modified the recipe, just answer in one sentence what you did. dont describe the recipe, just say what you did. + If you have just created or modified the recipe, just answer in one sentence what you did. dont describe the recipe, just say what you did. Do not mention "working memory", "memory", or "state" in your answer. `, model: openai("gpt-4o"), memory: new Memory({ - storage: storage, + storage: getStorage(), options: { workingMemory: { enabled: true,