1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

add docs, consolidate more config values

This commit is contained in:
Matthias Kretschmann 2019-06-26 11:13:41 +02:00
parent 0bc38610ee
commit 87176212ef
Signed by: m
GPG Key ID: 606EEEF3C479A91F
8 changed files with 51 additions and 67 deletions

View File

@ -10,13 +10,14 @@ addons:
- libgconf-2-4
env:
# run E2E tests against these values
- REACT_APP_NODE_URI="https://nile.dev-ocean.com"
- REACT_APP_AQUARIUS_URI="https://aquarius.marketplace.dev-ocean.com"
- REACT_APP_BRIZO_URI="https://brizo.marketplace.dev-ocean.com"
- REACT_APP_SECRET_STORE_URI="https://secret-store.marketplace.dev-ocean.com"
- REACT_APP_FAUCET_URI="https://faucet.nile.dev-ocean.com"
- REACT_APP_BRIZO_ADDRESS="0x4aaab179035dc57b35e2ce066919048686f82972"
global:
# run E2E tests against these values
- REACT_APP_NODE_URI="https://nile.dev-ocean.com"
- REACT_APP_AQUARIUS_URI="https://aquarius.marketplace.dev-ocean.com"
- REACT_APP_BRIZO_URI="https://brizo.marketplace.dev-ocean.com"
- REACT_APP_SECRET_STORE_URI="https://secret-store.marketplace.dev-ocean.com"
- REACT_APP_FAUCET_URI="https://faucet.nile.dev-ocean.com"
- REACT_APP_BRIZO_ADDRESS="0x4aaab179035dc57b35e2ce066919048686f82972"
before_install:
- npm install -g npm

View File

