Skip to content

Commit a2f5da3

Browse files
authored
Revise contributing guidelines for clarity and updates
1 parent 6b7eb17 commit a2f5da3

File tree

1 file changed

+63
-73
lines changed

1 file changed

+63
-73
lines changed

.github/CONTRIBUTING.md

Lines changed: 63 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
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.
44

5-
Go over the steps in [this](https://github.com/firstcontributions/first-contributions) guide as first contributions
6-
75
To start you need:
86

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
1815

1916
To run codeceptjs from this repo use:
2017

@@ -28,28 +25,21 @@ To run examples:
2825
node bin/codecept.js run -c examples
2926
```
3027

31-
Depending on a type of change you should do the following.
32-
33-
## Debugging
3428

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.
4030

4131
## Helpers
4232

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.
4434

45-
### Updating Playwright | Puppeteer | WebDriver
35+
### Updating a WebDriverIO | Nightmare
4636

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! *
4838

4939
Working test is highly appreciated. To run the test suite you need:
5040

51-
- selenium server + chromedriver
52-
- PHP installed
41+
* selenium server + chromedriver
42+
* PHP installed
5343

5444
To launch PHP demo application run:
5545

@@ -60,8 +50,9 @@ php -S 127.0.0.1:8000 -t test/data/app
6050
Execute test suite:
6151

6252
```sh
63-
mocha test/helper/WebDriver_test.js
53+
mocha test/helper/WebDriverIO_test.js
6454
mocha test/helper/Puppeteer_test.js
55+
mocha test/helper/Nightmare_test.js
6556
```
6657

6758
Use `--grep` to execute tests only for changed parts.
@@ -80,9 +71,21 @@ Then is should be accessible at:
8071
http://localhost:8000/form/myexample
8172
```
8273

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+
8386
### Updating REST | ApiDataFactory
8487

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!*
8689

8790
Adding a test is highly appreciated.
8891

@@ -96,20 +99,30 @@ Edit a test at `test/rest/REST_test.js` or `test/rest/ApiDataFactory_test.js`
9699

97100
## Appium
98101

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! *
100103

101104
It is recommended to run mobile tests on CI.
102105
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**.
104107

105108
## Core Changes
106109

107110
Before applying any Core changes please raise an issue to discuss that change with core team.
108111
Please try to add corresponding testcase to runner or unit.
109112

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+
110123
## Documentation
111124

112-
Documentation is stored in `/docs` directory in Markdown format.
125+
Documentation is stored in `/docs` directory in markdown format.
113126

114127
**Documentation for helpers is a part of a source code**.
115128

@@ -121,52 +134,17 @@ After you updated docblock in JS file, generate markdown files with next command
121134
npm run docs
122135
```
123136

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:
148138

149139
```js
150140
/**
151-
* // After
152-
* Click action
153141
* {{> click }}
154142
*/
155143
click() {
156144
// ...
157145
}
158146
```
159147

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-
170148
## Testing
171149

172150
Whenever you implemented a feature/bugfix
@@ -188,7 +166,7 @@ mocha test/runner
188166
Instead of manually running php, json_server and selenium for before tests you
189167
can use `docker-compose` to run those automatically.
190168
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
192170
respective dependencies:
193171

194172
#### Run unit tests
@@ -203,25 +181,28 @@ docker-compose run --rm test-unit
203181
docker-compose run --rm test-helpers
204182

205183
# 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
208186

209187
# Or to run only rest and ApiDataFactory tests
210188
docker-compose run --rm test-helpers test/rest
211189
```
212190

213191
#### Run acceptance tests
214192

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:
216195

217196
```sh
218197
docker-compose run --rm test-acceptance.webdriverio
198+
docker-compose run --rm test-acceptance.nightmare
219199
docker-compose run --rm test-acceptance.puppeteer
200+
docker-compose run --rm test-acceptance.protractor
220201
```
221202

222203
#### Running against specific Node version
223204

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
225206
specific version as long as there is Docker container available for such
226207
version. To do that you need to build codecept's Docker image prior to running
227208
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
236217
same argument can be passed when building unit and acceptance tests services.
237218

238219
### 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
241221
different environments. Here's short summary of what are differences between
242222
separate services
243223

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.
245231

232+
#### CircleCI
246233
Here we use CodeceptJS docker image to build and execute tests inside it. We
247234
start with building Docker container based on Dockerfile present in main project
248235
directory. Then we run (in this order) unit tests, all helpers present in
249236
`test/helpers`, then we go with `test/rest` directory and finally if everything
250237
passed so far it executes acceptance tests. For easier maintenance and local
251238
debugging CircleCI uses `docker-compose.yml` file from `test` directory.
252239
You can find Circle config in `.circleci` directory.
240+
241+
#### Semaphore
242+
Currently Semaphore runs only Appium helper tests.

0 commit comments

Comments
 (0)