OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
import { ACTIVE_PROVIDER_CONFIG } from "../config/provider";
import { expect, test } from "../utils/fixtures";
import logger from "../utils/logger";
import { navigateToHome } from "../utils/navigation";
test(`@smoke URL connector ingestion reliability - ${ACTIVE_PROVIDER_CONFIG.provider} @33219228`, async ({
page,
settings,
knowledge,
chat,
cleanupDocuments,
}) => {
test.setTimeout(180000);
// Navigate to the application
await navigateToHome(page);
logger.info(
`\nπ§ͺ Testing URL Ingestion with ${ACTIVE_PROVIDER_CONFIG.provider}`,
);
// Step 1: Cleanup test document if it exists
logger.info(` π§Ή Cleaning up existing test document...`);
const docName = ACTIVE_PROVIDER_CONFIG.testCase.docName;
try {
await knowledge.deleteDocument(docName);
logger.info(` β Test document cleaned up`);
} catch (_error) {
logger.info(` βΉοΈ No existing test document to clean up`);
}
// Register document for cleanup after test
await cleanupDocuments([docName]);
// Step 2: Set models for active provider
logger.info(` βοΈ Setting models for ${ACTIVE_PROVIDER_CONFIG.provider}...`);
await settings.clickTab("Agent");
await settings.selectModel("Language model", ACTIVE_PROVIDER_CONFIG.language);
await settings.clickTab("Ingestion");
await settings.selectModel(
"Embedding model",
ACTIVE_PROVIDER_CONFIG.embedding,
);
logger.info(` β Language model set to: ${ACTIVE_PROVIDER_CONFIG.language}`);
logger.info(
` β Embedding model set to: ${ACTIVE_PROVIDER_CONFIG.embedding}`,
);
// Step 3: Ingest URL via chat
logger.info(` π Ingesting URL: ${ACTIVE_PROVIDER_CONFIG.testCase.url}`);
await chat.open();
const { toolCall, toolData } = await chat.ingestUrl(
ACTIVE_PROVIDER_CONFIG.testCase.url,
);
logger.info(` β URL ingestion initiated`);
// Step 4: Verify tool call arguments
logger.info(` π Verifying tool call arguments...`);
expect(toolData).toBeDefined();
expect(toolData.tool_name).toBe("opensearch_url_ingestion_flow");
expect(toolData.inputs.input_value).toBe(ACTIVE_PROVIDER_CONFIG.testCase.url);
logger.info(
` β Tool called with correct URL: ${toolData.inputs.input_value}`,
);
// Step 5: Verify ingestion succeeded (tool did not fail)
logger.info(` β³ Verifying ingestion success...`);
const failedTool = await chat.isToolFailed(toolCall);
expect(failedTool).toBe(false);
logger.info(` β Ingestion completed without errors`);
// Step 6: Verify document is active in knowledge base
logger.info(` π Verifying document in knowledge base...`);
await knowledge.verifyDocumentActive(docName);
logger.info(` β Document "${docName}" is active in knowledge base`);
// Success!
logger.info(` β
SUCCESS: URL ingestion verified for OpenAI\n`);
// Assertions for Playwright reporting
expect(failedTool).toBe(false);
});
test("URL connector ingestion - Invalid URL handling @34581217", async ({
page,
settings,
chat,
}) => {
test.setTimeout(180000);
await navigateToHome(page);
logger.info(`\nπ§ͺ Testing Invalid URL Ingestion`);
// Set models
await settings.clickTab("Agent");
await settings.selectModel("Language model", ACTIVE_PROVIDER_CONFIG.language);
await settings.clickTab("Ingestion");
await settings.selectModel(
"Embedding model",
ACTIVE_PROVIDER_CONFIG.embedding,
);
// Attempt to ingest invalid URL
const invalidUrl = "http://www.nonexistent-domain.invalid";
logger.info(` π Ingesting invalid URL: ${invalidUrl}`);
await chat.open();
const { toolData, fullResponse } = await chat.ingestUrl(invalidUrl);
// Verify tool call input (ensures failure is not due to incorrect input)
expect(toolData).toBeDefined();
expect(toolData.inputs.input_value).toBe(invalidUrl);
logger.info(` β Tool called with correct URL`);
// Verify chat response contains error message and helpful guidance
// Check for failure indication
const lowerResponse = fullResponse.toLowerCase();
const hasFailureIndication =
/fail|error|unsuccessful|unreachable|invalid|could not|unable|problem|issue/i.test(
lowerResponse,
);
expect(hasFailureIndication).toBe(true);
// Check for specific error message indicating ingestion failure (LLM wording varies)
const hasSpecificErrorMessage =
/no documents|failed|error|unsuccessful|unreachable|invalid|could not|unable|dns resolution/i.test(
lowerResponse,
);
expect(hasSpecificErrorMessage).toBe(true);
// Check for helpful next steps or guidance (flexible patterns)
const hasGuidance =
/possible (next )?steps|what (would you like|can I do)|next steps|confirm|provide|try|verify|check|please/i.test(
fullResponse,
);
expect(hasGuidance).toBe(true);
logger.info(` β Error message and guidance provided`);
logger.info(` β
Invalid URL handling verified\n`);
});
test("URL connector ingestion - Authentication-blocked URL handling @34581218", async ({
page,
settings,
chat,
}) => {
test.setTimeout(240000);
await navigateToHome(page);
logger.info(`\nπ§ͺ Testing Authentication-Blocked URL Ingestion`);
// Set models
await settings.clickTab("Agent");
await settings.selectModel("Language model", ACTIVE_PROVIDER_CONFIG.language);
await settings.clickTab("Ingestion");
await settings.selectModel(
"Embedding model",
ACTIVE_PROVIDER_CONFIG.embedding,
);
// Attempt to ingest authentication-blocked URL
const authBlockedUrl = "https://github.com/settings/profile";
logger.info(` π Ingesting authentication-blocked URL: ${authBlockedUrl}`);
await chat.open();
const { toolData, fullResponse } = await chat.ingestUrl(authBlockedUrl);
// The LLM may skip the ingestion tool entirely for auth-blocked URLs and
// respond with a direct message β only validate tool inputs when a tool fired.
if (toolData) {
expect(toolData.inputs.input_value).toBe(authBlockedUrl);
}
logger.info(` β Tool called with correct URL`);
// Verify chat response contains authentication/authorization message
// Check for authentication-related keywords
const hasAuthMessage =
/authentication|authorization|sign.?in|log.?in|requires|accessible|private|protected|restricted|denied|forbidden|unauthorized|credential/i.test(
fullResponse,
);
expect(hasAuthMessage).toBe(true);
logger.info(` β Response indicates authentication is required`);
// Verify response mentions the URL or GitHub
const mentionsSource = /github|settings\/profile/i.test(fullResponse);
expect(mentionsSource).toBe(true);
logger.info(` β Response mentions the blocked URL source`);
logger.info(` β
Authentication-blocked URL handling verified\n`);
});
test("URL ingestion persists after conversation deletion @34581222", async ({
page,
settings,
chat,
cleanupDocuments,
knowledge,
}) => {
test.setTimeout(300000);
await navigateToHome(page);
logger.info(
`\nπ§ͺ Testing URL Ingestion Persistence After Conversation Deletion`,
);
// Step 1: Cleanup test document if it exists
logger.info(` π§Ή Cleaning up existing test document...`);
const testUrl = "https://playwright.dev/docs/locators";
const docName = "Locators | Playwright";
try {
await knowledge.deleteDocument(docName);
logger.info(` β Test document cleaned up`);
} catch (_error) {
logger.info(` βΉοΈ No existing test document to clean up`);
}
// Register document for cleanup after test
await cleanupDocuments([docName]);
// Step 2: Set models for active provider
logger.info(` βοΈ Setting models for ${ACTIVE_PROVIDER_CONFIG.provider}...`);
await settings.clickTab("Agent");
await settings.selectModel("Language model", ACTIVE_PROVIDER_CONFIG.language);
await settings.clickTab("Ingestion");
await settings.selectModel(
"Embedding model",
ACTIVE_PROVIDER_CONFIG.embedding,
);
logger.info(` β Language model set to: ${ACTIVE_PROVIDER_CONFIG.language}`);
logger.info(
` β Embedding model set to: ${ACTIVE_PROVIDER_CONFIG.embedding}`,
);
// Step 3: Ingest URL via chat
logger.info(` π Ingesting URL: ${testUrl}`);
await chat.open();
const { toolCall, toolData } = await chat.ingestUrl(testUrl);
logger.info(` β URL ingestion initiated`);
// Step 4: Verify tool call arguments
logger.info(` π Verifying tool call arguments...`);
expect(toolData).toBeDefined();
expect(toolData.tool_name).toBe("opensearch_url_ingestion_flow");
expect(toolData.inputs.input_value).toBe(testUrl);
logger.info(
` β Tool called with correct URL: ${toolData.inputs.input_value}`,
);
// Step 5: Verify ingestion succeeded (tool did not fail)
logger.info(` β³ Verifying ingestion success...`);
const failedTool = await chat.isToolFailed(toolCall);
expect(failedTool).toBe(false);
logger.info(` β Ingestion completed without errors`);
// Step 5.5: Wait for document to be active in the knowledge base before querying/deleting conversation
logger.info(` π Verifying document is active in knowledge base...`);
await knowledge.verifyDocumentActive(docName);
// Step 6: Delete the conversation
logger.info(` ποΈ Deleting the conversation...`);
const chatTitle = `Please ingest this URL: ${testUrl}`;
await chat.deleteChatByTitle(chatTitle);
logger.info(` β Conversation deleted successfully`);
// Step 7: Open a new chat and ask a question related to the ingested URL
logger.info(` π¬ Opening new chat and asking related question...`);
await chat.openNewChat();
const question = "What are the different types of locators in Playwright?";
const response = await chat.askQuestion(question);
logger.info(` β Received response to question`);
// Step 8: Verify the response contains relevant information from the ingested URL
logger.info(
` π Verifying response contains information from ingested URL...`,
);
// Check if response has source citation from the ingested document first (short-circuit)
// If it has "Source: Locators | Playwright", it's definitely using the ingested doc
// Otherwise, check if it mentions locator types like getByRole, getByText, etc.
const hasSourceFromIngestedDoc = /Source:.*Locators.*Playwright/i.test(
response,
);
const hasRelevantInfo =
hasSourceFromIngestedDoc ||
/getByRole|getByText|getByLabel|getByPlaceholder|getByTestId|locator/i.test(
response,
);
expect(hasRelevantInfo).toBe(true);
logger.info(
` β Response contains ${hasSourceFromIngestedDoc ? "source citation from" : "relevant information about"} ingested URL`,
);
// Step 9: Verify response does NOT contain "no relevant sources" message
logger.info(
` π Verifying response is from ingested URL (not external sources)...`,
);
const hasNoSourcesMessage =
/no relevant supporting sources|no supporting sources|couldn't find relevant|no relevant information/i.test(
response,
);
expect(hasNoSourcesMessage).toBe(false);
logger.info(
` β Response is based on ingested URL data (no "no sources" message)`,
);
// Success!
logger.info(
` β
SUCCESS: URL ingestion persists after conversation deletion\n`,
);
// Assertions for Playwright reporting
expect(failedTool).toBe(false);
expect(hasRelevantInfo).toBe(true);
expect(hasNoSourcesMessage).toBe(false);
});