Skip to content

Commit 1261783

Browse files
committed
update 01 config
1 parent 8cf3dc1 commit 1261783

38 files changed

Lines changed: 5442 additions & 18145 deletions

05-testing/03-e2e/00-boilerplate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"start": "run-p -l type-check:watch start:dev start:server",
8-
"start:dev": "vite",
8+
"start:dev": "vite --port 8080",
99
"start:server": "cd server && npm run mock-server",
1010
"prebuild": "npm run type-check",
1111
"build": "vite build",

05-testing/03-e2e/01-config/.babelrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

05-testing/03-e2e/01-config/README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1212
npm 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
2020
npm 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
4040
npm run test:e2e
@@ -58,15 +58,15 @@ Pick `Chrome`, after that Cypress will prompt us to scaffold examples or create
5858

5959
From 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
7272
describe('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
8484
import { 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
114114
npm 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
123123
import { 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
138138
describe('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
174174
describe('Login specs', () => {

05-testing/03-e2e/01-config/config/webpack/base.js

Lines changed: 0 additions & 43 deletions
This file was deleted.

05-testing/03-e2e/01-config/config/webpack/dev.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

05-testing/03-e2e/01-config/config/webpack/helpers.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

05-testing/03-e2e/01-config/config/webpack/prod.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

05-testing/03-e2e/01-config/src/index.html renamed to 05-testing/03-e2e/01-config/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
</head>
88
<body>
99
<div id="root"></div>
10+
<script type="module" src="/src/index.tsx"></script>
1011
</body>
1112
</html>

0 commit comments

Comments
 (0)