Skip to content
Closed
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
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ See https://git-scm.com/downloads for instructions.

### Step 2: Install Node.js

_Node.js version 16.x works best for now; later versions have exhibited some strange behaviour with this project.
_Node.js version 18.x works best for now; later versions have exhibited some strange behaviour with this project.
If you encounter issues with the server, check your version of Node.js first. This includes CORS related issues when fetching the API._

We recommend using [nvm](https://github.com/nvm-sh/nvm) to install and manage your Node.js instances. More details here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/

1. Make sure a profile exists for your terminal, run `touch ~/.profile; touch ~/.zshrc`
2. Install nvm: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash`
3. Install the latest version of Node.js 16: `nvm install 16`
4. Use the installed Node.js: `nvm use 16`
3. Install the latest version of Node.js 18: `nvm install 18`
4. Use the installed Node.js: `nvm use 18`

Alternatively, you can install Node.js directly from https://nodejs.org/dist/latest-v16.x/
Alternatively, you can install Node.js directly from https://nodejs.org/dist/latest-v18.x/

_On MacOS, you can alleviate the need to run as sudo by using nvm or by [following John Papa's instructions](http://jpapa.me/nomoresudo)._

Expand Down Expand Up @@ -82,10 +82,15 @@ REACT_APP_API_ROOT=http://localhost:3000

### Step 5: Install npm dependencies

_option_

```
npm install
```

_For Legacy dependencies run_ -
**`npm install --legacy-peer-deps`**

### Step 6: Start the client

```
Expand Down Expand Up @@ -227,10 +232,26 @@ We follow the React/Jest convention for writng tests. All test file are located

Please ensure that at least all the _model_ unit tests under `./src/model/` pass.

To run tests:
Some components test are also located under _tests_ under `./src/components/tests`

Contains mock data and utilities used across tests `./src/testMocks`

```
Current Test Stats

Total Tests: 108

Framework: Jest

Environment: React 18.x / Babel-Jest
```

To run tests:
`npm test`

To run a single test:
`npm test -- xxx.test.js`

### Cypress

Make your own `/cypress/fixtures/login.json` file containing the actual credentials in order to run the cypress tests.
Expand Down
10 changes: 6 additions & 4 deletions src/components/Verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ const Verify = (props) => {
e.stopPropagation();
e.preventDefault();
log.debug('click on capture pin:%d', captureId);
const url = `${process.env.REACT_APP_WEBMAP_DOMAIN}/?treeid=${captureId}`;
const url = `${process.env.REACT_APP_WEBMAP_DOMAIN}/trees/${captureId}`;
window.open(url, '_blank').opener = null;
}

function handleGrowerMapClick(e, growerId) {
e.stopPropagation();
e.preventDefault();
log.debug('click on grower:%d', growerId);
const url = `${process.env.REACT_APP_WEBMAP_DOMAIN}/?userid=${growerId}`;
const url = `${process.env.REACT_APP_WEBMAP_DOMAIN}/planters/${growerId}`;
window.open(url, '_blank').opener = null;
}

Expand Down Expand Up @@ -480,7 +480,8 @@ const Verify = (props) => {
</IconButton>
<IconButton
variant="link"
href={`${process.env.REACT_APP_WEBMAP_DOMAIN}/?treeid=${capture.id}`}
rel="noopener noreferrer"
href={`${process.env.REACT_APP_WEBMAP_DOMAIN}/trees/${capture.id}`}
target="_blank"
onClick={(e) => handleCapturePinClick(e, capture.id)}
aria-label={`Capture location`}
Expand All @@ -490,7 +491,8 @@ const Verify = (props) => {
</IconButton>
<IconButton
variant="link"
href={`${process.env.REACT_APP_WEBMAP_DOMAIN}/?userid=${capture.planterId}`}
rel="noopener noreferrer"
href={`${process.env.REACT_APP_WEBMAP_DOMAIN}/planters/${capture.planterId}`}
target="_blank"
onClick={(e) =>
handleGrowerMapClick(e, capture.planterId)
Expand Down