Skip to content

Commit

Permalink
Merge pull request #606 from EYBlockchain/liju.jose/remove-browser-e2…
Browse files Browse the repository at this point in the history
…e-test-github-actions-workflow

remove browser e2e test GitHub actions workflow
  • Loading branch information
Westlad authored Apr 6, 2022
2 parents 397a3d0 + f3092d6 commit 722bc6e
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 95 deletions.
160 changes: 80 additions & 80 deletions .github/workflows/browser-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
name: Browser e2e test

on:
pull_request:
branch:
- master

jobs:
e2e-test:
runs-on: ubuntu-18.04
environment: AWS
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v1
with:
node-version: '14.17.0'

- name: Start Containers
run: |
npm ci
docker-compose -f docker-compose.dev.yml build
./start-nightfall -g -d -s &> docker-compose.log &disown
env:
AWS_ACCESS_KEY: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}

- name: wait 1000s for Containers startup and setup completion
run: sleep 1000

- name: container logs
if: always()
run: cat docker-compose.log

- name: Setup proposer
run: cd cli && npm ci

- name: Run proposer
run: |
./proposer > proposer.log &disown
sleep 200
- name: proposer script log
if: always()
run: cat proposer.log

- name: Setup browser app
run: |
cd wallet/
npm ci
- name: Start browser app
run: |
cd wallet/
npm start &> browser-app.log &disown
sleep 400
- name: debug logs - browser startup
if: always()
run: cat wallet/browser-app.log

# in local machine
# NETWORK_NAME=ganache-nightfall RPC_URL=http://localhost:8546 CHAIN_ID=1337 PRIVATE_KEY=0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69e npm run e2e-test
- name: Run e2e test
run: cd wallet && npm run e2e-test
env:
NETWORK_NAME: 'ganache-nightfall'
RPC_URL: 'http://localhost:8546'
CHAIN_ID: 1337
PRIVATE_KEY: '0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69e'

- name: test video
if: always()
uses: actions/upload-artifact@v2
with:
name: e2e-video
path: wallet/tests/e2e/videos/e2e-spec.js.mp4

- name: debug logs - Container log after e2ee test run
if: always()
run: cat docker-compose.log
# name: Browser e2e test
#
# on:
# pull_request:
# branch:
# - master
#
# jobs:
# e2e-test:
# runs-on: ubuntu-18.04
# environment: AWS
# steps:
# - uses: actions/checkout@master
# - uses: actions/setup-node@v1
# with:
# node-version: '14.17.0'
#
# - name: Start Containers
# run: |
# npm ci
# docker-compose -f docker-compose.dev.yml build
# ./start-nightfall -g -d -s &> docker-compose.log &disown
# env:
# AWS_ACCESS_KEY: ${{ secrets.ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
#
# - name: wait 1000s for Containers startup and setup completion
# run: sleep 1000
#
# - name: container logs
# if: always()
# run: cat docker-compose.log
#
# - name: Setup proposer
# run: cd cli && npm ci
#
# - name: Run proposer
# run: |
# ./proposer > proposer.log &disown
# sleep 200
#
# - name: proposer script log
# if: always()
# run: cat proposer.log
#
# - name: Setup browser app
# run: |
# cd wallet/
# npm ci
#
# - name: Start browser app
# run: |
# cd wallet/
# npm start &> browser-app.log &disown
# sleep 400
#
# - name: debug logs - browser startup
# if: always()
# run: cat wallet/browser-app.log
#
# # in local machine
# # NETWORK_NAME=ganache-nightfall RPC_URL=http://localhost:8546 CHAIN_ID=1337 PRIVATE_KEY=0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69e npm run e2e-test
# - name: Run e2e test
# run: cd wallet && npm run e2e-test
# env:
# NETWORK_NAME: 'ganache-nightfall'
# RPC_URL: 'http://localhost:8546'
# CHAIN_ID: 1337
# PRIVATE_KEY: '0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69e'
#
# - name: test video
# if: always()
# uses: actions/upload-artifact@v2
# with:
# name: e2e-video
# path: wallet/tests/e2e/videos/e2e-spec.js.mp4
#
# - name: debug logs - Container log after e2ee test run
# if: always()
# run: cat docker-compose.log
1 change: 1 addition & 0 deletions wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ If you select to backup your nightfall mnemonic, it will be encrypted in local s
When you login to nightfall, you will be using account index 0. You can select a different index in `Account Settings` to use a different set of keys.

## Tests
*Updates : E2E test is not working, not maintained currently*
To launch test, set these `NETWORK_NAME`, `RPC_URL`, `CHAIN_ID`, and `PRIVATE_KEY` environment variable in local machine and then run
```sh
npm run e2e-test
Expand Down
30 changes: 15 additions & 15 deletions wallet/src/nightfall-browser/services/withdraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It is agnostic to whether we are dealing with an ERC20 or ERC721 (or ERC1155).
*/
import gen from 'general-number';
import { initialize } from 'zokrates-js';
import axios from 'axios';

import { getContractInstance } from '../../common-files/utils/contract';
import logger from '../../common-files/utils/logger';
import { Nullifier, Transaction } from '../classes/index';
Expand All @@ -20,17 +20,17 @@ import {
getSiblingInfo,
} from './commitment-storage';
import { calculateIvkPkdfromAskNsk } from './keys';
import { saveTransaction, checkIndexDBForCircuit, getStoreCircuit } from './database';
import { checkIndexDBForCircuit, getStoreCircuit } from './database';

const { BN128_GROUP_ORDER, SHIELD_CONTRACT_NAME, proposerUrl, USE_STUBS } = global.config;
const { BN128_GROUP_ORDER, SHIELD_CONTRACT_NAME, USE_STUBS } = global.config;
const { generalise } = gen;
const circuitName = USE_STUBS ? 'withdraw_stub' : 'withdraw';

async function withdraw(withdrawParams, shieldContractAddress) {
logger.info('Creating a withdraw transaction');
// let's extract the input items
const { offchain = false, ...items } = withdrawParams;
const { ercAddress, tokenId, value, recipientAddress, nsk, ask, fee } = generalise(items);
const { ercAddress, tokenId, value, recipientAddress, nsk, ask, fee } =
generalise(withdrawParams);
const { compressedPkd } = calculateIvkPkdfromAskNsk(ask, nsk);

if (!(await checkIndexDBForCircuit(circuitName)))
Expand Down Expand Up @@ -108,7 +108,7 @@ async function withdraw(withdrawParams, shieldContractAddress) {
fee,
historicRootBlockNumberL2: [isOnChain, 0],
transactionType: 3,
tokenType: items.tokenType,
tokenType: withdrawParams.tokenType,
tokenId,
value,
ercAddress,
Expand All @@ -118,15 +118,15 @@ async function withdraw(withdrawParams, shieldContractAddress) {
});
try {
// if (offchain) {
// await axios
// .post(
// `${proposerUrl}/proposer/offchain-transaction`,
// { transaction: optimisticWithdrawTransaction },
// { timeout: 3600000 },
// )
// .catch(err => {
// throw new Error(err);
// });
// await axios
// .post(
// `${proposerUrl}/proposer/offchain-transaction`,
// { transaction: optimisticWithdrawTransaction },
// { timeout: 3600000 },
// )
// .catch(err => {
// throw new Error(err);
// });
// const th = optimisticWithdrawTransaction.transactionHash;
// delete optimisticWithdrawTransaction.transactionHash;
// optimisticWithdrawTransaction.transactionHash = th;
Expand Down

0 comments on commit 722bc6e

Please sign in to comment.