Skip to content

Commit 5b95eaf

Browse files
committed
fix: update E2E test selectors to match current UI components
- item-create.page.ts: use getByLabel() for SelectField (htmlFor/id linked), switch fillLatex to BlockEditor source mode - items-list.page.ts: use locator("select") instead of getByRole("combobox") for FilterSelect - search.page.ts: fix filterBySchoolLevel to use parent-traversal with locator("select") - skills-list.page.ts: fix filterByBloomLevel and filterByTopicPath selectors - admin-dashboard.spec.ts: add waitFor before instant isVisible checks in RBAC test
1 parent 8cc3f48 commit 5b95eaf

5 files changed

Lines changed: 28 additions & 17 deletions

File tree

apps/web/e2e/pages/item-create.page.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@ export class ItemCreatePage extends BasePage {
2929
}
3030

3131
/**
32-
* 라벨 텍스트 옆의 combobox를 찾아 선택
33-
* 이 페이지의 select들은 <label>이 아닌 div 텍스트를 사용
32+
* 라벨 텍스트로 연결된 select 요소를 반환
33+
* SelectField 컴포넌트가 htmlFor/id로 label-select를 연결하므로 getByLabel 사용
3434
*/
3535
private selectByLabel(labelText: string): Locator {
36-
return this.page
37-
.getByText(labelText, { exact: true })
38-
.locator("..")
39-
.getByRole("combobox");
36+
return this.page.getByLabel(labelText, { exact: true });
4037
}
4138

42-
/** 수식 LaTeX 입력 (FormulaEditor textarea) */
39+
/** 수식 LaTeX 입력 (BlockEditor 소스 모드 textarea) */
4340
async fillLatex(latex: string): Promise<void> {
44-
await this.page
45-
.getByPlaceholder("LaTeX 수식을 입력하세요")
46-
.fill(latex);
41+
// 소스 모드 토글 버튼 클릭
42+
const sourceBtn = this.page.getByRole("button", { name: "소스 모드" });
43+
if (await sourceBtn.isVisible()) {
44+
await sourceBtn.click();
45+
}
46+
// 소스 모드 textarea에 입력
47+
const textarea = this.page.getByPlaceholder("LaTeX 소스를 직접 입력하세요");
48+
await textarea.fill(latex);
4749
}
4850

4951
/** 학교급 선택 */

apps/web/e2e/pages/items-list.page.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ export class ItemsListPage extends BasePage {
2828
}
2929

3030
/**
31-
* 라벨 텍스트의 직접 부모에서 combobox를 찾아 반환
31+
* 라벨 텍스트의 직접 부모에서 select 요소를 찾아 반환
32+
* FilterSelect는 htmlFor/id 연결이 없으므로 부모 탐색 방식 사용
3233
*/
3334
private selectByLabel(labelText: string): Locator {
3435
return this.page
3536
.getByText(labelText, { exact: true })
3637
.locator("..")
37-
.getByRole("combobox");
38+
.locator("select");
3839
}
3940

4041
/** /items 페이지로 이동 */

apps/web/e2e/pages/search.page.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ export class SearchPage extends BasePage {
5959

6060
/** 학교급 필터 선택 */
6161
async filterBySchoolLevel(level: string): Promise<void> {
62-
await this.page.getByLabel("학교급").selectOption(level);
62+
await this.page
63+
.getByText("학교급", { exact: true })
64+
.locator("..")
65+
.locator("select")
66+
.selectOption(level);
6367
}
6468

6569
/** 필터 초기화 */

apps/web/e2e/pages/skills-list.page.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ export class SkillsListPage extends BasePage {
7272

7373
/** 분류 경로 필터 입력 */
7474
async filterByTopicPath(path: string): Promise<void> {
75-
await this.page.getByLabel("분류 경로").fill(path);
75+
await this.page.getByPlaceholder("예: math.algebra").fill(path);
7676
}
7777

7878
/** Bloom 수준 필터 선택 */
7979
async filterByBloomLevel(level: string): Promise<void> {
80-
// "Bloom 수준" 라벨의 부모 div에서 combobox 선택
80+
// "Bloom 수준" 라벨의 부모 div에서 select 요소 선택
8181
const bloomLabel = this.page.getByText("Bloom 수준", { exact: true }).first();
82-
await bloomLabel.locator("..").getByRole("combobox").selectOption(level);
82+
await bloomLabel.locator("..").locator("select").selectOption(level);
8383
}
8484

8585
/** 다음 페이지로 이동 */

apps/web/e2e/tests/admin-dashboard.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ test.describe("관리자 대시보드", () => {
3333
const dashboardPage = new AdminDashboardPage(page);
3434

3535
// teacher에게는 에러가 표시되거나 KPI 데이터가 로드되지 않아야 함
36+
// 페이지 렌더링 대기: 에러 상태 또는 KPI 데이터 중 하나가 나타날 때까지 대기
37+
const errorOrKpi = dashboardPage.errorState.or(page.getByText("전체 문항 수"));
38+
await errorOrKpi.first().waitFor({ state: "visible", timeout: 20_000 }).catch(() => {});
39+
3640
const hasError = await dashboardPage.errorState
3741
.isVisible()
3842
.catch(() => false);
3943
const kpiVisible = await page
4044
.getByText("전체 문항 수")
41-
.isVisible({ timeout: 5_000 })
45+
.isVisible()
4246
.catch(() => false);
4347

4448
expect(hasError || !kpiVisible).toBeTruthy();

0 commit comments

Comments
 (0)