@@ -6,25 +6,25 @@ We will start from `00-boilerplate`.
66
77# Steps to build it
88
9- - ` npm install ` to install previous sample packages:
9+ ` npm install ` to install previous sample packages:
1010
1111``` bash
1212npm install
1313```
1414
1515# Libraries
1616
17- - We are going to install the main library which we base all our unit tests, [ Cypress] ( https://www.cypress.io/ ) .
17+ We are going to install the main library which we base all our unit tests, [ Cypress] ( https://www.cypress.io/ ) .
1818
1919``` bash
2020npm install cypress --save-dev
2121```
2222
2323# Config
2424
25- - We can just add cypress command to scripts and running it:
25+ We can just add cypress command to scripts and running it:
2626
27- ### ./package.json
27+ _ ./package.json _
2828
2929``` diff
3030"scripts": {
@@ -34,7 +34,7 @@ npm install cypress --save-dev
3434 },
3535```
3636
37- - Run it:
37+ Run it:
3838
3939``` bash
4040npm run test:e2e
@@ -58,15 +58,15 @@ Pick `Chrome`, after that Cypress will prompt us to scaffold examples or create
5858
5959From here we will go in our own, cut the Cypress server by closing the opened browser windows, or from console using ` Ctrl + C `
6060
61- - Let's remove ` downloads ` , ` fixtures/example.json ` , ` support/commands.ts ` and clear ` support/e2e.ts ` file content.
61+ Let's remove ` downloads ` , ` fixtures/example.json ` , ` support/commands.ts ` and clear ` support/e2e.ts ` file content.
6262
6363> We will use ` support/e2e.ts `
6464
65- - Create ` ./cypress/e2e ` folder
65+ Create ` ./cypress/e2e ` folder
6666
67- - Add login spec inside ` e2e ` folder:
67+ Add login spec inside ` e2e ` folder:
6868
69- ### ./cypress/e2e/login.spec.js
69+ _ ./cypress/e2e/login.spec.js _
7070
7171``` javascript
7272describe (' Login specs' , () => {
@@ -76,9 +76,9 @@ describe('Login specs', () => {
7676});
7777```
7878
79- - Update specPattern (by default is ` cypress/e2e/**/*.cy.{js,jsx,ts,tsx} ` ):
79+ Update specPattern (by default is ` cypress/e2e/**/*.cy.{js,jsx,ts,tsx} ` ):
8080
81- ### ./cypress.config.ts
81+ _ ./cypress.config.ts _
8282
8383``` diff
8484import { defineConfig } from "cypress";
@@ -95,9 +95,9 @@ export default defineConfig({
9595
9696> [ Config API] ( https://docs.cypress.io/guides/references/configuration#Testing-Type-Specific-Options )
9797
98- - An important note is that we need to running the app to execute the e2e tests:
98+ An important note is that we need to running the app to execute the e2e tests:
9999
100- ### ./package.json
100+ _ ./package.json _
101101
102102``` diff
103103"scripts": {
@@ -108,16 +108,16 @@ export default defineConfig({
108108 },
109109```
110110
111- - Running:
111+ Running:
112112
113113``` bash
114114npm run test:e2e
115115
116116```
117117
118- - So far so good, we can add the base app url in ` cypress.config.ts ` to avoid repeat it in whole tests:
118+ So far so good, we can add the base app url in ` cypress.config.ts ` to avoid repeat it in whole tests:
119119
120- ### ./cypress.config.ts
120+ _ ./cypress.config.ts _
121121
122122``` diff
123123import { defineConfig } from "cypress";
@@ -132,7 +132,7 @@ export default defineConfig({
132132
133133> You can see more info [ here] ( https://docs.cypress.io/guides/references/configuration.html#Options )
134134
135- ### ./cypress/e2e/login.spec.js
135+ _ ./cypress/e2e/login.spec.js _
136136
137137``` diff
138138describe('Login specs', () => {
@@ -144,13 +144,13 @@ describe('Login specs', () => {
144144
145145```
146146
147- - Could we work with Typescript? If we rename spec to ` .ts ` :
147+ Could we work with Typescript? If we rename spec to ` .ts ` :
148148
149149_ ./cypress/e2e/login.spec.js_ -> _ ./cypress/e2e/login.spec.ts_
150150
151- - For now, it's not neccessary but advisable to add the ` tsconfig.json ` file inside cypress folder:
151+ For now, it's not neccessary but advisable to add the ` tsconfig.json ` file inside cypress folder:
152152
153- ### ./cypress/tsconfig.json
153+ _ ./cypress/tsconfig.json _
154154
155155``` json
156156{
@@ -166,9 +166,9 @@ _./cypress/e2e/login.spec.js_ -> _./cypress/e2e/login.spec.ts_
166166
167167> You can see more info [ here] ( https://docs.cypress.io/guides/tooling/typescript-support#Configure-tsconfig-json )
168168
169- - Now it's fully supported. Let's try another spec:
169+ Now it's fully supported. Let's try another spec:
170170
171- ### ./cypress/e2e/login.spec.ts
171+ _ ./cypress/e2e/login.spec.ts _
172172
173173``` diff
174174describe('Login specs', () => {
0 commit comments