test(ct-angular): fix all tests
This commit is contained in:
parent
8029022f02
commit
ea9f612869
|
|
@ -12,10 +12,7 @@ export type HooksConfig = {
|
|||
};
|
||||
|
||||
beforeMount<HooksConfig>(async ({ hooksConfig, TestBed }) => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ButtonComponent],
|
||||
});
|
||||
|
||||
|
||||
if (hooksConfig?.routing)
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideRouter(routes)],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import { test, expect } from '@playwright/experimental-ct-angular';
|
||||
import type { HooksConfig } from 'playwright';
|
||||
import { InjectComponent } from '@/components/inject.component';
|
||||
import { AppComponent } from '@/app.component';
|
||||
|
||||
|
||||
test('navigate to a page by clicking a link', async ({ page, mount }) => {
|
||||
const component = await mount<HooksConfig>(AppComponent, {
|
||||
hooksConfig: { routing: true },
|
||||
|
|
@ -10,5 +12,12 @@ test('navigate to a page by clicking a link', async ({ page, mount }) => {
|
|||
await expect(page).toHaveURL('/');
|
||||
await component.getByRole('link', { name: 'Dashboard' }).click();
|
||||
await expect(component.getByRole('main')).toHaveText('Dashboard');
|
||||
await expect(page).toHaveURL('/dashboard');
|
||||
});
|
||||
|
||||
test('inject a token', async ({ page, mount }) => {
|
||||
const component = await mount<HooksConfig>(InjectComponent, {
|
||||
hooksConfig: { injectToken: true },
|
||||
});
|
||||
await expect(component).toHaveText('has been overwritten');
|
||||
await expect(component).not.toHaveText('gets overwritten');
|
||||
});
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import { test, expect } from '@playwright/experimental-ct-angular';
|
||||
import type { HooksConfig } from 'playwright';
|
||||
import { InjectComponent } from '@/components/inject.component';
|
||||
|
||||
test('inject a token', async ({ page, mount }) => {
|
||||
const component = await mount<HooksConfig>(InjectComponent, {
|
||||
hooksConfig: { injectToken: true },
|
||||
});
|
||||
await expect(component).toHaveText('has been overwritten');
|
||||
await expect(component).not.toHaveText('gets overwritten');
|
||||
});
|
||||
Loading…
Reference in a new issue