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

prototype using truffle-privatekey-provider & ganache to provide accounts

This commit is contained in:
Matthias Kretschmann 2019-05-17 14:17:27 +02:00
parent 81cb06e19b
commit d8f4ebe7b4
Signed by: m
GPG Key ID: 606EEEF3C479A91F
8 changed files with 3118 additions and 4 deletions

View File

@ -11,10 +11,18 @@ addons:
before_install: before_install:
- npm install -g npm - npm install -g npm
- npm install -g codacy-coverage - npm install -g codacy-coverage truffle ganache-cli
script: script:
# - ./scripts/install.sh # runs automatically with npm ci # - ./scripts/install.sh # runs automatically with npm ci
# run E2E tests against these values
- export REACT_APP_NODE_HOST="duero.dev-ocean.com"
- export REACT_APP_AQUARIUS_HOST="aquarius.duero.dev-ocean.com"
- export REACT_APP_BRIZO_HOST="brizo.duero.dev-ocean.com"
- export REACT_APP_SECRET_STORE_HOST="secret-store.duero.dev-ocean.com"
- export REACT_APP_FAUCET_HOST="faucet.duero.dev-ocean.com"
- export REACT_APP_PARITY_HOST=$REACT_APP_NODE_HOST
- export REACT_APP_BRIZO_ADDRESS="0x9d4ed58293f71122ad6a733c1603927a150735d0"
- ./scripts/test.sh - ./scripts/test.sh
- ./scripts/coverage.sh - ./scripts/coverage.sh
- ./scripts/build.sh - ./scripts/build.sh

View File

@ -0,0 +1,25 @@
/// <reference types="Cypress" />
import Web3 from 'web3'
import PrivateKeyProvider from 'truffle-privatekey-provider'
context('Consume', () => {
beforeEach(() => {
cy.on('window:before:load', win => {
const provider = new PrivateKeyProvider(
'd631de5b7e9cf451135896c833187c8b4dc230bf47756a9a2ca4ffccc161175e',
'http://localhost:8545'
)
win.web3 = new Web3(provider)
})
cy.visit(
'http://localhost:3000/asset/did:op:52f2ed716f97463e97beeb414195a075b606675874204e3da39b0c237377dbd3'
)
// wait for the asset details to have loaded
cy.get('button', { timeout: 10000 }).should('have.length', 1)
})
it('Download button is clickable when user is connected.', () => {
cy.get('button').should('not.be.disabled')
})
})

17
cypress/plugins/index.js Normal file
View File

@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

3060
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,10 +6,12 @@
"scripts": { "scripts": {
"install": "./scripts/install.sh", "install": "./scripts/install.sh",
"start": "concurrently \"cd client && npm start\" \"cd server && npm start\"", "start": "concurrently \"cd client && npm start\" \"cd server && npm start\"",
"start:commons-and-ganache": "concurrently 'npm run start:ganache' 'npm run start'",
"build": "./scripts/build.sh", "build": "./scripts/build.sh",
"test": "npm run lint && scripts/test.sh", "test": "npm run lint && scripts/test.sh",
"test:e2e": "start-server-and-test start http-get://localhost:3000 cypress:run", "test:e2e": "start-test start:commons-and-ganache http-get://localhost:3000 cypress:run",
"test:watch": "npm run lint && concurrently \"cd client && npm run test:watch\" \"cd server && npm run test:watch\"", "test:watch": "npm run lint && concurrently \"cd client && npm run test:watch\" \"cd server && npm run test:watch\"",
"start:ganache": "ganache-cli -m 'stamp polar cup smart ill agree human episode reform trigger text forget' -i 5777",
"format:js": "prettier --parser typescript --write '**/*.{js,jsx,ts,tsx}'", "format:js": "prettier --parser typescript --write '**/*.{js,jsx,ts,tsx}'",
"format:css": "prettier-stylelint --ignore-path .gitignore --write --quiet '**/*.{css,scss}'", "format:css": "prettier-stylelint --ignore-path .gitignore --write --quiet '**/*.{css,scss}'",
"format": "npm run format:js && npm run format:css", "format": "npm run format:js && npm run format:css",
@ -18,7 +20,7 @@
"lint:fix": "eslint --fix --ignore-path .gitignore --ignore-path .prettierignore --ext .ts,.tsx .", "lint:fix": "eslint --fix --ignore-path .gitignore --ignore-path .prettierignore --ext .ts,.tsx .",
"lint": "npm run lint:js && npm run lint:css", "lint": "npm run lint:js && npm run lint:css",
"release": "release-it --non-interactive", "release": "release-it --non-interactive",
"changelog": "auto-changelog -p" "changelog": "auto-changelog -p",
"cypress:run": "cypress run", "cypress:run": "cypress run",
"cypress:open": "cypress open" "cypress:open": "cypress open"
}, },
@ -43,7 +45,9 @@
"stylelint-config-bigchaindb": "^1.2.2", "stylelint-config-bigchaindb": "^1.2.2",
"stylelint-config-css-modules": "^1.4.0", "stylelint-config-css-modules": "^1.4.0",
"stylelint-config-standard": "^18.3.0", "stylelint-config-standard": "^18.3.0",
"typescript": "3.4.5" "truffle-privatekey-provider": "^1.1.0",
"typescript": "3.4.5",
"web3": "^1.0.0-beta.55"
}, },
"repository": { "repository": {
"type": "git", "type": "git",