diff --git a/tests/components/ct-angular/playwright/index.ts b/tests/components/ct-angular/playwright/index.ts index 7bcc690810..8fd1ba8055 100644 --- a/tests/components/ct-angular/playwright/index.ts +++ b/tests/components/ct-angular/playwright/index.ts @@ -4,6 +4,7 @@ import { routes } from '@/router'; import { APP_INITIALIZER, inject } from '@angular/core'; import { Router, provideRouter } from '@angular/router'; import { afterMount, beforeMount } from '@playwright/experimental-ct-angular/hooks'; +import { BrowserPlatformLocation, PlatformLocation } from '@angular/common'; export type HooksConfig = { routing?: boolean; @@ -15,6 +16,7 @@ beforeMount(async ({ hooksConfig, TestBed }) => { TestBed.configureTestingModule({ providers: [ provideRouter(routes), + { provide: PlatformLocation, useExisting: BrowserPlatformLocation }, { provide: APP_INITIALIZER, multi: true, diff --git a/tests/components/ct-angular/tests/angular-router.spec.ts b/tests/components/ct-angular/tests/angular-router.spec.ts index 8aacb5a5a5..6009d55e33 100644 --- a/tests/components/ct-angular/tests/angular-router.spec.ts +++ b/tests/components/ct-angular/tests/angular-router.spec.ts @@ -9,4 +9,5 @@ test('navigate to a page by clicking a link', async ({ page, mount }) => { await expect(component.getByRole('main')).toHaveText('Login'); await component.getByRole('link', { name: 'Dashboard' }).click(); await expect(component.getByRole('main')).toHaveText('Dashboard'); + await expect(page).toHaveURL('/dashboard'); });