@ -22,17 +22,19 @@
If you're a developer and want to contribute to, or want to utilize this marketplace's code in your projects, then keep on reading.
- [🏄 Get Started](#-get-started)
- [🏖 Remote Ocean: Nile](#-remote-ocean-nile)
- [🐳 Use with Barge](#-use-with-barge)
- [⛵️ Environment Variables](#-environment-variables)
- [👩‍🔬 Testing](#-testing)
- [✨ Code Style](#-code-style)
- [🛳 Production](#-production)
- [⬆️ Releases](#-releases)
- [📜 Changelog](#-changelog)
- [🎁 Contributing](#-contributing)
- [🏛 License](#-license)
- [🏄 Get Started](#-Get-Started)
- [🏖 Remote Ocean: Nile](#-Remote-Ocean-Nile)
- [🐳 Use with Barge](#-Use-with-Barge)
- [⛵️ Environment Variables](#-Environment-Variables)
- [👩‍🔬 Testing](#-Testing)
- [Unit Tests](#Unit-Tests)
- [End-to-End Integration Tests](#End-to-End-Integration-Tests)
- [✨ Code Style](#-Code-Style)
- [🛳 Production](#-Production)
- [⬆️ Releases](#-Releases)
- [📜 Changelog](#-Changelog)
- [🎁 Contributing](#-Contributing)
- [🏛 License](#-License)
## 🏄 Get Started
@ -90,9 +92,11 @@ vi client/.env.local
## 👩‍🔬 Testing
Test suite is setup with [Jest](https://jestjs.io) and [react-testing-library](https://github.com/kentcdodds/react-testing-library).
Test suite is setup with [Jest](https://jestjs.io) and [react-testing-library](https://github.com/kentcdodds/react-testing-library) for unit testing, and [Cypress](https://www.cypress.io) for integration testing.
To run all tests, including all linting tests:
### Unit Tests
To run all unit tests, including all linting tests:
```bash
npm test
@ -114,6 +118,18 @@ cd server/
npm run test:watch
```
### End-to-End Integration Tests
To run all integration tests, run:
```bash
npm run test:e2e
```
This will automatically spin up all required resources to run the integrations tests, and then run them.
The endpoints Cypress runs against are defined by your [Environment Variables](#-Environment-Variables), and Cypress-specific variables in `cypress.json`.
## ✨ Code Style
For linting and auto-formatting you can use from the root of the project:

View File

@ -1,7 +1,8 @@
{
"env": {
"NODE_URI": "https://nile.dev-ocean.com",
"SEEDPHRASE": "taxi music thumb unique chat sand crew more leg another off lamp",
"CONSUME_ASSET": "http://localhost:3000/asset/did:op:fb172f4bfeb3454a99ec752fcd20f37665fa3f1879154746b1be1b014fae91d0"
}
"baseUrl": "http://localhost:3000",
"env": {
"NODE_URI": "https://nile.dev-ocean.com",
"SEEDPHRASE": "taxi music thumb unique chat sand crew more leg another off lamp",
"CONSUME_ASSET": "http://localhost:3000/asset/did:op:8014d305dcb44b42a5355791a2f016a654a61184456a4d178dc6e5913deb3a5c"
}
}

View File

@ -6,22 +6,14 @@ context('Consume', () => {
before(() => {
cy.on('window:before:load', win => {
const provider = new HDWalletProvider(
Cypress.env('SEEDPHRASE')
? Cypress.env('SEEDPHRASE')
: 'taxi music thumb unique chat sand crew more leg another off lamp',
Cypress.env('SEEDPHRASE'),
Cypress.env('NODE_URI')
? Cypress.env('NODE_URI')
: 'https://nile.dev-ocean.com'
)
win.web3 = new Web3(provider)
win.ethereum = win.web3
})
cy.visit(
Cypress.env('CONSUME_ASSET')
? Cypress.env('CONSUME_ASSET')
: 'http://localhost:3000/asset/did:op:8014d305dcb44b42a5355791a2f016a654a61184456a4d178dc6e5913deb3a5c'
)
cy.visit(Cypress.env('CONSUME_ASSET'))
// Wait for end of loading
cy.get('button', { timeout: 60000 }).should('have.length', 1)

View File

@ -6,18 +6,14 @@ context('Faucet', () => {
before(() => {
cy.on('window:before:load', win => {
const provider = new HDWalletProvider(
Cypress.env('SEEDPHRASE')
? Cypress.env('SEEDPHRASE')
: 'taxi music thumb unique chat sand crew more leg another off lamp',
Cypress.env('SEEDPHRASE'),
Cypress.env('NODE_URI')
? Cypress.env('NODE_URI')
: 'https://nile.dev-ocean.com'
)
win.web3 = new Web3(provider)
win.ethereum = win.web3
})
cy.visit('http://localhost:3000/faucet')
cy.visit('/faucet')
// Wait for end of loading
cy.get('button', { timeout: 60000 }).should('have.length', 1)
})

View File

@ -6,18 +6,14 @@ context('Publish', () => {
before(() => {
cy.on('window:before:load', win => {
const provider = new HDWalletProvider(
Cypress.env('SEEDPHRASE')
? Cypress.env('SEEDPHRASE')
: 'taxi music thumb unique chat sand crew more leg another off lamp',
Cypress.env('SEEDPHRASE'),
Cypress.env('NODE_URI')
? Cypress.env('NODE_URI')
: 'https://nile.dev-ocean.com'
)
win.web3 = new Web3(provider)
win.ethereum = win.web3
})
cy.visit('http://localhost:3000/publish')
cy.visit('/publish')
cy.get('article>div', { timeout: 60000 }).should(
'contain',

View File

@ -6,18 +6,14 @@ context('Search', () => {
before(() => {
cy.on('window:before:load', win => {
const provider = new HDWalletProvider(
Cypress.env('SEEDPHRASE')
? Cypress.env('SEEDPHRASE')
: 'taxi music thumb unique chat sand crew more leg another off lamp',
Cypress.env('SEEDPHRASE'),
Cypress.env('NODE_URI')
? Cypress.env('NODE_URI')
: 'https://nile.dev-ocean.com'
)
win.web3 = new Web3(provider)
win.ethereum = win.web3
})
cy.visit('http://localhost:3000')
cy.visit('/')
// Wait for end of loading
cy.get('button', { timeout: 60000 }).should('have.length', 1)
})

View File

@ -1,14 +0,0 @@
/// <reference types="Cypress" />
context('Viewport', () => {
beforeEach(() => {
cy.visit('http://localhost:3000')
})
it('cy.viewport() - set the viewport size and dimension', () => {
cy.get('#root > div > header > div > a > h1').should('be.visible')
cy.viewport(320, 480)
cy.get('#root > div > header > div > a > h1').should('not.be.visible')
})
})