fix(clazz-dual-view): use index-based role selection with org-select loop
music-room Playwright (Gitea Actions) / playwright (push) Successful in 41m31s

Replace text-based filter that failed to find teacher role button with
the original index-based approach (nth(2)), wrapped in an org-select
handling loop matching the supervisor-features pattern.

Also adds test.setTimeout(240_000) for CI environment slowness and
documents authcore as public repo in CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-03 21:45:07 +08:00
parent 8d389c17c9
commit bcd53411bb
2 changed files with 16 additions and 5 deletions
+5
View File
@@ -37,6 +37,11 @@
SSH 连接服务器(部署用):`ssh -i ~/.ssh/id_rsa.moicen weli@101.43.244.164`
## 仓库迁移注意
- `authcore`Firebase Auth Core)是**公开仓库**,不要托管到自托管 Gitea
- huike-e2e-moicen、huike-front、huike-back、resty_functions 这 4 个仓库需要统一管理 GitHub ↔ Gitea 同步
## 工具链
- 文本检索:`rg`ripgrep
+11 -5
View File
@@ -9,8 +9,8 @@ async function loginAsTeacher(page: any) {
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
// 逐层处理选择页:机构选择 → 角色选择(可能有 0~n 层)
const teacherRoleText = '教师';
for (let i = 0; i < 5; i++) {
let roleSelected = false;
for (let i = 0; i < 5 && !roleSelected; i++) {
const path = await page.evaluate(() => window.location.pathname);
if (path === '/org/select') {
@@ -20,11 +20,17 @@ async function loginAsTeacher(page: any) {
const rs = page.getByText('请选择您的登录身份');
try {
await rs.waitFor({ state: 'visible', timeout: 10_000 });
await page.locator('.van-grid-item').filter({ hasText: teacherRoleText }).click();
const items = page.locator('.van-grid-item');
const count = await items.count();
if (count >= 3) {
await items.nth(2).click(); // TEACHER role
} else {
await items.first().click();
}
await page.waitForTimeout(3_000);
return;
roleSelected = true;
} catch {
// 无角色选择器 → 角色已自动选中,继续
// 无角色选择器 → 角色已自动选中
break;
}
} else {