Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✅ test: fix e2e community (#11622)

Arvin Xu560f5de02693
diff --git a/e2e/src/steps/community/detail-pages.steps.ts b/e2e/src/steps/community/detail-pages.steps.ts
index c3a21e13ee2..ee7fb7ea7c4 100644
--- a/e2e/src/steps/community/detail-pages.steps.ts
+++ b/e2e/src/steps/community/detail-pages.steps.ts
@@ -68,7 +68,7 @@ Then('I should be on an assistant detail page', async function (this: CustomWorl
const currentUrl = this.page.url();
// Check if URL matches assistant detail page pattern
- const hasAssistantDetail = /\/community\/assistant\/[^#?]+/.test(currentUrl);
+ const hasAssistantDetail = /\/community\/agent\/[^#?]+/.test(currentUrl);
expect(
hasAssistantDetail,
`Expected URL to match assistant detail page pattern, but got: ${currentUrl}`,
@@ -138,7 +138,7 @@ Then('I should be on the assistant list page', async function (this: CustomWorld
// After back navigation, URL should be /community/agent or /community
const isListPage =
(currentUrl.includes('/community/agent') &&
- !/\/community\/assistant\/[\dA-Za-z-]+$/.test(currentUrl)) ||
+ !/\/community\/agent\/[\dA-Za-z-]+$/.test(currentUrl)) ||
currentUrl.endsWith('/community') ||
currentUrl.includes('/community#');
diff --git a/e2e/src/steps/community/interactions.steps.ts b/e2e/src/steps/community/interactions.steps.ts
index f43e21beb8a..5376da12c31 100644
--- a/e2e/src/steps/community/interactions.steps.ts
+++ b/e2e/src/steps/community/interactions.steps.ts
@@ -230,10 +230,10 @@ When('I click on the sort dropdown', async function (this: CustomWorld) {
});
When('I select a sort option', async function (this: CustomWorld) {
- await this.page.waitForTimeout(500);
+ await this.page.waitForTimeout(1000);
- // Find and click a sort option (assuming dropdown opens a menu)
- const sortOptions = this.page.locator('[role="option"], [role="menuitem"]');
+ // The sort dropdown uses checkbox items with role="menuitemcheckbox"
+ const sortOptions = this.page.locator('[role="menuitemcheckbox"]');
// Wait for options to appear
await sortOptions.first().waitFor({ state: 'visible', timeout: 30_000 });
@@ -381,7 +381,7 @@ Then('the URL should contain the category parameter', async function (this: Cust
currentUrl.includes('category=') ||
currentUrl.includes('tag=') ||
// For path-based routing like /community/agent/category-name
- /\/community\/assistant\/[^/?]+/.test(currentUrl);
+ /\/community\/agent\/[^/?]+/.test(currentUrl);
expect(
hasCategory,
@@ -433,8 +433,8 @@ Then('I should be navigated to the assistant detail page', async function (this:
await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
const currentUrl = this.page.url();
- // Verify that URL changed and contains /assistant/ followed by an identifier
- const hasAssistantDetail = /\/community\/assistant\/[^#?]+/.test(currentUrl);
+ // Verify that URL changed and contains /agent/ followed by an identifier
+ const hasAssistantDetail = /\/community\/agent\/[^#?]+/.test(currentUrl);
const urlChanged = currentUrl !== this.testContext.previousUrl;
expect(
diff --git a/e2e/src/steps/hooks.ts b/e2e/src/steps/hooks.ts
index 0d8306e95fb..bf6e26b0145 100644
--- a/e2e/src/steps/hooks.ts
+++ b/e2e/src/steps/hooks.ts
@@ -45,10 +45,24 @@ BeforeAll({ timeout: 600_000 }, async function () {
// Navigate to signin page
await page.goto(`${baseUrl}/signin`, { waitUntil: 'networkidle' });
+ // Wait for the page to fully hydrate
+ await page.waitForTimeout(2000);
+
+ // Check if we can find the email input
+ const emailInput = page
+ .locator('input[id="email"], input[name="email"], input[type="text"]')
+ .first();
+ const emailInputVisible = await emailInput.isVisible().catch(() => false);
+
+ if (!emailInputVisible) {
+ console.log(
+ '⚠️ Login form not available, skipping authentication (tests requiring auth may fail)',
+ );
+ return;
+ }
+
// Step 1: Enter email
console.log(' Step 1: Entering email...');
- const emailInput = page.locator('input[id="email"]').first();
- await emailInput.waitFor({ state: 'visible', timeout: 30_000 });
await emailInput.fill(TEST_USER.email);
// Click the next button
@@ -57,7 +71,9 @@ BeforeAll({ timeout: 600_000 }, async function () {
// Step 2: Wait for password step and enter password
console.log(' Step 2: Entering password...');
- const passwordInput = page.locator('input[id="password"]').first();
+ const passwordInput = page
+ .locator('input[id="password"], input[name="password"], input[type="password"]')
+ .first();
await passwordInput.waitFor({ state: 'visible', timeout: 30_000 });
await passwordInput.fill(TEST_USER.password);
diff --git a/src/app/manifest.ts b/src/app/manifest.ts
index 8cef07a1c0c..b9ac3f946a0 100644
--- a/src/app/manifest.ts
+++ b/src/app/manifest.ts
@@ -16,7 +16,7 @@ const manifest = async (): Promise<MetadataRoute.Manifest> => {
],
name: 'LobeChat',
short_name: 'LobeChat',
- start_url: '/agent',
+ start_url: '/',
theme_color: '#000000',
};
}
diff --git a/src/server/manifest.ts b/src/server/manifest.ts
index 5f3192476e4..1c6869db596 100644
--- a/src/server/manifest.ts
+++ b/src/server/manifest.ts
@@ -63,10 +63,10 @@ export class Manifest {
screenshots: screenshots.map((item) => this._getScreenshot(item)),
short_name: name,
splash_pages: null,
- start_url: '/agent',
+ start_url: '/',
tab_strip: {
new_tab_button: {
- url: '/agent',
+ url: '/',
},
},
theme_color: color,