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: improve community e2e testing (#11534)

Arvin Xu171f328ff128
diff --git a/e2e/src/steps/community/detail-pages.steps.ts b/e2e/src/steps/community/detail-pages.steps.ts
index ca8ba39c540..c7d31be1e89 100644
--- a/e2e/src/steps/community/detail-pages.steps.ts
+++ b/e2e/src/steps/community/detail-pages.steps.ts
@@ -8,7 +8,9 @@ import { CustomWorld } from '../../support/world';
// ============================================
Given('I wait for the page to fully load', async function (this: CustomWorld) {
- await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
+ // Use domcontentloaded instead of networkidle to avoid hanging on persistent connections
+ await this.page.waitForLoadState('domcontentloaded', { timeout: 10_000 });
+ // Short wait for React hydration
await this.page.waitForTimeout(1000);
});
diff --git a/e2e/src/steps/community/interactions.steps.ts b/e2e/src/steps/community/interactions.steps.ts
index b782b4fffad..418e1e31fda 100644
--- a/e2e/src/steps/community/interactions.steps.ts
+++ b/e2e/src/steps/community/interactions.steps.ts
@@ -446,8 +446,8 @@ Then('I should be navigated to the assistant detail page', async function (this:
Then('I should see the assistant detail content', async function (this: CustomWorld) {
await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
- // Look for detail page elements (e.g., title, description, etc.)
- const detailContent = this.page.locator('[data-testid="detail-content"], main, article').first();
+ // Look for assistant detail page content
+ const detailContent = this.page.locator('[data-testid="assistant-detail-content"]');
await expect(detailContent).toBeVisible({ timeout: 30_000 });
});
@@ -561,8 +561,8 @@ Then('I should be navigated to the MCP detail page', async function (this: Custo
Then('I should see the MCP detail content', async function (this: CustomWorld) {
await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
- // Look for detail page elements
- const detailContent = this.page.locator('[data-testid="detail-content"], main, article').first();
+ // Look for MCP detail page content
+ const detailContent = this.page.locator('[data-testid="mcp-detail-content"]');
await expect(detailContent).toBeVisible({ timeout: 30_000 });
});
diff --git a/src/app/[variants]/(main)/community/(detail)/assistant/index.tsx b/src/app/[variants]/(main)/community/(detail)/assistant/index.tsx
index e1abc862bdc..4a7eefa2b34 100644
--- a/src/app/[variants]/(main)/community/(detail)/assistant/index.tsx
+++ b/src/app/[variants]/(main)/community/(detail)/assistant/index.tsx
@@ -40,7 +40,7 @@ const AssistantDetailPage = memo<AssistantDetailPageProps>(({ mobile }) => {
return (
<TocProvider>
<DetailProvider config={data}>
- <Flexbox gap={16}>
+ <Flexbox data-testid="assistant-detail-content" gap={16}>
<Header mobile={mobile} />
<Details mobile={mobile} />
</Flexbox>
diff --git a/src/app/[variants]/(main)/community/(detail)/mcp/index.tsx b/src/app/[variants]/(main)/community/(detail)/mcp/index.tsx
index c077d61f75e..f288ad3a0a5 100644
--- a/src/app/[variants]/(main)/community/(detail)/mcp/index.tsx
+++ b/src/app/[variants]/(main)/community/(detail)/mcp/index.tsx
@@ -35,7 +35,7 @@ const McpDetailPage = memo<McpDetailPageProps>(({ mobile }) => {
return (
<TocProvider>
<DetailProvider config={data}>
- <Flexbox gap={16}>
+ <Flexbox data-testid="mcp-detail-content" gap={16}>
<Header mobile={mobile} />
<Details mobile={mobile} />
</Flexbox>