Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation on testing with Cypress #434

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ The library consists of multiple layers. It needs to add several other layers. T

### Steps to add a new layer :
1. Find an issue labelled <i>new layer</i>.
2. Go through the documentaion provided to understand how the API works.
2. Go through the documentation provided to understand how the API works.
3. Here's a [codepen example](https://codepen.io/rkpattnaik780/full/MxMRBP) that consists of a base layer and [Luftdaten Layer](https://github.com/publiclab/leaflet-environmental-layers/issues/88) as an overlay. You can check its full implementation [here](https://github.com/publiclab/leaflet-environmental-layers/pull/137).

### Steps to test a new layer :
1. Make a fixture file in html for the layer.
2. Load the fixture and test for markers and polygons using jasmine testing framework.
3. Run `grunt jasmine` to run tests and ensure they pass before making a commit.
4. [Here](https://github.com/publiclab/leaflet-environmental-layers/pull/206/files) is an example PR for writing tests.
### Steps to test a new layer:
1. Create a fixture for the layer in `./cypress/fixtures`.
2. Add a spec file for the new layer in `./cypress/integration`. Please refer to one of the existing spec files for reference.
3. Run `npm run start` to start a local server.
4. Run `npm run cy:run:chrome` to run the tests.

### Some sample PRs to be referred for adding new layers:
* OSM landfill mine quarry : [#94](https://github.com/publiclab/leaflet-environmental-layers/pull/94)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ A leaflet plugin that has a collection of layers containing environmental data p

### _Instructions for a developer_
1. Install grunt - https://gruntjs.com/installing-grunt.
2. Make the changes you are working on in respective /src files.
2. Make the changes you are working on in the respective /src files.
3. Run `grunt build` to generate files in the /dist directory.
4. Run `grunt transpile` to transpile es6 code and copy files needed to run the tests to the /dist directory.
5. Run `grunt jasmine` to run tests on the LEL layers and ensure they pass.
6. Test your changes on a browser by opening `examples/index.html`.
6. Run `npm run start` to start a local server.
7. Run `npm run cy:run:chrome` to run e2e and integration tests.
Comment on lines +102 to +103
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow up, let' combine these 2 commands into one command:
npm run cypress which will be equal to npm run start && npm run cy:run:chrome in package.json. Thanks!
Can be a FTO a well!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I'll create an FTO for this.

8. Test your changes on a browser by opening `examples/index.html`.

## Features

Expand Down