Skip to content

Commit 4d461ea

Browse files
new angular 17 post (CodingCatDev#527)
Co-authored-by: Alex Patterson <alex.patterson@fusionauth.io>
1 parent f561d02 commit 4d461ea

File tree

2 files changed

+122
-1
lines changed
  • apps/codingcatdev/src/routes/(content-single)/(non-course)

2 files changed

+122
-1
lines changed

apps/codingcatdev/src/routes/(content-single)/(non-course)/podcast/cwcc-1-1-angular-17/+page.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ title: 'Angular 17, does SSR/SSG really work?'
2525
youtube: https://youtube.com/live/Yy0XJP9ReJk?feature=share
2626
---
2727

28-
> This is a pretty long video. I won't blame you if you want to [see some shorts](#shorts) instead.
28+
<script lang="ts">
29+
import Video from '$lib/components/content/Video.svelte'
30+
import Shorts from '$lib/components/content/Shorts.svelte'
31+
</script>
32+
33+
<Shorts />
34+
35+
Before I even get started Angular 17, I have to say the new design on [Angular.dev](https://angular.dev) looks incredible. It is full on conference season so I hope that they printed some kick ass [custom-stickers](https://www.stickermule.com/custom-stickers) from [Sticker Mule](https://www.stickermule.com/) and are bringing them out to Vegas!
2936

3037
# My Experience Getting Started with Angular SSR and SSG
3138

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
type: post
3+
authors:
4+
- alex-patterson
5+
cloudinary_convert: false
6+
cover: https://media.codingcat.dev/image/upload/v1700112316/main-codingcatdev-photo/cypress-angular-testing.png
7+
devto:
8+
excerpt: How you can easily test Angular 17 components with Cypress
9+
hashnode:
10+
published: published
11+
start: November 11, 2023
12+
title: How to test Angular 17 using Cypress.io
13+
youtube: https://youtu.be/w3smSGP4w1M
14+
---
15+
16+
<script lang="ts">
17+
import Video from '$lib/components/content/Video.svelte'
18+
import Shorts from '$lib/components/content/Shorts.svelte'
19+
</script>
20+
21+
<Shorts />
22+
23+
Before I even get started on Cypress and Angular, I have to say the new design on [Angular.dev](https://angular.dev) looks incredible. It is full on conference season so I hope that they printed some kick ass [custom-stickers](https://www.stickermule.com/custom-stickers) from [Sticker Mule](https://www.stickermule.com/) and are bringing them out to Vegas!
24+
25+
## Cypress JavaScript Testing
26+
27+
[Cypress](https://www.cypress.io/) is a popular JavaScript end-to-end testing framework. It is known for being easy to use and fast. Cypress is also able to test Angular components.
28+
29+
**What is Angular component testing?**
30+
31+
Angular component testing is a type of testing that ensures that Angular components are working correctly. Angular components are the basic building blocks of Angular applications. They encapsulate HTML, CSS, and JavaScript code.
32+
33+
**Why use Cypress for Angular component testing?**
34+
35+
There are many reasons to use Cypress for Angular component testing. Some of the benefits include:
36+
37+
- Cypress is easy to use and learn.
38+
- Cypress is fast and performant.
39+
- Cypress supports many Angular features, including directives, pipes, and services.
40+
- Cypress can be used to test Angular components in isolation or in the context of a larger application.
41+
42+
**Getting started with Cypress component testing**
43+
44+
To get started with Cypress component testing, you will need to install Cypress and the Cypress Angular support package. You can do this by running the following commands in your terminal:
45+
46+
```sh
47+
npm install cypress -D
48+
npm install @cypress/angular
49+
```
50+
51+
Once Cypress is installed, you can create a new test file. For example, you could create a file called `stepper.component.spec.ts`. This file will contain the tests for your stepper component.
52+
53+
**Writing your first Angular component test**
54+
55+
The following code snippet shows how to write a simple test for a stepper component:
56+
57+
```ts
58+
import { ComponentFixture, TestBed } from '@angular/core/testing';
59+
import { StepperComponent } from './stepper.component';
60+
61+
describe('StepperComponent', () => {
62+
let component: StepperComponent;
63+
let fixture: ComponentFixture<StepperComponent>;
64+
65+
beforeEach(() => {
66+
TestBed.configureTestingModule({
67+
declarations: [StepperComponent]
68+
});
69+
70+
fixture = TestBed.createComponent(StepperComponent);
71+
component = fixture.componentInstance;
72+
fixture.detectChanges();
73+
});
74+
75+
it('should render the stepper component', () => {
76+
expect(component).toBeTruthy();
77+
});
78+
});
79+
```
80+
81+
This test will check that the stepper component is created and that it is visible.
82+
83+
**Advanced topics in Angular component testing**
84+
85+
There are many advanced topics in Angular component testing. Some of these topics include:
86+
87+
- Testing Angular components with data binding
88+
- Testing Angular components with RxJS
89+
- Testing Angular components with router
90+
- Testing Angular components with Angular Material
91+
92+
If you are interested in learning more about these topics, I recommend checking out the Cypress documentation.
93+
94+
## Conclusion
95+
96+
Angular component testing is an important part of developing Angular applications. Cypress is a powerful tool for Angular component testing. It is easy to use, fast, and supports many Angular features. I hope this blog post has helped you get started with Angular component testing with Cypress.
97+
98+
## Links
99+
100+
- https://docs.cypress.io/guides/component-testing/angular/overview
101+
- https://docs.cypress.io/guides/component-testing/getting-started
102+
103+
## Shorts
104+
105+
<Video src="https://youtube.com/shorts/jum4EQkvr2E" title="Beat the Winter Blues and Boost Your Productivity with Simple Changes" />
106+
<Video src="https://youtube.com/shorts/oUz4Dg6bfCM" title="Injury Forces Me to Give Up Working Out My Mental Struggle" />
107+
<Video src="https://youtube.com/shorts/OnXj8czngfM" title="Mastering my Fitness Routine A WellStructured Gym Week" />
108+
<Video src="https://youtube.com/shorts/vgeDC6VOhOE" title="Revolutionizing Time Zones A World United by a Single Time" />
109+
<Video src="https://youtube.com/shorts/i4ekWDkOmt4" title="Unbelievable Opportunity Google Sends Me to Singapore for Creators Conference" />
110+
<Video src="https://youtube.com/shorts/yiVoxYL69rI" title="The versatility of Angular Testing maintenance and love for the framework" />
111+
<Video src="https://youtube.com/shorts/x968CKBoKbY" title="Unleashing Angular The Exciting Update Revealing its Natural Learning Curve" />
112+
<Video src="https://youtube.com/shorts/ZiDT55SOk2c" title="Unlock Your Days Potential Conquer Challenges First for Maximum Success" />
113+
<Video src="https://youtube.com/shorts/z5wS0YNtwsI" title="Unleashing the Power of Angular Exploring Exciting New Changes" />
114+
<Video src="https://youtube.com/shorts/MADkeUFuXhE" title="Angular's Scully The Missing Link for Angular Web Development?" />

0 commit comments

Comments
 (0)