Skip to content

Commit 8457318

Browse files
fix(posts): update cypress angular CT blog (#533)
1 parent ba6826f commit 8457318

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

  • apps/codingcatdev/src/routes/(content-single)/(non-course)/post/angular-17-cypress-testing

‎apps/codingcatdev/src/routes/(content-single)/(non-course)/post/angular-17-cypress-testing/+page.md‎

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,20 @@ To get started with Cypress component testing, you will need to install Cypress
4545

4646
```sh
4747
npm install cypress -D
48-
npm install @cypress/angular
4948
```
5049

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.
50+
Once Cypress is installed, you can create a new test file. For example, you could create a file called `stepper.component.cy.ts`. This file will contain the tests for your stepper component.
5251

5352
**Writing your first Angular component test**
5453

5554
The following code snippet shows how to write a simple test for a stepper component:
5655

5756
```ts
58-
import { ComponentFixture, TestBed } from '@angular/core/testing';
5957
import { StepperComponent } from './stepper.component';
6058

6159
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-
7560
it('should render the stepper component', () => {
76-
expect(component).toBeTruthy();
61+
cy.mount(StepperComponent);
7762
});
7863
});
7964
```

0 commit comments

Comments
 (0)