Skip to content

Commit

Permalink
Update CONTRIBUTING guide and refactor README. (#4014)
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 authored Feb 6, 2024
1 parent 42dbafc commit 3681a0b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 40 deletions.
3 changes: 2 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.

It's inspired among other things by:

- [Citizen Code of Conduct](http://citizencodeofconduct.org/)
- [Appim](https://github.com/appium/appium/blob/master/CONDUCT.md)
- [Appium](https://github.com/appium/appium/blob/master/CONDUCT.md)

[homepage]: https://www.contributor-covenant.org

Expand Down
50 changes: 28 additions & 22 deletions .github/CONTRIBUTING.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,58 @@

Contributions to Nightwatch are always welcome but please try to follow these guidelines when sending in something as it will help addressing the issue quicker and more smoothly.

__Please do not ask for assistance in the Issues list.__ Use the [Discussions](https://github.com/nightwatchjs/nightwatch/discussions) section to ask questions and seek help.
__Please do not ask for assistance in the Issues list.__ Join our [Discord server](https://discord.com/invite/SN8Da2X) to ask questions and seek help.

Assistance requests posted in the Issues list are usually closed right away.

## Code of Conduct

Contributors are expected to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).

## Submit an issue

Before submitting a new issues, try searching for a similar one here: https://github.com/nightwatchjs/nightwatch/search?type=Issues and add your scenario there and anything else which you think will help with fixing it;

If you are filing a bug report, regression issue or what it appears to be strange behaviour, please follow the steps below:

1. Please write an elaborate title which explains the problem as accurate as possible
For instance:
- __not helpful__: "Issue with tags"
- __much better__: "Tags don't work when combined with --skiptags option"
2. Include a sample test which reproduces the problem you're experiencing. The test should be against a **public url**. The test and other info should be posted inline, attachments will be ignored;
For instance:
- __not helpful__: "Issue with tags"
- __much better__: "Tags don't work when combined with --skiptags option"
2. Include a sample test which reproduces the problem you're experiencing. The test should be against a __public url__. The test and other info should be posted inline, attachments will be ignored;
3. Include the verbose output, if possible (run nightwatch with `--verbose` argument);
4. Include your configuration (try to leave out the irrelevant bits);
5. Also include: Nightwatch version, Node.js version, OS version and Webdriver/Selenium Server version;
6. Please try not to report issues you have with individual browser drivers which cannot or should not be solved in Nightwatch.

## Requesting a feature
Feature requests are welcome.

1. Indicate in the issue title that it is a feature/enhancement request
2. Explain the use case and include a sample test case and/or usage, if possible
3. Try to submit enhancements that you cannot build with custom commands/assertions and something that will benefit the community
4. Same as for issues, add your comments/vote to an existing feature request if you'd like to see it implemented
Feature requests are welcome.

1. Indicate in the issue title that it is a feature/enhancement request;
2. Explain the use case and include a sample test case and/or usage, if possible;
3. Try to submit enhancements that you cannot build with custom commands/assertions and something that will benefit the community;
4. Same as for issues, add your comments/vote to an existing feature request if you'd like to see it implemented.

## Submitting a pull request

Thanks in advance for your contribution.

1. Follow the usual git workflow for submitting a pull request:
* fork the project
* create a new branch from main (e.g. `features/my-new-feature` or `issue/123-my-bugfix`)
* add your changes
* try to run some Nightwatch tests locally to test the functionality after making your changes: `npm run dev -- examples/tests/ecosia.js --env chrome`
* run Nightwatch unit tests locally: `npm test`
or, run individual tests: `npm run mocha -- test/src/api/commands/client/testWaitUntil.js`
* commit your changes and create a pull request
- Fork and clone the project.
- Create a new branch from main (e.g. `features/my-new-feature` or `issue/123-my-bugfix`).
- Add your changes.
- Try to run some Nightwatch example tests locally to test the functionality after making your changes: `node ./bin/nightwatch examples/tests/ecosia.js --env chrome`.
- Run Nightwatch unit tests locally: `npm test`;
Or, run individual tests: `npx mocha test/src/api/commands/client/testWaitUntil.js`.
- Commit your changes and create a pull request.

__Note:__ When running Nightwatch example test for the first time, if you encounter _"Cannot read source"_ error, go to `nightwatch.conf.js` file and set 'page_objects_path' and 'custom_commands_path' configs to `[]`.

2. If you're fixing a bug, also create an issue if one doesn't exist yet.
3. If it's a new feature/enhancement, explain why do you think it's necessary.
4. If your change include drastic or low level changes please discuss them to make sure they will be accepted and what the impact will be.
5. If your change is based on existing functionality, please consider refactoring first. Pull requests that duplicate code will not make it in very quick, if at all.
6. Do not include changes that are not related to the issue at hand.
6. Follow the same coding style with regards to spaces, semicolons, variable naming etc.
7. Always add tests - after all this _is_ a testing framework.


7. Follow the same coding style with regards to spaces, semicolons, variable naming etc.
8. Always add tests - after all this _is_ a testing framework.
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,32 @@ With Nightwatch you can test components in isolation by mounting them in the bro
### Nightwatch unit tests

The tests for Nightwatch are written using Mocha.
1. Clone the project
```bash
$ git clone https://github.com/nightwatchjs/nightwatch.git
$ cd nightwatch
$ npm install
```
2. Run tests

To run the complete test suite:
```bash
$ npm test
```
1. **Clone the project**

To check test coverage, run the command:
```bash
$ npm run mocha-coverage
```
```bash
$ git clone https://github.com/nightwatchjs/nightwatch.git
$ cd nightwatch
$ npm install
```

2. **Run tests**

To run the complete test suite:

and then open the generated coverage/index.html file in your browser.
```bash
$ npm test
```

[Unit testing guide](https://nightwatchjs.org/guide/writing-tests/write-nodejs-unit-integration-tests.html)
To check test coverage, run the command:

```bash
$ npm run mocha-coverage
```

and then open the generated coverage/index.html file in your browser.

See [Unit testing guide](https://nightwatchjs.org/guide/writing-tests/write-nodejs-unit-integration-tests.html) for more details.

### Other types of testing
#### [Visual Regression Testing](https://nightwatchjs.org/guide/writing-tests/visual-regression-testing.html)
Expand Down Expand Up @@ -141,6 +146,10 @@ Nightwatch v3 packages the aXe-core package developed by Deque Systems as a plug
## 🦉 About Nightwatch
Nightwatch was initially built by [@pineviewlabs](https://github.com/pineviewlabs/) - an independent software consultancy based in Oslo, Norway, with help from [contributors](https://github.com/nightwatchjs/nightwatch/graphs/contributors). In mid 2021, Nightwatch has become a part of the [@BrowserStack](https://github.com/browserstack) family and it is being developed further at the BrowserStack Open-source Program Office. Read more on [our blog](https://nightwatchjs.org/blog/nightwatch-has-joined-the-browserstack-family.html).

## Contributing

We welcome any and all contributions from the community which can help improve Nightwatch. Please check out [CONTRIBUTING.md](CONTRIBUTING.md) for more extensive contributing guidelines.

## Licence
[MIT](https://github.com/nightwatchjs/nightwatch/blob/main/LICENSE.md)

Expand Down

0 comments on commit 3681a0b

Please sign in to comment.