dev #5

Merged
zhangxiang merged 159 commits from dev into main 2026-04-12 17:39:08 +08:00
Showing only changes of commit b150ad346b - Show all commits
+16 -6
View File
@@ -66,7 +66,7 @@ export class AdminContentPage {
await this.page.click('button:has-text("发布")');
try {
await this.page.waitForURL(/\/admin\/content\/[a-zA-Z0-9]+/, { timeout: 15000 });
await this.page.waitForURL(/\/admin\/content\/[a-zA-Z0-9_-]+/, { timeout: 15000 });
} catch {
console.log('等待URL跳转失败,当前URL:', this.page.url());
@@ -86,7 +86,7 @@ export class AdminContentPage {
const url = this.page.url();
console.log('最终URL:', url);
const match = url.match(/\/admin\/content\/([a-zA-Z0-9]+)/);
const match = url.match(/\/admin\/content\/([a-zA-Z0-9_-]+)/);
const contentId = match ? match[1] : null;
if (!contentId) {
@@ -152,7 +152,7 @@ export class AdminContentPage {
await this.goto();
await this.page.waitForLoadState('domcontentloaded');
await this.page.waitForTimeout(2000);
await this.page.waitForTimeout(3000);
let row = this.page.locator(`tr:has-text("${title}")`);
let isVisible = await row.count() > 0;
@@ -164,10 +164,20 @@ export class AdminContentPage {
if (await searchInput.count() > 0) {
await searchInput.fill(title);
await this.page.keyboard.press('Enter');
await this.page.waitForTimeout(2000);
await this.page.waitForTimeout(3000);
row = this.page.locator(`tr:has-text("${title}")`);
isVisible = await row.count() > 0;
if (!isVisible) {
console.log('搜索无结果,清空搜索框');
await searchInput.fill('');
await this.page.keyboard.press('Enter');
await this.page.waitForTimeout(2000);
row = this.page.locator(`tr:has-text("${title}")`);
isVisible = await row.count() > 0;
}
}
}
@@ -175,7 +185,7 @@ export class AdminContentPage {
console.log('搜索后仍未找到,尝试刷新页面');
await this.page.reload({ waitUntil: 'domcontentloaded' });
await this.page.waitForSelector('table', { timeout: 10000, state: 'visible' });
await this.page.waitForTimeout(2000);
await this.page.waitForTimeout(3000);
row = this.page.locator(`tr:has-text("${title}")`);
isVisible = await row.count() > 0;
@@ -192,7 +202,7 @@ export class AdminContentPage {
}
}
await expect(row.first()).toBeVisible({ timeout: 15000 });
await expect(row.first()).toBeVisible({ timeout: 20000 });
console.log(`✅ 找到内容: ${title}`);
}