Skip to content

Commit 36f810f

Browse files
committed
feat(edit): readme
1 parent 8ffa2dc commit 36f810f

File tree

1 file changed

+41
-17
lines changed

1 file changed

+41
-17
lines changed

README.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<img alt="Javascript" src="https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E" target="_blank" />
1010
</a>
1111

12-
Cypress plugin for use with [cypress-multi-product-template](https://github.com/optimumqa/cypress-multi-product-template).
12+
Cypress plugin for use with [cypress-boilerplate](https://github.com/optimumqa/cypress-boilerplate).
1313

14-
Read more about the boilerplate project [here](https://github.com/optimumqa/cypress-multi-product-template/blob/main/README.md)
14+
Read more about the boilerplate project [here](https://github.com/optimumqa/cypress-boilerplate/blob/main/README.md)
1515

1616
## Installation
1717

@@ -21,6 +21,8 @@ npm install cypress-setup-utilities
2121

2222
## Usage
2323

24+
### Cypress version < v10
25+
2426
```js
2527
// ./cypress/plugins/index.js
2628

@@ -31,6 +33,23 @@ module.exports = (on, config) => {
3133
}
3234
```
3335

36+
### Cypress version >= 10
37+
38+
```js
39+
import { defineConfig } from 'cypress'
40+
41+
const finalConfig = defineConfig({
42+
e2e: {
43+
setupNodeEvents(on, config) {
44+
// Setup plugins
45+
config = import('@optimumqa/cypress-setup-utilities')(on, config)
46+
47+
return config
48+
},
49+
},
50+
})
51+
```
52+
3453
## What is inside?
3554

3655
### Stores
@@ -99,33 +118,29 @@ Cypress.env('originalConfig')
99118

100119
Test files are set depending on the `team` and `product` arguments.
101120

102-
`testFiles` inside the config will be populated with all spec files from `./cypress/integration/team/product/**/*`.
121+
`specPattern` inside the config will be populated with all spec files from `./cypress/e2e/team/product/**/*`.
103122

104-
> This will only happen if you have not specified `testFiles` already.
123+
> This will only happen if you have not specified `specPattern` already.
105124
106125
So when you run
107126

108127
```sh
109128
$ cypress run --env product=yourProductName
110129
```
111130

112-
It will give you only the spec files from `./cypress/integration/yourProductname/`.
113-
114-
#### Local config
115-
116-
If you have a local config, `cypress.local.json` inside of `./cypress/configs` it will be merged with the default config.
131+
It will give you only the spec files from `./cypress/e2e/yourProductname/`.
117132

118133
#### Type based configs
119134

120135
If you have the need to specify different config types for any reason. You can do that by creating them inside `./cypress/configs/your-product-name/`.
121136

122137
For example:
123138

124-
- Create `daily.json` where we have the need to specify only 3 spec files
139+
- Create `daily.ts` where we have the need to specify only 3 spec files
125140

126141
```json
127142
{
128-
"testFiles": ["**/your-product-name/spec1.ts", "**/your-product-name/spec2.ts", "**/your-product-name/spec3.ts"]
143+
"specPattern": ["**/your-product-name/spec1.ts", "**/your-product-name/spec2.ts", "**/your-product-name/spec3.ts"]
129144
}
130145
```
131146

@@ -134,22 +149,31 @@ Then you create a command in package.json inside `scripts`:
134149
```json
135150
{
136151
"scripts": {
137-
"yourProductName-staging-daily": "cypress run --env product=yourProductName,env=staging,type=daily"
152+
"yourProductName-staging-daily": "cypress run -e product=yourProductName,env=staging,type=daily"
138153
}
139154
}
140155
```
141156

142-
To sum up, both `cypress.local.json` and `./cypress/configs/your-product-name/daily.json` will be merged into the global `./cypress.json` in that order.
157+
#### Local config
158+
159+
Create a file `cypress.local.ts` inside `./cypress/configs/`. Your local config will be then merged with the global config and product config.
160+
161+
Here you can place your overrides.
162+
163+
> If you need to temporarily disable this file, just rename it.
164+
> Example: cypress.local.ts -> cypress.local-tmp.ts
165+
166+
It is ignored by GIT.
143167

144168
#### baseUrl
145169

146-
By default, in the [parent boilerplate](https://github.com/optimumqa/cypress-multi-product-template), three environments are created: [staging, release, production] inside the `./cypress/fixtures/yourProductName/` populated with the `baseUrl` per environment.
170+
By default, in the [parent boilerplate](https://github.com/optimumqa/cypress-boilerplate), three environments are created: [staging, release, production] inside the `./cypress/fixtures/yourProductName/` populated with the `baseUrl` per environment.
147171

148172
When you run cypress, this plugin will take the baseUrl of the current product and environment, and set it to the final cypress config if you have the need to get the `baseUrl` from there, and not from the fixtures `routes.json` file.
149173

150-
Therefor, you can have multiple products inside the [parent boilerplate](https://github.com/optimumqa/cypress-multi-product-template), as this plugin sets up your config depending on the parameters you've given it.
174+
Therefor, you can have multiple products inside the [parent boilerplate](https://github.com/optimumqa/cypress-boilerplate), as this plugin sets up your config depending on the parameters you've given it.
151175

152-
Keeps the package.json clutter free and gives it intuitive commands to run.
176+
Keeps the `package.json` clutter free and gives it intuitive commands to run.
153177

154178
### Delete passed video
155179

@@ -158,7 +182,7 @@ Deletes videos from passed test cases.
158182
## Summary
159183

160184
- Project is dynamically set up based on the four arguments above
161-
- If you specify `baseUrl` or `testFiles` in configs, they will not be overwritten.
185+
- If you specify `baseUrl` or `specPattern` in configs, they will not be overwritten.
162186

163187
## 🤝 Contributing
164188

0 commit comments

Comments
 (0)