New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ct): angular component testing #27783
base: main
Are you sure you want to change the base?
Conversation
aa9b3fe
to
71599da
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
What's out plan here, is it ready to land? Is it based on Younes's work or is this something different? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @sand4rt!
Here are a couple of things that would be nice to solve before merging.
Let me know if you want me to contribute to your branch directly with some PRs.
The main discussion here is about vite plugin replacement and configuration.
Hey @pavelfeldman! I just shared my feedback with @sand4rt.
It doesn't matter anymore. There was just a misunderstanding. |
Hey guys, thanks for the comments! I'm AFK for a couple of days. Will hopefully look at the PR by the end of next week as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added logo is the Angular.js one, here's the link to the correct Angular logo.
720980b
to
71599da
Compare
Hi @edbzn, thanks for the input! Would you like to make the change by creating a PR against this branch? See #27783 (comment) for more details edit: Angular just released their new logo: https://angular.dev/press-kit |
71599da
to
8ccb3bb
Compare
This comment has been minimized.
This comment has been minimized.
I just noticed that the tests themselves are using Angular 15. |
Hey @sand4rt, I just created a This way, we can update the todo list as this:
Here are the advantages of moving the Angular vite plugin setup to the
The drawbacks are:
Of course, this is just a temporary solution until the Angular team releases an official vite plugin which will at least warranty major version compatibility. |
Hey @sand4rt are you available in the upcoming days or weeks so we can finish this 😊 |
Hey @yjaaidi, #29544 needs to be resolved before i can update. I could resolve the merge conflicts later on if needed, so don't let that hold you back. For the people willing to contribute; beta testing would also help a lot to ensure everything operates as expected, your feedback is very welcome! |
Thanks @sand4rt! I think that we have everything now 😊:
Cf. sand4rt#5 |
9e88b09
to
31e8817
Compare
Great great great work! Thank you!! |
31e8817
to
3226aa5
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"27323 passed, 661 skipped Merge workflow run. |
Hey @pavelfeldman, the PR is finally set for review by the Playwright team! We have deliberately kept the adapter minimal for now and postponed the documentation until more people have tested it and shared their feedback. We would like to gradually make improvements here and there after the merge. |
Congratulations to all of you. That's a milestone in Angular testing history! Just a small remark: From what I've seen, there is no possibility to provide services, right? If that's the case, it would be great to add this as the next feature once this branch is merged. As you know, the vast majority of Angular Components usually depend on Services. If we could mock these services, the number of people who could test on a large scale would increase "exponentially." Either way, congratulations and a thousand thanks again. I'm looking forward to it |
Providers/imports are still open for discussion indeed. We've decided to merge the library first before continuing the discussion: sand4rt#5 (comment) I think it could either be supported like the other frameworks through the // playwright/index.ts
beforeMount(async ({ TestBed, hooksConfig }) => {
TestBed.configureTestingModule({
imports: hooksConfig?.imports,
providers: hooksConfig?.providers
});
}); test('hooks config', async ({ mount }) => {
const component = await mount(AngularComponent, {
hooksConfig: {
imports: [Component],
providers: [Service],
}
});
await expect(component).toContainText('boop');
}); or with dedicated APIs: test('imports and providers', async ({ mount }) => {
const component = await mount(AngularComponent, {
imports: [Component],
providers: [Service],
});
await expect(component).toContainText('boop');
}); |
Understood, then let's wait for the merge and then continue the discussion. Congrats again. |
@yjaaidi I am running into some issues while testing this library.
Other than that it's working great so far. Thanks so much for this. |
Hi @chronospatian, what is the value of ctViteConfig: {
plugins: [analog()], // or [swc.vite(swcAngularUnpluginOptions())]
resolve: {
/* @angular/material is using "style" as a Custom Conditional export to expose prebuilt styles etc... */
conditions: ['style'],
},
}, |
@rainerhahnekamp note that there are some known limitations on what can be used in providers. |
@yjaaidi I am using the same config as you have it here: https://github.com/sand4rt/playwright/blob/hello-angular-ct/tests/components/ct-angular/playwright.config.mts
|
|
@chronospatain you might want to check out #23662 for the esm/cjs issues |
The last thing I did to get hooks working was to make sure |
In which file did you put it initially? |
closes: #14153 and https://github.com/sand4rt/playwright-ct-angular
TODO
Enable vite-plugin-angular JIT mode: feat(vite-plugin-angular): add support for JIT mode analogjs/analog#374 (comment)Sourcemap is likely to be incorrect: a plugin (@analogjs/vite-plugin-angular)
errors when transpiling: Sourcemap is likely to be incorrect: a plugin (@analogjs/vite-plugin-angular) analogjs/analog#410typeof plugin.default
check: https://github.com/microsoft/playwright/pull/27783/files#diff-4592ac823d44ec894c518ba459cfab4bd544056a674739fda5fc145cdc596923R28@analogjs/vite-plugin-angular
and related code and move it tocreate-playwright
? feat(ct): angular component testing #27783 (comment)