test: improve community e2e testing (#11534)

* improve community e2e testing

* fix steps
This commit is contained in:
Arvin Xu
2026-01-18 21:31:05 +08:00
committed by GitHub
parent 14b9bf7353
commit 171f328ff1
4 changed files with 9 additions and 7 deletions

View File

@@ -8,7 +8,9 @@ import { CustomWorld } from '../../support/world';
// ============================================ // ============================================
Given('I wait for the page to fully load', async function (this: CustomWorld) { 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); await this.page.waitForTimeout(1000);
}); });

View File

@@ -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) { Then('I should see the assistant detail content', async function (this: CustomWorld) {
await this.page.waitForLoadState('networkidle', { timeout: 30_000 }); await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
// Look for detail page elements (e.g., title, description, etc.) // Look for assistant detail page content
const detailContent = this.page.locator('[data-testid="detail-content"], main, article').first(); const detailContent = this.page.locator('[data-testid="assistant-detail-content"]');
await expect(detailContent).toBeVisible({ timeout: 30_000 }); 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) { Then('I should see the MCP detail content', async function (this: CustomWorld) {
await this.page.waitForLoadState('networkidle', { timeout: 30_000 }); await this.page.waitForLoadState('networkidle', { timeout: 30_000 });
// Look for detail page elements // Look for MCP detail page content
const detailContent = this.page.locator('[data-testid="detail-content"], main, article').first(); const detailContent = this.page.locator('[data-testid="mcp-detail-content"]');
await expect(detailContent).toBeVisible({ timeout: 30_000 }); await expect(detailContent).toBeVisible({ timeout: 30_000 });
}); });

View File

@@ -40,7 +40,7 @@ const AssistantDetailPage = memo<AssistantDetailPageProps>(({ mobile }) => {
return ( return (
<TocProvider> <TocProvider>
<DetailProvider config={data}> <DetailProvider config={data}>
<Flexbox gap={16}> <Flexbox data-testid="assistant-detail-content" gap={16}>
<Header mobile={mobile} /> <Header mobile={mobile} />
<Details mobile={mobile} /> <Details mobile={mobile} />
</Flexbox> </Flexbox>

View File

@@ -35,7 +35,7 @@ const McpDetailPage = memo<McpDetailPageProps>(({ mobile }) => {
return ( return (
<TocProvider> <TocProvider>
<DetailProvider config={data}> <DetailProvider config={data}>
<Flexbox gap={16}> <Flexbox data-testid="mcp-detail-content" gap={16}>
<Header mobile={mobile} /> <Header mobile={mobile} />
<Details mobile={mobile} /> <Details mobile={mobile} />
</Flexbox> </Flexbox>