mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-26 13:19:34 +07:00
✅ test: improve community e2e testing (#11534)
* improve community e2e testing * fix steps
This commit is contained in:
@@ -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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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 });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user