Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(e2e-contracts-test): make tests run on testnet #1380

Merged
merged 26 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ee168e0
feat: make e2e-contracts work on testnet
LuizAsFight Jun 14, 2024
bfae149
feat: e2e-tests on testnet
LuizAsFight Jun 14, 2024
2eaf1a0
chore: make test run on PR commit
LuizAsFight Jun 14, 2024
b42cd10
chore: node version
LuizAsFight Jun 14, 2024
524c6a8
chore: add devnet
LuizAsFight Jun 14, 2024
8366c48
chore
LuizAsFight Jun 14, 2024
000b51a
chore
LuizAsFight Jun 15, 2024
ab9bf35
chore: abstract e2e-contract-test action
LuizAsFight Jun 17, 2024
c8e9edc
chore: var
LuizAsFight Jun 17, 2024
da3de2d
chore
LuizAsFight Jun 17, 2024
2eeb931
chore
LuizAsFight Jun 17, 2024
217c477
chore
LuizAsFight Jun 17, 2024
3af2734
chore: add skipDeploy
LuizAsFight Jun 17, 2024
ec26569
chore
LuizAsFight Jun 17, 2024
1002126
chore
LuizAsFight Jun 17, 2024
3373b81
chore: name of tests
LuizAsFight Jun 17, 2024
26c4ec9
feat: config for testnet+devnet
LuizAsFight Jun 17, 2024
06c966d
fix: audit
LuizAsFight Jun 17, 2024
93d5ebe
chore: remove leftover prop
LuizAsFight Jun 17, 2024
33c881b
chore: waitt 15 seconds to transaction complete
LuizAsFight Jun 17, 2024
d5704f5
chore: don't run prod tests on every pr commit
LuizAsFight Jun 17, 2024
3c09e6a
chore: audit
LuizAsFight Jun 17, 2024
7ca351e
Update packages/e2e-contract-tests/src/config.ts
LuizAsFight Jun 19, 2024
967c983
Update packages/e2e-contract-tests/playwright/e2e/config.ts
LuizAsFight Jun 19, 2024
a17b540
Update packages/e2e-contract-tests/playwright/e2e/config.ts
LuizAsFight Jun 20, 2024
3ae1bda
Update packages/e2e-contract-tests/src/config.ts
LuizAsFight Jun 20, 2024
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
2 changes: 2 additions & 0 deletions .changeset/lemon-bugs-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
52 changes: 52 additions & 0 deletions .github/actions/e2e-tests-contracts/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'E2E Contract Tests'

