1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-25 16:38:08 +00:00
Go to file
Vladimir Volek 46fe6d00fc Integration tests (#311)
* Add base test env

* Add eslint rules for cypress

* Add configs and scripts in package json

* Added docker file for bridge and emualator

* Bridge install progress

* Bridge install next step

* Add task for integration tests

* Fixed deps

* Added baseUrl

* Added baseUrl fix

* Added npx

* Added caching for cypress bin

* Added path to binary

* Install cypress

* Finalized dockerfile

* Fixed bridge lib path

* Fixed path for binary

* Adjust script again

* Run all the things properly

* Try to run the tests

* First POC test

* First POC test in gitlab

* Fixed flow

* Fixed gitlab test url, try docker service

* export artifacts

* Test only integration tests in CI

* Test only integration tests in CI 2

* Test only integration tests in CI 3

* Added tests for initialize device

* Try to add docker in only one step

* Turn on other integration steps

* Correct node version

* Ignore cache in flow

* Run bridge and emulator in debug link mode

* Fix param

* Try to run new config in CI

* init device in docker

* Remove docker image after run

* Remove amp

* Fix path

* Artifacts on fail

* Artifacts on fail with volume

* Artifacts on fail with volume 2

* Install mkdir

* Install mkdir again

* test

* test 2

* test 3

* test 4

* test 5

* test 6

* test 7

* test 8

* test 9

* test 10

* test 11

* test 12

* test 13

* test 14

* test 15

* test 16

* test 17

* Revert "test 17"

This reverts commit f3f6c0d690.

* test 18

* test 19

* test 20

* test 21 try chrome

* test 22

* test 23

* test 24

* test 25

* test 25 try to install chrome again

* test 25 try to install chrome again

* Added missing deps

* Added debug

* Install chromium

* Install chromium 2

* turn on chromium

* turn off debug

* turn on debug

* fix folder

* turn off debug

* Fix init device

* Add header dashboard test

* Bring things back

* clean

* clean fix

* Build image in CI

* Added stage step

* Added docker image

* Added service

* Added tests to docker image

* Refactor a bit

* Correct registry image

* Build wallet again

* Add test for dashbaord content

* new node version, more tests

* Remove unused code

* typo

* Correct snapshots, moved deps to dev, beta disclaimer prop
2019-02-05 14:26:40 +01:00
public bring ripple back :) 2019-01-04 15:31:22 +01:00
scripts echo build directory from docker-build 2018-10-24 23:35:48 +02:00
server Fix prod and beta local servers 2018-10-24 17:58:10 +02:00
src Integration tests (#311) 2019-02-05 14:26:40 +01:00
test Integration tests (#311) 2019-02-05 14:26:40 +01:00
webpack Turn off standart errors 2019-02-03 17:10:39 +01:00
.babelrc Implemented review 2018-11-02 16:38:27 +01:00
.dockerignore Added scripts for easy run and build 2018-10-09 14:46:39 +02:00
.eslintignore eslint and flow ignore ./scripts/solidity 2018-10-20 00:18:48 +02:00
.eslintrc Integration tests (#311) 2019-02-05 14:26:40 +01:00
.flowconfig Integration tests (#311) 2019-02-05 14:26:40 +01:00
.gitignore Integration tests (#311) 2019-02-05 14:26:40 +01:00
.gitlab-ci.yml Integration tests (#311) 2019-02-05 14:26:40 +01:00
.stylelintrc Adjusted configs 2018-08-30 20:10:36 +02:00
browserslist Add error message for IE8 and lower 2018-09-21 16:54:02 +02:00
CHANGELOG.md update CHANGELOG 2019-01-03 17:47:21 +01:00
cypress.json Integration tests (#311) 2019-02-05 14:26:40 +01:00
Dockerfile Integration tests (#311) 2019-02-05 14:26:40 +01:00
jest.config.js Changed coverage report path 2018-10-03 12:11:00 +02:00
jsconfig.json Removed /js folder 2018-08-27 17:15:22 +02:00
LICENSE.md fix format in license 2018-09-13 16:40:16 +02:00
Makefile Makefile: added "sync-" prefix and default goal with usage description 2018-10-26 11:50:31 +02:00
package.json Integration tests (#311) 2019-02-05 14:26:40 +01:00
README.md fix typos 2018-12-12 13:06:39 +01:00
yarn.lock Integration tests (#311) 2019-02-05 14:26:40 +01:00

Trezor Wallet

To install dependencies run npm install or yarn To start locally run npm run dev or yarn run dev To build the project run npm run build or yarn run build

Docker

  • Build ./scripts/docker-build.sh
  • Run ./scripts/docker-run.sh

Project structure

The project is divided into two parts - data that are used when compiling the project and data that aren't.

All data that are used during compilation are stored inside the src/ folder.

src/ folder

At the root of the src/ folder are all files or folders that are shared.

  • src/index.js - root of the application
  • src/views/ - contains all React components and views
  • src/store/ - todo
  • src/actions/ - todo
  • src/reducers/ - todo
  • todo other folders/files?

Component

Component is what you'd intuitively think it is. It's a regular React component (doesn't matter whether statefull or stateless).

Global components

All global components are stored in src/views/components/ folder. Global components are such components that are shared across multiple different components or views.

  • For example there's a Button component that is used in both ConnectDevice and AccountSend. ConnectDevice and AccountSend are both placed accross different views so the Button component they're both using must be stored in the global components folder.

Naming & structure convention

Each component has it's own folder. Name of the folder is same as is the name of the component (camel case and first letter is capitalized, e.g.: MyComponent).

If you want to create multiple components of the same type you should put them into a common folder with a lowercase name like this views/components/type/MyComponent.

  • For example there are different types of modals like confirm or device. Because the confirm and device modals are subtypes of modal the folder structure looks like this
    modals/confirm/Address
    modals/confirm/SignTx
    modals/device/Duplicate
    
    Where Address, SignTx and Duplicate are the actual modal components.

Inside each component's folder is index.js file containing the actual component's code with following export at the end of the file export default ComponentName;

There's only one render function per component's index file. If you need more renders you should probably create new component.

Each component may contain other components in its own components/ folder. Component's components may contain another components etc.

View

The difference between view and component is rather semantical then technical.

From the React's standpoint a view is just another component. So when is component a regular component and when is it a view? View components basically copy router structure and are composed either from view's own components or global components.

Naming & structure convention

Both naming and structure conventions are similar to components conventions. Each view has its own folder in views/ folder. Name of this folder is same as is the view's name (camel case and first letter is capitalized, e.g.: MyView). Inside the view's folder is always an index.js file containing view's code itself.

View may contain own components inside view's folder - in the components/ folder. One of the differences between a component and a view is that view can have another views. Of course those views may have their own components and views, etc.

views/
    MyView/
            components/
            views/
            index.js
    MyAnotherView/
            components/
            index.js
  • For example there's a Landing component that is displayed if no device is detected. This view contains its own components in a Landing/components/ folder. These components are then used exclusively in Landing/index.js and together compose different versions of the Landing view.

trezor-connect

If you are implementing a new feature from 'trezor-connect' which is not deployed on npm yet follow these steps:

  1. Build trezor-connect npm module locally:
  • go to trezor-connect project
  • call yarn build:npm
  • cd npm
  1. Call yarn link to register this module
  2. go to trezor-wallet project
  3. Call yarn link trezor-connect to link registered module with trezor-wallet

Additionally you can publish trezor-connect to dev server (sisyfos.trezor.io/connect):

  1. go to trezor-connect project
  2. call make build-test