Просмотр исходного кода

test: align schedule calendar integration

彭峰 2 месяцев назад
Родитель
Сommit
de37927bd1
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      src/app/core/home-learning-modules.integration.spec.ts

+ 8 - 1
src/app/core/home-learning-modules.integration.spec.ts

@@ -265,6 +265,11 @@ describe('home learning modules', () => {
     expect(harness.routeNativeElement?.textContent).toContain('选择词库教材');
 
     await harness.navigateByUrl('/pages/home/cart');
+    expect(harness.routeNativeElement?.querySelectorAll('.schedule-list article').length).toBe(0);
+    const allDates = Array.from(harness.routeNativeElement?.querySelectorAll('.range-tabs button') ?? [])
+      .find((button) => button.textContent?.trim() === '全部') as HTMLButtonElement;
+    allDates.click();
+    harness.fixture.detectChanges();
     expect(harness.routeNativeElement?.querySelectorAll('.schedule-list article').length).toBe(2);
     expect(harness.routeNativeElement?.textContent).toContain('同步伴学');
     expect(harness.routeNativeElement?.textContent).toContain('历史伴学');
@@ -280,7 +285,9 @@ describe('home learning modules', () => {
     const allFilter = harness.routeNativeElement?.querySelector('.schedule-filters button') as HTMLButtonElement;
     allFilter.click();
     harness.fixture.detectChanges();
-    (harness.routeNativeElement?.querySelector('.schedule-list article') as HTMLElement).click();
+    const upcomingSchedule = Array.from(harness.routeNativeElement?.querySelectorAll('.schedule-list article') ?? [])
+      .find((article) => article.textContent?.includes('同步伴学')) as HTMLElement;
+    upcomingSchedule.click();
     await harness.fixture.whenStable();
     expect(TestBed.inject(Router).url).toBe('/pages/shop/stu_get_order?id=901');