test(ct-angular): use analog's vite plugin to handle template files

This commit is contained in:
Younes Jaaidi 2024-02-23 11:13:51 +01:00
parent 6ecfba218e
commit 237d065c8e
No known key found for this signature in database
GPG key ID: 3126C5717BDF3241
5 changed files with 20 additions and 2 deletions

View file

@ -26,6 +26,9 @@ export default defineConfig({
use: {
trace: 'on-first-retry',
ctViteConfig: {
plugins: [angular({
tsconfig: resolve('./tsconfig.spec.json'),
})],
resolve: {
alias: {
'@': resolve('./src'),

View file

@ -1,9 +1,9 @@
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { RouterLink, RouterOutlet } from '@angular/router';
@Component({
standalone: true,
imports: [RouterModule],
imports: [RouterLink, RouterOutlet],
selector: 'app-root',
template: `
<header>

View file

@ -0,0 +1 @@
<h1>Not Inlined</h1>

View file

@ -0,0 +1,8 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
templateUrl: './not-inlined.component.html',
})
export class NotInlinedComponent {}

View file

@ -2,6 +2,7 @@ import { test, expect } from '@playwright/experimental-ct-angular';
import { ButtonComponent } from '@/components/button.component';
import { EmptyComponent } from '@/components/empty.component';
import { ComponentComponent } from '@/components/component.component';
import { NotInlinedComponent } from '@/components/not-inlined.component';
test('render props', async ({ mount }) => {
const component = await mount(ButtonComponent, {
@ -23,3 +24,8 @@ test('render a component without options', async ({ mount }) => {
const component = await mount(ComponentComponent);
await expect(component).toContainText('test');
});
test('render component with not inlined template', async ({ mount }) => {
const component = await mount(NotInlinedComponent);
await expect(component).toContainText('Not Inlined');
});