You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+63-73Lines changed: 63 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,16 @@
2
2
3
3
Thanks for getting here. If you have a good will to improve CodeceptJS we are always glad to help. Ask questions, raise issues, ping in Twitter.
4
4
5
-
Go over the steps in [this](https://github.com/firstcontributions/first-contributions) guide as first contributions
6
-
7
5
To start you need:
8
6
9
-
1. Fork and clone the repo.
10
-
2. Run `npm i --force` to install all required libraries
11
-
3. Do the changes.
12
-
4. Add/Update Test (if possible)
13
-
5. Update documentation
14
-
6. Run `npm run def` to generate types
15
-
7. Run `npm run docs` if you change the documentation
16
-
8. Commit and Push to your fork
17
-
9. Make Pull Request
7
+
1. Fork the repo.
8
+
2. Run `npm install` to install all required libraries
9
+
3. Run `npm run def`to generate types
10
+
4. Do the changes.
11
+
5. Add/Update Test (if possible)
12
+
6. Update documentation
13
+
7. Commit and Push to your fork
14
+
8. Make Pull Request
18
15
19
16
To run codeceptjs from this repo use:
20
17
@@ -28,28 +25,21 @@ To run examples:
28
25
node bin/codecept.js run -c examples
29
26
```
30
27
31
-
Depending on a type of change you should do the following.
32
-
33
-
## Debugging
34
28
35
-
To see recorder queue in logs enable NodeJS debug output by passing `DEBUG=codeceptjs:*` env variable:
36
-
37
-
```
38
-
DEBUG=codeceptjs:* npx codeceptjs run
39
-
```
29
+
Depending on a type of a change you should do the following.
40
30
41
31
## Helpers
42
32
43
-
Please keep in mind that CodeceptJS have **unified API** for Playwright, WebDriverIO, Appium, Puppeteer, TestCafe. Tests written using those helpers should be compatible at syntax level. However, some helpers may contain unique methods. That happens. If, for instance, WebDriverIO has method XXX and Playwright doesn't, you can implement XXX inside Playwright using the same method signature.
33
+
Please keep in mind that CodeceptJS have **unified API** for WebDriverIO, Appium, Protractor, Nightmare, Puppeteer, TestCafe. Tests written using those helpers should be compatible at syntax level. However, some of helpers may contain unique methods. That happens. If, for instance, WebDriverIO has method XXX and Nightmare doesn't, you can implement XXX inside Nightmare using the same method signature.
44
34
45
-
### Updating Playwright | Puppeteer | WebDriver
35
+
### Updating a WebDriverIO | Nightmare
46
36
47
-
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit**`docs/helpers/`, those files are generated from docblocks in corresponding helpers! _
37
+
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit**`docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
48
38
49
39
Working test is highly appreciated. To run the test suite you need:
Use `--grep` to execute tests only for changed parts.
@@ -80,9 +71,21 @@ Then is should be accessible at:
80
71
http://localhost:8000/form/myexample
81
72
```
82
73
74
+
### Updating Protractor
75
+
76
+
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit**`docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
77
+
78
+
Protractor helper is based on [Protractor library](http://www.protractortest.org)
79
+
80
+
In case you do Protractor-specific change, please add a test:To run the test suite you need:
81
+
82
+
* selenium server + chromedriver
83
+
84
+
Demo application is located at: [http://davertmik.github.io/angular-demo-app](http://davertmik.github.io/angular-demo-app)
85
+
83
86
### Updating REST | ApiDataFactory
84
87
85
-
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!_
88
+
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!*
86
89
87
90
Adding a test is highly appreciated.
88
91
@@ -96,20 +99,30 @@ Edit a test at `test/rest/REST_test.js` or `test/rest/ApiDataFactory_test.js`
96
99
97
100
## Appium
98
101
99
-
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit**`docs/helpers/`, those files are generated from docblocks in corresponding helpers! _
102
+
*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit**`docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
100
103
101
104
It is recommended to run mobile tests on CI.
102
105
So do the changes, make pull request, see the CI status.
103
-
Appium tests are executed at **Saucelabs**.
106
+
Appium tests are executed at **Semaphore CI**.
104
107
105
108
## Core Changes
106
109
107
110
Before applying any Core changes please raise an issue to discuss that change with core team.
108
111
Please try to add corresponding testcase to runner or unit.
109
112
113
+
## Typings
114
+
115
+
Typings is generated in `typings/` directory via `jsdoc`
116
+
117
+
After you updated docblock in JS file, generate typing files with next command:
118
+
119
+
```
120
+
npm run def
121
+
```
122
+
110
123
## Documentation
111
124
112
-
Documentation is stored in `/docs` directory in Markdown format.
125
+
Documentation is stored in `/docs` directory in markdown format.
113
126
114
127
**Documentation for helpers is a part of a source code**.
115
128
@@ -121,52 +134,17 @@ After you updated docblock in JS file, generate markdown files with next command
121
134
npm run docs
122
135
```
123
136
124
-
Documentation parts can be shared across helpers. Those parts are located in `docs/webapi/*.mustache`. Inside a docblock those files can be included like this:
125
-
126
-
```js
127
-
/**
128
-
* {{> click }}
129
-
*/
130
-
click() {
131
-
// ...
132
-
}
133
-
```
134
-
135
-
_Note:_ Due to the (lib)[https://documentation.js.org/] that we are using to generate docs, the fast and cheap way to fix format issue that text after the mustache template is appended without formatting is moving the texts to above the mustache template.
136
-
137
-
```js
138
-
/**
139
-
* // Before
140
-
* Click action
141
-
* {{> click }}
142
-
* Click action
143
-
*/
144
-
click() {
145
-
// ...
146
-
}
147
-
```
137
+
Documentation parts can be shared accross helpers. Those parts are located in `docs/webapi/*.mustache`. Inside a docblock those files can be included like this:
148
138
149
139
```js
150
140
/**
151
-
* // After
152
-
* Click action
153
141
* {{> click }}
154
142
*/
155
143
click() {
156
144
// ...
157
145
}
158
146
```
159
147
160
-
## Typings
161
-
162
-
Typings are generated in `typings/` directory via `jsdoc`
163
-
164
-
After you updated docblock in JS file, generate typing files with next command:
165
-
166
-
```
167
-
npm run def
168
-
```
169
-
170
148
## Testing
171
149
172
150
Whenever you implemented a feature/bugfix
@@ -188,7 +166,7 @@ mocha test/runner
188
166
Instead of manually running php, json_server and selenium for before tests you
189
167
can use `docker-compose` to run those automatically.
190
168
You can find `docker-compose.yml` file in `test` directory and run all commands
191
-
from this directory. Currently, we provide following commands to run tests with
169
+
from this directory. Currently we provide following commands to run tests with
192
170
respective dependencies:
193
171
194
172
#### Run unit tests
@@ -203,25 +181,28 @@ docker-compose run --rm test-unit
203
181
docker-compose run --rm test-helpers
204
182
205
183
# or pass path to helper test to run specific helper,
206
-
# for example to run only WebDriver tests:
207
-
docker-compose run --rm test-helpers test/helper/WebDriver_test.js
184
+
# for example to run only WebDriverIO tests:
185
+
docker-compose run --rm test-helpers test/helper/WebDriverIO_test.js
208
186
209
187
# Or to run only rest and ApiDataFactory tests
210
188
docker-compose run --rm test-helpers test/rest
211
189
```
212
190
213
191
#### Run acceptance tests
214
192
215
-
To that we provide three separate services respectively for WebDriver, Nightmare and Puppeteer tests:
193
+
To that we provide three separate services respectively for WebDriverIO, Nightmare, Puppeteer and
194
+
Protractor tests:
216
195
217
196
```sh
218
197
docker-compose run --rm test-acceptance.webdriverio
198
+
docker-compose run --rm test-acceptance.nightmare
219
199
docker-compose run --rm test-acceptance.puppeteer
200
+
docker-compose run --rm test-acceptance.protractor
220
201
```
221
202
222
203
#### Running against specific Node version
223
204
224
-
By default, dockerized tests are run against node 12.10.0, you can run it against
205
+
By default dockerized tests are run against node 12.10.0, you can run it against
225
206
specific version as long as there is Docker container available for such
226
207
version. To do that you need to build codecept's Docker image prior to running
227
208
tests and pass `NODE_VERSION` as build argument.
@@ -236,17 +217,26 @@ And now every command based on `test-helpers` service will use node 9.4.0. The
236
217
same argument can be passed when building unit and acceptance tests services.
237
218
238
219
### CI flow
239
-
240
-
We're currently using a bunch of CI services to build and test codecept in
220
+
We're currently using bunch of CI services to build and test codecept in
241
221
different environments. Here's short summary of what are differences between
242
222
separate services
243
223
244
-
#### CircleCI
224
+
#### TravisCI
225
+
Travis CI uses runs tests against Node 8 and Node 9. In total it uses 8 jobs to
226
+
build each helper against both Node versions. For every job it runs unit tests
227
+
first, then `ApiDataFactory` and `REST` tests present in `test/rest` directory.
228
+
Finally if those pass we run specific helper tests found in `test/helper`
229
+
directory. It doesn't run acceptance tests.
230
+
Config is present in `.travis.yml` file.
245
231
232
+
#### CircleCI
246
233
Here we use CodeceptJS docker image to build and execute tests inside it. We
247
234
start with building Docker container based on Dockerfile present in main project
248
235
directory. Then we run (in this order) unit tests, all helpers present in
249
236
`test/helpers`, then we go with `test/rest` directory and finally if everything
250
237
passed so far it executes acceptance tests. For easier maintenance and local
251
238
debugging CircleCI uses `docker-compose.yml` file from `test` directory.
252
239
You can find Circle config in `.circleci` directory.
240
+
241
+
#### Semaphore
242
+
Currently Semaphore runs only Appium helper tests.
0 commit comments