inputs:
providerUrl:
description: Provider URL (e.g. https://testnet.fuel.network/v1/graphql)
required: true
masterMnemonic:
description: Mnemonic of the master wallet that will fund the tests
required: true
genesisSecret:
description: Secret of genesis to fund the master wallet
required: false

runs:
using: 'composite'
steps:


- name: Build Application
shell: bash
run: pnpm build:all
env:
## increase node.js m memory limit for building
## with sourcemaps
NODE_OPTIONS: "--max-old-space-size=4096"
NODE_ENV: test

# E2E tests running with Playwright
- name: Install Playwright Browsers
shell: bash
run: npx playwright install --with-deps chromium

- name: Run E2E Contract Tests
shell: bash
run: xvfb-run --auto-servernum -- pnpm test:e2e:contracts
env:
VITE_FUEL_PROVIDER_URL: ${{ inputs.providerUrl }}
VITE_MASTER_WALLET_MNEMONIC: ${{ inputs.masterMnemonic }}
VITE_WALLET_SECRET: ${{ inputs.genesisSecret }}

- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: |
packages/app/playwright-report/
packages/app/playwright-html/
retention-days: 30

- name: Stop Test Node
shell: bash
run: pnpm node:clean
46 changes: 12 additions & 34 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
Expand Down Expand Up @@ -111,13 +111,13 @@ jobs:
run: pnpm node:clean

tests-e2e-contracts:
name: E2E Contract Tests
name: E2E Contract Tests - Local
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
Expand All @@ -131,43 +131,21 @@ jobs:

- name: Start Test Node
run: pnpm node:up

- name: Generate .env app
run: cp packages/app/.env.example packages/app/.env

- name: Generate .env e2e-contracts
run: cp packages/e2e-contract-tests/.env.example packages/e2e-contract-tests/.env

- name: Build Application
run: pnpm build:all
env:
## increase node.js m memory limit for building
## with sourcemaps
NODE_OPTIONS: "--max-old-space-size=4096"
NODE_ENV: test

- name: Build & Deploy Contracts
run: pnpm deploy:contracts
working-directory: ./packages/e2e-contract-tests

# E2E tests running with Playwright
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: Run E2E Contract Tests
run: xvfb-run --auto-servernum -- pnpm test:e2e:contracts
env:
NODE_ENV: test

- uses: actions/upload-artifact@v4
if: always()
- name: Run E2E Contract Tests - Local
uses: ./.github/actions/e2e-tests-contracts
with:
name: playwright-report
path: |
packages/app/playwright-report/
packages/app/playwright-html/
retention-days: 30

- name: Stop Test Node
run: pnpm node:clean

ghToken: ${{ secrets.GITHUB_TOKEN }}
providerUrl: "http://localhost:4000/v1/graphql"
masterMnemonic: ${{ secrets.VITE_MASTER_WALLET_MNEMONIC }}
genesisSecret: "0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298"
6 changes: 3 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: CI Setup
uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7

- name: Validate Changeset
Expand All @@ -60,7 +60,7 @@ jobs:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7
- run: pnpm audit --prod

Expand All @@ -78,7 +78,7 @@ jobs:
- name: Setup Node
uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7

- name: Run lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-changeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
persist-credentials: false
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7

- name: Bump and Collect Version
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/tests-devnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Devnet tests

on:
workflow_dispatch:
inputs:
masterMnemonic:
description: Mnemonic of the wallet that will fund the tests
required: false
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests-e2e-contracts:
name: E2E Contract Tests - Devnet
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.18.0
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run PNPM install
id: pnpm-cache
run:
pnpm recursive install --frozen-lockfile

- name: Generate .env app
run: cp packages/app/.env.example packages/app/.env

- name: Generate .env e2e-contracts
run: cp packages/e2e-contract-tests/.env.example packages/e2e-contract-tests/.env

- name: Run E2E Contract Tests - Devnet
uses: ./.github/actions/e2e-tests-contracts
with:
providerUrl: "https://devnet.fuel.network/v1/graphql"
masterMnemonic: ${{ inputs.masterMnemonic || secrets.VITE_MASTER_WALLET_MNEMONIC }}
47 changes: 47 additions & 0 deletions .github/workflows/tests-testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Testnet tests

on:
workflow_dispatch:
inputs:
masterMnemonic:
description: Mnemonic of the wallet that will fund the tests
required: false
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests-e2e-contracts:
name: E2E Contract Tests - Testnet
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.18.0
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/docker@master
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run PNPM install
id: pnpm-cache
run:
pnpm recursive install --frozen-lockfile

- name: Generate .env app
run: cp packages/app/.env.example packages/app/.env

- name: Generate .env e2e-contracts
run: cp packages/e2e-contract-tests/.env.example packages/e2e-contract-tests/.env

- name: Run E2E Contract Tests - Testnet
uses: ./.github/actions/e2e-tests-contracts
with:
providerUrl: "https://testnet.fuel.network/v1/graphql"
masterMnemonic: ${{ inputs.masterMnemonic || secrets.VITE_MASTER_WALLET_MNEMONIC }}
2 changes: 1 addition & 1 deletion .github/workflows/unpublish-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7
- uses: FuelLabs/github-actions/setups/npm@master
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-sdk-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7

- name: Checking updates
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-sdk-manual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/checkout@v3
- uses: FuelLabs/github-actions/setups/node@master
with:
node-version: 18.14.1
node-version: 18.18.0
pnpm-version: 8.15.7

- name: Checking updates
Expand Down
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node-version=18.14.1
node-version=18.18.0
strict-peer-dependencies=false
save-exact=true
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.14.1
18.18.0
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Fuel Wallet",
"author": "Fuel Labs <contact@fuel.sh> (https://fuel.network/)",
"engines": {
"node": ">=18.14.1",
"node": ">=18.18.0",
"pnpm": ">=8"
},
"homepage": "https://github.com/FuelLabs/fuels-wallet",
Expand Down Expand Up @@ -113,7 +113,9 @@
"zod@<=3.22.2": ">=3.22.3",
"nth-check": ">=2.1.1",
"@adobe/css-tools@<4.3.2": ">=4.3.2",
"@babel/traverse@<7.23.2": ">=7.23.2"
"@babel/traverse@<7.23.2": ">=7.23.2",
"braces@<3.0.3": ">=3.0.3",
"ws": "8.17.1"
}
}
}
10 changes: 10 additions & 0 deletions packages/app/.env.example.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
VITE_CRX_NAME="Fuel Wallet Development"
VITE_CRX_VERSION_API="https://fuellabs.github.io/fuels-wallet/latest.json"
VITE_FUEL_PROVIDER_URL=https://testnet.fuel.network/v1/graphql
VITE_FUEL_FAUCET_URL=https://faucet-testnet.fuel.network/
VITE_EXPLORER_URL=https://app.fuel.network/
VITE_MNEMONIC_WORDS=12
VITE_ADDR_OWNER=0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298
GENESIS_SECRET=0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298
VITE_AUTO_LOCK_IN_MINUTES=1
VITE_SENTRY_DSN=
2 changes: 1 addition & 1 deletion packages/docs/docs/contributing/running-locally.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is a guide that will show you how you can run this project locally if you w

This project includes frontend. To begin, install dependencies:

- [Node.js 18.14.1 or latest stable](https://nodejs.org/en/). We recommend using [nvm](https://github.com/nvm-sh/nvm) to install.
- [Node.js 18.18.0 or latest stable](https://nodejs.org/en/). We recommend using [nvm](https://github.com/nvm-sh/nvm) to install.
- [pnpm v7.18.2 or latest stable](https://pnpm.io/installation/)
- [Docker v0.8.2 or latest stable](https://docs.docker.com/get-docker/)
- [Docker Compose v2.6.0 or latest stable](https://docs.docker.com/get-docker/)
Expand Down
3 changes: 2 additions & 1 deletion packages/e2e-contract-tests/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PORT=5173
VITE_FUEL_PROVIDER_URL="http://localhost:4000/v1/graphql"
VITE_WALLET_SECRET=0xa449b1ffee0e2205fa924c6740cc48b3b473aa28587df6dab12abc245d1f5298
VITE_WALLET_SECRET= # leave it empty to skip seed wallet
VITE_MASTER_WALLET_MNEMONIC=
2 changes: 1 addition & 1 deletion packages/e2e-contract-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import './load.envs';

const config: PlaywrightTestConfig = defineConfig({
testDir: './playwright',
retries: 1,
retries: 0,
workers: 1,
timeout: 60_000,
reporter: [['html', { printSteps: true }]],
Expand Down
Loading
Loading