test(ct-angular): test url change
This commit is contained in:
parent
fcc1635185
commit
a547da51b8
|
|
@ -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<HooksConfig>(async ({ hooksConfig, TestBed }) => {
|
|||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
provideRouter(routes),
|
||||
{ provide: PlatformLocation, useExisting: BrowserPlatformLocation },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
multi: true,
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue