Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1300d13a |
@@ -3,7 +3,3 @@ apps/**/node_modules/*
|
|||||||
tmp/*
|
tmp/*
|
||||||
.dockerignore
|
.dockerignore
|
||||||
dockerfiles
|
dockerfiles
|
||||||
node_modules
|
|
||||||
.git
|
|
||||||
.github
|
|
||||||
.vscode
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
name: Release
|
|
||||||
about: A template to outline the steps needed to for a successful release of our frontend apps
|
|
||||||
title: 'Release [add dapp version]-core-[add core version]'
|
|
||||||
labels:
|
|
||||||
assignees: ''
|
|
||||||
---
|
|
||||||
|
|
||||||
### Tasks
|
|
||||||
|
|
||||||
- [ ] Review [link to core release](xxx)
|
|
||||||
- [ ] Tag frontend-monorepo
|
|
||||||
- [ ] Create release and generate release notes
|
|
||||||
- [ ] Run `@smoke` tests
|
|
||||||
- [ ] Run `@regression` tests
|
|
||||||
- [ ] Run `@slow` tests
|
|
||||||
- [ ] Explorative testing of key flows
|
|
||||||
- [ ] Set `release/[network]` to tagged commit
|
|
||||||
- [ ] Verify builds (on Netlify and Fleek) are successful
|
|
||||||
- [ ] Verify build has been deployed
|
|
||||||
- [ ] Smoke testing on deployed app
|
|
||||||
@@ -13,7 +13,7 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
add_issue:
|
add_issue:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Add issue to project board'
|
- name: 'Add issue to project board'
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
name: 'Check if branch is shorter than 52 chars'
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
branch-naming-rules:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# echo "branches that are longer than 51 chars can't be parsed by kubernetes to create previews. Each app has prefix of it's name like: 'governance-' (12 chars), what leaves 51 max branch length"
|
|
||||||
# current parsable length: $( git rev-parse --abbrev-ref HEAD | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | wc -c)
|
|
||||||
- uses: deepakputhraya/action-branch-name@master
|
|
||||||
with:
|
|
||||||
# regex: '([a-z])+\/([a-z])+' # Regex the branch should match. This example enforces grouping
|
|
||||||
# allowed_prefixes: 'feature,stable,fix' # All branches should start with the given prefix
|
|
||||||
# ignore: master,develop # Ignore exactly matching branch names from convention
|
|
||||||
min_length: 1 # Min length of the branch name
|
|
||||||
max_length: 51 # Max length of the branch name
|
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
name: CI/CD
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- release/*
|
|
||||||
- develop
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- ready_for_review
|
|
||||||
- reopened
|
|
||||||
- edited
|
|
||||||
- synchronize
|
|
||||||
jobs:
|
|
||||||
node-modules:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
name: 'Cache yarn modules'
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
id: cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
|
||||||
# comment out "restore-keys" if you need to rebuild yarn from 0
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-cache-node-modules-
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
|
||||||
cache: yarn
|
|
||||||
|
|
||||||
- name: yarn install
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: yarn install --pure-lockfile
|
|
||||||
|
|
||||||
lint-pr-title:
|
|
||||||
needs: node-modules
|
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
name: Verify PR title
|
|
||||||
uses: ./.github/workflows/lint-pr.yml
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
lint-test-build:
|
|
||||||
timeout-minutes: 60
|
|
||||||
needs: node-modules
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
name: '(CI) lint + unit test + build'
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
|
||||||
cache: yarn
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
|
||||||
|
|
||||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
|
||||||
uses: nrwl/nx-set-shas@v3
|
|
||||||
with:
|
|
||||||
main-branch-name: develop
|
|
||||||
|
|
||||||
- name: Check formatting
|
|
||||||
run: yarn nx format:check
|
|
||||||
|
|
||||||
- name: Lint affected
|
|
||||||
run: yarn nx affected:lint --max-warnings=0
|
|
||||||
|
|
||||||
- name: Build affected spec
|
|
||||||
run: yarn nx affected --target=build-spec
|
|
||||||
|
|
||||||
- name: Test affected
|
|
||||||
run: yarn nx affected:test
|
|
||||||
|
|
||||||
- name: Build affected
|
|
||||||
run: yarn nx affected:build || (yarn install && yarn nx affected:build)
|
|
||||||
|
|
||||||
# See affected apps
|
|
||||||
- name: See affected apps
|
|
||||||
run: |
|
|
||||||
echo ">>>> debug"
|
|
||||||
echo "NX Version: $nx_version"
|
|
||||||
echo "NX_BASE: ${{ env.NX_BASE }}"
|
|
||||||
echo "NX_HEAD: ${{ env.NX_HEAD }}"
|
|
||||||
echo ">>>> eof debug"
|
|
||||||
|
|
||||||
affected="$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)"
|
|
||||||
echo -n "Affected projects: $affected"
|
|
||||||
|
|
||||||
branch_slug="$(echo ${{ github.head_ref || github.ref_name }} | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | cut -c 1-50 )"
|
|
||||||
projects_e2e=""
|
|
||||||
preview_governance="not deployed"
|
|
||||||
preview_trading="not deployed"
|
|
||||||
preview_explorer="not deployed"
|
|
||||||
if [[ -z "$projects_e2e" ]]; then
|
|
||||||
projects_e2e+='"governance-e2e" "trading-e2e" "explorer-e2e" '
|
|
||||||
preview_governance=$(printf "https://%s.%s.vega.rocks" "governance" "$branch_slug")
|
|
||||||
preview_trading=$(printf "https://%s.%s.vega.rocks" "trading" "$branch_slug")
|
|
||||||
preview_explorer=$(printf "https://%s.%s.vega.rocks" "explorer" "$branch_slug")
|
|
||||||
else
|
|
||||||
if [[ $affected == *"governance"* ]]; then
|
|
||||||
projects_e2e+='"governance-e2e" '
|
|
||||||
preview_governance=$(printf "https://%s.%s.vega.rocks" "governance" "$branch_slug")
|
|
||||||
fi
|
|
||||||
if [[ $affected == *"trading"* ]]; then
|
|
||||||
projects_e2e+='"trading-e2e" '
|
|
||||||
preview_trading=$(printf "https://%s.%s.vega.rocks" "trading" "$branch_slug")
|
|
||||||
fi
|
|
||||||
if [[ $affected == *"explorer"* ]]; then
|
|
||||||
projects_e2e+='"explorer-e2e" '
|
|
||||||
preview_explorer=$(printf "https://%s.%s.vega.rocks" "explorer" "$branch_slug")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
projects_e2e=${projects_e2e%?}
|
|
||||||
projects_e2e=[${projects_e2e// /,}]
|
|
||||||
echo PROJECTS_E2E=$projects_e2e >> $GITHUB_ENV
|
|
||||||
echo PROJECTS=$(echo $projects_e2e | sed 's|-e2e||g') >> $GITHUB_ENV
|
|
||||||
echo PREVIEW_GOVERNANCE=$preview_governance >> $GITHUB_ENV
|
|
||||||
echo PREVIEW_TRADING=$preview_trading >> $GITHUB_ENV
|
|
||||||
echo PREVIEW_EXPLORER=$preview_explorer >> $GITHUB_ENV
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
projects: ${{ env.PROJECTS }}
|
|
||||||
projects-e2e: ${{ env.PROJECTS_E2E }}
|
|
||||||
preview_governance: ${{ env.PREVIEW_GOVERNANCE }}
|
|
||||||
preview_trading: ${{ env.PREVIEW_TRADING }}
|
|
||||||
preview_explorer: ${{ env.PREVIEW_EXPLORER }}
|
|
||||||
|
|
||||||
cypress:
|
|
||||||
needs: lint-test-build
|
|
||||||
name: '(CI) cypress'
|
|
||||||
if: ${{ needs.lint-test-build.outputs.projects != '[]' }}
|
|
||||||
uses: ./.github/workflows/cypress-run.yml
|
|
||||||
secrets: inherit
|
|
||||||
with:
|
|
||||||
projects: ${{ needs.lint-test-build.outputs.projects-e2e }}
|
|
||||||
tags: '@smoke @regression'
|
|
||||||
|
|
||||||
publish-dist:
|
|
||||||
needs: lint-test-build
|
|
||||||
name: '(CD) publish dist'
|
|
||||||
if: ${{ needs.lint-test-build.outputs.projects != '[]' }}
|
|
||||||
uses: ./.github/workflows/publish-dist.yml
|
|
||||||
secrets: inherit
|
|
||||||
with:
|
|
||||||
projects: ${{ needs.lint-test-build.outputs.projects }}
|
|
||||||
|
|
||||||
dist-check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- publish-dist
|
|
||||||
- lint-test-build
|
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
name: '(CD) comment preview links'
|
|
||||||
steps:
|
|
||||||
- name: Find Comment
|
|
||||||
uses: peter-evans/find-comment@v2
|
|
||||||
id: fc
|
|
||||||
with:
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
body-includes: Previews
|
|
||||||
|
|
||||||
- name: Create comment
|
|
||||||
uses: peter-evans/create-or-update-comment@v3
|
|
||||||
if: ${{ steps.fc.outputs.comment-id == 0 }}
|
|
||||||
with:
|
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
|
||||||
body: |
|
|
||||||
Previews:
|
|
||||||
* governance: ${{ needs.lint-test-build.outputs.preview_governance }}
|
|
||||||
* explorer: ${{ needs.lint-test-build.outputs.preview_explorer }}
|
|
||||||
* trading: ${{ needs.lint-test-build.outputs.preview_trading }}
|
|
||||||
|
|
||||||
cypress-check:
|
|
||||||
name: '(CI) cypress - check'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: cypress
|
|
||||||
steps:
|
|
||||||
- run: echo Done!
|
|
||||||
|
|
||||||
# Report single result at the end, to avoid mess with required checks in PR
|
|
||||||
cypress-result:
|
|
||||||
if: ${{ always() }}
|
|
||||||
needs: cypress
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- run: |
|
|
||||||
result="${{ needs.cypress.result }}"
|
|
||||||
if [[ $result == "success" || $result == "skipped" ]]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -13,7 +13,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
cypress-run:
|
cypress-run:
|
||||||
name: Run Cypress Trading tests -- live environment
|
name: Run Cypress Trading tests -- live environment
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
name: Cypress tests - PR
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
- ready_for_review
|
||||||
|
jobs:
|
||||||
|
pr:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout frontend mono repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
|
||||||
|
- name: Remove package.json & yarn.lock to avoid installing everything
|
||||||
|
run: rm package.json yarn.lock
|
||||||
|
|
||||||
|
- name: Install nx
|
||||||
|
run: yarn add nx
|
||||||
|
|
||||||
|
# Check SHAs
|
||||||
|
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||||
|
uses: nrwl/nx-set-shas@v2
|
||||||
|
with:
|
||||||
|
main-branch-name: ${{ github.base_ref || github.ref_name }}
|
||||||
|
set-environment-variables-for-job: true
|
||||||
|
|
||||||
|
# See affected apps
|
||||||
|
- name: See affected apps
|
||||||
|
run: |
|
||||||
|
affected=$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)
|
||||||
|
echo -n "Affected projects: $affected"
|
||||||
|
projects=""
|
||||||
|
if [[ $affected == *"governance"* ]]; then projects+='"governance-e2e" '; fi
|
||||||
|
if [[ $affected == *"trading"* ]]; then projects+='"trading-e2e" '; fi
|
||||||
|
if [[ $affected == *"explorer"* ]]; then projects+='"explorer-e2e" '; fi
|
||||||
|
if [[ -z "$projects" ]]; then projects+='"governance-e2e" "trading-e2e" "explorer-e2e" '; fi
|
||||||
|
projects=${projects%?}
|
||||||
|
projects=[${projects// /,}]
|
||||||
|
echo PROJECTS=$projects >> $GITHUB_ENV
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
projects: ${{ env.PROJECTS }}
|
||||||
|
|
||||||
|
run:
|
||||||
|
needs: pr
|
||||||
|
if: ${{ needs.pr.outputs.projects != '[]' }}
|
||||||
|
uses: ./.github/workflows/cypress-run.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
projects: ${{ needs.pr.outputs.projects }}
|
||||||
|
tags: '@smoke @regression'
|
||||||
|
|
||||||
|
# Report single result at the end, to avoid mess with required checks in PR
|
||||||
|
result:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: run
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Cypress result
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
result="${{ needs.run.result }}"
|
||||||
|
if [[ $result == "success" || $result == "skipped" ]]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
name: (CI) Cypress Run
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -18,9 +17,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
project: ${{ fromJSON(inputs.projects) }}
|
project: ${{ fromJSON(inputs.projects) }}
|
||||||
name: ${{ matrix.project }}
|
|
||||||
runs-on: self-hosted-runner
|
runs-on: self-hosted-runner
|
||||||
timeout-minutes: 40
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
# Checks if skip cache was requested
|
# Checks if skip cache was requested
|
||||||
- name: Set skip-nx-cache flag
|
- name: Set skip-nx-cache flag
|
||||||
@@ -93,9 +91,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: logs-${{ matrix.project }}
|
name: logs-${{ matrix.project }}
|
||||||
path: /home/runner/.vegacapsule/testnet/logs
|
path: /home/runner/.vegacapsule/testnet/logs
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: ${{ failure() }}
|
|
||||||
with:
|
|
||||||
name: test-report-${{ matrix.project }}
|
|
||||||
path: frontend-monorepo/apps/trading-e2e/cypress/reports
|
|
||||||
|
|||||||
@@ -8,25 +8,22 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
master:
|
master:
|
||||||
name: Generate Queries
|
name: Generate Queries
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
fetch-depth: 0
|
||||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
- name: Use Node.js 16
|
||||||
cache: yarn
|
id: Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16.15.1
|
||||||
- name: Install root dependencies
|
- name: Install root dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install
|
||||||
|
|
||||||
- name: Generate queries
|
- name: Generate queries
|
||||||
run: node ./scripts/get-queries.js
|
run: node ./scripts/get-queries.js
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: queries
|
name: queries
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
name: Verify PR title
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint_pr:
|
|
||||||
timeout-minutes: 10
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
|
||||||
cache: yarn
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
|
||||||
|
|
||||||
- name: Check PR title
|
|
||||||
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --config ./commitlint.config-ci.js
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Verify PR title
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, ready_for_review, reopened, edited, synchronize]
|
||||||
|
jobs:
|
||||||
|
lint_pr:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Use Node.js 16
|
||||||
|
id: Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16.15.1
|
||||||
|
- name: Install root dependencies
|
||||||
|
run: yarn install
|
||||||
|
- name: Check PR title
|
||||||
|
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --config ./commitlint.config-ci.js
|
||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
master:
|
master:
|
||||||
name: Generate Queries
|
name: Generate Queries
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
name: (CD) Publish docker + s3
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
projects:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish-dist:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
app: ${{ fromJSON(inputs.projects) }}
|
|
||||||
name: ${{ matrix.app }}
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
timeout-minutes: 25
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
id: quemu
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Available platforms
|
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Setup node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version-file: '.nvmrc'
|
|
||||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
|
||||||
cache: yarn
|
|
||||||
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
|
||||||
|
|
||||||
# https://docs.github.com/en/actions/learn-github-actions/contexts
|
|
||||||
- name: Define variables
|
|
||||||
run: |
|
|
||||||
envName=''
|
|
||||||
dockerfile="dist.Dockerfile"
|
|
||||||
if [[ "${{ github.event_name }}" = "push" ]]; then
|
|
||||||
domain="vega.rocks"
|
|
||||||
if [[ "${{ github.ref }}" =~ .*release/.* ]]; then
|
|
||||||
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
|
|
||||||
if [[ "${{ github.ref }}" =~ .*mainnet.* ]]; then
|
|
||||||
domain="vega.community"
|
|
||||||
if [[ "${{ matrix.app }}" = "trading" ]]; then
|
|
||||||
dockerfile="ipfs.Dockerfile"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then
|
|
||||||
envName="stagnet1"
|
|
||||||
fi
|
|
||||||
bucketName="${{ matrix.app }}.${envName}.${domain}"
|
|
||||||
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
nodeVersion=$(cat .nvmrc | head -n 1)
|
|
||||||
echo ENV_NAME=${envName} >> $GITHUB_ENV
|
|
||||||
echo NODE_VERSION=${nodeVersion} >> $GITHUB_ENV
|
|
||||||
echo DOCKERFILE=docker/${dockerfile} >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build local dist
|
|
||||||
if: ${{ env.DOCKERFILE != 'docker/ipfs.Dockerfile' }}
|
|
||||||
run: |
|
|
||||||
flags=""
|
|
||||||
if [[ ! -z "${{ env.ENV_NAME }}" ]]; then
|
|
||||||
if [[ "${{ env.ENV_NAME }}" != "ops-vega" ]]; then
|
|
||||||
flags="--env=${{ env.ENV_NAME }}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${{ matrix.app }}" = "trading" ]; then
|
|
||||||
yarn nx export trading $flags || (yarn install && yarn nx export trading $flags)
|
|
||||||
DIST_LOCATION=dist/apps/trading/exported
|
|
||||||
else
|
|
||||||
yarn nx build ${{ matrix.app }} $flags || (yarn install && yarn nx build ${{ matrix.app }} $flags)
|
|
||||||
DIST_LOCATION=dist/apps/${{ matrix.app }}
|
|
||||||
fi
|
|
||||||
mv $DIST_LOCATION dist-result
|
|
||||||
tree dist-result
|
|
||||||
|
|
||||||
- name: Build and export to local Docker
|
|
||||||
id: docker_build
|
|
||||||
if: ${{ github.event_name == 'pull_request' || ( env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' ) }}
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ${{ env.DOCKERFILE }}
|
|
||||||
load: true
|
|
||||||
build-args: |
|
|
||||||
APP=${{ matrix.app }}
|
|
||||||
NODE_VERSION=${{ env.NODE_VERSION }}
|
|
||||||
ENV_NAME=${{ env.ENV_NAME }}
|
|
||||||
tags: |
|
|
||||||
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
|
||||||
|
|
||||||
- name: Image digest
|
|
||||||
if: ${{ github.event_name == 'pull_request' || ( env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' ) }}
|
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
||||||
|
|
||||||
- name: Sanity check docker image
|
|
||||||
if: ${{ github.event_name == 'pull_request' || ( env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' ) }}
|
|
||||||
run: |
|
|
||||||
echo "Check ipfs-hash"
|
|
||||||
if [[ "${{ env.DOCKERFILE }}" = "docker/ipfs.Dockerfile" ]]; then
|
|
||||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat /ipfs-hash
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "List html directory"
|
|
||||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local sh -c 'apk add --update tree; tree .'
|
|
||||||
|
|
||||||
- name: Copy dist to local filesystem
|
|
||||||
if: ${{ env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' }}
|
|
||||||
run: |
|
|
||||||
docker create --name=dist ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
|
||||||
docker cp dist:/usr/share/nginx/html dist
|
|
||||||
|
|
||||||
echo "check local dist files"
|
|
||||||
tree dist/html
|
|
||||||
mv dist/html dist-result
|
|
||||||
|
|
||||||
- name: Publish dist as docker image
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ${{ env.DOCKERFILE }}
|
|
||||||
push: true
|
|
||||||
build-args: |
|
|
||||||
APP=${{ matrix.app }}
|
|
||||||
NODE_VERSION=${{ env.NODE_VERSION }}
|
|
||||||
ENV_NAME=${{ env.ENV_NAME }}
|
|
||||||
tags: |
|
|
||||||
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }}
|
|
||||||
|
|
||||||
# bucket creation in github.com/vegaprotocol/terraform//frontend
|
|
||||||
- name: Publish dist to s3
|
|
||||||
uses: jakejarvis/s3-sync-action@master
|
|
||||||
if: ${{ github.event_name == 'push' }}
|
|
||||||
with:
|
|
||||||
args: --acl private --follow-symlinks --delete
|
|
||||||
env:
|
|
||||||
AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_REGION: 'eu-west-1'
|
|
||||||
SOURCE_DIR: 'dist-result'
|
|
||||||
|
|
||||||
- name: Add preview label
|
|
||||||
uses: actions-ecosystem/action-add-labels@v1
|
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
with:
|
|
||||||
labels: ${{ matrix.app }}-preview
|
|
||||||
number: ${{ github.event.number }}
|
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
name: Publish docker containers
|
||||||
|
|
||||||
|
'on':
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
- 'v[0-9]+.[0-9]+.[0-9]+-*'
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
publish:
|
||||||
|
description: 'Publish tag to Docker Hub & GitHub Registry'
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
tag:
|
||||||
|
description: 'Git Tag to build and publish'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ''
|
||||||
|
apps:
|
||||||
|
description: 'Applications to build and publish'
|
||||||
|
required: false
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- '["explorer", "token", "trading"]'
|
||||||
|
- '["explorer"]'
|
||||||
|
- '["token"]'
|
||||||
|
- '["trading"]'
|
||||||
|
archs:
|
||||||
|
description: 'Architecture to build and publish'
|
||||||
|
required: false
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- linux/amd64, linux/arm64
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
master:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
app: ${{ fromJson(inputs.apps || '["explorer", "token", "trading"]') }}
|
||||||
|
name: Build the ${{ matrix.app }} image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ inputs.tag }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
id: quemu
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Available platforms
|
||||||
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
if: ${{ inputs.publish || startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Determine Docker Image tag
|
||||||
|
id: tags
|
||||||
|
run: |
|
||||||
|
hash=$(git rev-parse HEAD|cut -b1-8)
|
||||||
|
versionTag=${{ inputs.tag || startsWith(github.ref, 'refs/tags/') && github.ref_name || '${hash}' }}
|
||||||
|
echo ::set-output name=version::${versionTag}
|
||||||
|
echo ::set-output name=npmVersion::$(cat dockerfiles/${{ matrix.app =='trading' && 'Dockerfile.next' || 'Dockerfile.cra' }} | grep FROM | head -n 1 | awk '{print $2}' | cut -d ':' -f 2 | cut -d '-' -f 1 )
|
||||||
|
|
||||||
|
- name: Print config
|
||||||
|
run: |
|
||||||
|
git rev-parse --verify HEAD
|
||||||
|
git status
|
||||||
|
echo "inputs.tag=${{ inputs.tag }}"
|
||||||
|
echo "inputs.publish=${{ inputs.publish }}"
|
||||||
|
echo "inputs.apps=${{ inputs.apps }}"
|
||||||
|
echo "inputs.archs=${{ inputs.archs }}"
|
||||||
|
echo "steps.tags.outputs.version=${{ steps.tags.outputs.version }}"
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ steps.tags.outputs.npmVersion }}
|
||||||
|
|
||||||
|
- name: Build frontend dists
|
||||||
|
run: |
|
||||||
|
yarn --verbose --pure-lockfile
|
||||||
|
yarn nx ${{ matrix.app =='trading' && 'export' || 'build' }} ${{ matrix.app }} --pure-lockfile
|
||||||
|
|
||||||
|
- name: Build and export to local Docker
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: false
|
||||||
|
file: dockerfiles/${{ matrix.app =='trading' && 'Dockerfile.next' || 'Dockerfile.cra' }}.dist
|
||||||
|
build-args: APP=${{ matrix.app }}
|
||||||
|
load: true
|
||||||
|
tags: vegaprotocol/${{ matrix.app }}:local
|
||||||
|
|
||||||
|
- name: Sanity check docker image
|
||||||
|
run: |
|
||||||
|
docker run --rm vegaprotocol/${{ matrix.app }}:local cat .env
|
||||||
|
docker run --rm vegaprotocol/${{ matrix.app }}:local ls -lah
|
||||||
|
|
||||||
|
- name: Build and push to DockerHub
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: ${{ inputs.publish || startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
file: dockerfiles/${{ matrix.app =='trading' && 'Dockerfile.next' || 'Dockerfile.cra' }}.dist
|
||||||
|
build-args: APP=${{ matrix.app }}
|
||||||
|
platforms: ${{ inputs.archs || 'linux/amd64, linux/arm64' }}
|
||||||
|
tags: |
|
||||||
|
vegaprotocol/${{ matrix.app }}:latest
|
||||||
|
vegaprotocol/${{ matrix.app }}:${{ steps.tags.outputs.version }}
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
@@ -8,7 +8,6 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- announcements
|
|
||||||
- ui-toolkit
|
- ui-toolkit
|
||||||
- react-helpers
|
- react-helpers
|
||||||
- tailwindcss-config
|
- tailwindcss-config
|
||||||
@@ -19,27 +18,29 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
name: Build & Publish - Tag
|
name: Build & Publish - Tag
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: 'read'
|
contents: 'read'
|
||||||
actions: 'read'
|
actions: 'read'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
- name: Setup node
|
fetch-depth: 0
|
||||||
|
- name: User Node.js 16
|
||||||
|
id: Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version: 16.15.1
|
||||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
- name: Restore node_modules from cache
|
||||||
cache: yarn
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
- name: Install root dependencies
|
- name: Install root dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: yarn nx build ${{inputs.project}}
|
run: yarn nx build ${{inputs.project}}
|
||||||
|
|
||||||
- name: Publish project to @vegaprotocol
|
- name: Publish project to @vegaprotocol
|
||||||
uses: JS-DevTools/npm-publish@v1
|
uses: JS-DevTools/npm-publish@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: Unit tests & build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
jobs:
|
||||||
|
pr:
|
||||||
|
name: Test and lint - PR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: 'read'
|
||||||
|
actions: 'read'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||||
|
uses: nrwl/nx-set-shas@v2
|
||||||
|
with:
|
||||||
|
main-branch-name: ${{ github.base_ref }}
|
||||||
|
- name: Use Node.js 16
|
||||||
|
id: Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16.15.1
|
||||||
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
- name: Install root dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
- name: Check formatting
|
||||||
|
run: yarn nx format:check
|
||||||
|
- name: Lint affected
|
||||||
|
run: yarn nx affected:lint --max-warnings=0
|
||||||
|
- name: Test affected
|
||||||
|
run: yarn nx affected:test
|
||||||
|
- name: Build affected
|
||||||
|
run: yarn nx affected:build
|
||||||
|
- name: Build affected spec
|
||||||
|
run: yarn nx affected --target=build-spec
|
||||||
@@ -46,6 +46,3 @@ cypress.env.json
|
|||||||
|
|
||||||
# Next.js
|
# Next.js
|
||||||
.next
|
.next
|
||||||
|
|
||||||
#cypress
|
|
||||||
/apps/trading-e2e/cypress/reports/
|
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ __generated___
|
|||||||
|
|
||||||
apps/static/src/assets/devnet-tranches.json
|
apps/static/src/assets/devnet-tranches.json
|
||||||
apps/static/src/assets/mainnet-tranches.json
|
apps/static/src/assets/mainnet-tranches.json
|
||||||
|
apps/static/src/assets/stagnet3-tranches.json
|
||||||
apps/static/src/assets/testnet-tranches.json
|
apps/static/src/assets/testnet-tranches.json
|
||||||
|
|||||||
Vendored
+19
-1
@@ -1,2 +1,20 @@
|
|||||||
@Library('vega-shared-library') _
|
@Library('vega-shared-library') _
|
||||||
runApprobation ignoreFailure: false, frontendBranch: env.BRANCH_NAME, type: 'frontend'
|
|
||||||
|
def commitHash = 'UNKNOWN'
|
||||||
|
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
options {
|
||||||
|
skipDefaultCheckout true
|
||||||
|
parallelsAlwaysFailFast()
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('approbation') {
|
||||||
|
steps {
|
||||||
|
sh 'printenv'
|
||||||
|
checkout scm
|
||||||
|
runApprobation ignoreFailure: false, frontendBranch: env.BRANCH_NAME, type: 'frontend'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Run `nx serve my-app` for a dev server. Navigate to the port specified in `app/<
|
|||||||
In order to generate the schemas for your GraphQL queries, you can run `GRAPHQL_SCHEMA_PATH=[YOUR SCHEMA FILE / API URL HERE] nx run types:generate`.
|
In order to generate the schemas for your GraphQL queries, you can run `GRAPHQL_SCHEMA_PATH=[YOUR SCHEMA FILE / API URL HERE] nx run types:generate`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export GRAPHQL_SCHEMA_PATH=https://api.n07.testnet.vega.xyz/graphql
|
export GRAPHQL_SCHEMA_PATH=https://api.n11.testnet.vega.xyz/graphql
|
||||||
yarn nx run types:generate
|
yarn nx run types:generate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||||
NX_TENDERMINT_URL=http://localhost:26617
|
NX_TENDERMINT_URL=http://localhost:26617
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
||||||
NX_VEGA_URL=http://localhost:3008/graphql
|
NX_VEGA_URL=http://localhost:3028/query
|
||||||
NX_VEGA_ENV=CUSTOM
|
NX_VEGA_ENV=CUSTOM
|
||||||
NX_VEGA_CONFIG_URL=
|
NX_VEGA_CONFIG_URL=
|
||||||
|
|
||||||
@@ -18,4 +18,4 @@ NX_EXPLORER_PARTIES=1
|
|||||||
NX_EXPLORER_VALIDATORS=1
|
NX_EXPLORER_VALIDATORS=1
|
||||||
|
|
||||||
CYPRESS_VEGA_WALLET_API_TOKEN=
|
CYPRESS_VEGA_WALLET_API_TOKEN=
|
||||||
CYPRESS_VEGA_URL=http://localhost:3008/graphql
|
CYPRESS_VEGA_URL=http://localhost:3028/query
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# App configuration variables
|
||||||
|
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||||
|
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
||||||
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
|
||||||
|
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
|
||||||
|
NX_VEGA_ENV=STAGNET3
|
||||||
|
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
|
||||||
|
|
||||||
|
# App flags
|
||||||
|
NX_EXPLORER_ASSETS=1
|
||||||
|
NX_EXPLORER_GENESIS=1
|
||||||
|
NX_EXPLORER_GOVERNANCE=1
|
||||||
|
NX_EXPLORER_MARKETS=1
|
||||||
|
NX_EXPLORER_ORACLES=1
|
||||||
|
NX_EXPLORER_TXS_LIST=0
|
||||||
|
NX_EXPLORER_NETWORK_PARAMETERS=1
|
||||||
|
NX_EXPLORER_PARTIES=1
|
||||||
|
NX_EXPLORER_VALIDATORS=1
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||||
NX_TENDERMINT_URL=https://tm.n07.testnet.vega.xyz/tm
|
NX_TENDERMINT_URL=https://tm.n07.testnet.vega.xyz/tm
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://lb.testnet.vega.xyz/tm/websocket
|
||||||
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql
|
||||||
NX_VEGA_ENV=TESTNET
|
NX_VEGA_ENV=TESTNET
|
||||||
NX_BLOCK_EXPLORER=https://be.testnet.vega.xyz/rest
|
NX_BLOCK_EXPLORER=https://be.testnet.vega.xyz/rest
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,10 @@ module.exports = defineConfig({
|
|||||||
chromeWebSecurity: false,
|
chromeWebSecurity: false,
|
||||||
viewportWidth: 1440,
|
viewportWidth: 1440,
|
||||||
viewportHeight: 900,
|
viewportHeight: 900,
|
||||||
testIsolation: false,
|
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
environment: 'CUSTOM',
|
environment: 'CUSTOM',
|
||||||
networkQueryUrl: 'http://localhost:3008/graphql',
|
networkQueryUrl: 'http://localhost:3028/query',
|
||||||
ethUrl: 'https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
|
ethUrl: 'https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8',
|
||||||
commitHash: 'dev',
|
commitHash: 'dev',
|
||||||
tsConfig: 'tsconfig.json',
|
tsConfig: 'tsconfig.json',
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
"governance.proposal.updateMarket.minVoterBalance",
|
"governance.proposal.updateMarket.minVoterBalance",
|
||||||
"governance.proposal.updateNetParam.minProposerBalance",
|
"governance.proposal.updateNetParam.minProposerBalance",
|
||||||
"governance.proposal.updateNetParam.minVoterBalance",
|
"governance.proposal.updateNetParam.minVoterBalance",
|
||||||
"governance.proposal.updateAsset.minProposerBalance",
|
|
||||||
"governance.proposal.updateAsset.minVoterBalance",
|
|
||||||
"reward.staking.delegation.maxPayoutPerEpoch",
|
"reward.staking.delegation.maxPayoutPerEpoch",
|
||||||
"reward.staking.delegation.maxPayoutPerParticipant",
|
"reward.staking.delegation.maxPayoutPerParticipant",
|
||||||
"reward.staking.delegation.minimumValidatorStake",
|
"reward.staking.delegation.minimumValidatorStake",
|
||||||
@@ -21,6 +19,9 @@
|
|||||||
"validators.delegation.minAmount"
|
"validators.delegation.minAmount"
|
||||||
],
|
],
|
||||||
"fiveDecimal": [
|
"fiveDecimal": [
|
||||||
|
"governance.proposal.updateAsset.minProposerBalance",
|
||||||
|
"governance.proposal.updateAsset.minVoterBalance",
|
||||||
|
"governance.proposal.updateAsset.requiredParticipation",
|
||||||
"market.fee.factors.infrastructureFee",
|
"market.fee.factors.infrastructureFee",
|
||||||
"market.fee.factors.makerFee",
|
"market.fee.factors.makerFee",
|
||||||
"market.liquidity.bondPenaltyParameter",
|
"market.liquidity.bondPenaltyParameter",
|
||||||
@@ -76,7 +77,6 @@
|
|||||||
"governance.proposal.updateNetParam.requiredMajority",
|
"governance.proposal.updateNetParam.requiredMajority",
|
||||||
"governance.proposal.updateNetParam.requiredParticipation",
|
"governance.proposal.updateNetParam.requiredParticipation",
|
||||||
"governance.proposal.updateMarket.minProposerEquityLikeShare",
|
"governance.proposal.updateMarket.minProposerEquityLikeShare",
|
||||||
"governance.proposal.updateAsset.requiredParticipation",
|
|
||||||
"validators.vote.required"
|
"validators.vote.required"
|
||||||
],
|
],
|
||||||
"duration": [
|
"duration": [
|
||||||
|
|||||||
@@ -6,39 +6,75 @@ context('Home Page', function () {
|
|||||||
describe('Stats page', { tags: '@smoke' }, function () {
|
describe('Stats page', { tags: '@smoke' }, function () {
|
||||||
const statsValue = '[data-testid="stats-value"]';
|
const statsValue = '[data-testid="stats-value"]';
|
||||||
|
|
||||||
|
it('Should show connected environment', function () {
|
||||||
|
const deployedEnv = Cypress.env('environment').toUpperCase();
|
||||||
|
cy.get('[data-testid="stats-environment"]').should(
|
||||||
|
'have.text',
|
||||||
|
`/ ${deployedEnv}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should show connected environment stats', function () {
|
it('should show connected environment stats', function () {
|
||||||
const statTitles = {
|
const statTitles = {
|
||||||
0: 'Status',
|
0: 'Status',
|
||||||
1: 'Epoch',
|
1: 'Height',
|
||||||
2: 'Block height',
|
2: 'Uptime',
|
||||||
3: 'Uptime',
|
3: 'Total nodes',
|
||||||
4: 'Total nodes',
|
4: 'Total staked',
|
||||||
5: 'Total staked',
|
5: 'Backlog',
|
||||||
6: 'Backlog',
|
6: 'Trades / second',
|
||||||
7: 'Trades / second',
|
7: 'Orders / block',
|
||||||
8: 'Orders / block',
|
8: 'Orders / second',
|
||||||
9: 'Orders / second',
|
9: 'Transactions / block',
|
||||||
10: 'Transactions / block',
|
10: 'Block time',
|
||||||
11: 'Block time',
|
11: 'Time',
|
||||||
12: 'Time',
|
12: 'App',
|
||||||
13: 'App',
|
13: 'Tendermint',
|
||||||
14: 'Tendermint',
|
14: 'Up since',
|
||||||
15: 'Up since',
|
15: 'Chain ID',
|
||||||
16: 'Chain ID',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cy.get('[data-testid="stats-title"]')
|
cy.get('[data-testid="stats-title"]')
|
||||||
.each(($list, index) => {
|
.each(($list, index) => {
|
||||||
cy.wrap($list).should('contain.text', statTitles[index]);
|
cy.wrap($list).should('have.text', statTitles[index]);
|
||||||
})
|
})
|
||||||
.then(($list) => {
|
.then(($list) => {
|
||||||
cy.wrap($list).should('have.length', 17);
|
cy.wrap($list).should('have.length', 16);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cy.get(statsValue).eq(0).should('have.text', 'CONNECTED');
|
||||||
|
cy.get(statsValue).eq(1).should('not.be.empty');
|
||||||
|
cy.get(statsValue)
|
||||||
|
.eq(2)
|
||||||
|
.invoke('text')
|
||||||
|
.should('match', /\d+d \d+h \d+m \d+s/i);
|
||||||
|
cy.get(statsValue).eq(3).should('have.text', '2');
|
||||||
|
cy.get(statsValue)
|
||||||
|
.eq(4)
|
||||||
|
.invoke('text')
|
||||||
|
.should('match', /\d+\.\d\d(?!\d)/i);
|
||||||
|
cy.get(statsValue).eq(5).should('have.text', '0');
|
||||||
|
cy.get(statsValue).eq(6).should('have.text', '0');
|
||||||
|
cy.get(statsValue).eq(7).should('have.text', '0');
|
||||||
|
cy.get(statsValue).eq(8).should('have.text', '0');
|
||||||
|
cy.get(statsValue).eq(9).should('not.be.empty');
|
||||||
|
cy.get(statsValue).eq(10).should('not.be.empty');
|
||||||
|
cy.get(statsValue).eq(11).should('not.be.empty');
|
||||||
|
cy.get(statsValue)
|
||||||
|
.eq(12)
|
||||||
|
.invoke('text')
|
||||||
|
.should('match', /v\d+\.\d+\.\d+/i);
|
||||||
|
cy.get(statsValue)
|
||||||
|
.eq(13)
|
||||||
|
.invoke('text')
|
||||||
|
.should('match', /\d+\.\d+\.\d+/i);
|
||||||
|
cy.get(statsValue).eq(14).should('not.be.empty');
|
||||||
|
cy.get(statsValue).eq(15).should('not.be.empty');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Block height should be updating', function () {
|
it('Block height should be updating', function () {
|
||||||
cy.get(statsValue)
|
cy.get(statsValue)
|
||||||
.eq(2)
|
.eq(1)
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.then((blockHeightTxt) => {
|
.then((blockHeightTxt) => {
|
||||||
cy.get(statsValue)
|
cy.get(statsValue)
|
||||||
@@ -50,4 +86,75 @@ context('Home Page', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Git info', function () {
|
||||||
|
it('git info is rendered on the footer of the page', function () {
|
||||||
|
cy.getByTestId('git-info').within(() => {
|
||||||
|
cy.getByTestId('git-network-data').within(() => {
|
||||||
|
cy.contains('Reading network data from').should('be.visible');
|
||||||
|
cy.get('span').should('have.text', Cypress.env('networkQueryUrl'));
|
||||||
|
cy.getByTestId('link').should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.getByTestId('git-eth-data').within(() => {
|
||||||
|
cy.contains('Reading Ethereum data from').should('be.visible');
|
||||||
|
cy.get('span').should('have.text', Cypress.env('ethUrl'));
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.getByTestId('git-commit-hash').within(() => {
|
||||||
|
cy.contains('Version/commit hash:').should('be.visible');
|
||||||
|
cy.getByTestId('link').should('have.text', Cypress.env('commitHash'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Search bar', function () {
|
||||||
|
it('Successful search for specific id by block id', function () {
|
||||||
|
const blockId = '973624';
|
||||||
|
search(blockId);
|
||||||
|
cy.url().should('include', blockId);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Successful search for specific id by tx hash', function () {
|
||||||
|
const txHash =
|
||||||
|
'9ED3718AA8308E7E08EC588EE7AADAF49711D2138860D8914B4D81A2054D9FB8';
|
||||||
|
search(txHash);
|
||||||
|
cy.url().should('include', txHash);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Successful search for specific id by tx id', function () {
|
||||||
|
const txId =
|
||||||
|
'0x61DCCEBB955087F50D0B85382DAE138EDA9631BF1A4F92E563D528904AA38898';
|
||||||
|
search(txId);
|
||||||
|
cy.url().should('include', txId);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Error message displayed when invalid search by wrong string length', function () {
|
||||||
|
search('9ED3718AA8308E7E08EC588EE7AADAF497D2138860D8914B4D81A2054D9FB8');
|
||||||
|
validateSearchError("Something doesn't look right");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Error message displayed when invalid search by invalid hash', function () {
|
||||||
|
search(
|
||||||
|
'9ED3718AA8308E7E08ECht8EE753DAF49711D2138860D8914B4D81A2054D9FB8'
|
||||||
|
);
|
||||||
|
validateSearchError('Transaction is not hexadecimal');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Error message displayed when searching empty field', function () {
|
||||||
|
cy.get('[data-testid="search"]').clear();
|
||||||
|
cy.get('[data-testid="search-button"]').click();
|
||||||
|
validateSearchError('Search required');
|
||||||
|
});
|
||||||
|
|
||||||
|
function search(searchTxt) {
|
||||||
|
cy.get('[data-testid="search"]').clear().type(searchTxt);
|
||||||
|
cy.get('[data-testid="search-button"]').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateSearchError(expectedError) {
|
||||||
|
cy.get('[data-testid="search-error"]').should('have.text', expectedError);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ context('Network parameters page', { tags: '@smoke' }, function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('should list each network parameter displayed as a currency value with four decimals - in the correct format', function () {
|
it('should list each network parameter displayed as a currency value with four decimals - in the correct format', function () {
|
||||||
cy.get_network_parameters().then((network_parameters) => {
|
cy.get_network_parameters().then((network_parameters) => {
|
||||||
network_parameters = Object.entries(network_parameters);
|
network_parameters = Object.entries(network_parameters);
|
||||||
network_parameters.forEach((network_parameter) => {
|
network_parameters.forEach((network_parameter) => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const customNodeBtn = 'custom-node';
|
|||||||
context.skip('Node switcher', { tags: '@regression' }, function () {
|
context.skip('Node switcher', { tags: '@regression' }, function () {
|
||||||
beforeEach('visit home page', function () {
|
beforeEach('visit home page', function () {
|
||||||
cy.intercept('GET', 'https://static.vega.xyz/assets/capsule-network.json', {
|
cy.intercept('GET', 'https://static.vega.xyz/assets/capsule-network.json', {
|
||||||
hosts: ['http://localhost:3008/graphql'],
|
hosts: ['http://localhost:3028/query'],
|
||||||
}).as('nodeData');
|
}).as('nodeData');
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.wait('@nodeData');
|
cy.wait('@nodeData');
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ context.skip('Parties page', { tags: '@regression' }, function () {
|
|||||||
balance type asset {id symbol decimals}}}}}}}}';
|
balance type asset {id symbol decimals}}}}}}}}';
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: `http://localhost:3008/graphql`,
|
url: `http://localhost:3028/query`,
|
||||||
body: {
|
body: {
|
||||||
query: mutation,
|
query: mutation,
|
||||||
},
|
},
|
||||||
|
|||||||
+8
-13
@@ -1,18 +1,13 @@
|
|||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
|
||||||
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
|
||||||
|
NX_VEGA_NETWORKS='{"SANDBOX":"https://sandbox.explorer.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz", "STAGNET3":"https://stagnet3.explorer.vega.xyz","VALIDATOR_TESTNET":"https://validator-testnet.fairground.wtf","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||||
|
NX_VEGA_ENV=STAGNET3
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
|
|
||||||
NX_VEGA_ENV=STAGNET1
|
|
||||||
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
|
||||||
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
|
|
||||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
|
||||||
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
|
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
|
|
||||||
NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest
|
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
|
||||||
NX_VEGA_GOVERNANCE_URL=https://stagnet1.token.vega.xyz
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.jsoo
|
|
||||||
|
|
||||||
# App flags
|
# App flags
|
||||||
NX_EXPLORER_ASSETS=1
|
NX_EXPLORER_ASSETS=1
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ NX_TENDERMINT_URL=http://localhost:26617
|
|||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
||||||
NX_VEGA_ENV=CUSTOM
|
NX_VEGA_ENV=CUSTOM
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
|
|
||||||
|
|
||||||
# App flags
|
# App flags
|
||||||
|
NX_EXPLORER_ASSETS=1
|
||||||
|
NX_EXPLORER_GENESIS=1
|
||||||
|
NX_EXPLORER_GOVERNANCE=1
|
||||||
|
NX_EXPLORER_MARKETS=1
|
||||||
|
NX_EXPLORER_ORACLES=1
|
||||||
NX_EXPLORER_TXS_LIST=0
|
NX_EXPLORER_TXS_LIST=0
|
||||||
|
NX_EXPLORER_NETWORK_PARAMETERS=1
|
||||||
|
NX_EXPLORER_PARTIES=1
|
||||||
|
NX_EXPLORER_VALIDATORS=1
|
||||||
|
|||||||
@@ -8,4 +8,3 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
|||||||
NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz
|
||||||
NX_VEGA_URL=https://api.devnet1.vega.xyz/graphql
|
NX_VEGA_URL=https://api.devnet1.vega.xyz/graphql
|
||||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
|
||||||
@@ -6,4 +6,3 @@ NX_VEGA_ENV=MAINNET
|
|||||||
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/
|
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/
|
||||||
NX_ETHERSCAN_URL=https://etherscan.io
|
NX_ETHERSCAN_URL=https://etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# App configuration variables
|
||||||
|
NX_TENDERMINT_URL=https://tm.be.mainnet-mirror.vega.xyz
|
||||||
|
NX_TENDERMINT_WEBSOCKET_URL=wss://be.mainnet-mirror.vega.xyz/websocket
|
||||||
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml
|
||||||
|
NX_VEGA_ENV=MIRROR
|
||||||
|
NX_BLOCK_EXPLORER=https://be.mainnet-mirror.vega.xyz/rest/
|
||||||
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
NX_VEGA_GOVERNANCE_URL=https://mainnet-mirror.token.vega.xyz
|
||||||
|
|
||||||
|
# App flags
|
||||||
|
NX_EXPLORER_ASSETS=1
|
||||||
|
NX_EXPLORER_GENESIS=1
|
||||||
|
NX_EXPLORER_GOVERNANCE=1
|
||||||
|
NX_EXPLORER_NETWORK_PARAMETERS=1
|
||||||
|
NX_EXPLORER_PARTIES=1
|
||||||
|
NX_EXPLORER_VALIDATORS=1
|
||||||
|
NX_EXPLORER_MARKETS=0
|
||||||
|
NX_EXPLORER_ORACLES=0
|
||||||
|
NX_EXPLORER_TXS_LIST=1
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# App configuration variables
|
||||||
|
NX_VEGA_ENV=SANDBOX
|
||||||
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/sandbox/vegawallet-sandbox.toml
|
||||||
|
NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz
|
||||||
|
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||||
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
NX_TENDERMINT_URL=https://tm.sandbox.vega.xyz
|
||||||
|
NX_TENDERMINT_WEBSOCKET_URL=wss://be.sandbox.vega.xyz/websocket
|
||||||
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
NX_VEGA_GOVERNANCE_URL=https://sandbox.token.vega.xyz
|
||||||
@@ -1 +1,13 @@
|
|||||||
# .env is stagnet1, so there are no overrides required
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||||
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
|
||||||
|
NX_VEGA_ENV=STAGNET1
|
||||||
|
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
||||||
|
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
|
||||||
|
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||||
|
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
|
||||||
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
|
||||||
|
NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest
|
||||||
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
NX_VEGA_GOVERNANCE_URL=https://stagnet1.token.vega.xyz
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
||||||
|
NX_TENDERMINT_WEBSOCKET_URL=wss://be.stagnet3.vega.xyz/websocket
|
||||||
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet3/vegawallet-stagnet3.toml
|
||||||
|
NX_VEGA_ENV=STAGNET3
|
||||||
|
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
|
||||||
|
NX_VEGA_GOVERNANCE_URL=https://stagnet3.token.vega.xyz
|
||||||
|
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega-dev-releases/releases/
|
||||||
@@ -8,4 +8,3 @@ NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
|||||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf
|
NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
NX_VEGA_ENV=VALIDATOR_TESTNET
|
NX_VEGA_ENV=VALIDATOR_TESTNET
|
||||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml
|
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml
|
||||||
NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql
|
NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql
|
||||||
NX_VEGA_REST=https://api-validators-testnet.vega.rocks/
|
NX_VEGA_REST=https://api.validators-testnet.vega.xyz/
|
||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
|
||||||
|
|
||||||
NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz
|
||||||
NX_TENDERMINT_URL=https://tm-be.validators-testnet.vega.rocks
|
NX_TENDERMINT_URL=https://tm.be.validators-testnet.vega.xyz
|
||||||
NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.rocks/rest
|
NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.xyz/rest
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26607/websocket
|
|||||||
NX_VEGA_ENV=CUSTOM
|
NX_VEGA_ENV=CUSTOM
|
||||||
NX_BLOCK_EXPLORER=
|
NX_BLOCK_EXPLORER=
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
|
|
||||||
|
|||||||
@@ -35,11 +35,12 @@ Example configurations are provided here:
|
|||||||
- [Devnet](./.env.devnet)
|
- [Devnet](./.env.devnet)
|
||||||
- [Capsule](./.env.capsule)
|
- [Capsule](./.env.capsule)
|
||||||
- [Testnet](./.env.testnet)
|
- [Testnet](./.env.testnet)
|
||||||
|
- [Stagnet3](./.env.stagnet3)
|
||||||
|
|
||||||
For convenience, you can boot the app injecting one of the configurations above by running:
|
For convenience, you can boot the app injecting one of the configurations above by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn nx run explorer:serve --env={env} # e.g. stagnet1
|
yarn nx run explorer:serve --env={env} # e.g. stagnet3
|
||||||
```
|
```
|
||||||
|
|
||||||
There are a few different configuration options offered for this app:
|
There are a few different configuration options offered for this app:
|
||||||
|
|||||||
@@ -1,21 +1,87 @@
|
|||||||
import { NetworkLoader, useInitializeEnv } from '@vegaprotocol/environment';
|
import { NetworkLoader, useInitializeEnv } from '@vegaprotocol/environment';
|
||||||
|
import { Header } from './components/header';
|
||||||
|
import { Main } from './components/main';
|
||||||
import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider';
|
import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider';
|
||||||
import { Loader, Splash } from '@vegaprotocol/ui-toolkit';
|
import { Footer } from './components/footer/footer';
|
||||||
|
import {
|
||||||
|
AnnouncementBanner,
|
||||||
|
ExternalLink,
|
||||||
|
Icon,
|
||||||
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
|
import {
|
||||||
|
AssetDetailsDialog,
|
||||||
|
useAssetDetailsDialogStore,
|
||||||
|
} from '@vegaprotocol/assets';
|
||||||
import { DEFAULT_CACHE_CONFIG } from '@vegaprotocol/apollo-client';
|
import { DEFAULT_CACHE_CONFIG } from '@vegaprotocol/apollo-client';
|
||||||
import { RouterProvider } from 'react-router-dom';
|
import classNames from 'classnames';
|
||||||
import { router } from './routes/router-config';
|
import { useState } from 'react';
|
||||||
|
|
||||||
const splashLoading = (
|
const DialogsContainer = () => {
|
||||||
<Splash>
|
const { isOpen, id, trigger, asJson, setOpen } = useAssetDetailsDialogStore();
|
||||||
<Loader />
|
return (
|
||||||
</Splash>
|
<AssetDetailsDialog
|
||||||
);
|
assetId={id}
|
||||||
|
trigger={trigger || null}
|
||||||
|
asJson={asJson}
|
||||||
|
open={isOpen}
|
||||||
|
onChange={setOpen}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const MainnetSimAd = () => {
|
||||||
|
const [shouldDisplayBanner, setShouldDisplayBanner] = useState<boolean>(true);
|
||||||
|
|
||||||
|
// Return an empty div so that the grid layout in _app.page.ts
|
||||||
|
// renders correctly
|
||||||
|
if (!shouldDisplayBanner) {
|
||||||
|
return <div />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnnouncementBanner>
|
||||||
|
<div className="grid grid-cols-[auto_1fr] gap-4 font-alpha calt uppercase text-center text-lg text-white">
|
||||||
|
<button
|
||||||
|
className="flex items-center"
|
||||||
|
onClick={() => setShouldDisplayBanner(false)}
|
||||||
|
>
|
||||||
|
<Icon name="cross" className="w-6 h-6" ariaLabel="dismiss" />
|
||||||
|
</button>
|
||||||
|
<div>
|
||||||
|
<span className="pr-4">Mainnet sim 3 is live!</span>
|
||||||
|
<ExternalLink href="https://fairground.wtf/">Learn more</ExternalLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</AnnouncementBanner>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<TendermintWebsocketProvider>
|
<TendermintWebsocketProvider>
|
||||||
<NetworkLoader cache={DEFAULT_CACHE_CONFIG}>
|
<NetworkLoader cache={DEFAULT_CACHE_CONFIG}>
|
||||||
<RouterProvider router={router} fallbackElement={splashLoading} />
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'max-w-[1500px] min-h-[100vh]',
|
||||||
|
'mx-auto my-0',
|
||||||
|
'grid grid-rows-[auto_1fr_auto] grid-cols-1',
|
||||||
|
'border-vega-light-200 dark:border-vega-dark-200 lg:border-l lg:border-r',
|
||||||
|
'antialiased text-black dark:text-white',
|
||||||
|
'overflow-hidden relative'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<Header />
|
||||||
|
<MainnetSimAd />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Main />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Footer />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<DialogsContainer />
|
||||||
</NetworkLoader>
|
</NetworkLoader>
|
||||||
</TendermintWebsocketProvider>
|
</TendermintWebsocketProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { t } from '@vegaprotocol/i18n';
|
|||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type { VegaICellRendererParams } from '@vegaprotocol/datagrid';
|
import type { VegaICellRendererParams } from '@vegaprotocol/datagrid';
|
||||||
import { useRef, useLayoutEffect } from 'react';
|
import { useRef, useLayoutEffect } from 'react';
|
||||||
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const Footer = () => {
|
|||||||
const [nodeSwitcherOpen, setNodeSwitcherOpen] = useState(false);
|
const [nodeSwitcherOpen, setNodeSwitcherOpen] = useState(false);
|
||||||
const { screenSize } = useScreenDimensions();
|
const { screenSize } = useScreenDimensions();
|
||||||
const showFullFeedbackLabel = useMemo(
|
const showFullFeedbackLabel = useMemo(
|
||||||
() => ['md', 'lg', 'xl', 'xxl', 'xxxl'].includes(screenSize),
|
() => ['lg', 'xl'].includes(screenSize),
|
||||||
[screenSize]
|
[screenSize]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jest.mock('../search', () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const renderComponent = () => (
|
const renderComponent = () => (
|
||||||
<MemoryRouter initialEntries={['/txs']}>
|
<MemoryRouter>
|
||||||
<Header />
|
<Header />
|
||||||
</MemoryRouter>
|
</MemoryRouter>
|
||||||
);
|
);
|
||||||
@@ -24,7 +24,6 @@ describe('Header', () => {
|
|||||||
|
|
||||||
expect(screen.getByTestId('navigation')).toHaveTextContent('Explorer');
|
expect(screen.getByTestId('navigation')).toHaveTextContent('Explorer');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render search', () => {
|
it('should render search', () => {
|
||||||
render(renderComponent());
|
render(renderComponent());
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { matchPath, useLocation, useMatch } from 'react-router-dom';
|
import { matchPath, useLocation } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
ThemeSwitcher,
|
ThemeSwitcher,
|
||||||
Navigation,
|
Navigation,
|
||||||
@@ -13,26 +13,23 @@ import { t } from '@vegaprotocol/i18n';
|
|||||||
import { Routes } from '../../routes/route-names';
|
import { Routes } from '../../routes/route-names';
|
||||||
import { NetworkSwitcher } from '@vegaprotocol/environment';
|
import { NetworkSwitcher } from '@vegaprotocol/environment';
|
||||||
import type { Navigable } from '../../routes/router-config';
|
import type { Navigable } from '../../routes/router-config';
|
||||||
import { isNavigable } from '../../routes/router-config';
|
import routerConfig from '../../routes/router-config';
|
||||||
import { routerConfig } from '../../routes/router-config';
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import compact from 'lodash/compact';
|
import compact from 'lodash/compact';
|
||||||
import { Search } from '../search';
|
import { Search } from '../search';
|
||||||
|
|
||||||
const routeToNavigationItem = (r: Navigable) => (
|
const routeToNavigationItem = (r: Navigable) => (
|
||||||
<NavigationItem key={r.handle.name}>
|
<NavigationItem key={r.name}>
|
||||||
<NavigationLink to={r.path}>{r.handle.text}</NavigationLink>
|
<NavigationLink to={r.path}>{r.text}</NavigationLink>
|
||||||
</NavigationItem>
|
</NavigationItem>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const Header = () => {
|
export const Header = () => {
|
||||||
const isHome = Boolean(useMatch(Routes.HOME));
|
|
||||||
const pages = routerConfig[0].children || [];
|
|
||||||
const mainItems = compact(
|
const mainItems = compact(
|
||||||
[Routes.TX, Routes.BLOCKS, Routes.ORACLES, Routes.VALIDATORS].map((n) =>
|
[Routes.TX, Routes.BLOCKS, Routes.ORACLES, Routes.VALIDATORS].map((n) =>
|
||||||
pages.find((r) => r.path === n)
|
routerConfig.find((r) => r.path === n)
|
||||||
)
|
)
|
||||||
).filter(isNavigable);
|
);
|
||||||
|
|
||||||
const groupedItems = compact(
|
const groupedItems = compact(
|
||||||
[
|
[
|
||||||
@@ -42,8 +39,8 @@ export const Header = () => {
|
|||||||
Routes.GOVERNANCE,
|
Routes.GOVERNANCE,
|
||||||
Routes.NETWORK_PARAMETERS,
|
Routes.NETWORK_PARAMETERS,
|
||||||
Routes.GENESIS,
|
Routes.GENESIS,
|
||||||
].map((n) => pages.find((r) => r.path === n))
|
].map((n) => routerConfig.find((r) => r.path === n))
|
||||||
).filter(isNavigable);
|
);
|
||||||
|
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
@@ -70,7 +67,7 @@ export const Header = () => {
|
|||||||
actions={
|
actions={
|
||||||
<>
|
<>
|
||||||
<ThemeSwitcher />
|
<ThemeSwitcher />
|
||||||
{!isHome && <Search />}
|
<Search />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
onResize={(width, el) => {
|
onResize={(width, el) => {
|
||||||
@@ -93,7 +90,7 @@ export const Header = () => {
|
|||||||
hide={[NavigationBreakpoint.Small, NavigationBreakpoint.Narrow]}
|
hide={[NavigationBreakpoint.Small, NavigationBreakpoint.Narrow]}
|
||||||
>
|
>
|
||||||
{mainItems.map(routeToNavigationItem)}
|
{mainItems.map(routeToNavigationItem)}
|
||||||
{groupedItems && groupedItems.length > 0 && (
|
{groupedItems && (
|
||||||
<NavigationItem>
|
<NavigationItem>
|
||||||
<NavigationTrigger isActive={Boolean(isOnOther)}>
|
<NavigationTrigger isActive={Boolean(isOnOther)}>
|
||||||
{t('Other')}
|
{t('Other')}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const AssetLink = ({
|
|||||||
if (asDialog) {
|
if (asDialog) {
|
||||||
open(assetId, e.target as HTMLElement);
|
open(assetId, e.target as HTMLElement);
|
||||||
} else {
|
} else {
|
||||||
navigate(`/${Routes.ASSETS}/${asset?.id}`);
|
navigate(`${Routes.ASSETS}/${asset?.id}`);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { AppRouter } from '../../routes';
|
||||||
|
|
||||||
|
export const Main = () => {
|
||||||
|
return (
|
||||||
|
<main className="p-4">
|
||||||
|
<AppRouter />
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,113 +1,143 @@
|
|||||||
|
import {
|
||||||
|
addDecimalsFormatNumber,
|
||||||
|
formatNumberPercentage,
|
||||||
|
getMarketExpiryDateFormatted,
|
||||||
|
} from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import type { MarketInfoWithData } from '@vegaprotocol/market-info';
|
import type { MarketInfoWithData } from '@vegaprotocol/market-info';
|
||||||
import { LiquidityInfoPanel } from '@vegaprotocol/market-info';
|
|
||||||
import { LiquidityMonitoringParametersInfoPanel } from '@vegaprotocol/market-info';
|
|
||||||
import {
|
|
||||||
InstrumentInfoPanel,
|
|
||||||
KeyDetailsInfoPanel,
|
|
||||||
LiquidityPriceRangeInfoPanel,
|
|
||||||
MetadataInfoPanel,
|
|
||||||
OracleInfoPanel,
|
|
||||||
RiskFactorsInfoPanel,
|
|
||||||
RiskModelInfoPanel,
|
|
||||||
RiskParametersInfoPanel,
|
|
||||||
SettlementAssetInfoPanel,
|
|
||||||
} from '@vegaprotocol/market-info';
|
|
||||||
import { MarketInfoTable } from '@vegaprotocol/market-info';
|
import { MarketInfoTable } from '@vegaprotocol/market-info';
|
||||||
import type { DataSourceDefinition } from '@vegaprotocol/types';
|
import {
|
||||||
import isEqual from 'lodash/isEqual';
|
MarketStateMapping,
|
||||||
|
MarketTradingModeMapping,
|
||||||
|
} from '@vegaprotocol/types';
|
||||||
|
import { AssetDetailsTable, useAssetDataProvider } from '@vegaprotocol/assets';
|
||||||
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { useMemo } from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
||||||
|
const quoteUnit = market?.tradableInstrument.instrument.product.quoteName;
|
||||||
|
const assetId = useMemo(
|
||||||
|
() => market?.tradableInstrument.instrument.product?.settlementAsset.id,
|
||||||
|
[market]
|
||||||
|
);
|
||||||
|
const { data: asset } = useAssetDataProvider(assetId ?? '');
|
||||||
|
|
||||||
if (!market) return null;
|
if (!market) return null;
|
||||||
|
|
||||||
const settlementData =
|
const keyDetails = {
|
||||||
market.tradableInstrument.instrument.product.dataSourceSpecForSettlementData
|
decimalPlaces: market.decimalPlaces,
|
||||||
.data;
|
positionDecimalPlaces: market.positionDecimalPlaces,
|
||||||
const terminationData =
|
tradingMode: market.tradingMode,
|
||||||
market.tradableInstrument.instrument.product
|
state: MarketStateMapping[market.state],
|
||||||
.dataSourceSpecForTradingTermination.data;
|
|
||||||
|
|
||||||
const getSigners = (data: DataSourceDefinition) => {
|
|
||||||
if (data.sourceType.__typename === 'DataSourceDefinitionExternal') {
|
|
||||||
const signers = data.sourceType.sourceType.signers || [];
|
|
||||||
|
|
||||||
return signers.map(({ signer }, i) => {
|
|
||||||
return (
|
|
||||||
(signer.__typename === 'ETHAddress' && signer.address) ||
|
|
||||||
(signer.__typename === 'PubKey' && signer.key)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
};
|
};
|
||||||
|
const assetDecimals =
|
||||||
|
market.tradableInstrument.instrument.product.settlementAsset.decimals;
|
||||||
|
|
||||||
const oraclePanels = isEqual(
|
const liquidityPriceRange = formatNumberPercentage(
|
||||||
getSigners(settlementData),
|
new BigNumber(market.lpPriceRange).times(100)
|
||||||
getSigners(terminationData)
|
);
|
||||||
)
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
title: t('Settlement Oracle'),
|
|
||||||
content: (
|
|
||||||
<OracleInfoPanel
|
|
||||||
noBorder={false}
|
|
||||||
market={market}
|
|
||||||
type="settlementData"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t('Termination Oracle'),
|
|
||||||
content: (
|
|
||||||
<OracleInfoPanel
|
|
||||||
noBorder={false}
|
|
||||||
market={market}
|
|
||||||
type="termination"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
title: t('Oracle'),
|
|
||||||
content: (
|
|
||||||
<OracleInfoPanel
|
|
||||||
noBorder={false}
|
|
||||||
market={market}
|
|
||||||
type="settlementData"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const panels = [
|
const panels = [
|
||||||
{
|
{
|
||||||
title: t('Key details'),
|
title: t('Key details'),
|
||||||
content: <KeyDetailsInfoPanel noBorder={false} market={market} />,
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={{
|
||||||
|
name: market.tradableInstrument.instrument.name,
|
||||||
|
marketID: market.id,
|
||||||
|
tradingMode:
|
||||||
|
keyDetails.tradingMode &&
|
||||||
|
MarketTradingModeMapping[keyDetails.tradingMode],
|
||||||
|
marketDecimalPlaces: market.decimalPlaces,
|
||||||
|
positionDecimalPlaces: market.positionDecimalPlaces,
|
||||||
|
settlementAssetDecimalPlaces: assetDecimals,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Instrument'),
|
title: t('Instrument'),
|
||||||
content: <InstrumentInfoPanel noBorder={false} market={market} />,
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={{
|
||||||
|
marketName: market.tradableInstrument.instrument.name,
|
||||||
|
code: market.tradableInstrument.instrument.code,
|
||||||
|
productType:
|
||||||
|
market.tradableInstrument.instrument.product.__typename,
|
||||||
|
...market.tradableInstrument.instrument.product,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Settlement asset'),
|
title: t('Settlement asset'),
|
||||||
content: <SettlementAssetInfoPanel market={market} noBorder={false} />,
|
content: asset ? (
|
||||||
|
<AssetDetailsTable
|
||||||
|
asset={asset}
|
||||||
|
inline={true}
|
||||||
|
noBorder={false}
|
||||||
|
dtClassName="text-black dark:text-white text-ui !px-0 !font-normal"
|
||||||
|
ddClassName="text-black dark:text-white text-ui !px-0 !font-normal max-w-full"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Splash>{t('No data')}</Splash>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Metadata'),
|
title: t('Metadata'),
|
||||||
content: <MetadataInfoPanel noBorder={false} market={market} />,
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={{
|
||||||
|
expiryDate: getMarketExpiryDateFormatted(
|
||||||
|
market.tradableInstrument.instrument.metadata.tags
|
||||||
|
),
|
||||||
|
...market.tradableInstrument.instrument.metadata.tags
|
||||||
|
?.map((tag) => {
|
||||||
|
const [key, value] = tag.split(':');
|
||||||
|
return { [key]: value };
|
||||||
|
})
|
||||||
|
.reduce((acc, curr) => ({ ...acc, ...curr }), {}),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Risk model'),
|
title: t('Risk model'),
|
||||||
content: <RiskModelInfoPanel noBorder={false} market={market} />,
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={market.tradableInstrument.riskModel}
|
||||||
|
unformatted={true}
|
||||||
|
omits={[]}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Risk parameters'),
|
title: t('Risk parameters'),
|
||||||
content: <RiskParametersInfoPanel noBorder={false} market={market} />,
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={market.tradableInstrument.riskModel.params}
|
||||||
|
unformatted={true}
|
||||||
|
omits={[]}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('Risk factors'),
|
title: t('Risk factors'),
|
||||||
content: <RiskFactorsInfoPanel noBorder={false} market={market} />,
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={market.riskFactors}
|
||||||
|
unformatted={true}
|
||||||
|
omits={['market', '__typename']}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
...(market.priceMonitoringSettings?.parameters?.triggers || []).map(
|
...(market.priceMonitoringSettings?.parameters?.triggers || []).map(
|
||||||
(trigger, i) => ({
|
(trigger, i) => ({
|
||||||
@@ -121,19 +151,14 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
|||||||
<>
|
<>
|
||||||
<MarketInfoTable
|
<MarketInfoTable
|
||||||
noBorder={false}
|
noBorder={false}
|
||||||
data={{
|
data={trigger}
|
||||||
maxValidPrice: trigger.maxValidPrice,
|
|
||||||
minValidPrice: trigger.minValidPrice,
|
|
||||||
}}
|
|
||||||
decimalPlaces={market.decimalPlaces}
|
decimalPlaces={market.decimalPlaces}
|
||||||
|
omits={['referencePrice', '__typename']}
|
||||||
/>
|
/>
|
||||||
<MarketInfoTable
|
<MarketInfoTable
|
||||||
noBorder={false}
|
noBorder={false}
|
||||||
data={{ referencePrice: trigger.referencePrice }}
|
data={{ referencePrice: trigger.referencePrice }}
|
||||||
decimalPlaces={
|
decimalPlaces={assetDecimals}
|
||||||
market.tradableInstrument.instrument.product.settlementAsset
|
|
||||||
.decimals
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
@@ -141,29 +166,85 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
|||||||
{
|
{
|
||||||
title: t('Liquidity monitoring parameters'),
|
title: t('Liquidity monitoring parameters'),
|
||||||
content: (
|
content: (
|
||||||
<LiquidityMonitoringParametersInfoPanel
|
<MarketInfoTable
|
||||||
noBorder={false}
|
noBorder={false}
|
||||||
market={market}
|
data={{
|
||||||
|
triggeringRatio:
|
||||||
|
market.liquidityMonitoringParameters.triggeringRatio,
|
||||||
|
...market.liquidityMonitoringParameters.targetStakeParameters,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t('Liquidity'),
|
|
||||||
content: <LiquidityInfoPanel market={market} noBorder={false} />,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t('Liquidity price range'),
|
title: t('Liquidity price range'),
|
||||||
content: (
|
content: (
|
||||||
<LiquidityPriceRangeInfoPanel market={market} noBorder={false} />
|
<>
|
||||||
|
<p className="text-xs mb-4">
|
||||||
|
{`For liquidity orders to count towards a commitment, they must be
|
||||||
|
within the liquidity monitoring bounds.`}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs mb-4">
|
||||||
|
{`The liquidity price range is a ${liquidityPriceRange} difference from the mid
|
||||||
|
price.`}
|
||||||
|
</p>
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={{
|
||||||
|
liquidityPriceRange: `${liquidityPriceRange} of mid price`,
|
||||||
|
lowestPrice:
|
||||||
|
market.data?.midPrice &&
|
||||||
|
`${addDecimalsFormatNumber(
|
||||||
|
new BigNumber(1)
|
||||||
|
.minus(market.lpPriceRange)
|
||||||
|
.times(market.data.midPrice)
|
||||||
|
.toString(),
|
||||||
|
market.decimalPlaces
|
||||||
|
)} ${quoteUnit}`,
|
||||||
|
highestPrice:
|
||||||
|
market.data?.midPrice &&
|
||||||
|
`${addDecimalsFormatNumber(
|
||||||
|
new BigNumber(1)
|
||||||
|
.plus(market.lpPriceRange)
|
||||||
|
.times(market.data.midPrice)
|
||||||
|
.toString(),
|
||||||
|
market.decimalPlaces
|
||||||
|
)} ${quoteUnit}`,
|
||||||
|
}}
|
||||||
|
></MarketInfoTable>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('Oracle'),
|
||||||
|
content: (
|
||||||
|
<MarketInfoTable
|
||||||
|
noBorder={false}
|
||||||
|
data={
|
||||||
|
market.tradableInstrument.instrument.product.dataSourceSpecBinding
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Link
|
||||||
|
className="text-xs hover:underline"
|
||||||
|
to={`/oracles#${market.tradableInstrument.instrument.product.dataSourceSpecForSettlementData.id}`}
|
||||||
|
>
|
||||||
|
{t('View settlement data oracle specification')}
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
className="text-xs hover:underline"
|
||||||
|
to={`/oracles#${market.tradableInstrument.instrument.product.dataSourceSpecForTradingTermination.id}`}
|
||||||
|
>
|
||||||
|
{t('View termination oracle specification')}
|
||||||
|
</Link>
|
||||||
|
</MarketInfoTable>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
...oraclePanels,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{panels.map((p) => (
|
{panels.map((p) => (
|
||||||
<div key={p.title} className="mb-3">
|
<div className="mb-3">
|
||||||
<h2 className="font-alpha calt text-xl">{p.title}</h2>
|
<h2 className="font-alpha calt text-xl">{p.title}</h2>
|
||||||
{p.content}
|
{p.content}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { t } from '@vegaprotocol/i18n';
|
|||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import type {
|
||||||
VegaICellRendererParams,
|
VegaICellRendererParams,
|
||||||
VegaValueGetterParams,
|
VegaValueGetterParams,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import SizeInMarket from '../size-in-market/size-in-market';
|
|||||||
export interface DeterministicOrderDetailsProps {
|
export interface DeterministicOrderDetailsProps {
|
||||||
id: string;
|
id: string;
|
||||||
// Version to fetch, with 0 being 'latest' and 1 being 'first'. Defaults to 0
|
// Version to fetch, with 0 being 'latest' and 1 being 'first'. Defaults to 0
|
||||||
version?: number | null;
|
version?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const wrapperClasses =
|
export const wrapperClasses =
|
||||||
@@ -28,7 +28,7 @@ export const wrapperClasses =
|
|||||||
*/
|
*/
|
||||||
const DeterministicOrderDetails = ({
|
const DeterministicOrderDetails = ({
|
||||||
id,
|
id,
|
||||||
version = null,
|
version = 0,
|
||||||
}: DeterministicOrderDetailsProps) => {
|
}: DeterministicOrderDetailsProps) => {
|
||||||
const { data, error } = useExplorerDeterministicOrderQuery({
|
const { data, error } = useExplorerDeterministicOrderQuery({
|
||||||
variables: { orderId: id, version },
|
variables: { orderId: id, version },
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { VoteProgress } from '@vegaprotocol/proposals';
|
|||||||
import type { AgGridReact } from 'ag-grid-react';
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import { AgGridLazy as AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import type {
|
||||||
VegaICellRendererParams,
|
VegaICellRendererParams,
|
||||||
VegaValueFormatterParams,
|
VegaValueFormatterParams,
|
||||||
@@ -12,10 +12,7 @@ import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|||||||
import type { RowClickedEvent } from 'ag-grid-community';
|
import type { RowClickedEvent } from 'ag-grid-community';
|
||||||
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import {
|
import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers';
|
||||||
NetworkParams,
|
|
||||||
useNetworkParams,
|
|
||||||
} from '@vegaprotocol/network-parameters';
|
|
||||||
import { ProposalStateMapping } from '@vegaprotocol/types';
|
import { ProposalStateMapping } from '@vegaprotocol/types';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment';
|
import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment';
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import { StatusMessage } from '../status-message';
|
import { StatusMessage } from '../status-message';
|
||||||
|
|
||||||
interface RenderFetchedProps {
|
interface RenderFetchedProps {
|
||||||
@@ -8,7 +7,6 @@ interface RenderFetchedProps {
|
|||||||
loading: boolean | undefined;
|
loading: boolean | undefined;
|
||||||
className?: string;
|
className?: string;
|
||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
refetch?: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RenderFetched = ({
|
export const RenderFetched = ({
|
||||||
@@ -17,7 +15,6 @@ export const RenderFetched = ({
|
|||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
errorMessage = t('Error retrieving data'),
|
errorMessage = t('Error retrieving data'),
|
||||||
refetch,
|
|
||||||
}: RenderFetchedProps) => {
|
}: RenderFetchedProps) => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -26,20 +23,7 @@ export const RenderFetched = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return <StatusMessage className={className}>{errorMessage}</StatusMessage>;
|
||||||
<>
|
|
||||||
<StatusMessage className={className}>{errorMessage}</StatusMessage>
|
|
||||||
{refetch && (
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
refetch();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t('Try again')}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { t } from '@vegaprotocol/i18n';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface RouteErrorBoundaryProps {
|
||||||
|
children: React.ReactElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class RouteErrorBoundary extends React.Component<
|
||||||
|
RouteErrorBoundaryProps,
|
||||||
|
{ hasError: boolean }
|
||||||
|
> {
|
||||||
|
constructor(props: RouteErrorBoundaryProps) {
|
||||||
|
super(props);
|
||||||
|
this.state = { hasError: false };
|
||||||
|
}
|
||||||
|
|
||||||
|
static getDerivedStateFromError() {
|
||||||
|
return { hasError: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
override componentDidCatch(error: Error) {
|
||||||
|
console.log(`Error caught in App error boundary ${error.message}`, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
override render() {
|
||||||
|
if (this.state.hasError) {
|
||||||
|
return <h1>{t('Something went wrong')}</h1>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.props.children;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,70 +1,189 @@
|
|||||||
import {
|
import {
|
||||||
determineType,
|
detectTypeByFetching,
|
||||||
|
detectTypeFromQuery,
|
||||||
|
getSearchType,
|
||||||
isBlock,
|
isBlock,
|
||||||
|
isHexadecimal,
|
||||||
isNetworkParty,
|
isNetworkParty,
|
||||||
|
isNonHex,
|
||||||
SearchTypes,
|
SearchTypes,
|
||||||
isHash,
|
toHex,
|
||||||
|
toNonHex,
|
||||||
} from './detect-search';
|
} from './detect-search';
|
||||||
|
import { DATA_SOURCES } from '../../config';
|
||||||
|
|
||||||
global.fetch = jest.fn();
|
global.fetch = jest.fn();
|
||||||
|
|
||||||
describe('Detect Search', () => {
|
describe('Detect Search', () => {
|
||||||
it.each([
|
it("should detect that it's a hexadecimal", () => {
|
||||||
['0000000000000000000000000000000000000000000000000000000000000000', true],
|
const expected = true;
|
||||||
['0000000000000000000000000000000000000000000000000000000000000001', true],
|
const testString =
|
||||||
[
|
'0x073ceaab59e5f2dd0561dec4883e7ee5bc7165cd4de34717a3ab8f2cbe3007f9';
|
||||||
'LOOONG0000000000000000000000000000000000000000000000000000000000000000',
|
const actual = isHexadecimal(testString);
|
||||||
false,
|
expect(actual).toBe(expected);
|
||||||
],
|
});
|
||||||
['xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', false],
|
|
||||||
['something else', false],
|
it("should detect that it's not hexadecimal", () => {
|
||||||
])("should detect that it's a hash", (input, expected) => {
|
const expected = true;
|
||||||
expect(isHash(input)).toBe(expected);
|
const testString =
|
||||||
|
'073ceaab59e5f2dd0561dec4883e7ee5bc7165cd4de34717a3ab8f2cbe3007f9';
|
||||||
|
const actual = isNonHex(testString);
|
||||||
|
expect(actual).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should detect that it's a network party", () => {
|
it("should detect that it's a network party", () => {
|
||||||
expect(isNetworkParty('network')).toBe(true);
|
const expected = true;
|
||||||
expect(isNetworkParty('web')).toBe(false);
|
const testString = 'network';
|
||||||
|
const actual = isNetworkParty(testString);
|
||||||
|
expect(actual).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should detect that it's a block", () => {
|
it("should detect that it's a block", () => {
|
||||||
expect(isBlock('123')).toBe(true);
|
const expected = true;
|
||||||
expect(isBlock('x123')).toBe(false);
|
const testString = '3188';
|
||||||
|
const actual = isBlock(testString);
|
||||||
|
expect(actual).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it('should convert from non-hex to hex', () => {
|
||||||
[
|
const expected = '0x123';
|
||||||
'0000000000000000000000000000000000000000000000000000000000000000',
|
const testString = '123';
|
||||||
SearchTypes.Transaction,
|
const actual = toHex(testString);
|
||||||
],
|
expect(actual).toBe(expected);
|
||||||
[
|
});
|
||||||
'0000000000000000000000000000000000000000000000000000000000000001',
|
|
||||||
SearchTypes.Party,
|
it('should convert from hex to non-hex', () => {
|
||||||
],
|
const expected = '123';
|
||||||
['123', SearchTypes.Block],
|
const testString = '0x123';
|
||||||
['network', SearchTypes.Party],
|
const actual = toNonHex(testString);
|
||||||
['something else', SearchTypes.Unknown],
|
expect(actual).toBe(expected);
|
||||||
])(
|
});
|
||||||
"detectTypeByFetching should call fetch with non-hex query it's a transaction",
|
|
||||||
async (input, type) => {
|
it("should detect type client side from query if it's a hexadecimal", () => {
|
||||||
// @ts-ignore issue related to polyfill
|
const expected = [SearchTypes.Party, SearchTypes.Transaction];
|
||||||
fetch.mockImplementation(
|
const testString =
|
||||||
jest.fn(() =>
|
'0x4624293CFE3D8B67A0AB448BAFF8FBCF1A1B770D9D5F263761D3D6CBEA94D97F';
|
||||||
Promise.resolve({
|
const actual = detectTypeFromQuery(testString);
|
||||||
ok:
|
expect(actual).toStrictEqual(expected);
|
||||||
input ===
|
});
|
||||||
'0000000000000000000000000000000000000000000000000000000000000000',
|
|
||||||
json: () =>
|
it("should detect type client side from query if it's a non hex", () => {
|
||||||
Promise.resolve({
|
const expected = [SearchTypes.Party, SearchTypes.Transaction];
|
||||||
transaction: {
|
const testString =
|
||||||
hash: input,
|
'4624293CFE3D8B67A0AB448BAFF8FBCF1A1B770D9D5F263761D3D6CBEA94D97F';
|
||||||
},
|
const actual = detectTypeFromQuery(testString);
|
||||||
}),
|
expect(actual).toStrictEqual(expected);
|
||||||
})
|
});
|
||||||
)
|
|
||||||
);
|
it("should detect type client side from query if it's a network party", () => {
|
||||||
const result = await determineType(input);
|
const expected = [SearchTypes.Party];
|
||||||
expect(result).toBe(type);
|
const testString = 'network';
|
||||||
}
|
const actual = detectTypeFromQuery(testString);
|
||||||
);
|
expect(actual).toStrictEqual(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should detect type client side from query if it's a block (number)", () => {
|
||||||
|
const expected = [SearchTypes.Block];
|
||||||
|
const testString = '23432';
|
||||||
|
const actual = detectTypeFromQuery(testString);
|
||||||
|
expect(actual).toStrictEqual(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("detectTypeByFetching should call fetch with non-hex query it's a transaction", async () => {
|
||||||
|
const query = '0xabc';
|
||||||
|
const type = SearchTypes.Transaction;
|
||||||
|
// @ts-ignore issue related to polyfill
|
||||||
|
fetch.mockImplementation(
|
||||||
|
jest.fn(() =>
|
||||||
|
Promise.resolve({
|
||||||
|
ok: true,
|
||||||
|
json: () =>
|
||||||
|
Promise.resolve({
|
||||||
|
transaction: {
|
||||||
|
hash: query,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const result = await detectTypeByFetching(query);
|
||||||
|
expect(fetch).toHaveBeenCalledWith(
|
||||||
|
`${DATA_SOURCES.blockExplorerUrl}/transactions/${toNonHex(query)}`
|
||||||
|
);
|
||||||
|
expect(result).toBe(type);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("detectTypeByFetching should call fetch with non-hex query it's a party", async () => {
|
||||||
|
const query = 'abc';
|
||||||
|
const type = SearchTypes.Party;
|
||||||
|
// @ts-ignore issue related to polyfill
|
||||||
|
fetch.mockImplementation(
|
||||||
|
jest.fn(() =>
|
||||||
|
Promise.resolve({
|
||||||
|
ok: false,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const result = await detectTypeByFetching(query);
|
||||||
|
expect(result).toBe(type);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getSearchType should return party from fetch response', async () => {
|
||||||
|
const query =
|
||||||
|
'0x4624293CFE3D8B67A0AB448BAFF8FBCF1A1B770D9D5F263761D3D6CBEA94D97F';
|
||||||
|
const expected = SearchTypes.Party;
|
||||||
|
// @ts-ignore issue related to polyfill
|
||||||
|
fetch.mockImplementation(
|
||||||
|
jest.fn(() =>
|
||||||
|
Promise.resolve({
|
||||||
|
ok: false,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const result = await getSearchType(query);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getSearchType should return transaction from fetch response', async () => {
|
||||||
|
const query =
|
||||||
|
'4624293CFE3D8B67A0AB448BAFF8FBCF1A1B770D9D5F263761D3D6CBEA94D97F';
|
||||||
|
const expected = SearchTypes.Transaction;
|
||||||
|
// @ts-ignore issue related to polyfill
|
||||||
|
fetch.mockImplementation(
|
||||||
|
jest.fn(() =>
|
||||||
|
Promise.resolve({
|
||||||
|
ok: true,
|
||||||
|
json: () =>
|
||||||
|
Promise.resolve({
|
||||||
|
transaction: {
|
||||||
|
hash: query,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const result = await getSearchType(query);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getSearchType should return undefined from transaction response', async () => {
|
||||||
|
const query = 'u';
|
||||||
|
const expected = undefined;
|
||||||
|
const result = await getSearchType(query);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getSearchType should return block if query is number', async () => {
|
||||||
|
const query = '123';
|
||||||
|
const expected = SearchTypes.Block;
|
||||||
|
const result = await getSearchType(query);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('getSearchType should return party if query is network', async () => {
|
||||||
|
const query = 'network';
|
||||||
|
const expected = SearchTypes.Party;
|
||||||
|
const result = await getSearchType(query);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { remove0x } from '@vegaprotocol/utils';
|
|
||||||
import { DATA_SOURCES } from '../../config';
|
import { DATA_SOURCES } from '../../config';
|
||||||
import type { BlockExplorerTransaction } from '../../routes/types/block-explorer-response';
|
import type { BlockExplorerTransaction } from '../../routes/types/block-explorer-response';
|
||||||
|
|
||||||
@@ -7,20 +6,15 @@ export enum SearchTypes {
|
|||||||
Party = 'party',
|
Party = 'party',
|
||||||
Block = 'block',
|
Block = 'block',
|
||||||
Order = 'order',
|
Order = 'order',
|
||||||
Unknown = 'unknown',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HASH_LENGTH = 64;
|
export const TX_LENGTH = 64;
|
||||||
|
|
||||||
export const isHash = (value: string) =>
|
|
||||||
/[0-9a-fA-F]+/.test(remove0x(value)) &&
|
|
||||||
remove0x(value).length === HASH_LENGTH;
|
|
||||||
|
|
||||||
export const isHexadecimal = (search: string) =>
|
export const isHexadecimal = (search: string) =>
|
||||||
search.startsWith('0x') && search.length === 2 + HASH_LENGTH;
|
search.startsWith('0x') && search.length === 2 + TX_LENGTH;
|
||||||
|
|
||||||
export const isNonHex = (search: string) =>
|
export const isNonHex = (search: string) =>
|
||||||
!search.startsWith('0x') && search.length === HASH_LENGTH;
|
!search.startsWith('0x') && search.length === TX_LENGTH;
|
||||||
|
|
||||||
export const isBlock = (search: string) => !Number.isNaN(Number(search));
|
export const isBlock = (search: string) => !Number.isNaN(Number(search));
|
||||||
|
|
||||||
@@ -29,44 +23,121 @@ export const isNetworkParty = (search: string) => search === 'network';
|
|||||||
export const toHex = (query: string) =>
|
export const toHex = (query: string) =>
|
||||||
isHexadecimal(query) ? query : `0x${query}`;
|
isHexadecimal(query) ? query : `0x${query}`;
|
||||||
|
|
||||||
export const toNonHex = remove0x;
|
export const toNonHex = (query: string) =>
|
||||||
|
isNonHex(query) ? query : `${query.replace('0x', '')}`;
|
||||||
|
|
||||||
/**
|
export const detectTypeFromQuery = (
|
||||||
* Determine the type of the given query
|
query: string
|
||||||
*/
|
): SearchTypes[] | undefined => {
|
||||||
export const determineType = async (query: string): Promise<SearchTypes> => {
|
const i = query.toLowerCase();
|
||||||
const value = query.toLowerCase();
|
|
||||||
if (isHash(value)) {
|
if (isHexadecimal(i) || isNonHex(i)) {
|
||||||
// it can be either `SearchTypes.Party` or `SearchTypes.Transaction`
|
return [SearchTypes.Party, SearchTypes.Transaction];
|
||||||
if (await isTransactionHash(value)) {
|
} else if (isNetworkParty(i)) {
|
||||||
return SearchTypes.Transaction;
|
return [SearchTypes.Party];
|
||||||
} else {
|
} else if (isBlock(i)) {
|
||||||
return SearchTypes.Party;
|
return [SearchTypes.Block];
|
||||||
}
|
|
||||||
} else if (isNetworkParty(value)) {
|
|
||||||
return SearchTypes.Party;
|
|
||||||
} else if (isBlock(value)) {
|
|
||||||
return SearchTypes.Block;
|
|
||||||
}
|
}
|
||||||
return SearchTypes.Unknown;
|
|
||||||
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
export const detectTypeByFetching = async (
|
||||||
* Checks if given input is a transaction hash by querying the transactions
|
query: string
|
||||||
* endpoint
|
): Promise<SearchTypes | undefined> => {
|
||||||
*/
|
const hash = toNonHex(query);
|
||||||
export const isTransactionHash = async (input: string): Promise<boolean> => {
|
|
||||||
const hash = remove0x(input);
|
|
||||||
const request = await fetch(
|
const request = await fetch(
|
||||||
`${DATA_SOURCES.blockExplorerUrl}/transactions/${hash}`
|
`${DATA_SOURCES.blockExplorerUrl}/transactions/${hash}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (request?.ok) {
|
if (request?.ok) {
|
||||||
const body: BlockExplorerTransaction = await request.json();
|
const body: BlockExplorerTransaction = await request.json();
|
||||||
|
|
||||||
if (body?.transaction) {
|
if (body?.transaction) {
|
||||||
return true;
|
return SearchTypes.Transaction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return SearchTypes.Party;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Code commented out because the current solution to detect a hex is temporary (by process of elimination)
|
||||||
|
// export const detectTypeByFetching = async (
|
||||||
|
// query: string,
|
||||||
|
// type: SearchTypes
|
||||||
|
// ): Promise<SearchTypes | undefined> => {
|
||||||
|
// const TYPES = [SearchTypes.Party, SearchTypes.Transaction];
|
||||||
|
//
|
||||||
|
// if (!TYPES.includes(type)) {
|
||||||
|
// throw new Error('Search type provided not recognised');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (type === SearchTypes.Transaction) {
|
||||||
|
// const hash = toNonHex(query);
|
||||||
|
// const request = await fetch(
|
||||||
|
// `${DATA_SOURCES.blockExplorerUrl}/transactions/${hash}`
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (request?.ok) {
|
||||||
|
// const body: BlockExplorerTransaction = await request.json();
|
||||||
|
//
|
||||||
|
// if (body?.transaction) {
|
||||||
|
// return SearchTypes.Transaction;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else if (type === SearchTypes.Party) {
|
||||||
|
// const party = toNonHex(query);
|
||||||
|
//
|
||||||
|
// const request = await fetch(
|
||||||
|
// `${DATA_SOURCES.blockExplorerUrl}/transactions?limit=1&filters[tx.submitter]=${party}`
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (request.ok) {
|
||||||
|
// const body: BlockExplorerTransactions = await request.json();
|
||||||
|
//
|
||||||
|
// if (body?.transactions?.length) {
|
||||||
|
// return SearchTypes.Party;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return undefined;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// export const getSearchType = async (
|
||||||
|
// query: string
|
||||||
|
// ): Promise<SearchTypes | undefined> => {
|
||||||
|
// const searchTypes = detectTypeFromQuery(query);
|
||||||
|
// const hasResults = searchTypes?.length;
|
||||||
|
//
|
||||||
|
// if (hasResults) {
|
||||||
|
// if (hasResults > 1) {
|
||||||
|
// const promises = searchTypes.map((type) =>
|
||||||
|
// detectTypeByFetching(query, type)
|
||||||
|
// );
|
||||||
|
// const results = await Promise.all(promises);
|
||||||
|
// return results.find((result) => result !== undefined);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return searchTypes[0];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return undefined;
|
||||||
|
// };
|
||||||
|
|
||||||
|
export const getSearchType = async (
|
||||||
|
query: string
|
||||||
|
): Promise<SearchTypes | undefined> => {
|
||||||
|
const searchTypes = detectTypeFromQuery(query);
|
||||||
|
const hasResults = searchTypes?.length;
|
||||||
|
|
||||||
|
if (hasResults) {
|
||||||
|
if (hasResults > 1) {
|
||||||
|
return await detectTypeByFetching(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
return searchTypes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,82 +1,157 @@
|
|||||||
import {
|
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||||
act,
|
import { Search } from './search';
|
||||||
fireEvent,
|
|
||||||
render,
|
|
||||||
screen,
|
|
||||||
waitFor,
|
|
||||||
} from '@testing-library/react';
|
|
||||||
import { SearchForm } from './search';
|
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import { Routes } from '../../routes/route-names';
|
import { Routes } from '../../routes/route-names';
|
||||||
|
import { SearchTypes, getSearchType } from './detect-search';
|
||||||
|
|
||||||
global.fetch = jest.fn();
|
|
||||||
const mockedNavigate = jest.fn();
|
const mockedNavigate = jest.fn();
|
||||||
|
const mockGetSearchType = getSearchType as jest.MockedFunction<
|
||||||
|
typeof getSearchType
|
||||||
|
>;
|
||||||
|
|
||||||
jest.mock('react-router-dom', () => ({
|
jest.mock('react-router-dom', () => ({
|
||||||
...jest.requireActual('react-router-dom'),
|
...jest.requireActual('react-router-dom'),
|
||||||
useNavigate: () => mockedNavigate,
|
useNavigate: () => mockedNavigate,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
jest.mock('./detect-search', () => ({
|
||||||
|
...jest.requireActual('./detect-search'),
|
||||||
|
getSearchType: jest.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockedNavigate.mockClear();
|
mockedNavigate.mockClear();
|
||||||
});
|
});
|
||||||
|
|
||||||
const renderComponent = () =>
|
const renderComponent = () => (
|
||||||
render(
|
<MemoryRouter>
|
||||||
<MemoryRouter>
|
<Search />
|
||||||
<SearchForm />
|
</MemoryRouter>
|
||||||
</MemoryRouter>
|
);
|
||||||
);
|
|
||||||
|
|
||||||
describe('SearchForm', () => {
|
const getInputs = () => ({
|
||||||
|
input: screen.getByTestId('search'),
|
||||||
|
button: screen.getByTestId('search-button'),
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Search', () => {
|
||||||
it('should render search input and button', () => {
|
it('should render search input and button', () => {
|
||||||
renderComponent();
|
render(renderComponent());
|
||||||
expect(screen.getByTestId('search')).toBeInTheDocument();
|
expect(screen.getByTestId('search')).toBeInTheDocument();
|
||||||
expect(screen.getByTestId('search-button')).toHaveTextContent('Search');
|
expect(screen.getByTestId('search-button')).toHaveTextContent('Search');
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it('should render error if input is not known', async () => {
|
||||||
[
|
render(renderComponent());
|
||||||
Routes.TX,
|
const { button, input } = getInputs();
|
||||||
'0000000000000000000000000000000000000000000000000000000000000000',
|
fireEvent.change(input, { target: { value: 'asd' } });
|
||||||
],
|
fireEvent.click(button);
|
||||||
[
|
|
||||||
Routes.PARTIES,
|
expect(await screen.findByTestId('search-error')).toHaveTextContent(
|
||||||
'0000000000000000000000000000000000000000000000000000000000000001',
|
'Transaction type is not recognised'
|
||||||
],
|
|
||||||
[Routes.BLOCKS, '123'],
|
|
||||||
[undefined, 'something else'],
|
|
||||||
])('should redirect to %s', async (route, input) => {
|
|
||||||
// @ts-ignore issue related to polyfill
|
|
||||||
fetch.mockImplementation(
|
|
||||||
jest.fn(() =>
|
|
||||||
Promise.resolve({
|
|
||||||
ok:
|
|
||||||
input ===
|
|
||||||
'0000000000000000000000000000000000000000000000000000000000000000',
|
|
||||||
json: () =>
|
|
||||||
Promise.resolve({
|
|
||||||
transaction: {
|
|
||||||
hash: input,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
renderComponent();
|
});
|
||||||
await act(async () => {
|
|
||||||
fireEvent.change(screen.getByTestId('search'), {
|
it('should render error if no input is given', async () => {
|
||||||
target: {
|
render(renderComponent());
|
||||||
value: input,
|
const { button } = getInputs();
|
||||||
},
|
|
||||||
});
|
fireEvent.click(button);
|
||||||
fireEvent.click(screen.getByTestId('search-button'));
|
|
||||||
|
expect(await screen.findByTestId('search-error')).toHaveTextContent(
|
||||||
|
'Search query required'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to transactions page', async () => {
|
||||||
|
render(renderComponent());
|
||||||
|
const { button, input } = getInputs();
|
||||||
|
mockGetSearchType.mockResolvedValue(SearchTypes.Transaction);
|
||||||
|
fireEvent.change(input, {
|
||||||
|
target: {
|
||||||
|
value:
|
||||||
|
'0x1234567890123456789012345678901234567890123456789012345678901234',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fireEvent.click(button);
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(mockedNavigate).toBeCalledTimes(route ? 1 : 0);
|
expect(mockedNavigate).toBeCalledWith(
|
||||||
if (route) {
|
`${Routes.TX}/0x1234567890123456789012345678901234567890123456789012345678901234`
|
||||||
// eslint-disable-next-line jest/no-conditional-expect
|
);
|
||||||
expect(mockedNavigate).toBeCalledWith(`${route}/${input}`);
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
|
it('should redirect to transactions page without proceeding 0x', async () => {
|
||||||
|
render(renderComponent());
|
||||||
|
const { button, input } = getInputs();
|
||||||
|
mockGetSearchType.mockResolvedValue(SearchTypes.Transaction);
|
||||||
|
fireEvent.change(input, {
|
||||||
|
target: {
|
||||||
|
value:
|
||||||
|
'1234567890123456789012345678901234567890123456789012345678901234',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fireEvent.click(button);
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(mockedNavigate).toBeCalledWith(
|
||||||
|
`${Routes.TX}/0x1234567890123456789012345678901234567890123456789012345678901234`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to parties page', async () => {
|
||||||
|
render(renderComponent());
|
||||||
|
const { button, input } = getInputs();
|
||||||
|
mockGetSearchType.mockResolvedValue(SearchTypes.Party);
|
||||||
|
fireEvent.change(input, {
|
||||||
|
target: {
|
||||||
|
value:
|
||||||
|
'0x1234567890123456789012345678901234567890123456789012345678901234',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fireEvent.click(button);
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(mockedNavigate).toBeCalledWith(
|
||||||
|
`${Routes.PARTIES}/0x1234567890123456789012345678901234567890123456789012345678901234`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to parties page without proceeding 0x', async () => {
|
||||||
|
render(renderComponent());
|
||||||
|
const { button, input } = getInputs();
|
||||||
|
mockGetSearchType.mockResolvedValue(SearchTypes.Party);
|
||||||
|
fireEvent.change(input, {
|
||||||
|
target: {
|
||||||
|
value:
|
||||||
|
'1234567890123456789012345678901234567890123456789012345678901234',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fireEvent.click(button);
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(mockedNavigate).toBeCalledWith(
|
||||||
|
`${Routes.PARTIES}/0x1234567890123456789012345678901234567890123456789012345678901234`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to blocks page if passed a number', async () => {
|
||||||
|
render(renderComponent());
|
||||||
|
const { button, input } = getInputs();
|
||||||
|
mockGetSearchType.mockResolvedValue(SearchTypes.Block);
|
||||||
|
fireEvent.change(input, {
|
||||||
|
target: {
|
||||||
|
value: '123',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
fireEvent.click(button);
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(mockedNavigate).toBeCalledWith(`${Routes.BLOCKS}/123`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { Button, Input, InputError } from '@vegaprotocol/ui-toolkit';
|
import { Button, Input, InputError } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { getSearchType, SearchTypes, toHex } from './detect-search';
|
||||||
import { Routes } from '../../routes/route-names';
|
import { Routes } from '../../routes/route-names';
|
||||||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { remove0x } from '@vegaprotocol/utils';
|
|
||||||
import { determineType, isBlock, isHash, SearchTypes } from './detect-search';
|
|
||||||
|
|
||||||
interface FormFields {
|
interface FormFields {
|
||||||
search: string;
|
search: string;
|
||||||
@@ -31,26 +30,101 @@ const MagnifyingGlass = () => (
|
|||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
||||||
const Clear = () => (
|
|
||||||
<svg
|
|
||||||
className="w-3 h-3"
|
|
||||||
viewBox="0 0 12 12"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M11.3748 1.37478L1.37478 11.3748L0.625244 10.6252L10.6252 0.625244L11.3748 1.37478Z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M1.37478 0.625244L11.3748 10.6252L10.6252 11.3748L0.625244 1.37478L1.37478 0.625244Z"
|
|
||||||
fill="currentColor"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
);
|
|
||||||
|
|
||||||
export const Search = () => {
|
export const Search = () => {
|
||||||
const searchForm = <SearchForm />;
|
const { register, handleSubmit } = useForm<FormFields>();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [error, setError] = useState<Error | null>(null);
|
||||||
|
|
||||||
|
const onSubmit = useCallback(
|
||||||
|
async (fields: FormFields) => {
|
||||||
|
setError(null);
|
||||||
|
|
||||||
|
const query = fields.search;
|
||||||
|
|
||||||
|
if (!query) {
|
||||||
|
return setError(new Error(t('Search query required')));
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await getSearchType(query);
|
||||||
|
const urlAsHex = toHex(query);
|
||||||
|
const unrecognisedError = new Error(
|
||||||
|
t('Transaction type is not recognised')
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
switch (result) {
|
||||||
|
case SearchTypes.Party:
|
||||||
|
return navigate(`${Routes.PARTIES}/${urlAsHex}`);
|
||||||
|
case SearchTypes.Transaction:
|
||||||
|
return navigate(`${Routes.TX}/${urlAsHex}`);
|
||||||
|
case SearchTypes.Block:
|
||||||
|
return navigate(`${Routes.BLOCKS}/${Number(query)}`);
|
||||||
|
default:
|
||||||
|
return setError(unrecognisedError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return setError(unrecognisedError);
|
||||||
|
},
|
||||||
|
[navigate]
|
||||||
|
);
|
||||||
|
|
||||||
|
const searchForm = (
|
||||||
|
<form className="block min-w-[290px]" onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<div className="flex relative items-stretch gap-2 text-xs">
|
||||||
|
<label htmlFor="search" className="sr-only">
|
||||||
|
{t('Search by block number or transaction hash')}
|
||||||
|
</label>
|
||||||
|
<button
|
||||||
|
className={classNames(
|
||||||
|
'absolute top-[50%] translate-y-[-50%] left-2',
|
||||||
|
'text-vega-light-300 dark:text-vega-dark-300'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<MagnifyingGlass />
|
||||||
|
</button>
|
||||||
|
<Input
|
||||||
|
{...register('search')}
|
||||||
|
id="search"
|
||||||
|
data-testid="search"
|
||||||
|
className={classNames(
|
||||||
|
'peer',
|
||||||
|
'pl-8 py-2 text-xs',
|
||||||
|
'border rounded border-vega-light-200 dark:border-vega-dark-200'
|
||||||
|
)}
|
||||||
|
hasError={Boolean(error?.message)}
|
||||||
|
type="text"
|
||||||
|
placeholder={t('Enter block number, public key or transaction hash')}
|
||||||
|
/>
|
||||||
|
{error?.message && (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'hidden peer-focus:block',
|
||||||
|
'bg-white dark:bg-black',
|
||||||
|
'border rounded-b border-t-0 border-vega-light-200 dark:border-vega-dark-200',
|
||||||
|
'absolute top-[100%] flex-1 w-full pb-2 px-2 text-black dark:text-white'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<InputError
|
||||||
|
data-testid="search-error"
|
||||||
|
intent="danger"
|
||||||
|
className="text-xs"
|
||||||
|
>
|
||||||
|
{error.message}
|
||||||
|
</InputError>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
className="hidden [.search-dropdown_&]:block"
|
||||||
|
type="submit"
|
||||||
|
size="xs"
|
||||||
|
data-testid="search-button"
|
||||||
|
>
|
||||||
|
{t('Search')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
|
||||||
const searchTrigger = (
|
const searchTrigger = (
|
||||||
<DropdownMenu.Root>
|
<DropdownMenu.Root>
|
||||||
@@ -80,135 +154,10 @@ export const Search = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="hidden [.nav-search-full_&]:block min-w-[290px]">
|
<div className="hidden [.nav-search-full_&]:block">{searchForm}</div>
|
||||||
{searchForm}
|
|
||||||
</div>
|
|
||||||
<div className="hidden [.nav-search-compact_&]:block">
|
<div className="hidden [.nav-search-compact_&]:block">
|
||||||
{searchTrigger}
|
{searchTrigger}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SearchForm = () => {
|
|
||||||
const {
|
|
||||||
register,
|
|
||||||
handleSubmit,
|
|
||||||
setValue,
|
|
||||||
setError,
|
|
||||||
clearErrors,
|
|
||||||
formState,
|
|
||||||
watch,
|
|
||||||
} = useForm<FormFields>();
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const onSubmit = useCallback(
|
|
||||||
async (fields: FormFields) => {
|
|
||||||
clearErrors();
|
|
||||||
const type = await determineType(fields.search);
|
|
||||||
if (type) {
|
|
||||||
switch (type) {
|
|
||||||
case SearchTypes.Party:
|
|
||||||
return navigate(`${Routes.PARTIES}/${remove0x(fields.search)}`);
|
|
||||||
case SearchTypes.Transaction:
|
|
||||||
return navigate(`${Routes.TX}/${remove0x(fields.search)}`);
|
|
||||||
case SearchTypes.Block:
|
|
||||||
return navigate(`${Routes.BLOCKS}/${Number(fields.search)}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setError('search', new Error(t('The search term is not a valid query')));
|
|
||||||
},
|
|
||||||
[clearErrors, navigate, setError]
|
|
||||||
);
|
|
||||||
|
|
||||||
const searchQuery = watch('search', '');
|
|
||||||
|
|
||||||
return (
|
|
||||||
<form className="block min-w-[200px]" onSubmit={handleSubmit(onSubmit)}>
|
|
||||||
<div className="flex relative items-stretch gap-2 text-xs">
|
|
||||||
<div className="relative w-full">
|
|
||||||
<label htmlFor="search" className="sr-only">
|
|
||||||
{t('Search by block number or transaction hash')}
|
|
||||||
</label>
|
|
||||||
<button
|
|
||||||
className={classNames(
|
|
||||||
'absolute top-[50%] translate-y-[-50%] left-2',
|
|
||||||
'text-vega-light-300 dark:text-vega-dark-300'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<MagnifyingGlass />
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
setValue('search', '');
|
|
||||||
clearErrors();
|
|
||||||
}}
|
|
||||||
className={classNames(
|
|
||||||
{ hidden: searchQuery.length === 0 },
|
|
||||||
'absolute top-[50%] translate-y-[-50%] right-2',
|
|
||||||
'text-vega-light-300 dark:text-vega-dark-300'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<Clear />
|
|
||||||
</button>
|
|
||||||
<Input
|
|
||||||
{...register('search', {
|
|
||||||
required: t('Search query is required'),
|
|
||||||
validate: (value) =>
|
|
||||||
isHash(value) ||
|
|
||||||
isBlock(value) ||
|
|
||||||
t('Search query has to be a number or a 64 character hash'),
|
|
||||||
onBlur: () => clearErrors('search'),
|
|
||||||
})}
|
|
||||||
id="search"
|
|
||||||
data-testid="search"
|
|
||||||
className={classNames(
|
|
||||||
'pl-8 py-2 text-xs',
|
|
||||||
{ 'pr-8': searchQuery.length > 1 },
|
|
||||||
'border rounded border-vega-light-200 dark:border-vega-dark-200',
|
|
||||||
{
|
|
||||||
'border-vega-pink dark:border-vega-pink': Boolean(
|
|
||||||
formState.errors.search
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
hasError={Boolean(formState.errors.search)}
|
|
||||||
type="text"
|
|
||||||
placeholder={t(
|
|
||||||
'Enter block number, public key or transaction hash'
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{formState.errors.search && (
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
'[nav_&]:border [nav_&]:rounded [nav_&]:border-vega-light-300 [nav_&]:dark:border-vega-light-300',
|
|
||||||
'[.search-dropdown_&]:border [.search-dropdown_&]:rounded [.search-dropdown_&]:border-vega-light-300 [.search-dropdown_&]:dark:border-vega-light-300',
|
|
||||||
'bg-white dark:bg-black',
|
|
||||||
'absolute top-[100%] flex-1 w-full pb-2 px-2 text-black dark:text-white'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<InputError
|
|
||||||
data-testid="search-error"
|
|
||||||
intent="danger"
|
|
||||||
className="text-xs"
|
|
||||||
>
|
|
||||||
{formState.errors.search.message}
|
|
||||||
</InputError>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<Button
|
|
||||||
variant="primary"
|
|
||||||
type="submit"
|
|
||||||
size="xs"
|
|
||||||
data-testid="search-button"
|
|
||||||
className="[nav_&]:hidden"
|
|
||||||
>
|
|
||||||
{t('Search')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { proposalsDataProvider } from '@vegaprotocol/proposals';
|
import { proposalsDataProvider } from '@vegaprotocol/proposals';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||||
import { ProposalsTable } from '../../components/proposals/proposals-table';
|
import { ProposalsTable } from '../../components/proposals/proposals-table';
|
||||||
import { RouteTitle } from '../../components/route-title';
|
import { RouteTitle } from '../../components/route-title';
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
import { StatsManager } from '@vegaprotocol/network-stats';
|
import { StatsManager } from '@vegaprotocol/network-stats';
|
||||||
import { SearchForm } from '../../components/search';
|
|
||||||
import { useDocumentTitle } from '../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../hooks/use-document-title';
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const classnames = 'mt-4 mb-4';
|
const classnames = 'mt-4 grid grid-cols-1 lg:grid-cols-2 lg:gap-4';
|
||||||
|
|
||||||
useDocumentTitle();
|
useDocumentTitle();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
<div className="p-20 max-sm:py-10 max-sm:px-0">
|
<StatsManager className={classnames} />
|
||||||
<SearchForm />
|
|
||||||
</div>
|
|
||||||
<div className="px-20 max-sm:px-0">
|
|
||||||
<StatsManager className={classnames} />
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useRoutes } from 'react-router-dom';
|
||||||
|
import { RouteErrorBoundary } from '../components/router-error-boundary';
|
||||||
|
|
||||||
|
import routerConfig from './router-config';
|
||||||
|
import { Loader, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
|
export interface RouteChildProps {
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppRouter = () => {
|
||||||
|
const routes = useRoutes(routerConfig);
|
||||||
|
|
||||||
|
const splashLoading = (
|
||||||
|
<Splash>
|
||||||
|
<Loader />
|
||||||
|
</Splash>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<RouteErrorBoundary>
|
||||||
|
<React.Suspense fallback={splashLoading}>{routes}</React.Suspense>
|
||||||
|
</RouteErrorBoundary>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
import {
|
|
||||||
AssetDetailsDialog,
|
|
||||||
useAssetDetailsDialogStore,
|
|
||||||
} from '@vegaprotocol/assets';
|
|
||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
|
||||||
import { AnnouncementBanner } from '@vegaprotocol/announcements';
|
|
||||||
import {
|
|
||||||
BackgroundVideo,
|
|
||||||
BreadcrumbsContainer,
|
|
||||||
ButtonLink,
|
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
|
||||||
import classNames from 'classnames';
|
|
||||||
import {
|
|
||||||
isRouteErrorResponse,
|
|
||||||
Link,
|
|
||||||
Outlet,
|
|
||||||
useMatch,
|
|
||||||
useRouteError,
|
|
||||||
} from 'react-router-dom';
|
|
||||||
import { Footer } from '../components/footer/footer';
|
|
||||||
import { Header } from '../components/header';
|
|
||||||
import { Routes } from './route-names';
|
|
||||||
|
|
||||||
const DialogsContainer = () => {
|
|
||||||
const { isOpen, id, trigger, asJson, setOpen } = useAssetDetailsDialogStore();
|
|
||||||
return (
|
|
||||||
<AssetDetailsDialog
|
|
||||||
assetId={id}
|
|
||||||
trigger={trigger || null}
|
|
||||||
asJson={asJson}
|
|
||||||
open={isOpen}
|
|
||||||
onChange={setOpen}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Layout = () => {
|
|
||||||
const isHome = Boolean(useMatch(Routes.HOME));
|
|
||||||
const { ANNOUNCEMENTS_CONFIG_URL } = useEnvironment();
|
|
||||||
const fixedWidthClasses = 'w-full max-w-[1500px] mx-auto';
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
'min-h-screen',
|
|
||||||
'mx-auto my-0',
|
|
||||||
'grid grid-rows-[auto_1fr_auto] grid-cols-1',
|
|
||||||
'border-vega-light-200 dark:border-vega-dark-200',
|
|
||||||
'antialiased text-black dark:text-white',
|
|
||||||
'overflow-hidden relative'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
{ANNOUNCEMENTS_CONFIG_URL && (
|
|
||||||
<AnnouncementBanner
|
|
||||||
app="explorer"
|
|
||||||
configUrl={ANNOUNCEMENTS_CONFIG_URL}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<Header />
|
|
||||||
</div>
|
|
||||||
<div className={fixedWidthClasses}>
|
|
||||||
<main className="p-4">
|
|
||||||
{!isHome && <BreadcrumbsContainer className="mb-4" />}
|
|
||||||
<Outlet />
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
<div className={fixedWidthClasses}>
|
|
||||||
<Footer />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<DialogsContainer />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ErrorBoundary = () => {
|
|
||||||
const error = useRouteError();
|
|
||||||
|
|
||||||
const errorTitle = isRouteErrorResponse(error)
|
|
||||||
? `${error.status} ${error.statusText}`
|
|
||||||
: t('Something went wrong');
|
|
||||||
|
|
||||||
const errorMessage = isRouteErrorResponse(error)
|
|
||||||
? error.error?.message
|
|
||||||
: (error as Error).message || JSON.stringify(error);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<BackgroundVideo className="brightness-50" />
|
|
||||||
<div
|
|
||||||
className={classNames(
|
|
||||||
'max-w-[620px] p-2 mt-[10vh]',
|
|
||||||
'mx-auto my-0',
|
|
||||||
'antialiased text-white',
|
|
||||||
'overflow-hidden relative',
|
|
||||||
'flex flex-col gap-2'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className="flex gap-4">
|
|
||||||
<div>{GHOST}</div>
|
|
||||||
<h1 className="text-[2.7rem] font-alpha calt break-words uppercase">
|
|
||||||
{errorTitle}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<div className="text-sm mt-10 overflow-auto break-all font-mono">
|
|
||||||
{errorMessage}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<ButtonLink onClick={() => window.location.reload()}>
|
|
||||||
{t('Try refreshing')}
|
|
||||||
</ButtonLink>{' '}
|
|
||||||
{t('or go back to')}{' '}
|
|
||||||
<Link className="underline" to="/">
|
|
||||||
{t('Home')}
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const GHOST = (
|
|
||||||
<svg
|
|
||||||
width="56"
|
|
||||||
height="85"
|
|
||||||
viewBox="0 0 56 85"
|
|
||||||
fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path d="M41 0.5H3V60.5H41V0.5Z" fill="white" />
|
|
||||||
<path d="M15 18.5H13V20.5H15V18.5Z" fill="black" />
|
|
||||||
<path d="M17 20.5H15V22.5H17V20.5Z" fill="black" />
|
|
||||||
<path d="M19 18.5H17V20.5H19V18.5Z" fill="black" />
|
|
||||||
<path d="M15 22.5H13V24.5H15V22.5Z" fill="black" />
|
|
||||||
<path d="M19 22.5H17V24.5H19V22.5Z" fill="black" />
|
|
||||||
<path d="M29 28.5H15V30.5H29V28.5Z" fill="black" />
|
|
||||||
<path d="M27 18.5H25V20.5H27V18.5Z" fill="black" />
|
|
||||||
<path d="M29 20.5H27V22.5H29V20.5Z" fill="black" />
|
|
||||||
<path d="M31 18.5H29V20.5H31V18.5Z" fill="black" />
|
|
||||||
<path d="M27 22.5H25V24.5H27V22.5Z" fill="black" />
|
|
||||||
<path d="M31 22.5H29V24.5H31V22.5Z" fill="black" />
|
|
||||||
<path d="M31 26.5H29V28.5H31V26.5Z" fill="black" />
|
|
||||||
<path d="M19 60.5H17V84.5H19V60.5Z" fill="black" />
|
|
||||||
<path d="M27 60.5H25V84.5H27V60.5Z" fill="black" />
|
|
||||||
<path
|
|
||||||
d="M3 42.5V58.64V60.5V64.5H21V60.5H23V64.5H41V60.5V58.64V42.5H3Z"
|
|
||||||
fill="#FF077F"
|
|
||||||
/>
|
|
||||||
<path d="M35 46.5H41V42.5H3V46.5H31H35Z" fill="#CB0666" />
|
|
||||||
<path d="M3 32.32V29.5L0 32.5V60.5H2V33.33L3 32.32Z" fill="black" />
|
|
||||||
<path d="M41 31.8V29.49L54.79 21.53L55.79 23.26L41 31.8Z" fill="black" />
|
|
||||||
<path d="M36 54.5H35V55.5H36V54.5Z" fill="black" />
|
|
||||||
<path d="M35 53.5H34V54.5H35V53.5Z" fill="black" />
|
|
||||||
<path d="M34 48.5H33V53.5H34V48.5Z" fill="black" />
|
|
||||||
<path d="M38 48.5H37V52.5H38V48.5Z" fill="black" />
|
|
||||||
<path d="M37 53.5H36V54.5H37V53.5Z" fill="black" />
|
|
||||||
<path d="M39 52.5H38V53.5H39V52.5Z" fill="black" />
|
|
||||||
<path
|
|
||||||
d="M55.7901 23.27L53.0601 22.54L45.1001 8.75L46.8301 7.75L55.7901 23.27Z"
|
|
||||||
fill="black"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
);
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
@@ -8,7 +8,7 @@ import { useScrollToLocation } from '../../hooks/scroll-to-location';
|
|||||||
import { useDocumentTitle } from '../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../hooks/use-document-title';
|
||||||
import compact from 'lodash/compact';
|
import compact from 'lodash/compact';
|
||||||
import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
|
import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
|
||||||
import { marketInfoWithDataProvider } from '@vegaprotocol/market-info';
|
import { marketInfoProvider } from '@vegaprotocol/market-info';
|
||||||
import { PageTitle } from '../../components/page-helpers/page-title';
|
import { PageTitle } from '../../components/page-helpers/page-title';
|
||||||
|
|
||||||
export const MarketPage = () => {
|
export const MarketPage = () => {
|
||||||
@@ -17,7 +17,7 @@ export const MarketPage = () => {
|
|||||||
const { marketId } = useParams<{ marketId: string }>();
|
const { marketId } = useParams<{ marketId: string }>();
|
||||||
|
|
||||||
const { data, loading, error } = useDataProvider({
|
const { data, loading, error } = useDataProvider({
|
||||||
dataProvider: marketInfoWithDataProvider,
|
dataProvider: marketInfoProvider,
|
||||||
skipUpdates: true,
|
skipUpdates: true,
|
||||||
variables: {
|
variables: {
|
||||||
marketId: marketId || '',
|
marketId: marketId || '',
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { marketsProvider } from '@vegaprotocol/market-list';
|
|||||||
import { RouteTitle } from '../../components/route-title';
|
import { RouteTitle } from '../../components/route-title';
|
||||||
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
import { MarketsTable } from '../../components/markets/markets-table';
|
import { MarketsTable } from '../../components/markets/markets-table';
|
||||||
|
|
||||||
export const MarketsPage = () => {
|
export const MarketsPage = () => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import type { NetworkParamsQuery } from '@vegaprotocol/network-parameters';
|
import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers';
|
||||||
import { NetworkParametersTable } from './network-parameters';
|
import { NetworkParametersTable } from './network-parameters';
|
||||||
|
|
||||||
describe('NetworkParametersTable', () => {
|
describe('NetworkParametersTable', () => {
|
||||||
|
|||||||
@@ -13,15 +13,14 @@ import {
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { RouteTitle } from '../../components/route-title';
|
import { RouteTitle } from '../../components/route-title';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import { useNetworkParamsQuery } from '@vegaprotocol/network-parameters';
|
import { useNetworkParamsQuery } from '@vegaprotocol/react-helpers';
|
||||||
import type { NetworkParamsQuery } from '@vegaprotocol/network-parameters';
|
import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers';
|
||||||
import { useScrollToLocation } from '../../hooks/scroll-to-location';
|
import { useScrollToLocation } from '../../hooks/scroll-to-location';
|
||||||
import { useDocumentTitle } from '../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../hooks/use-document-title';
|
||||||
|
|
||||||
const PERCENTAGE_PARAMS = [
|
const PERCENTAGE_PARAMS = [
|
||||||
'governance.proposal.asset.requiredMajority',
|
'governance.proposal.asset.requiredMajority',
|
||||||
'governance.proposal.asset.requiredParticipation',
|
'governance.proposal.asset.requiredParticipation',
|
||||||
'governance.proposal.updateAsset.requiredParticipation',
|
|
||||||
'governance.proposal.freeform.requiredMajority',
|
'governance.proposal.freeform.requiredMajority',
|
||||||
'governance.proposal.freeform.requiredParticipation',
|
'governance.proposal.freeform.requiredParticipation',
|
||||||
'governance.proposal.market.requiredMajority',
|
'governance.proposal.market.requiredMajority',
|
||||||
@@ -54,8 +53,6 @@ const BIG_NUMBER_PARAMS = [
|
|||||||
'governance.proposal.asset.minProposerBalance',
|
'governance.proposal.asset.minProposerBalance',
|
||||||
'governance.proposal.market.minProposerBalance',
|
'governance.proposal.market.minProposerBalance',
|
||||||
'governance.proposal.market.minVoterBalance',
|
'governance.proposal.market.minVoterBalance',
|
||||||
'governance.proposal.updateAsset.minProposerBalance',
|
|
||||||
'governance.proposal.updateAsset.minVoterBalance',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const NetworkParameterRow = ({
|
export const NetworkParameterRow = ({
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export const PartyAccounts = ({ accounts }: PartyAccountsProps) => {
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td className="text-md">
|
<td className="text-md">
|
||||||
<AssetLink assetId={account.asset.id} asDialog={true} />
|
<AssetLink assetId={account.asset.id} />
|
||||||
</td>
|
</td>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Oracle } from './oracles/id';
|
|||||||
import Party from './parties';
|
import Party from './parties';
|
||||||
import { Parties } from './parties/home';
|
import { Parties } from './parties/home';
|
||||||
import { Party as PartySingle } from './parties/id';
|
import { Party as PartySingle } from './parties/id';
|
||||||
|
import Txs from './txs';
|
||||||
import { ValidatorsPage } from './validators';
|
import { ValidatorsPage } from './validators';
|
||||||
import Genesis from './genesis';
|
import Genesis from './genesis';
|
||||||
import { Block } from './blocks/id';
|
import { Block } from './blocks/id';
|
||||||
@@ -19,55 +20,23 @@ import flags from '../config/flags';
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { Routes } from './route-names';
|
import { Routes } from './route-names';
|
||||||
import { NetworkParameters } from './network-parameters';
|
import { NetworkParameters } from './network-parameters';
|
||||||
import type { Params, RouteObject } from 'react-router-dom';
|
import type { RouteObject } from 'react-router-dom';
|
||||||
import { createBrowserRouter } from 'react-router-dom';
|
|
||||||
import { Link } from 'react-router-dom';
|
|
||||||
import { MarketPage, MarketsPage } from './markets';
|
import { MarketPage, MarketsPage } from './markets';
|
||||||
import type { ReactNode } from 'react';
|
|
||||||
import { ErrorBoundary, Layout } from './layout';
|
|
||||||
import compact from 'lodash/compact';
|
|
||||||
import { AssetLink, MarketLink } from '../components/links';
|
|
||||||
import { truncateMiddle } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import { remove0x } from '@vegaprotocol/utils';
|
|
||||||
|
|
||||||
export type Navigable = {
|
export type Navigable = {
|
||||||
path: string;
|
path: string;
|
||||||
handle: {
|
name: string;
|
||||||
name: string;
|
text: string;
|
||||||
text: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export const isNavigable = (item: RouteObject): item is Navigable =>
|
|
||||||
(item as Navigable).path !== undefined &&
|
|
||||||
(item as Navigable).handle !== undefined &&
|
|
||||||
(item as Navigable).handle.name !== undefined &&
|
|
||||||
(item as Navigable).handle.text !== undefined;
|
|
||||||
|
|
||||||
export type Breadcrumbable = {
|
|
||||||
handle: { breadcrumb: (data?: Params<string>) => ReactNode | string };
|
|
||||||
};
|
|
||||||
export const isBreadcrumbable = (item: RouteObject): item is Breadcrumbable =>
|
|
||||||
(item as Breadcrumbable).handle !== undefined &&
|
|
||||||
(item as Breadcrumbable).handle.breadcrumb !== undefined;
|
|
||||||
|
|
||||||
type RouteItem =
|
|
||||||
| RouteObject
|
|
||||||
| (RouteObject & Navigable)
|
|
||||||
| (RouteObject & Breadcrumbable);
|
|
||||||
type Route = RouteItem & {
|
|
||||||
children?: RouteItem[];
|
|
||||||
};
|
};
|
||||||
|
type Route = RouteObject & Navigable;
|
||||||
|
|
||||||
const partiesRoutes: Route[] = flags.parties
|
const partiesRoutes: Route[] = flags.parties
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.PARTIES,
|
path: Routes.PARTIES,
|
||||||
|
name: t('Parties'),
|
||||||
|
text: t('Parties'),
|
||||||
element: <Party />,
|
element: <Party />,
|
||||||
handle: {
|
|
||||||
name: t('Parties'),
|
|
||||||
text: t('Parties'),
|
|
||||||
breadcrumb: () => <Link to={Routes.PARTIES}>{t('Parties')}</Link>,
|
|
||||||
},
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
@@ -76,13 +45,6 @@ const partiesRoutes: Route[] = flags.parties
|
|||||||
{
|
{
|
||||||
path: ':party',
|
path: ':party',
|
||||||
element: <PartySingle />,
|
element: <PartySingle />,
|
||||||
handle: {
|
|
||||||
breadcrumb: (params: Params<string>) => (
|
|
||||||
<Link to={linkTo(Routes.PARTIES, params.party)}>
|
|
||||||
{truncateMiddle(params.party as string)}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -93,11 +55,8 @@ const assetsRoutes: Route[] = flags.assets
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.ASSETS,
|
path: Routes.ASSETS,
|
||||||
handle: {
|
text: t('Assets'),
|
||||||
name: t('Assets'),
|
name: t('Assets'),
|
||||||
text: t('Assets'),
|
|
||||||
breadcrumb: () => <Link to={Routes.ASSETS}>{t('Assets')}</Link>,
|
|
||||||
},
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
@@ -106,11 +65,6 @@ const assetsRoutes: Route[] = flags.assets
|
|||||||
{
|
{
|
||||||
path: ':assetId',
|
path: ':assetId',
|
||||||
element: <AssetPage />,
|
element: <AssetPage />,
|
||||||
handle: {
|
|
||||||
breadcrumb: (params: Params<string>) => (
|
|
||||||
<AssetLink assetId={params.assetId as string} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -121,13 +75,8 @@ const genesisRoutes: Route[] = flags.genesis
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.GENESIS,
|
path: Routes.GENESIS,
|
||||||
handle: {
|
name: t('Genesis'),
|
||||||
name: t('Genesis'),
|
text: t('Genesis Parameters'),
|
||||||
text: t('Genesis Parameters'),
|
|
||||||
breadcrumb: () => (
|
|
||||||
<Link to={Routes.GENESIS}>{t('Genesis Parameters')}</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
element: <Genesis />,
|
element: <Genesis />,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -137,13 +86,8 @@ const governanceRoutes: Route[] = flags.governance
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.GOVERNANCE,
|
path: Routes.GOVERNANCE,
|
||||||
handle: {
|
name: t('Governance proposals'),
|
||||||
name: t('Governance proposals'),
|
text: t('Governance Proposals'),
|
||||||
text: t('Governance Proposals'),
|
|
||||||
breadcrumb: () => (
|
|
||||||
<Link to={Routes.GOVERNANCE}>{t('Governance Proposals')}</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
element: <Proposals />,
|
element: <Proposals />,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -153,11 +97,8 @@ const marketsRoutes: Route[] = flags.markets
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.MARKETS,
|
path: Routes.MARKETS,
|
||||||
handle: {
|
name: t('Markets'),
|
||||||
name: t('Markets'),
|
text: t('Markets'),
|
||||||
text: t('Markets'),
|
|
||||||
breadcrumb: () => <Link to={Routes.MARKETS}>{t('Markets')}</Link>,
|
|
||||||
},
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
@@ -166,11 +107,6 @@ const marketsRoutes: Route[] = flags.markets
|
|||||||
{
|
{
|
||||||
path: ':marketId',
|
path: ':marketId',
|
||||||
element: <MarketPage />,
|
element: <MarketPage />,
|
||||||
handle: {
|
|
||||||
breadcrumb: (params: Params<string>) => (
|
|
||||||
<MarketLink id={params.marketId as string} />
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -181,15 +117,8 @@ const networkParametersRoutes: Route[] = flags.networkParameters
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.NETWORK_PARAMETERS,
|
path: Routes.NETWORK_PARAMETERS,
|
||||||
handle: {
|
name: t('NetworkParameters'),
|
||||||
name: t('NetworkParameters'),
|
text: t('Network Parameters'),
|
||||||
text: t('Network Parameters'),
|
|
||||||
breadcrumb: () => (
|
|
||||||
<Link to={Routes.NETWORK_PARAMETERS}>
|
|
||||||
{t('Network Parameters')}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
element: <NetworkParameters />,
|
element: <NetworkParameters />,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -199,133 +128,80 @@ const validators: Route[] = flags.validators
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
path: Routes.VALIDATORS,
|
path: Routes.VALIDATORS,
|
||||||
handle: {
|
name: t('Validators'),
|
||||||
name: t('Validators'),
|
text: t('Validators'),
|
||||||
text: t('Validators'),
|
|
||||||
breadcrumb: () => (
|
|
||||||
<Link to={Routes.VALIDATORS}>{t('Validators')}</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
element: <ValidatorsPage />,
|
element: <ValidatorsPage />,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const linkTo = (...segments: (string | undefined)[]) =>
|
const routerConfig: Route[] = [
|
||||||
compact(segments).join('/');
|
|
||||||
|
|
||||||
export const routerConfig: Route[] = [
|
|
||||||
{
|
{
|
||||||
path: Routes.HOME,
|
path: Routes.HOME,
|
||||||
element: <Layout />,
|
name: t('Home'),
|
||||||
handle: {
|
text: t('Home'),
|
||||||
name: t('Home'),
|
element: <Home />,
|
||||||
text: t('Home'),
|
index: true,
|
||||||
breadcrumb: () => <Link to={Routes.HOME}>{t('Home')}</Link>,
|
},
|
||||||
},
|
{
|
||||||
errorElement: <ErrorBoundary />,
|
path: Routes.TX,
|
||||||
|
name: t('Txs'),
|
||||||
|
text: t('Transactions'),
|
||||||
|
element: <Txs />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'pending',
|
||||||
|
element: <PendingTxs />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':txHash',
|
||||||
|
element: <Tx />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: true,
|
||||||
|
element: <TxsList />,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: Routes.BLOCKS,
|
||||||
|
name: t('Blocks'),
|
||||||
|
text: t('Blocks'),
|
||||||
|
element: <BlockPage />,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true,
|
||||||
element: <Home />,
|
element: <Blocks />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: Routes.TX,
|
path: ':block',
|
||||||
handle: {
|
element: <Block />,
|
||||||
name: t('Txs'),
|
|
||||||
text: t('Transactions'),
|
|
||||||
breadcrumb: () => <Link to={Routes.TX}>{t('Transactions')}</Link>,
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'pending',
|
|
||||||
element: <PendingTxs />,
|
|
||||||
handle: {
|
|
||||||
breadcrumb: () => (
|
|
||||||
<Link to={linkTo(Routes.TX, 'pending')}>
|
|
||||||
{t('Pending transactions')}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':txHash',
|
|
||||||
element: <Tx />,
|
|
||||||
handle: {
|
|
||||||
breadcrumb: (params: Params<string>) => (
|
|
||||||
<Link to={linkTo(Routes.TX, params.txHash)}>
|
|
||||||
{truncateMiddle(remove0x(params.txHash as string))}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
index: true,
|
|
||||||
element: <TxsList />,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: Routes.BLOCKS,
|
|
||||||
handle: {
|
|
||||||
name: t('Blocks'),
|
|
||||||
text: t('Blocks'),
|
|
||||||
breadcrumb: () => <Link to={Routes.BLOCKS}>{t('Blocks')}</Link>,
|
|
||||||
},
|
|
||||||
element: <BlockPage />,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
index: true,
|
|
||||||
element: <Blocks />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':block',
|
|
||||||
element: <Block />,
|
|
||||||
handle: {
|
|
||||||
breadcrumb: (params: Params<string>) => (
|
|
||||||
<Link to={linkTo(Routes.BLOCKS, params.block)}>
|
|
||||||
{params.block}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: Routes.ORACLES,
|
|
||||||
handle: {
|
|
||||||
name: t('Oracles'),
|
|
||||||
text: t('Oracles'),
|
|
||||||
breadcrumb: () => <Link to={Routes.ORACLES}>{t('Oracles')}</Link>,
|
|
||||||
},
|
|
||||||
element: <OraclePage />,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
index: true,
|
|
||||||
element: <Oracles />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':id',
|
|
||||||
element: <Oracle />,
|
|
||||||
handle: {
|
|
||||||
breadcrumb: (params: Params<string>) => (
|
|
||||||
<Link to={linkTo(Routes.ORACLES, params.id)}>
|
|
||||||
{truncateMiddle(params.id as string)}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
...partiesRoutes,
|
|
||||||
...assetsRoutes,
|
|
||||||
...genesisRoutes,
|
|
||||||
...governanceRoutes,
|
|
||||||
...marketsRoutes,
|
|
||||||
...networkParametersRoutes,
|
|
||||||
...validators,
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: Routes.ORACLES,
|
||||||
|
name: t('Oracles'),
|
||||||
|
text: t('Oracles'),
|
||||||
|
element: <OraclePage />,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
index: true,
|
||||||
|
element: <Oracles />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':id',
|
||||||
|
element: <Oracle />,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
...partiesRoutes,
|
||||||
|
...assetsRoutes,
|
||||||
|
...genesisRoutes,
|
||||||
|
...governanceRoutes,
|
||||||
|
...marketsRoutes,
|
||||||
|
...networkParametersRoutes,
|
||||||
|
...validators,
|
||||||
];
|
];
|
||||||
|
|
||||||
export const router = createBrowserRouter(routerConfig);
|
export default routerConfig;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useParams } from 'react-router-dom';
|
import React from 'react';
|
||||||
|
import { Link, useParams } from 'react-router-dom';
|
||||||
import { remove0x } from '@vegaprotocol/utils';
|
import { remove0x } from '@vegaprotocol/utils';
|
||||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||||
import { DATA_SOURCES } from '../../../config';
|
import { DATA_SOURCES } from '../../../config';
|
||||||
@@ -7,6 +8,9 @@ import { TxDetails } from './tx-details';
|
|||||||
import type { BlockExplorerTransaction } from '../../../routes/types/block-explorer-response';
|
import type { BlockExplorerTransaction } from '../../../routes/types/block-explorer-response';
|
||||||
import { toNonHex } from '../../../components/search/detect-search';
|
import { toNonHex } from '../../../components/search/detect-search';
|
||||||
import { PageHeader } from '../../../components/page-header';
|
import { PageHeader } from '../../../components/page-header';
|
||||||
|
import { Routes } from '../../../routes/route-names';
|
||||||
|
import { IconNames } from '@blueprintjs/icons';
|
||||||
|
import { Icon } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
||||||
|
|
||||||
const Tx = () => {
|
const Tx = () => {
|
||||||
@@ -18,7 +22,6 @@ const Tx = () => {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
state: { data, loading, error },
|
state: { data, loading, error },
|
||||||
refetch,
|
|
||||||
} = useFetch<BlockExplorerTransaction>(
|
} = useFetch<BlockExplorerTransaction>(
|
||||||
`${DATA_SOURCES.blockExplorerUrl}/transactions/${toNonHex(hash)}`
|
`${DATA_SOURCES.blockExplorerUrl}/transactions/${toNonHex(hash)}`
|
||||||
);
|
);
|
||||||
@@ -31,6 +34,17 @@ const Tx = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
|
<Link
|
||||||
|
className="font-normal underline underline-offset-4 block mb-5"
|
||||||
|
to={`/${Routes.TX}`}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
className="text-vega-light-150 dark:text-vega-light-150"
|
||||||
|
name={IconNames.CHEVRON_LEFT}
|
||||||
|
/>
|
||||||
|
All Transactions
|
||||||
|
</Link>
|
||||||
|
|
||||||
<PageHeader
|
<PageHeader
|
||||||
title="transaction"
|
title="transaction"
|
||||||
truncateStart={5}
|
truncateStart={5}
|
||||||
@@ -42,7 +56,6 @@ const Tx = () => {
|
|||||||
error={error}
|
error={error}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
errorMessage={errorMessage}
|
errorMessage={errorMessage}
|
||||||
refetch={refetch}
|
|
||||||
>
|
>
|
||||||
<TxDetails
|
<TxDetails
|
||||||
className="mb-28"
|
className="mb-28"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
|
|||||||
import { PageTitle } from '../../components/page-helpers/page-title';
|
import { PageTitle } from '../../components/page-helpers/page-title';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import {
|
import {
|
||||||
EtherscanLink,
|
ContractAddressLink,
|
||||||
DApp,
|
DApp,
|
||||||
TOKEN_VALIDATOR,
|
TOKEN_VALIDATOR,
|
||||||
useLinks,
|
useLinks,
|
||||||
@@ -224,7 +224,7 @@ export const ValidatorsPage = () => {
|
|||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
<div>{t('Ethereum address')}</div>
|
<div>{t('Ethereum address')}</div>
|
||||||
<div className="break-all text-xs">
|
<div className="break-all text-xs">
|
||||||
<EtherscanLink address={v.ethereumAddress} />{' '}
|
<ContractAddressLink address={v.ethereumAddress} />{' '}
|
||||||
<CopyWithTooltip text={v.ethereumAddress}>
|
<CopyWithTooltip text={v.ethereumAddress}>
|
||||||
<button title={t('Copy address to clipboard')}>
|
<button title={t('Copy address to clipboard')}>
|
||||||
<Icon size={3} name="duplicate" />
|
<Icon size={3} name="duplicate" />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import './styles.css';
|
import './styles.css';
|
||||||
|
|
||||||
import App from './app/app';
|
import App from './app/app';
|
||||||
@@ -9,6 +10,8 @@ const root = rootElement && createRoot(rootElement);
|
|||||||
|
|
||||||
root?.render(
|
root?.render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
<App />
|
<BrowserRouter>
|
||||||
|
<App />
|
||||||
|
</BrowserRouter>
|
||||||
</StrictMode>
|
</StrictMode>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
@import 'ag-grid-community/dist/styles/ag-grid.css';
|
|
||||||
@import 'ag-grid-community/dist/styles/ag-theme-balham.css';
|
|
||||||
@import 'ag-grid-community/dist/styles/ag-theme-balham-dark.css';
|
|
||||||
|
|
||||||
/* You can add global styles to this file, and also import other style files */
|
/* You can add global styles to this file, and also import other style files */
|
||||||
@tailwind base;
|
@tailwind base;
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
@@ -15,43 +11,3 @@
|
|||||||
.react-markdown-container a:before {
|
.react-markdown-container a:before {
|
||||||
content: '🔗 ';
|
content: '🔗 ';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AG GRID - Do not edit without updating other global stylesheets for each app */
|
|
||||||
|
|
||||||
.vega-ag-grid .ag-root-wrapper {
|
|
||||||
border: solid 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vega-ag-grid .ag-react-container {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vega-ag-grid .ag-cell,
|
|
||||||
.vega-ag-grid .ag-full-width-row .ag-cell-wrapper.ag-row-group {
|
|
||||||
line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Light variables */
|
|
||||||
.ag-theme-balham {
|
|
||||||
--ag-background-color: theme(colors.white);
|
|
||||||
--ag-border-color: theme(colors.neutral[300]);
|
|
||||||
--ag-header-background-color: theme(colors.white);
|
|
||||||
--ag-odd-row-background-color: theme(colors.white);
|
|
||||||
--ag-header-column-separator-color: theme(colors.neutral[300]);
|
|
||||||
--ag-row-border-color: theme(colors.white);
|
|
||||||
--ag-row-hover-color: theme(colors.neutral[100]);
|
|
||||||
--ag-font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Dark variables */
|
|
||||||
.ag-theme-balham-dark {
|
|
||||||
--ag-background-color: theme(colors.black);
|
|
||||||
--ag-border-color: theme(colors.neutral[700]);
|
|
||||||
--ag-header-background-color: theme(colors.black);
|
|
||||||
--ag-odd-row-background-color: theme(colors.black);
|
|
||||||
--ag-header-column-separator-color: theme(colors.neutral[600]);
|
|
||||||
--ag-row-border-color: theme(colors.black);
|
|
||||||
--ag-row-hover-color: theme(colors.neutral[800]);
|
|
||||||
--ag-font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,22 +5,18 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
|||||||
NX_FAIRGROUND=false
|
NX_FAIRGROUND=false
|
||||||
NX_VEGA_NETWORKS={}
|
NX_VEGA_NETWORKS={}
|
||||||
|
|
||||||
NX_VEGA_URL=http://localhost:3008/graphql
|
NX_VEGA_URL=http://localhost:3028/query
|
||||||
NX_ETHEREUM_CHAIN_ID=1440
|
NX_ETHEREUM_CHAIN_ID=1440
|
||||||
NX_ETH_URL_CONNECT=1
|
NX_ETH_URL_CONNECT=1
|
||||||
NX_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
|
NX_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
|
||||||
NX_LOCAL_PROVIDER_URL=http://localhost:8545/
|
NX_LOCAL_PROVIDER_URL=http://localhost:8545/
|
||||||
NX_ETH_LOCAL_PROVIDER_URL=http://localhost:8545/
|
|
||||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
|
NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet
|
||||||
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz
|
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet3-k8s.ops.vega.xyz
|
||||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
|
|
||||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
|
||||||
NX_WALLETCONNECT_PROJECT_ID=fe8091dc35738863e509fc4947525c72
|
|
||||||
|
|
||||||
#Test configuration variables
|
#Test configuration variables
|
||||||
CYPRESS_FAIRGROUND=false
|
CYPRESS_FAIRGROUND=false
|
||||||
CYPRESS_VEGA_URL=http://localhost:3008/graphql
|
CYPRESS_VEGA_URL=http://localhost:3028/query
|
||||||
CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
|
CYPRESS_ETH_WALLET_MNEMONIC=ozone access unlock valid olympic save include omit supply green clown session
|
||||||
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
CYPRESS_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
||||||
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
|
CYPRESS_EXPLORER_URL=https://explorer.fairground.wtf
|
||||||
@@ -31,5 +27,6 @@ CYPRESS_VEGA_ENV=CUSTOM
|
|||||||
CYPRESS_VEGA_PUBLIC_KEY=02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65
|
CYPRESS_VEGA_PUBLIC_KEY=02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65
|
||||||
CYPRESS_VEGA_PUBLIC_KEY2=7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535
|
CYPRESS_VEGA_PUBLIC_KEY2=7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535
|
||||||
CYPRESS_VEGA_TOKEN_URL=https://token.fairground.wtf
|
CYPRESS_VEGA_TOKEN_URL=https://token.fairground.wtf
|
||||||
|
CYPRESS_VEGA_URL=http://localhost:3028/query
|
||||||
CYPRESS_VEGA_WALLET_URL=http://localhost:1789
|
CYPRESS_VEGA_WALLET_URL=http://localhost:1789
|
||||||
CYPRESS_VEGA_WALLET_API_TOKEN=
|
CYPRESS_VEGA_WALLET_API_TOKEN=
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# App configuration variables
|
||||||
|
NX_VEGA_ENV=STAGNET3
|
||||||
|
NX_VEGA_URL=https://api.stagnet3.vega.xyz/graphql
|
||||||
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_VEGA_ENV=TESTNET
|
NX_VEGA_ENV=TESTNET
|
||||||
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql
|
||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ module.exports = defineConfig({
|
|||||||
viewportWidth: 1440,
|
viewportWidth: 1440,
|
||||||
viewportHeight: 900,
|
viewportHeight: 900,
|
||||||
numTestsKeptInMemory: 5,
|
numTestsKeptInMemory: 5,
|
||||||
testIsolation: false,
|
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
ethProviderUrl: 'http://localhost:8545/',
|
ethProviderUrl: 'http://localhost:8545/',
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
export const upgradeProposalsData = {
|
|
||||||
lastBlockHeight: '2014133',
|
|
||||||
protocolUpgradeProposals: {
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
upgradeBlockHeight: '2015942',
|
|
||||||
vegaReleaseTag: 'v1',
|
|
||||||
approvers: [
|
|
||||||
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
|
|
||||||
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
|
|
||||||
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
|
|
||||||
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
|
|
||||||
],
|
|
||||||
status: 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED',
|
|
||||||
__typename: 'ProtocolUpgradeProposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProtocolUpgradeProposalEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
upgradeBlockHeight: '1955065',
|
|
||||||
vegaReleaseTag: 'v0.71.0+dev-12156-bca1d57e',
|
|
||||||
approvers: [
|
|
||||||
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
|
|
||||||
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
|
|
||||||
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
|
|
||||||
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
|
|
||||||
],
|
|
||||||
status: 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED',
|
|
||||||
__typename: 'ProtocolUpgradeProposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProtocolUpgradeProposalEdge',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
__typename: 'ProtocolUpgradeProposalConnection',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
export const nodeData = {
|
|
||||||
epoch: {
|
|
||||||
id: '204731',
|
|
||||||
timestamps: {
|
|
||||||
start: '2023-04-14T09:30:09.452005Z',
|
|
||||||
end: null,
|
|
||||||
expiry: '2023-04-14T09:31:09.452005Z',
|
|
||||||
__typename: 'EpochTimestamps',
|
|
||||||
},
|
|
||||||
__typename: 'Epoch',
|
|
||||||
},
|
|
||||||
nodesConnection: {
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
avatarUrl:
|
|
||||||
'https://www.gravatar.com/avatar/y2hwc4xjds7zvlam3y4in94q2rcdimsn?d=identicon',
|
|
||||||
id: 'f337b5cc50c49a928e49129a2eca62277a81b4b7336b6e4131f8f0431e8db029',
|
|
||||||
name: 'lovely-fisherman',
|
|
||||||
pubkey:
|
|
||||||
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
|
|
||||||
stakedByOperator: '3000000000000000000000',
|
|
||||||
stakedByDelegates: '0',
|
|
||||||
stakedTotal: '3000000000000000000000',
|
|
||||||
pendingStake: '0',
|
|
||||||
rankingScore: {
|
|
||||||
rankingScore: '0.4999166805532412',
|
|
||||||
stakeScore: '0.2499583402766206',
|
|
||||||
performanceScore: '1',
|
|
||||||
votingPower: '2499',
|
|
||||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
|
||||||
__typename: 'RankingScore',
|
|
||||||
},
|
|
||||||
__typename: 'Node',
|
|
||||||
},
|
|
||||||
__typename: 'NodeEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
avatarUrl:
|
|
||||||
'https://www.gravatar.com/avatar/g1tw70qnoo0tf8ror30jefwhae92zy16?d=identicon',
|
|
||||||
id: 'cdadcf885556e372b6b39679d6ad46854d1d9c1e982da7ff2929544df01f9088',
|
|
||||||
name: 'magnificent-door',
|
|
||||||
pubkey:
|
|
||||||
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
|
|
||||||
stakedByOperator: '3000000000000000000000',
|
|
||||||
stakedByDelegates: '0',
|
|
||||||
stakedTotal: '3000000000000000000000',
|
|
||||||
pendingStake: '0',
|
|
||||||
rankingScore: {
|
|
||||||
rankingScore: '0.4999166805532412',
|
|
||||||
stakeScore: '0.2499583402766206',
|
|
||||||
performanceScore: '1',
|
|
||||||
votingPower: '2499',
|
|
||||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
|
||||||
__typename: 'RankingScore',
|
|
||||||
},
|
|
||||||
__typename: 'Node',
|
|
||||||
},
|
|
||||||
__typename: 'NodeEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
avatarUrl:
|
|
||||||
'https://www.gravatar.com/avatar/s2e7hp7soq5zdhxeap7p21onetsjiy6w?d=identicon',
|
|
||||||
id: '9a13de2548fef30d928e71e76004c98ec7ad9d8fc3ddcd16ddee210b28ea4cfc',
|
|
||||||
name: 'helpful-tree',
|
|
||||||
pubkey:
|
|
||||||
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
|
|
||||||
stakedByOperator: '3000000000000000000000',
|
|
||||||
stakedByDelegates: '2000000000000000000',
|
|
||||||
stakedTotal: '3002000000000000000000',
|
|
||||||
pendingStake: '0',
|
|
||||||
rankingScore: {
|
|
||||||
rankingScore: '0.5002499583402766',
|
|
||||||
stakeScore: '0.2501249791701383',
|
|
||||||
performanceScore: '1',
|
|
||||||
votingPower: '2501',
|
|
||||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
|
||||||
__typename: 'RankingScore',
|
|
||||||
},
|
|
||||||
__typename: 'Node',
|
|
||||||
},
|
|
||||||
__typename: 'NodeEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
avatarUrl:
|
|
||||||
'https://www.gravatar.com/avatar/3gop683kg2cvd8rpv286hzagqt3yjsdq?d=identicon',
|
|
||||||
id: '93ac271ab95038333587e47d11461e6edc0126e6e77156281c545f4c5650a6d0',
|
|
||||||
name: 'easy-cookie',
|
|
||||||
pubkey:
|
|
||||||
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
|
|
||||||
stakedByOperator: '3000000000000000000000',
|
|
||||||
stakedByDelegates: '0',
|
|
||||||
stakedTotal: '3000000000000000000000',
|
|
||||||
pendingStake: '0',
|
|
||||||
rankingScore: {
|
|
||||||
rankingScore: '0.4999166805532412',
|
|
||||||
stakeScore: '0.2499583402766206',
|
|
||||||
performanceScore: '1',
|
|
||||||
votingPower: '2499',
|
|
||||||
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
|
|
||||||
__typename: 'RankingScore',
|
|
||||||
},
|
|
||||||
__typename: 'Node',
|
|
||||||
},
|
|
||||||
__typename: 'NodeEdge',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
__typename: 'NodesConnection',
|
|
||||||
},
|
|
||||||
nodeData: {
|
|
||||||
stakedTotal: '12002000000000000000000',
|
|
||||||
__typename: 'NodeData',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,325 +0,0 @@
|
|||||||
export const proposalsData = {
|
|
||||||
proposalsConnection: {
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
id: 'e8ba9d268e12514644fd1fc7ff289292f4ce6489cc32cc73133aea52c04aef89',
|
|
||||||
rationale: {
|
|
||||||
title: 'Add asset Wrapped Ether',
|
|
||||||
description: 'Proposal to add asset WETH to Vega network',
|
|
||||||
__typename: 'ProposalRationale',
|
|
||||||
},
|
|
||||||
reference: '',
|
|
||||||
state: 'STATE_OPEN',
|
|
||||||
datetime: '2026-12-01T11:41:28.654288Z',
|
|
||||||
rejectionReason: null,
|
|
||||||
party: {
|
|
||||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
|
||||||
__typename: 'Party',
|
|
||||||
},
|
|
||||||
errorDetails: null,
|
|
||||||
terms: {
|
|
||||||
closingDatetime: '2026-12-01T11:45:33Z',
|
|
||||||
enactmentDatetime: '2026-12-01T11:45:43Z',
|
|
||||||
change: {
|
|
||||||
name: 'Wrapped Ether',
|
|
||||||
symbol: 'WETH',
|
|
||||||
decimals: 18,
|
|
||||||
quantum: '0.0008',
|
|
||||||
source: {
|
|
||||||
contractAddress: '0x9B18C6CaD886D5653783E2B25759124760F4407F',
|
|
||||||
withdrawThreshold: '1',
|
|
||||||
lifetimeLimit: '400000000000000000',
|
|
||||||
__typename: 'ERC20',
|
|
||||||
},
|
|
||||||
__typename: 'NewAsset',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalTerms',
|
|
||||||
},
|
|
||||||
votes: {
|
|
||||||
yes: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalVotes',
|
|
||||||
},
|
|
||||||
__typename: 'Proposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
id: 'd848fc7881f13d366df5f61ab139d5fcfa72bf838151bb51b54381870e357931',
|
|
||||||
rationale: {
|
|
||||||
title: 'Add asset Dai Stablecoin',
|
|
||||||
description: 'Proposal to add asset DAI to Vega network',
|
|
||||||
__typename: 'ProposalRationale',
|
|
||||||
},
|
|
||||||
reference: '',
|
|
||||||
state: 'STATE_ENACTED',
|
|
||||||
datetime: '2022-11-29T15:49:57.80978Z',
|
|
||||||
rejectionReason: null,
|
|
||||||
party: {
|
|
||||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
|
||||||
__typename: 'Party',
|
|
||||||
},
|
|
||||||
errorDetails: null,
|
|
||||||
terms: {
|
|
||||||
closingDatetime: '2023-04-13T15:52:58Z',
|
|
||||||
enactmentDatetime: '2023-04-13T15:53:08Z',
|
|
||||||
change: {
|
|
||||||
name: 'Dai Stablecoin',
|
|
||||||
symbol: 'DAI',
|
|
||||||
decimals: 18,
|
|
||||||
quantum: '1',
|
|
||||||
source: {
|
|
||||||
contractAddress: '0xad018fB8ec00bfd622B91C83E684a6AC7bB8fbA4',
|
|
||||||
withdrawThreshold: '1',
|
|
||||||
lifetimeLimit: '500000000000000000000',
|
|
||||||
__typename: 'ERC20',
|
|
||||||
},
|
|
||||||
__typename: 'NewAsset',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalTerms',
|
|
||||||
},
|
|
||||||
votes: {
|
|
||||||
yes: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalVotes',
|
|
||||||
},
|
|
||||||
__typename: 'Proposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
id: 'ccbd651b4a1167fd73c4a0340ac759fa0a31ca487ad46a13254b741ad71947ed',
|
|
||||||
rationale: {
|
|
||||||
title: 'New DAI market',
|
|
||||||
description: 'New DAI market',
|
|
||||||
__typename: 'ProposalRationale',
|
|
||||||
},
|
|
||||||
reference: '0VFQusmmESdrP5GuL8naB6lxfoE3RPGaEeo7abdN',
|
|
||||||
state: 'STATE_ENACTED',
|
|
||||||
datetime: '2022-11-26T19:36:19.26034Z',
|
|
||||||
rejectionReason: null,
|
|
||||||
party: {
|
|
||||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
|
||||||
__typename: 'Party',
|
|
||||||
},
|
|
||||||
errorDetails: null,
|
|
||||||
terms: {
|
|
||||||
closingDatetime: '2022-11-26T19:36:42Z',
|
|
||||||
enactmentDatetime: '2023-03-22T13:57:37Z',
|
|
||||||
change: {
|
|
||||||
instrument: {
|
|
||||||
name: 'UNIDAI Monthly (Dec 2022)',
|
|
||||||
code: 'UNIDAI.MF21',
|
|
||||||
futureProduct: {
|
|
||||||
settlementAsset: { symbol: 'tDAI', __typename: 'Asset' },
|
|
||||||
__typename: 'FutureProduct',
|
|
||||||
},
|
|
||||||
__typename: 'InstrumentConfiguration',
|
|
||||||
},
|
|
||||||
__typename: 'NewMarket',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalTerms',
|
|
||||||
},
|
|
||||||
votes: {
|
|
||||||
yes: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalVotes',
|
|
||||||
},
|
|
||||||
__typename: 'Proposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
id: 'bc70383f0e9515b15542cf4c63590cd2ca46b3363ba7c4a72af0e62112b3951b',
|
|
||||||
rationale: {
|
|
||||||
title: 'USDC-III',
|
|
||||||
description: 'USDC-III D List test',
|
|
||||||
__typename: 'ProposalRationale',
|
|
||||||
},
|
|
||||||
reference: '',
|
|
||||||
state: 'STATE_ENACTED',
|
|
||||||
datetime: '2022-11-22T15:17:28.829605Z',
|
|
||||||
rejectionReason: null,
|
|
||||||
party: {
|
|
||||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
|
||||||
__typename: 'Party',
|
|
||||||
},
|
|
||||||
errorDetails: null,
|
|
||||||
terms: {
|
|
||||||
closingDatetime: '2022-11-22T15:18:56Z',
|
|
||||||
enactmentDatetime: '2022-11-22T15:19:06Z',
|
|
||||||
change: {
|
|
||||||
name: 'USDC-III',
|
|
||||||
symbol: 'USDC-III',
|
|
||||||
decimals: 18,
|
|
||||||
quantum: '1',
|
|
||||||
source: {
|
|
||||||
contractAddress: '0x1F1A067aEC530b66BA5128C9Db76825eC22c3C6b',
|
|
||||||
withdrawThreshold: '100000000000000000000000000',
|
|
||||||
lifetimeLimit: '1000000000000000000000000000',
|
|
||||||
__typename: 'ERC20',
|
|
||||||
},
|
|
||||||
__typename: 'NewAsset',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalTerms',
|
|
||||||
},
|
|
||||||
votes: {
|
|
||||||
yes: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalVotes',
|
|
||||||
},
|
|
||||||
__typename: 'Proposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
id: '9d9b2a9d0179d0e4ccb317f6c4a5db0b905d893190bfb5e5499985ef313281c8',
|
|
||||||
rationale: {
|
|
||||||
title: 'New BTC market',
|
|
||||||
description: 'New BTC market',
|
|
||||||
__typename: 'ProposalRationale',
|
|
||||||
},
|
|
||||||
reference: 'AXeRWS3TvLBFDgWOSHQpKFJf3NTbnWK6310q02fZ',
|
|
||||||
state: 'STATE_ENACTED',
|
|
||||||
datetime: '2022-11-26T19:36:19.26034Z',
|
|
||||||
rejectionReason: null,
|
|
||||||
party: {
|
|
||||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
|
||||||
__typename: 'Party',
|
|
||||||
},
|
|
||||||
errorDetails: null,
|
|
||||||
terms: {
|
|
||||||
closingDatetime: '2022-11-26T19:36:42Z',
|
|
||||||
enactmentDatetime: '2023-03-22T13:57:37Z',
|
|
||||||
change: {
|
|
||||||
instrument: {
|
|
||||||
name: 'ETHBTC Quarterly (Feb 2023)',
|
|
||||||
code: 'ETHBTC.QM21',
|
|
||||||
futureProduct: {
|
|
||||||
settlementAsset: { symbol: 'tBTC', __typename: 'Asset' },
|
|
||||||
__typename: 'FutureProduct',
|
|
||||||
},
|
|
||||||
__typename: 'InstrumentConfiguration',
|
|
||||||
},
|
|
||||||
__typename: 'NewMarket',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalTerms',
|
|
||||||
},
|
|
||||||
votes: {
|
|
||||||
yes: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalVotes',
|
|
||||||
},
|
|
||||||
__typename: 'Proposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalEdge',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
node: {
|
|
||||||
id: '9c48796e7988769ededc2b2b02220b00e93f65f23e8141bf1fd23a6983d95943',
|
|
||||||
rationale: {
|
|
||||||
title: 'Update governance.proposal.asset.requiredMajority',
|
|
||||||
description:
|
|
||||||
'Proposal to update governance.proposal.asset.requiredMajority to 300}',
|
|
||||||
__typename: 'ProposalRationale',
|
|
||||||
},
|
|
||||||
reference: '',
|
|
||||||
state: 'STATE_ENACTED',
|
|
||||||
datetime: '2022-11-22T13:22:52.370655Z',
|
|
||||||
rejectionReason: null,
|
|
||||||
party: {
|
|
||||||
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
|
|
||||||
__typename: 'Party',
|
|
||||||
},
|
|
||||||
errorDetails: null,
|
|
||||||
terms: {
|
|
||||||
closingDatetime: '2022-11-22T13:27:13Z',
|
|
||||||
enactmentDatetime: '2022-11-22T13:27:33Z',
|
|
||||||
change: {
|
|
||||||
networkParameter: {
|
|
||||||
key: 'governance.proposal.asset.requiredParticipation',
|
|
||||||
value: '0.000001',
|
|
||||||
__typename: 'NetworkParameter',
|
|
||||||
},
|
|
||||||
__typename: 'UpdateNetworkParameter',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalTerms',
|
|
||||||
},
|
|
||||||
votes: {
|
|
||||||
yes: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
totalTokens: '0',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalVotes',
|
|
||||||
},
|
|
||||||
__typename: 'Proposal',
|
|
||||||
},
|
|
||||||
__typename: 'ProposalEdge',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
__typename: 'ProposalsConnection',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -2,14 +2,12 @@
|
|||||||
"changes": {
|
"changes": {
|
||||||
"decimalPlaces": "5",
|
"decimalPlaces": "5",
|
||||||
"positionDecimalPlaces": "5",
|
"positionDecimalPlaces": "5",
|
||||||
"linearSlippageFactor": "0.001",
|
|
||||||
"quadraticSlippageFactor": "0",
|
|
||||||
"lpPriceRange": "10",
|
"lpPriceRange": "10",
|
||||||
"instrument": {
|
"instrument": {
|
||||||
"name": "Token test market",
|
"name": "Token test market",
|
||||||
"code": "Token.24h",
|
"code": "Token.24h",
|
||||||
"future": {
|
"future": {
|
||||||
"settlementAsset": "73174a6fb1d5802ba0ac7bd7ab79e0a3a4837b262de0a4e80815a55442692bd0",
|
"settlementAsset": "fBTC",
|
||||||
"quoteName": "fBTC",
|
"quoteName": "fBTC",
|
||||||
"dataSourceSpecForSettlementData": {
|
"dataSourceSpecForSettlementData": {
|
||||||
"external": {
|
"external": {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"lpPriceRange": "10",
|
"lpPriceRange": "10",
|
||||||
"linearSlippageFactor": "0.001",
|
|
||||||
"quadraticSlippageFactor": "0",
|
|
||||||
"instrument": {
|
"instrument": {
|
||||||
"code": "TEST.24h",
|
"code": "TEST.24h",
|
||||||
"future": {
|
"future": {
|
||||||
|
|||||||
+92
-107
@@ -1,28 +1,9 @@
|
|||||||
|
import { associateTokenStartOfTests } from '../../support/common.functions';
|
||||||
import {
|
import {
|
||||||
navigateTo,
|
|
||||||
waitForSpinner,
|
|
||||||
navigation,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
convertUnixTimestampToDateformat,
|
|
||||||
createRawProposal,
|
createRawProposal,
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays,
|
|
||||||
enterUniqueFreeFormProposalBody,
|
|
||||||
generateFreeFormProposalTitle,
|
generateFreeFormProposalTitle,
|
||||||
getGovernanceProposalDateFormatForSpecifiedDays,
|
|
||||||
getProposalIdFromList,
|
|
||||||
getProposalInformationFromTable,
|
|
||||||
getSubmittedProposalFromProposalList,
|
|
||||||
goToMakeNewProposal,
|
|
||||||
governanceProposalType,
|
governanceProposalType,
|
||||||
voteForProposal,
|
} from '../../support/governance.functions';
|
||||||
waitForProposalSubmitted,
|
|
||||||
waitForProposalSync,
|
|
||||||
} from '../../../../governance-e2e/src/support/governance.functions';
|
|
||||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../../../governance-e2e/src/support/staking.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../../../governance-e2e/src/support/wallet-eth.functions';
|
|
||||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../../../governance-e2e/src/support/wallet-teardown.functions';
|
|
||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
|
||||||
|
|
||||||
const proposalVoteProgressForPercentage =
|
const proposalVoteProgressForPercentage =
|
||||||
'[data-testid="vote-progress-indicator-percentage-for"]';
|
'[data-testid="vote-progress-indicator-percentage-for"]';
|
||||||
@@ -44,25 +25,24 @@ describe(
|
|||||||
function () {
|
function () {
|
||||||
before('connect wallets and set approval limit', function () {
|
before('connect wallets and set approval limit', function () {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
ethereumWalletConnect();
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
cy.associateTokensToVegaWallet('1');
|
associateTokenStartOfTests();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit proposals tab', function () {
|
beforeEach('visit proposals tab', function () {
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
ethereumWalletConnect();
|
cy.ethereum_wallet_connect();
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
cy.ensure_specified_unstaked_tokens_are_associated(1);
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-050 3001-VOTE-054 3001-VOTE-055 3002-PROP-019
|
// 3001-VOTE-055
|
||||||
it('Newly created raw proposal details - shows proposal title and full description', function () {
|
it('Newly created raw proposal details - shows proposal title and full description', function () {
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
getProposalIdFromList(rawProposal.rationale.title);
|
cy.get_proposal_id_from_list(rawProposal.rationale.title);
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
cy.get('@proposalIdText').then((proposalId) => {
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.get(`#${proposalId}`).within(() => {
|
cy.get(`#${proposalId}`).within(() => {
|
||||||
@@ -89,26 +69,30 @@ describe(
|
|||||||
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
it('Newly created freeform proposal details - shows proposed and closing dates', function () {
|
||||||
const closingVoteHrs = '72';
|
const closingVoteHrs = '72';
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
const proposalTimeStamp = createTenDigitUnixTimeStampForSpecifiedDays(3);
|
|
||||||
|
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody(closingVoteHrs, proposalTitle);
|
cy.create_ten_digit_unix_timestamp_for_specified_days('3').then(
|
||||||
waitForProposalSubmitted();
|
(closingDateTimestamp) => {
|
||||||
waitForProposalSync();
|
cy.enter_unique_freeform_proposal_body(closingVoteHrs, proposalTitle);
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() =>
|
cy.wait_for_proposal_submitted();
|
||||||
cy.get(viewProposalButton).click()
|
cy.wait_for_proposal_sync();
|
||||||
);
|
cy.navigate_to('proposals');
|
||||||
convertUnixTimestampToDateformat(proposalTimeStamp).then(
|
cy.get_submitted_proposal_from_proposal_list(proposalTitle).within(
|
||||||
(closingDate) => {
|
() => cy.get(viewProposalButton).click()
|
||||||
getProposalInformationFromTable('Closes on')
|
);
|
||||||
.contains(closingDate)
|
cy.convert_unix_timestamp_to_governance_data_table_date_format(
|
||||||
.should('be.visible');
|
closingDateTimestamp
|
||||||
|
).then((closingDate) => {
|
||||||
|
cy.get_proposal_information_from_table('Closes on')
|
||||||
|
.contains(closingDate)
|
||||||
|
.should('be.visible');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
getGovernanceProposalDateFormatForSpecifiedDays(0).then(
|
cy.get_governance_proposal_date_format_for_specified_days('0').then(
|
||||||
(proposalDate) => {
|
(proposalDate) => {
|
||||||
getProposalInformationFromTable('Proposed on')
|
cy.get_proposal_information_from_table('Proposed on')
|
||||||
.contains(proposalDate)
|
.contains(proposalDate)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
}
|
}
|
||||||
@@ -120,25 +104,25 @@ describe(
|
|||||||
// 3001-VOTE-040
|
// 3001-VOTE-040
|
||||||
// 3001-VOTE-067
|
// 3001-VOTE-067
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
cy.get_submitted_proposal_from_proposal_list(
|
||||||
rawProposal.rationale.title
|
rawProposal.rationale.title
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
).within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
|
cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
);
|
);
|
||||||
getProposalInformationFromTable('Expected to pass')
|
cy.get_proposal_information_from_table('Expected to pass')
|
||||||
.contains('👎')
|
.contains('👎')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
// 3001-VOTE-062
|
// 3001-VOTE-062
|
||||||
// 3001-VOTE-040
|
// 3001-VOTE-040
|
||||||
// 3001-VOTE-070
|
// 3001-VOTE-070
|
||||||
getProposalInformationFromTable('Token majority met')
|
cy.get_proposal_information_from_table('Token majority met')
|
||||||
.contains('👎')
|
.contains('👎')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
// 3001-VOTE-068
|
// 3001-VOTE-068
|
||||||
getProposalInformationFromTable('Token participation met')
|
cy.get_proposal_information_from_table('Token participation met')
|
||||||
.contains('👎')
|
.contains('👎')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
@@ -146,27 +130,28 @@ describe(
|
|||||||
// 3001-VOTE-080 3001-VOTE-090 3001-VOTE-069 3001-VOTE-072 3001-VOTE-073
|
// 3001-VOTE-080 3001-VOTE-090 3001-VOTE-069 3001-VOTE-072 3001-VOTE-073
|
||||||
it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () {
|
it('Newly created proposal details - ability to vote for and against proposal - with minimum required tokens associated', function () {
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
cy.get_submitted_proposal_from_proposal_list(
|
||||||
rawProposal.rationale.title
|
rawProposal.rationale.title
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
).within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
// 3001-VOTE-080
|
// 3001-VOTE-080
|
||||||
cy.getByTestId('vote-buttons').contains('against').should('be.visible');
|
cy.getByTestId('vote-buttons').contains('against').should('be.visible');
|
||||||
cy.getByTestId('vote-buttons').contains('for').should('be.visible');
|
cy.getByTestId('vote-buttons').contains('for').should('be.visible');
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
getGovernanceProposalDateFormatForSpecifiedDays(0, 'shortMonth').then(
|
cy.get_governance_proposal_date_format_for_specified_days(
|
||||||
(votedDate) => {
|
'0',
|
||||||
// 3001-VOTE-051
|
'shortMonth'
|
||||||
// 3001-VOTE-093
|
).then((votedDate) => {
|
||||||
cy.contains('You voted:')
|
// 3001-VOTE-051
|
||||||
.siblings()
|
// 3001-VOTE-093
|
||||||
.contains('For')
|
cy.contains('You voted:')
|
||||||
.siblings()
|
.siblings()
|
||||||
.contains(votedDate)
|
.contains('For')
|
||||||
.should('be.visible');
|
.siblings()
|
||||||
}
|
.contains(votedDate)
|
||||||
);
|
.should('be.visible');
|
||||||
|
});
|
||||||
cy.get(proposalVoteProgressForPercentage) // 3001-VOTE-072
|
cy.get(proposalVoteProgressForPercentage) // 3001-VOTE-072
|
||||||
.contains('100.00%')
|
.contains('100.00%')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
@@ -177,71 +162,69 @@ describe(
|
|||||||
cy.get(proposalVoteProgressAgainstTokens)
|
cy.get(proposalVoteProgressAgainstTokens)
|
||||||
.contains('0.00')
|
.contains('0.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
cy.get_proposal_information_from_table('Tokens for proposal')
|
||||||
.should('have.text', (1).toFixed(2))
|
.should('have.text', parseFloat(1).toFixed(2))
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Tokens against proposal')
|
cy.get_proposal_information_from_table('Tokens against proposal')
|
||||||
.should('have.text', '0.00')
|
.should('have.text', '0.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
// 3001-VOTE-061
|
// 3001-VOTE-061
|
||||||
getProposalInformationFromTable('Participation required')
|
cy.get_proposal_information_from_table('Participation required')
|
||||||
.contains('0.00%')
|
.contains(0.001)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
// 3001-VOTE-066
|
// 3001-VOTE-066
|
||||||
getProposalInformationFromTable('Majority Required') // 3001-VOTE-073
|
cy.get_proposal_information_from_table('Majority Required') // 3001-VOTE-073
|
||||||
.contains(`${(66).toFixed(2)}%`)
|
.contains(`${parseFloat(100).toFixed(2)}%`)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
getProposalInformationFromTable('Number of voting parties')
|
cy.get_proposal_information_from_table('Number of voting parties')
|
||||||
.should('have.text', '1')
|
.should('have.text', '1')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.get(changeVoteButton).should('be.visible').click();
|
cy.get(changeVoteButton).should('be.visible').click();
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
// 3001-VOTE-064
|
// 3001-VOTE-064
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
cy.get_proposal_information_from_table('Tokens for proposal')
|
||||||
.should('have.text', (1).toFixed(2))
|
.should('have.text', parseFloat(1).toFixed(2))
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.get(changeVoteButton).should('be.visible').click();
|
cy.get(changeVoteButton).should('be.visible').click();
|
||||||
voteForProposal('against');
|
cy.vote_for_proposal('against');
|
||||||
cy.get(proposalVoteProgressAgainstPercentage)
|
cy.get(proposalVoteProgressAgainstPercentage)
|
||||||
.contains('100.00%')
|
.contains('100.00%')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Tokens against proposal')
|
cy.get_proposal_information_from_table('Tokens against proposal')
|
||||||
.should('have.text', (1).toFixed(2))
|
.should('have.text', parseFloat(1).toFixed(2))
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Number of voting parties')
|
cy.get_proposal_information_from_table('Number of voting parties')
|
||||||
.should('have.text', '1')
|
.should('have.text', '1')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-042, 3001-VOTE-057, 3001-VOTE-058, 3001-VOTE-059, 3001-VOTE-060
|
// 3001-VOTE-042, 3001-VOTE-057, 3001-VOTE-058, 3001-VOTE-059, 3001-VOTE-060
|
||||||
it('Newly created proposal details - ability to increase associated tokens - by voting again after association', function () {
|
it('Newly created proposal details - ability to increase associated tokens - by voting again after association', function () {
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
cy.get_submitted_proposal_from_proposal_list(
|
||||||
rawProposal.rationale.title
|
rawProposal.rationale.title
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
)
|
||||||
|
.as('submittedProposal')
|
||||||
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
// 3001-VOTE-079
|
// 3001-VOTE-079
|
||||||
cy.contains('You voted: For').should('be.visible');
|
cy.contains('You voted: For').should('be.visible');
|
||||||
cy.get(proposalVoteProgressForTokens).contains('1').and('be.visible');
|
cy.get(proposalVoteProgressForTokens).contains('1').and('be.visible');
|
||||||
getProposalInformationFromTable('Total Supply')
|
cy.get_proposal_information_from_table('Total Supply')
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.then((totalSupply) => {
|
.then((totalSupply) => {
|
||||||
const tokensRequiredToAchieveResult = (
|
let tokensRequiredToAchieveResult = parseFloat(
|
||||||
(Number(totalSupply.replace(/,/g, '')) * 0.001) /
|
(totalSupply.replace(/,/g, '') * 0.001) / 100
|
||||||
100
|
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated(
|
cy.ensure_specified_unstaked_tokens_are_associated(
|
||||||
tokensRequiredToAchieveResult
|
tokensRequiredToAchieveResult
|
||||||
);
|
);
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@submittedProposal').within(() =>
|
||||||
getSubmittedProposalFromProposalList(
|
cy.get(viewProposalButton).click()
|
||||||
rawProposal.rationale.title
|
);
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
|
||||||
});
|
|
||||||
cy.get(proposalVoteProgressForPercentage)
|
cy.get(proposalVoteProgressForPercentage)
|
||||||
.contains('100.00%')
|
.contains('100.00%')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
@@ -250,36 +233,38 @@ describe(
|
|||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
// 3001-VOTE-065
|
// 3001-VOTE-065
|
||||||
cy.get(changeVoteButton).should('be.visible').click();
|
cy.get(changeVoteButton).should('be.visible').click();
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
cy.get(proposalVoteProgressForTokens)
|
cy.get(proposalVoteProgressForTokens)
|
||||||
.contains(tokensRequiredToAchieveResult)
|
.contains(tokensRequiredToAchieveResult)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.get(proposalVoteProgressAgainstTokens)
|
cy.get(proposalVoteProgressAgainstTokens)
|
||||||
.contains('0.00')
|
.contains('0.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Total tokens voted percentage')
|
cy.get_proposal_information_from_table(
|
||||||
|
'Total tokens voted percentage'
|
||||||
|
)
|
||||||
.should('have.text', '0.00%')
|
.should('have.text', '0.00%')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
cy.get_proposal_information_from_table('Tokens for proposal')
|
||||||
.should('have.text', tokensRequiredToAchieveResult)
|
.should('have.text', tokensRequiredToAchieveResult)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Tokens against proposal')
|
cy.get_proposal_information_from_table('Tokens against proposal')
|
||||||
.should('have.text', '0.00')
|
.should('have.text', '0.00')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Number of voting parties')
|
cy.get_proposal_information_from_table('Number of voting parties')
|
||||||
.should('have.text', '1')
|
.should('have.text', '1')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Expected to pass')
|
cy.get_proposal_information_from_table('Expected to pass')
|
||||||
.contains('👍')
|
.contains('👍')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
// 3001-VOTE-062
|
// 3001-VOTE-062
|
||||||
getProposalInformationFromTable('Token majority met')
|
cy.get_proposal_information_from_table('Token majority met')
|
||||||
.contains('👍')
|
.contains('👍')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
getProposalInformationFromTable('Token participation met')
|
cy.get_proposal_information_from_table('Token participation met')
|
||||||
.contains('👍')
|
.contains('👍')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
getProposalInformationFromTable('Tokens for proposal')
|
cy.get_proposal_information_from_table('Tokens for proposal')
|
||||||
.contains(tokensRequiredToAchieveResult)
|
.contains(tokensRequiredToAchieveResult)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
+34
-45
@@ -1,22 +1,11 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
import {
|
import { associateTokenStartOfTests } from '../../support/governance.functions';
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
waitForSpinner,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
getProposalInformationFromTable,
|
|
||||||
voteForProposal,
|
|
||||||
} from '../../support/governance.functions';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createUpdateNetworkProposalTxBody,
|
createUpdateNetworkProposalTxBody,
|
||||||
createFreeFormProposalTxBody,
|
createFreeFormProposalTxBody,
|
||||||
} from '../../support/proposal.functions';
|
} from '../../support/proposal.functions';
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
|
||||||
|
|
||||||
const proposalListItem = '[data-testid="proposals-list-item"]';
|
|
||||||
const closedProposals = '[data-testid="closed-proposals"]';
|
const closedProposals = '[data-testid="closed-proposals"]';
|
||||||
const proposalStatus = '[data-testid="proposal-status"]';
|
const proposalStatus = '[data-testid="proposal-status"]';
|
||||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||||
@@ -32,16 +21,20 @@ context(
|
|||||||
function () {
|
function () {
|
||||||
before('Connect wallets and set approval', function () {
|
before('Connect wallets and set approval', function () {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
|
associateTokenStartOfTests();
|
||||||
|
cy.connectVegaWallet();
|
||||||
|
cy.ethereum_wallet_connect();
|
||||||
|
cy.ensure_specified_unstaked_tokens_are_associated(1);
|
||||||
|
cy.clearLocalStorage();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit proposals', function () {
|
beforeEach('visit proposals', function () {
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
ethereumWalletConnect();
|
cy.ethereum_wallet_connect();
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-006
|
// 3001-VOTE-006
|
||||||
@@ -50,18 +43,17 @@ context(
|
|||||||
|
|
||||||
cy.createMarket();
|
cy.createMarket();
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.get(closedProposals).within(() => {
|
cy.get(closedProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil('[data-testid="proposals-list-item"]')
|
||||||
.last()
|
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(proposalStatus).should('have.text', 'Enacted ');
|
cy.get(proposalStatus).should('have.text', 'Enacted ');
|
||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cy.getByTestId('proposal-type').should('have.text', 'New market');
|
cy.getByTestId('proposal-type').should('have.text', 'New market');
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Enacted')
|
.contains('Enacted')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.get(votesTable).within(() => {
|
cy.get(votesTable).within(() => {
|
||||||
@@ -76,23 +68,22 @@ context(
|
|||||||
const proposalTx = createUpdateNetworkProposalTxBody();
|
const proposalTx = createUpdateNetworkProposalTxBody();
|
||||||
|
|
||||||
cy.VegaWalletSubmitProposal(proposalTx);
|
cy.VegaWalletSubmitProposal(proposalTx);
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil('[data-testid="proposals-list-item"]')
|
||||||
.last()
|
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Open')
|
.contains('Open')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
getProposalInformationFromTable('State') // 3001-VOTE-047
|
cy.get_proposal_information_from_table('State') // 3001-VOTE-047
|
||||||
.contains('Passed', proposalTimeout)
|
.contains('Passed', proposalTimeout)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Enacted', proposalTimeout)
|
.contains('Enacted', proposalTimeout)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
cy.get(votesTable).within(() => {
|
cy.get(votesTable).within(() => {
|
||||||
@@ -110,45 +101,43 @@ context(
|
|||||||
const proposalTx = createFreeFormProposalTxBody();
|
const proposalTx = createFreeFormProposalTxBody();
|
||||||
|
|
||||||
cy.VegaWalletSubmitProposal(proposalTx);
|
cy.VegaWalletSubmitProposal(proposalTx);
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.get(openProposals, { timeout: 6000 }).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil('[data-testid="proposals-list-item"]')
|
||||||
.last()
|
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Open')
|
.contains('Open')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Enacted', proposalTimeout)
|
.contains('Enacted', proposalTimeout)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-048 3001-VOTE-049 3001-VOTE-050
|
// 3001-VOTE-048 3001-VOTE-049
|
||||||
it('Able to fail proposal due to lack of participation', function () {
|
it('Able to fail proposal due to lack of participation', function () {
|
||||||
const proposalTitle = 'Add New free form proposal with short enactment';
|
const proposalTitle = 'Add New free form proposal with short enactment';
|
||||||
const proposalTx = createFreeFormProposalTxBody();
|
const proposalTx = createFreeFormProposalTxBody();
|
||||||
cy.VegaWalletSubmitProposal(proposalTx);
|
cy.VegaWalletSubmitProposal(proposalTx);
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.contains(proposalTitle)
|
cy.contains(proposalTitle)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil('[data-testid="proposals-list-item"]')
|
||||||
.last()
|
|
||||||
.within(() => cy.get(viewProposalButton).click());
|
.within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Open')
|
.contains('Open')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('State') // 3001-VOTE-047
|
cy.get_proposal_information_from_table('State') // 3001-VOTE-047
|
||||||
.contains('Declined', proposalTimeout)
|
.contains('Declined', proposalTimeout)
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Rejection reason')
|
cy.get_proposal_information_from_table('Rejection reason')
|
||||||
.contains('PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED')
|
.contains('PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
+152
-148
@@ -1,47 +1,22 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
import {
|
import {
|
||||||
createRawProposal,
|
createRawProposal,
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays,
|
|
||||||
enterRawProposalBody,
|
|
||||||
enterUniqueFreeFormProposalBody,
|
|
||||||
generateFreeFormProposalTitle,
|
generateFreeFormProposalTitle,
|
||||||
getProposalInformationFromTable,
|
|
||||||
getSubmittedProposalFromProposalList,
|
|
||||||
goToMakeNewProposal,
|
|
||||||
governanceProposalType,
|
governanceProposalType,
|
||||||
voteForProposal,
|
|
||||||
waitForProposalSubmitted,
|
|
||||||
waitForProposalSync,
|
|
||||||
} from '../../support/governance.functions';
|
} from '../../support/governance.functions';
|
||||||
|
|
||||||
import {
|
import { associateTokenStartOfTests } from '../../support/common.functions';
|
||||||
verifyUnstakedBalance,
|
|
||||||
waitForSpinner,
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
closeDialog,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
clickOnValidatorFromList,
|
|
||||||
closeStakingDialog,
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated,
|
|
||||||
stakingPageDisassociateTokens,
|
|
||||||
stakingValidatorPageAddStake,
|
|
||||||
} from '../../support/staking.functions';
|
|
||||||
import {
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
|
||||||
vegaWalletTeardown,
|
|
||||||
} from '../../support/wallet-teardown.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
|
||||||
|
|
||||||
|
const vegaWalletUnstakedBalance =
|
||||||
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
const vegaWalletStakedBalances =
|
const vegaWalletStakedBalances =
|
||||||
'[data-testid="vega-wallet-balance-staked-validators"]';
|
'[data-testid="vega-wallet-balance-staked-validators"]';
|
||||||
const vegaWalletAssociatedBalance = '[data-testid="associated-amount"]';
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
const vegaWalletNameElement = '[data-testid="wallet-name"]';
|
const vegaWalletNameElement = '[data-testid="wallet-name"]';
|
||||||
const vegaWallet = '[data-testid="vega-wallet"]';
|
const vegaWallet = '[data-testid="vega-wallet"]';
|
||||||
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
|
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
|
||||||
const newProposalSubmitButton = '[data-testid="proposal-submit"]';
|
const newProposalSubmitButton = '[data-testid="proposal-submit"]';
|
||||||
|
const dialogCloseButton = '[data-testid="dialog-close"]';
|
||||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||||
const rawProposalData = '[data-testid="proposal-data"]';
|
const rawProposalData = '[data-testid="proposal-data"]';
|
||||||
const minVoteButton = '[data-testid="min-vote"]';
|
const minVoteButton = '[data-testid="min-vote"]';
|
||||||
@@ -65,32 +40,30 @@ context(
|
|||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.get_network_parameters().then((network_parameters) => {
|
cy.get_network_parameters().then((network_parameters) => {
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
Number(network_parameters['spam.protection.proposal.min.tokens']) /
|
network_parameters['spam.protection.proposal.min.tokens'] /
|
||||||
1000000000000000000
|
1000000000000000000
|
||||||
).as('minProposerBalance');
|
).as('minProposerBalance');
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
Number(network_parameters['spam.protection.voting.min.tokens']) /
|
network_parameters['spam.protection.voting.min.tokens'] /
|
||||||
1000000000000000000
|
1000000000000000000
|
||||||
).as('minVoterBalance');
|
).as('minVoterBalance');
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
Number(
|
network_parameters['governance.proposal.freeform.requiredMajority'] *
|
||||||
network_parameters['governance.proposal.freeform.requiredMajority']
|
100
|
||||||
) * 100
|
|
||||||
).as('requiredMajority');
|
).as('requiredMajority');
|
||||||
});
|
});
|
||||||
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
cy.associateTokensToVegaWallet('1');
|
associateTokenStartOfTests();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
ethereumWalletConnect();
|
cy.ethereum_wallet_connect();
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
cy.ensure_specified_unstaked_tokens_are_associated(1);
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to see that no proposals exist', function () {
|
it('Should be able to see that no proposals exist', function () {
|
||||||
@@ -107,7 +80,7 @@ context(
|
|||||||
// 3002-PROP-003
|
// 3002-PROP-003
|
||||||
it('Submit a proposal form - shows how many vega tokens are required to make a proposal', function () {
|
it('Submit a proposal form - shows how many vega tokens are required to make a proposal', function () {
|
||||||
// 3002-PROP-005
|
// 3002-PROP-005
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
cy.go_to_make_new_proposal(governanceProposalType.NEW_MARKET);
|
||||||
cy.contains(
|
cy.contains(
|
||||||
`You must have at least 1 VEGA associated to make a proposal`
|
`You must have at least 1 VEGA associated to make a proposal`
|
||||||
).should('be.visible');
|
).should('be.visible');
|
||||||
@@ -115,7 +88,7 @@ context(
|
|||||||
|
|
||||||
// 3002-PROP-011
|
// 3002-PROP-011
|
||||||
it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () {
|
it('Able to submit a valid freeform proposal - with minimum required tokens associated', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||||
cy.get(minVoteButton).should('be.visible'); // 3002-PROP-008
|
cy.get(minVoteButton).should('be.visible'); // 3002-PROP-008
|
||||||
cy.get(maxVoteButton).should('be.visible');
|
cy.get(maxVoteButton).should('be.visible');
|
||||||
cy.get(votingDate).should('not.be.empty');
|
cy.get(votingDate).should('not.be.empty');
|
||||||
@@ -123,31 +96,40 @@ context(
|
|||||||
'contain.text',
|
'contain.text',
|
||||||
'we add 2 minutes of extra time'
|
'we add 2 minutes of extra time'
|
||||||
);
|
);
|
||||||
enterUniqueFreeFormProposalBody('50', generateFreeFormProposalTitle());
|
cy.enter_unique_freeform_proposal_body(
|
||||||
|
'50',
|
||||||
|
generateFreeFormProposalTitle()
|
||||||
|
);
|
||||||
// 3002-PROP-012
|
// 3002-PROP-012
|
||||||
// 3002-PROP-016
|
// 3002-PROP-016
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to submit a valid freeform proposal - with minimum required tokens associated - but also staked', function () {
|
it('Able to submit a valid freeform proposal - with minimum required tokens associated - but also staked', function () {
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('2');
|
cy.ensure_specified_unstaked_tokens_are_associated('2');
|
||||||
verifyUnstakedBalance(2);
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', '2');
|
||||||
navigateTo(navigation.validators);
|
cy.navigate_to('validators');
|
||||||
clickOnValidatorFromList(0);
|
cy.click_on_validator_from_list(0);
|
||||||
stakingValidatorPageAddStake('2');
|
cy.staking_validator_page_add_stake('2');
|
||||||
closeStakingDialog();
|
cy.close_staking_dialog();
|
||||||
|
|
||||||
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
|
cy.get(vegaWalletStakedBalances, txTimeout).should('contain', '2');
|
||||||
|
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody('50', generateFreeFormProposalTitle());
|
cy.enter_unique_freeform_proposal_body(
|
||||||
waitForProposalSubmitted();
|
'50',
|
||||||
|
generateFreeFormProposalTitle()
|
||||||
|
);
|
||||||
|
cy.wait_for_proposal_submitted();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Creating a proposal - proposal rejected - when closing time sooner than system default', function () {
|
it('Creating a proposal - proposal rejected - when closing time sooner than system default', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody('0.1', generateFreeFormProposalTitle());
|
cy.enter_unique_freeform_proposal_body(
|
||||||
|
'0.1',
|
||||||
|
generateFreeFormProposalTitle()
|
||||||
|
);
|
||||||
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
||||||
'not.exist'
|
'not.exist'
|
||||||
);
|
);
|
||||||
@@ -157,8 +139,8 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Creating a proposal - proposal rejected - when closing time later than system default', function () {
|
it('Creating a proposal - proposal rejected - when closing time later than system default', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody(
|
cy.enter_unique_freeform_proposal_body(
|
||||||
'100000',
|
'100000',
|
||||||
generateFreeFormProposalTitle()
|
generateFreeFormProposalTitle()
|
||||||
);
|
);
|
||||||
@@ -172,18 +154,22 @@ context(
|
|||||||
|
|
||||||
// 3001-VOTE-006
|
// 3001-VOTE-006
|
||||||
it('Creating a proposal - proposal rejected - able to access rejected proposals', function () {
|
it('Creating a proposal - proposal rejected - able to access rejected proposals', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
cy.go_to_make_new_proposal(governanceProposalType.RAW);
|
||||||
enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(1000));
|
cy.create_ten_digit_unix_timestamp_for_specified_days('1000').then(
|
||||||
|
(closingDateTimestamp) => {
|
||||||
|
cy.enter_raw_proposal_body(closingDateTimestamp).as('rawProposal');
|
||||||
|
}
|
||||||
|
);
|
||||||
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
cy.contains('Awaiting network confirmation', epochTimeout).should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
);
|
);
|
||||||
cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
|
cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
|
||||||
closeDialog();
|
cy.get(dialogCloseButton).click();
|
||||||
waitForProposalSync();
|
cy.wait_for_proposal_sync();
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
cy.get(rejectProposalsLink).click();
|
cy.get(rejectProposalsLink).click();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
cy.get_submitted_proposal_from_proposal_list(
|
||||||
rawProposal.rationale.title
|
rawProposal.rationale.title
|
||||||
).within(() => {
|
).within(() => {
|
||||||
cy.contains('Rejected').should('be.visible');
|
cy.contains('Rejected').should('be.visible');
|
||||||
@@ -191,68 +177,79 @@ context(
|
|||||||
cy.get(viewProposalButton).click();
|
cy.get(viewProposalButton).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('State')
|
cy.get_proposal_information_from_table('State')
|
||||||
.contains('Rejected')
|
.contains('Rejected')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Rejection reason')
|
cy.get_proposal_information_from_table('Rejection reason')
|
||||||
.contains('PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE')
|
.contains('PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
getProposalInformationFromTable('Error details')
|
cy.get_proposal_information_from_table('Error details')
|
||||||
.contains('proposal closing time too late')
|
.contains('proposal closing time too late')
|
||||||
.and('be.visible');
|
.and('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 0005-ETXN-004
|
// 0005-ETXN-004
|
||||||
it('Unable to create a proposal - when no tokens are associated', function () {
|
it('Unable to create a proposal - when no tokens are associated', function () {
|
||||||
const errorMsg =
|
cy.vega_wallet_teardown();
|
||||||
'Network error: the network blocked the transaction through the spam protection: party has insufficient associated governance tokens in their staking account to submit proposal request (ABCI code 89)';
|
|
||||||
vegaWalletTeardown();
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).contains(
|
cy.get(vegaWalletAssociatedBalance, txTimeout).contains(
|
||||||
'0.00',
|
'0.00',
|
||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
cy.go_to_make_new_proposal(governanceProposalType.RAW);
|
||||||
enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8));
|
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
|
||||||
|
(closingDateTimestamp) => {
|
||||||
|
cy.enter_raw_proposal_body(closingDateTimestamp).as;
|
||||||
|
}
|
||||||
|
);
|
||||||
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
||||||
cy.get(feedbackError).should('have.text', errorMsg);
|
cy.get(feedbackError).should(
|
||||||
closeDialog();
|
'have.text',
|
||||||
|
'Network error: the network blocked the transaction through the spam protection'
|
||||||
|
);
|
||||||
|
cy.get(dialogCloseButton).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3002-PROP-009
|
// 3002-PROP-009
|
||||||
it('Unable to create a proposal - when some but not enough tokens are associated', function () {
|
it('Unable to create a proposal - when some but not enough tokens are associated', function () {
|
||||||
const errorMsg =
|
cy.ensure_specified_unstaked_tokens_are_associated(0.000001);
|
||||||
'Network error: the network blocked the transaction through the spam protection: party has insufficient associated governance tokens in their staking account to submit proposal request (ABCI code 89)';
|
cy.go_to_make_new_proposal(governanceProposalType.RAW);
|
||||||
|
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('0.000001');
|
(closingDateTimestamp) => {
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
cy.enter_raw_proposal_body(closingDateTimestamp);
|
||||||
enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8));
|
}
|
||||||
|
);
|
||||||
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
||||||
cy.get(feedbackError).should('have.text', errorMsg);
|
cy.get(feedbackError).should(
|
||||||
closeDialog();
|
'have.text',
|
||||||
|
'Network error: the network blocked the transaction through the spam protection'
|
||||||
|
);
|
||||||
|
cy.get(dialogCloseButton).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
|
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
|
||||||
const errorMsg =
|
|
||||||
'Invalid params: the transaction does not use a valid Vega command: unknown field "unexpected" in vega.commands.v1.ProposalSubmission';
|
|
||||||
|
|
||||||
// 3001-VOTE-038 3002-PROP-013 3002-PROP-014
|
// 3001-VOTE-038 3002-PROP-013 3002-PROP-014
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
cy.go_to_make_new_proposal(governanceProposalType.RAW);
|
||||||
|
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
|
||||||
cy.fixture('/proposals/raw.json').then((freeformProposal) => {
|
(closingDateTimestamp) => {
|
||||||
freeformProposal.terms.closingTimestamp =
|
cy.fixture('/proposals/raw.json').then((freeformProposal) => {
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays(8);
|
freeformProposal.terms.closingTimestamp = closingDateTimestamp;
|
||||||
freeformProposal.unexpected = `i shouldn't be here`;
|
freeformProposal.unexpected = `i shouldn't be here`;
|
||||||
const proposalPayload = JSON.stringify(freeformProposal);
|
let proposalPayload = JSON.stringify(freeformProposal);
|
||||||
cy.get(rawProposalData).type(proposalPayload, {
|
cy.get(rawProposalData).type(proposalPayload, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
|
|
||||||
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
||||||
cy.get(feedbackError).should('have.text', errorMsg);
|
cy.get(feedbackError).should(
|
||||||
closeDialog();
|
'have.text',
|
||||||
|
'Invalid params: the transaction is malformed'
|
||||||
|
);
|
||||||
|
cy.get(dialogCloseButton).click();
|
||||||
cy.get(rawProposalData)
|
cy.get(rawProposalData)
|
||||||
.invoke('val')
|
.invoke('val')
|
||||||
.should('contain', "i shouldn't be here");
|
.should('contain', "i shouldn't be here");
|
||||||
@@ -260,64 +257,71 @@ context(
|
|||||||
|
|
||||||
it('Unable to create a freeform proposal - when json terms section contains unexpected field', function () {
|
it('Unable to create a freeform proposal - when json terms section contains unexpected field', function () {
|
||||||
// 3001-VOTE-038
|
// 3001-VOTE-038
|
||||||
const errorMsg =
|
cy.go_to_make_new_proposal(governanceProposalType.RAW);
|
||||||
'Invalid params: the transaction does not use a valid Vega command: unknown field "unexpectedField" in vega.ProposalTerms';
|
cy.create_ten_digit_unix_timestamp_for_specified_days('8').then(
|
||||||
|
(closingDateTimestamp) => {
|
||||||
|
cy.fixture('/proposals/raw.json').then((rawProposal) => {
|
||||||
|
rawProposal.terms.closingTimestamp = closingDateTimestamp;
|
||||||
|
rawProposal.terms.unexpectedField = `i shouldn't be here`;
|
||||||
|
let proposalPayload = JSON.stringify(rawProposal);
|
||||||
|
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
cy.get(rawProposalData).type(proposalPayload, {
|
||||||
|
parseSpecialCharSequences: false,
|
||||||
cy.fixture('/proposals/raw.json').then((rawProposal) => {
|
delay: 2,
|
||||||
rawProposal.terms.closingTimestamp =
|
});
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays(8);
|
});
|
||||||
rawProposal.terms.unexpectedField = `i shouldn't be here`;
|
}
|
||||||
const proposalPayload = JSON.stringify(rawProposal);
|
);
|
||||||
|
|
||||||
cy.get(rawProposalData).type(proposalPayload, {
|
|
||||||
parseSpecialCharSequences: false,
|
|
||||||
delay: 2,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
|
|
||||||
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
||||||
cy.get(feedbackError).should('have.text', errorMsg);
|
cy.get(feedbackError).should(
|
||||||
closeDialog();
|
'have.text',
|
||||||
|
'Invalid params: the transaction is malformed'
|
||||||
|
);
|
||||||
|
cy.get(dialogCloseButton).click();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 1005-PROP-009
|
// 1005-PROP-009
|
||||||
it('Unable to vote on a freeform proposal - when some but not enough vega associated', function () {
|
it.skip(
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
'Unable to vote on a freeform proposal - when some but not enough vega associated',
|
||||||
|
{ tags: '@smoke' },
|
||||||
|
function () {
|
||||||
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
cy.ensure_specified_unstaked_tokens_are_associated(1);
|
||||||
goToMakeNewProposal(governanceProposalType.FREEFORM);
|
cy.go_to_make_new_proposal(governanceProposalType.FREEFORM);
|
||||||
enterUniqueFreeFormProposalBody('50', proposalTitle);
|
cy.enter_unique_freeform_proposal_body('50', proposalTitle);
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
stakingPageDisassociateTokens('0.0001');
|
cy.staking_page_disassociate_tokens('0.0001');
|
||||||
cy.get(vegaWallet).within(() => {
|
cy.get(vegaWallet).within(() => {
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
cy.get(vegaWalletAssociatedBalance).should('have.length', 1);
|
||||||
'contain',
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
'0.9999'
|
'contain',
|
||||||
|
'0.9999'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
cy.navigate_to('proposals');
|
||||||
|
cy.get_submitted_proposal_from_proposal_list(proposalTitle).within(() =>
|
||||||
|
cy.get(viewProposalButton).click()
|
||||||
);
|
);
|
||||||
});
|
cy.contains('Vote breakdown').should('be.visible', {
|
||||||
navigateTo(navigation.proposals);
|
timeout: 10000,
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() =>
|
});
|
||||||
cy.get(viewProposalButton).click()
|
cy.get(voteButtons).should('not.exist');
|
||||||
);
|
cy.getByTestId('min-proposal-requirements').should(
|
||||||
cy.contains('Vote breakdown').should('be.visible', {
|
'have.text',
|
||||||
timeout: 10000,
|
`You must have at least ${this.minVoterBalance} VEGA associated to vote on this proposal`
|
||||||
});
|
);
|
||||||
cy.get(voteButtons).should('not.exist');
|
}
|
||||||
cy.getByTestId('min-proposal-requirements').should(
|
);
|
||||||
'have.text',
|
|
||||||
`You must have at least ${this.minVoterBalance} VEGA associated to vote on this proposal`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Unable to vote on a proposal - when vega wallet disconnected - option to connect from within', function () {
|
it('Unable to vote on a proposal - when vega wallet disconnected - option to connect from within', function () {
|
||||||
createRawProposal();
|
createRawProposal();
|
||||||
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
cy.get('[data-testid="manage-vega-wallet"]').click();
|
||||||
cy.get('[data-testid="disconnect"]').click();
|
cy.get('[data-testid="disconnect"]').click();
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
getSubmittedProposalFromProposalList(
|
cy.get_submitted_proposal_from_proposal_list(
|
||||||
rawProposal.rationale.title
|
rawProposal.rationale.title
|
||||||
).within(() => cy.get(viewProposalButton).click());
|
).within(() => cy.get(viewProposalButton).click());
|
||||||
});
|
});
|
||||||
@@ -335,7 +339,7 @@ context(
|
|||||||
'1.00',
|
'1.00',
|
||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
voteForProposal('against');
|
cy.vote_for_proposal('against');
|
||||||
// 3001-VOTE-079
|
// 3001-VOTE-079
|
||||||
cy.contains('You voted: Against').should('be.visible');
|
cy.contains('You voted: Against').should('be.visible');
|
||||||
});
|
});
|
||||||
+63
-112
@@ -1,23 +1,3 @@
|
|||||||
import {
|
|
||||||
closeDialog,
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
waitForSpinner,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
getProposalInformationFromTable,
|
|
||||||
goToMakeNewProposal,
|
|
||||||
voteForProposal,
|
|
||||||
waitForProposalSubmitted,
|
|
||||||
} from '../../support/governance.functions';
|
|
||||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/staking.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import {
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
|
||||||
vegaWalletTeardown,
|
|
||||||
} from '../../support/wallet-teardown.functions';
|
|
||||||
import { vegaWalletFaucetAssetsWithoutCheck } from '../../support/wallet-vega.functions';
|
|
||||||
|
|
||||||
const proposalListItem = '[data-testid="proposals-list-item"]';
|
const proposalListItem = '[data-testid="proposals-list-item"]';
|
||||||
const openProposals = '[data-testid="open-proposals"]';
|
const openProposals = '[data-testid="open-proposals"]';
|
||||||
const proposalType = '[data-testid="proposal-type"]';
|
const proposalType = '[data-testid="proposal-type"]';
|
||||||
@@ -40,6 +20,7 @@ const maxVoteDeadline = '[data-testid="max-vote"]';
|
|||||||
const minValidationDeadline = '[data-testid="min-validation"]';
|
const minValidationDeadline = '[data-testid="min-validation"]';
|
||||||
const minEnactDeadline = '[data-testid="min-enactment"]';
|
const minEnactDeadline = '[data-testid="min-enactment"]';
|
||||||
const maxEnactDeadline = '[data-testid="max-enactment"]';
|
const maxEnactDeadline = '[data-testid="max-enactment"]';
|
||||||
|
const dialogCloseButton = '[data-testid="dialog-close"]';
|
||||||
const inputError = '[data-testid="input-error-text"]';
|
const inputError = '[data-testid="input-error-text"]';
|
||||||
const enactmentDeadlineError =
|
const enactmentDeadlineError =
|
||||||
'[data-testid="enactment-before-voting-deadline"]';
|
'[data-testid="enactment-before-voting-deadline"]';
|
||||||
@@ -48,10 +29,7 @@ const feedbackError = '[data-testid="Error"]';
|
|||||||
const viewProposalBtn = 'view-proposal-btn';
|
const viewProposalBtn = 'view-proposal-btn';
|
||||||
const liquidityVoteStatus = 'liquidity-votes-status';
|
const liquidityVoteStatus = 'liquidity-votes-status';
|
||||||
const tokenVoteStatus = 'token-votes-status';
|
const tokenVoteStatus = 'token-votes-status';
|
||||||
const proposalTermsSection = 'proposal';
|
|
||||||
const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey');
|
const vegaWalletPublicKey = Cypress.env('vegaWalletPublicKey');
|
||||||
const fUSDCId =
|
|
||||||
'816af99af60d684502a40824758f6b5377e6af48e50a9ee8ef478ecb879ea8bc';
|
|
||||||
const epochTimeout = Cypress.env('epochTimeout');
|
const epochTimeout = Cypress.env('epochTimeout');
|
||||||
const proposalTimeout = { timeout: 14000 };
|
const proposalTimeout = { timeout: 14000 };
|
||||||
|
|
||||||
@@ -71,23 +49,22 @@ context(
|
|||||||
{ tags: '@slow' },
|
{ tags: '@slow' },
|
||||||
function () {
|
function () {
|
||||||
before('connect wallets and set approval limit', function () {
|
before('connect wallets and set approval limit', function () {
|
||||||
|
cy.createMarket();
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit governance tab', function () {
|
beforeEach('visit governance tab', function () {
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
cy.reload();
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
ethereumWalletConnect();
|
cy.ethereum_wallet_connect();
|
||||||
cy.createMarket();
|
cy.ensure_specified_unstaked_tokens_are_associated('1');
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
cy.navigate_to('proposals');
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to submit valid update network parameter proposal', function () {
|
it('Able to submit valid update network parameter proposal', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
cy.go_to_make_new_proposal(governanceProposalType.NETWORK_PARAMETER);
|
||||||
// 3002-PROP-006
|
// 3002-PROP-006
|
||||||
cy.get(newProposalTitle).type('Test update network parameter proposal');
|
cy.get(newProposalTitle).type('Test update network parameter proposal');
|
||||||
// 3002-PROP-007
|
// 3002-PROP-007
|
||||||
@@ -101,12 +78,12 @@ context(
|
|||||||
cy.get(currentParameterValue).should('have.value', '2s');
|
cy.get(currentParameterValue).should('have.value', '2s');
|
||||||
cy.get(newProposedParameterValue).type('5s'); // 3007-PNEC-003
|
cy.get(newProposedParameterValue).type('5s'); // 3007-PNEC-003
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to submit network parameter with missing/invalid fields', function () {
|
it('Unable to submit network parameter with missing/invalid fields', function () {
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
cy.go_to_make_new_proposal(governanceProposalType.NETWORK_PARAMETER);
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
cy.get(inputError).should('have.length', 3);
|
cy.get(inputError).should('have.length', 3);
|
||||||
cy.get(newProposalTitle).type(
|
cy.get(newProposalTitle).type(
|
||||||
@@ -131,7 +108,7 @@ context(
|
|||||||
|
|
||||||
it('Able to download network param proposal json', function () {
|
it('Able to download network param proposal json', function () {
|
||||||
const downloadFolder = './cypress/downloads/';
|
const downloadFolder = './cypress/downloads/';
|
||||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
cy.go_to_make_new_proposal(governanceProposalType.NETWORK_PARAMETER);
|
||||||
cy.log('Download proposal file');
|
cy.log('Download proposal file');
|
||||||
cy.get(proposalDownloadBtn)
|
cy.get(proposalDownloadBtn)
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
@@ -179,8 +156,8 @@ context(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to submit network parameter proposal with vote deadline above enactment deadline', function () {
|
it('Unable to submit network parameter proposal with vote deadline above enactment deadline', function () {
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
cy.go_to_make_new_proposal(governanceProposalType.NETWORK_PARAMETER);
|
||||||
cy.get(newProposalTitle).type('Test update network parameter proposal');
|
cy.get(newProposalTitle).type('Test update network parameter proposal');
|
||||||
cy.get(newProposalDescription).type('invalid deadlines');
|
cy.get(newProposalDescription).type('invalid deadlines');
|
||||||
cy.get(proposalParameterSelect).select(
|
cy.get(proposalParameterSelect).select(
|
||||||
@@ -198,39 +175,36 @@ context(
|
|||||||
'have.text',
|
'have.text',
|
||||||
'Invalid params: proposal_submission.terms.closing_timestamp (cannot be after enactment time)'
|
'Invalid params: proposal_submission.terms.closing_timestamp (cannot be after enactment time)'
|
||||||
);
|
);
|
||||||
closeDialog();
|
cy.get(dialogCloseButton).click();
|
||||||
cy.get(minVoteDeadline).click();
|
cy.get(minVoteDeadline).click();
|
||||||
cy.get(enactmentDeadlineError).should('not.exist');
|
cy.get(enactmentDeadlineError).should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3003-PMAN-001
|
// 3003-PMAN-001
|
||||||
it('Able to submit valid new market proposal', function () {
|
it('Able to submit valid new market proposal', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
cy.go_to_make_new_proposal(governanceProposalType.NEW_MARKET);
|
||||||
cy.get(newProposalTitle).type('Test new market proposal');
|
cy.get(newProposalTitle).type('Test new market proposal');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.fixture('/proposals/new-market').then((newMarketProposal) => {
|
cy.fixture('/proposals/new-market').then((newMarketProposal) => {
|
||||||
const newMarketPayload = JSON.stringify(newMarketProposal);
|
let newMarketPayload = JSON.stringify(newMarketProposal);
|
||||||
cy.get(newProposalTerms).type(newMarketPayload, {
|
cy.get(newProposalTerms).type(newMarketPayload, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to submit new market proposal with missing/invalid fields', function () {
|
it('Unable to submit new market proposal with missing/invalid fields', function () {
|
||||||
const errorMsg =
|
cy.go_to_make_new_proposal(governanceProposalType.NEW_MARKET);
|
||||||
'Invalid params: the transaction does not use a valid Vega command: unknown field "invalid" in vega.NewMarket';
|
|
||||||
|
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
cy.get(inputError).should('have.length', 3);
|
cy.get(inputError).should('have.length', 3);
|
||||||
cy.get(newProposalTitle).type('Test new market proposal');
|
cy.get(newProposalTitle).type('Test new market proposal');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.fixture('/proposals/new-market').then((newMarketProposal) => {
|
cy.fixture('/proposals/new-market').then((newMarketProposal) => {
|
||||||
newMarketProposal.invalid = 'I am an invalid field';
|
newMarketProposal.invalid = 'I am an invalid field';
|
||||||
const newMarketPayload = JSON.stringify(newMarketProposal);
|
let newMarketPayload = JSON.stringify(newMarketProposal);
|
||||||
cy.get(newProposalTerms).type(newMarketPayload, {
|
cy.get(newProposalTerms).type(newMarketPayload, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
@@ -238,18 +212,21 @@ context(
|
|||||||
});
|
});
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
cy.contains('Transaction failed', proposalTimeout).should('be.visible');
|
||||||
cy.get(feedbackError).should('have.text', errorMsg);
|
cy.get(feedbackError).should(
|
||||||
|
'have.text',
|
||||||
|
'Invalid params: the transaction is not a valid Vega command: unknown field "invalid" in vega.NewMarket'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Will fail if run after 'Able to submit update market proposal and vote for proposal'
|
// Will fail if run after 'Able to submit update market proposal and vote for proposal'
|
||||||
// 3002-PROP-022
|
// 3002-PROP-022
|
||||||
it('Unable to submit update market proposal without equity-like share in the market', function () {
|
it('Unable to submit update market proposal without equity-like share in the market', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_MARKET);
|
||||||
cy.get(newProposalTitle).type('Test update market proposal - rejected');
|
cy.get(newProposalTitle).type('Test update market proposal - rejected');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.get(proposalMarketSelect).select('Test market 1');
|
cy.get(proposalMarketSelect).select('Test market 1');
|
||||||
cy.fixture('/proposals/update-market').then((updateMarketProposal) => {
|
cy.fixture('/proposals/update-market').then((updateMarketProposal) => {
|
||||||
const newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
|
let newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
|
||||||
cy.get(newProposalTerms).type(newUpdateMarketProposal, {
|
cy.get(newProposalTerms).type(newUpdateMarketProposal, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
@@ -260,23 +237,23 @@ context(
|
|||||||
cy.getByTestId('dialog-content')
|
cy.getByTestId('dialog-content')
|
||||||
.find('p')
|
.find('p')
|
||||||
.should('have.text', 'PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE');
|
.should('have.text', 'PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE');
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
cy.ensure_specified_unstaked_tokens_are_associated('1');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3002-PROP-020
|
// 3002-PROP-020
|
||||||
it('Unable to submit update market proposal without minimum amount of tokens', function () {
|
it('Unable to submit update market proposal without minimum amount of tokens', function () {
|
||||||
vegaWalletTeardown();
|
cy.vega_wallet_teardown();
|
||||||
vegaWalletFaucetAssetsWithoutCheck(
|
cy.vega_wallet_faucet_assets_without_check(
|
||||||
fUSDCId,
|
'fUSDC',
|
||||||
'1000000',
|
'1000000',
|
||||||
vegaWalletPublicKey
|
vegaWalletPublicKey
|
||||||
);
|
);
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_MARKET);
|
||||||
cy.get(newProposalTitle).type('Test update market proposal - rejected');
|
cy.get(newProposalTitle).type('Test update market proposal - rejected');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.get(proposalMarketSelect).select('Test market 1');
|
cy.get(proposalMarketSelect).select('Test market 1');
|
||||||
cy.fixture('/proposals/update-market').then((updateMarketProposal) => {
|
cy.fixture('/proposals/update-market').then((updateMarketProposal) => {
|
||||||
const newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
|
let newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
|
||||||
cy.get(newProposalTerms).type(newUpdateMarketProposal, {
|
cy.get(newProposalTerms).type(newUpdateMarketProposal, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
@@ -290,14 +267,14 @@ context(
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-092 3004-PMAC-001
|
// 3001-VOTE-092
|
||||||
it('Able to submit update market proposal and vote for proposal', function () {
|
it('Able to submit update market proposal and vote for proposal', function () {
|
||||||
vegaWalletFaucetAssetsWithoutCheck(
|
cy.vega_wallet_faucet_assets_without_check(
|
||||||
fUSDCId,
|
'fUSDC',
|
||||||
'1000000',
|
'1000000',
|
||||||
vegaWalletPublicKey
|
vegaWalletPublicKey
|
||||||
);
|
);
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_MARKET);
|
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_MARKET);
|
||||||
cy.get(newProposalTitle).type('Test update market proposal');
|
cy.get(newProposalTitle).type('Test update market proposal');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.get(proposalMarketSelect).select('Test market 1');
|
cy.get(proposalMarketSelect).select('Test market 1');
|
||||||
@@ -305,28 +282,24 @@ context(
|
|||||||
cy.get('dd').eq(0).should('have.text', 'Test market 1');
|
cy.get('dd').eq(0).should('have.text', 'Test market 1');
|
||||||
cy.get('dd').eq(1).should('have.text', 'TEST.24h');
|
cy.get('dd').eq(1).should('have.text', 'TEST.24h');
|
||||||
cy.get('dd').eq(2).should('not.be.empty');
|
cy.get('dd').eq(2).should('not.be.empty');
|
||||||
cy.get('dd')
|
cy.get('dd').eq(2).invoke('text').as('EnactedMarketId');
|
||||||
.eq(2)
|
|
||||||
.invoke('text')
|
|
||||||
.as('EnactedMarketId', { type: 'static' });
|
|
||||||
});
|
});
|
||||||
cy.get('@EnactedMarketId').then((marketId) => {
|
cy.get('@EnactedMarketId').then((marketId) => {
|
||||||
cy.VegaWalletSubmitLiquidityProvision(String(marketId), '1');
|
cy.VegaWalletSubmitLiquidityProvision(marketId, '1');
|
||||||
});
|
});
|
||||||
cy.fixture('/proposals/update-market').then((updateMarketProposal) => {
|
cy.fixture('/proposals/update-market').then((updateMarketProposal) => {
|
||||||
const newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
|
let newUpdateMarketProposal = JSON.stringify(updateMarketProposal);
|
||||||
cy.get(newProposalTerms).type(newUpdateMarketProposal, {
|
cy.get(newProposalTerms).type(newUpdateMarketProposal, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
cy.get('@EnactedMarketId').then((marketId) => {
|
cy.get('@EnactedMarketId').then((marketId) => {
|
||||||
cy.contains(String(marketId))
|
cy.contains(marketId)
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
.last()
|
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId(viewProposalBtn).click();
|
cy.getByTestId(viewProposalBtn).click();
|
||||||
});
|
});
|
||||||
@@ -339,7 +312,7 @@ context(
|
|||||||
'contain.text',
|
'contain.text',
|
||||||
'Currently expected to fail'
|
'Currently expected to fail'
|
||||||
);
|
);
|
||||||
voteForProposal('for');
|
cy.vote_for_proposal('for');
|
||||||
cy.getByTestId(liquidityVoteStatus).should(
|
cy.getByTestId(liquidityVoteStatus).should(
|
||||||
'contain.text',
|
'contain.text',
|
||||||
'Currently expected to pass'
|
'Currently expected to pass'
|
||||||
@@ -348,19 +321,18 @@ context(
|
|||||||
'contain.text',
|
'contain.text',
|
||||||
'Currently expected to pass'
|
'Currently expected to pass'
|
||||||
);
|
);
|
||||||
getProposalInformationFromTable('Expected to pass')
|
cy.get_proposal_information_from_table('Expected to pass')
|
||||||
.contains('👍 by token vote')
|
.contains('👍 by Token vote')
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
// 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001
|
// 3001-VOTE-026 3001-VOTE-027 3001-VOTE-028 3001-VOTE-095 3001-VOTE-096 3005-PASN-001
|
||||||
it('Able to submit new asset proposal using min deadlines', function () {
|
it('Able to submit new asset proposal using min deadlines', function () {
|
||||||
const proposalTitle = 'Test new asset proposal';
|
cy.go_to_make_new_proposal(governanceProposalType.NEW_ASSET);
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_ASSET);
|
cy.get(newProposalTitle).type('Test new asset proposal');
|
||||||
cy.get(newProposalTitle).type(proposalTitle);
|
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.fixture('/proposals/new-asset').then((newAssetProposal) => {
|
cy.fixture('/proposals/new-asset').then((newAssetProposal) => {
|
||||||
const newAssetPayload = JSON.stringify(newAssetProposal);
|
let newAssetPayload = JSON.stringify(newAssetProposal);
|
||||||
cy.get(newProposalTerms).type(newAssetPayload, {
|
cy.get(newProposalTerms).type(newAssetPayload, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
@@ -376,34 +348,20 @@ context(
|
|||||||
cy.contains('Proposal waiting for node vote', proposalTimeout).should(
|
cy.contains('Proposal waiting for node vote', proposalTimeout).should(
|
||||||
'be.visible'
|
'be.visible'
|
||||||
);
|
);
|
||||||
closeDialog();
|
cy.get(dialogCloseButton).click();
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
// cannot submit a proposal with ERC20 address already in use
|
// cannot submit a proposal with ERC20 address already in use
|
||||||
cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
|
cy.contains('Proposal rejected', proposalTimeout).should('be.visible');
|
||||||
cy.getByTestId('dialog-content')
|
cy.getByTestId('dialog-content').within(() => {
|
||||||
.last()
|
cy.get('p').should(
|
||||||
.within(() => {
|
'have.text',
|
||||||
cy.get('p').should(
|
'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE'
|
||||||
'have.text',
|
);
|
||||||
'PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
closeDialog();
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
cy.contains(proposalTitle)
|
|
||||||
.parentsUntil(proposalListItem)
|
|
||||||
.last()
|
|
||||||
.within(() => {
|
|
||||||
cy.getByTestId(viewProposalBtn).click();
|
|
||||||
});
|
|
||||||
cy.getByTestId(proposalTermsSection).within(() => {
|
|
||||||
cy.contains('USDT Coin').should('be.visible');
|
|
||||||
cy.contains('USDT').should('be.visible');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to submit new asset proposal with missing/invalid fields', function () {
|
it('Unable to submit new asset proposal with missing/invalid fields', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.NEW_ASSET);
|
cy.go_to_make_new_proposal(governanceProposalType.NEW_ASSET);
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
cy.get(inputError).should('have.length', 3);
|
cy.get(inputError).should('have.length', 3);
|
||||||
cy.get(newProposalTitle).type('Invalid new asset proposal');
|
cy.get(newProposalTitle).type('Invalid new asset proposal');
|
||||||
@@ -419,45 +377,38 @@ context(
|
|||||||
const assetId =
|
const assetId =
|
||||||
'ebcd94151ae1f0d39a4bde3b21a9c7ae81a80ea4352fb075a92e07608d9c953d';
|
'ebcd94151ae1f0d39a4bde3b21a9c7ae81a80ea4352fb075a92e07608d9c953d';
|
||||||
|
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_ASSET);
|
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET);
|
||||||
enterUpdateAssetProposalDetails();
|
enterUpdateAssetProposalDetails();
|
||||||
cy.get(minVoteDeadline).click();
|
cy.get(minVoteDeadline).click();
|
||||||
cy.get(minEnactDeadline).click();
|
cy.get(minEnactDeadline).click();
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
cy.get(openProposals).within(() => {
|
cy.get(openProposals).within(() => {
|
||||||
cy.get(proposalType)
|
cy.get(proposalType)
|
||||||
.contains('Update asset')
|
.contains('Update asset')
|
||||||
.parentsUntil(proposalListItem)
|
.parentsUntil(proposalListItem)
|
||||||
.last()
|
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get(proposalDetails).should('contain.text', assetId); // 3001-VOTE-029
|
cy.get(proposalDetails).should('contain.text', assetId); // 3001-VOTE-029
|
||||||
cy.getByTestId(viewProposalBtn).click();
|
cy.getByTestId(viewProposalBtn).click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
getProposalInformationFromTable('Proposed enactment') // 3001-VOTE-044
|
cy.get_proposal_information_from_table('Proposed enactment') // 3001-VOTE-044
|
||||||
.invoke('text')
|
.invoke('text')
|
||||||
.should('not.be.empty');
|
.should('not.be.empty');
|
||||||
// 3001-VOTE-030 3001-VOTE-031
|
|
||||||
cy.getByTestId(proposalTermsSection).within(() => {
|
|
||||||
cy.contains('UpdateAsset').should('be.visible');
|
|
||||||
cy.contains('UpdateERC20').should('be.visible');
|
|
||||||
cy.contains('"lifetimeLimit": "10"').should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to submit update asset proposal using max deadline', function () {
|
it('Able to submit update asset proposal using max deadline', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_ASSET);
|
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET);
|
||||||
enterUpdateAssetProposalDetails();
|
enterUpdateAssetProposalDetails();
|
||||||
cy.get(maxVoteDeadline).click();
|
cy.get(maxVoteDeadline).click();
|
||||||
cy.get(maxEnactDeadline).click();
|
cy.get(maxEnactDeadline).click();
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
waitForProposalSubmitted();
|
cy.wait_for_proposal_submitted();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Unable to submit edit asset proposal with missing/invalid fields', function () {
|
it('Unable to submit edit asset proposal with missing/invalid fields', function () {
|
||||||
goToMakeNewProposal(governanceProposalType.UPDATE_ASSET);
|
cy.go_to_make_new_proposal(governanceProposalType.UPDATE_ASSET);
|
||||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||||
cy.get(inputError).should('have.length', 3);
|
cy.get(inputError).should('have.length', 3);
|
||||||
});
|
});
|
||||||
@@ -477,7 +428,7 @@ context(
|
|||||||
cy.get(newProposalTitle).type('Test update asset proposal');
|
cy.get(newProposalTitle).type('Test update asset proposal');
|
||||||
cy.get(newProposalDescription).type('E2E test for proposals');
|
cy.get(newProposalDescription).type('E2E test for proposals');
|
||||||
cy.fixture('/proposals/update-asset').then((newAssetProposal) => {
|
cy.fixture('/proposals/update-asset').then((newAssetProposal) => {
|
||||||
const newAssetPayload = JSON.stringify(newAssetProposal);
|
let newAssetPayload = JSON.stringify(newAssetProposal);
|
||||||
cy.get(newProposalTerms).type(newAssetPayload, {
|
cy.get(newProposalTerms).type(newAssetPayload, {
|
||||||
parseSpecialCharSequences: false,
|
parseSpecialCharSequences: false,
|
||||||
delay: 2,
|
delay: 2,
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
import {
|
||||||
|
createFreeformProposal,
|
||||||
|
createRawProposal,
|
||||||
|
generateFreeFormProposalTitle,
|
||||||
|
governanceProposalType,
|
||||||
|
} from '../../support/governance.functions';
|
||||||
|
|
||||||
|
const proposalDetailsTitle = '[data-testid="proposal-title"]';
|
||||||
|
const openProposals = '[data-testid="open-proposals"]';
|
||||||
|
const voteStatus = '[data-testid="vote-status"]';
|
||||||
|
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
||||||
|
|
||||||
|
describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
||||||
|
before('connect wallets and set approval limit', function () {
|
||||||
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
|
cy.visit('/');
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach('visit proposals tab', function () {
|
||||||
|
cy.reload();
|
||||||
|
cy.wait_for_spinner();
|
||||||
|
cy.connectVegaWallet();
|
||||||
|
cy.ethereum_wallet_connect();
|
||||||
|
cy.ensure_specified_unstaked_tokens_are_associated(1);
|
||||||
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Newly created proposals list - proposals closest to closing date appear higher in list', function () {
|
||||||
|
const minCloseDays = 2;
|
||||||
|
const maxCloseDays = 3;
|
||||||
|
|
||||||
|
// 3001-VOTE-005
|
||||||
|
let proposalDays = [
|
||||||
|
minCloseDays + 1,
|
||||||
|
maxCloseDays,
|
||||||
|
minCloseDays + 3,
|
||||||
|
minCloseDays + 2,
|
||||||
|
];
|
||||||
|
for (var index = 0; index < proposalDays.length; index++) {
|
||||||
|
cy.go_to_make_new_proposal(governanceProposalType.RAW);
|
||||||
|
cy.create_ten_digit_unix_timestamp_for_specified_days(
|
||||||
|
proposalDays[index]
|
||||||
|
).then((closingDateTimestamp) => {
|
||||||
|
cy.enter_raw_proposal_body(closingDateTimestamp);
|
||||||
|
});
|
||||||
|
cy.wait_for_proposal_submitted();
|
||||||
|
cy.wait_for_proposal_sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
let arrayOfProposals = [];
|
||||||
|
|
||||||
|
cy.navigate_to('proposals');
|
||||||
|
cy.get(proposalDetailsTitle)
|
||||||
|
.each((proposalTitleElement) => {
|
||||||
|
arrayOfProposals.push(proposalTitleElement.text());
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
cy.get_sort_order_of_supplied_array(arrayOfProposals).should(
|
||||||
|
'equal',
|
||||||
|
'descending'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Newly created proposals list - able to filter by proposerID to show it in list', function () {
|
||||||
|
const proposerId = Cypress.env('vegaWalletPublicKey');
|
||||||
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
|
|
||||||
|
createFreeformProposal(proposalTitle);
|
||||||
|
cy.get_proposal_id_from_list(proposalTitle);
|
||||||
|
cy.get('@proposalIdText').then((proposalId) => {
|
||||||
|
cy.get('[data-testid="set-proposals-filter-visible"]').click();
|
||||||
|
cy.get('[data-testid="filter-input"]').type(proposerId);
|
||||||
|
cy.get(`#${proposalId}`).should('contain', proposalId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Newly created proposals list - shows title and portion of summary', function () {
|
||||||
|
createRawProposal(this.minProposerBalance); // 3001-VOTE-052
|
||||||
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
|
cy.get_proposal_id_from_list(rawProposal.rationale.title);
|
||||||
|
cy.get('@proposalIdText').then((proposalId) => {
|
||||||
|
cy.get(openProposals).within(() => {
|
||||||
|
// 3001-VOTE-008
|
||||||
|
// 3001-VOTE-034
|
||||||
|
cy.get(`#${proposalId}`)
|
||||||
|
// 3001-VOTE-097
|
||||||
|
.should('contain', rawProposal.rationale.title)
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(`#${proposalId}`)
|
||||||
|
.should(
|
||||||
|
'contain',
|
||||||
|
rawProposal.rationale.description.substring(0, 59)
|
||||||
|
)
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Newly created proposals list - shows open proposals in an open state', function () {
|
||||||
|
// 3001-VOTE-004
|
||||||
|
// 3001-VOTE-035
|
||||||
|
createRawProposal(this.minProposerBalance);
|
||||||
|
cy.get('@rawProposal').then((rawProposal) => {
|
||||||
|
cy.get_submitted_proposal_from_proposal_list(
|
||||||
|
rawProposal.rationale.title
|
||||||
|
).within(() => {
|
||||||
|
cy.get(viewProposalButton).should('be.visible').click();
|
||||||
|
});
|
||||||
|
cy.get('@proposalIdText').then((proposalId) => {
|
||||||
|
cy.get_proposal_information_from_table('ID')
|
||||||
|
.contains(proposalId)
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
cy.get_proposal_information_from_table('State')
|
||||||
|
.contains('Open')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get_proposal_information_from_table('Type')
|
||||||
|
.contains('Freeform')
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3001-VOTE-071
|
||||||
|
it('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
|
||||||
|
const proposalTitle = generateFreeFormProposalTitle();
|
||||||
|
const requiredParticipation = 0.001;
|
||||||
|
|
||||||
|
createFreeformProposal(proposalTitle);
|
||||||
|
|
||||||
|
cy.get_submitted_proposal_from_proposal_list(proposalTitle)
|
||||||
|
.as('submittedProposal')
|
||||||
|
.within(() => {
|
||||||
|
// 3001-VOTE-039
|
||||||
|
cy.get(voteStatus).should('have.text', 'Participation not reached');
|
||||||
|
cy.get(viewProposalButton).click();
|
||||||
|
});
|
||||||
|
cy.vote_for_proposal('for');
|
||||||
|
cy.get_proposal_information_from_table('Total Supply')
|
||||||
|
.invoke('text')
|
||||||
|
.then((totalSupply) => {
|
||||||
|
let tokensRequiredToAchieveResult = parseFloat(
|
||||||
|
(totalSupply.replace(/,/g, '') * requiredParticipation) / 100
|
||||||
|
).toFixed(2);
|
||||||
|
cy.ensure_specified_unstaked_tokens_are_associated(
|
||||||
|
tokensRequiredToAchieveResult
|
||||||
|
);
|
||||||
|
cy.navigate_to_page_if_not_already_loaded('proposals');
|
||||||
|
cy.get('@submittedProposal').within(() =>
|
||||||
|
cy.get(viewProposalButton).click()
|
||||||
|
);
|
||||||
|
cy.get_proposal_information_from_table('Token participation met')
|
||||||
|
.contains('👍')
|
||||||
|
.should('be.visible');
|
||||||
|
cy.navigate_to('proposals');
|
||||||
|
cy.get('@submittedProposal').within(() =>
|
||||||
|
cy.get(voteStatus).should('have.text', 'Set to pass')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
|
||||||
import {
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
waitForSpinner,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
createFreeformProposal,
|
|
||||||
createRawProposal,
|
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays,
|
|
||||||
enterRawProposalBody,
|
|
||||||
generateFreeFormProposalTitle,
|
|
||||||
getProposalIdFromList,
|
|
||||||
getProposalInformationFromTable,
|
|
||||||
getSubmittedProposalFromProposalList,
|
|
||||||
goToMakeNewProposal,
|
|
||||||
governanceProposalType,
|
|
||||||
voteForProposal,
|
|
||||||
waitForProposalSubmitted,
|
|
||||||
waitForProposalSync,
|
|
||||||
} from '../../support/governance.functions';
|
|
||||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/staking.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
|
||||||
|
|
||||||
const openProposals = '[data-testid="open-proposals"]';
|
|
||||||
const voteStatus = '[data-testid="vote-status"]';
|
|
||||||
const proposalClosingDate = '[data-testid="vote-details"]';
|
|
||||||
const viewProposalButton = '[data-testid="view-proposal-btn"]';
|
|
||||||
|
|
||||||
describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
|
||||||
before('connect wallets and set approval limit', function () {
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
|
||||||
cy.visit('/');
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach('visit proposals tab', function () {
|
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
cy.connectVegaWallet();
|
|
||||||
ethereumWalletConnect();
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Newly created proposals list - proposals closest to closing date appear higher in list', function () {
|
|
||||||
// 3001-VOTE-005
|
|
||||||
const proposalDays = [364, 50, 2];
|
|
||||||
for (let index = 0; index < proposalDays.length; index++) {
|
|
||||||
goToMakeNewProposal(governanceProposalType.RAW);
|
|
||||||
enterRawProposalBody(
|
|
||||||
createTenDigitUnixTimeStampForSpecifiedDays(proposalDays[index])
|
|
||||||
);
|
|
||||||
waitForProposalSubmitted();
|
|
||||||
waitForProposalSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
cy.get(openProposals).within(() => {
|
|
||||||
cy.get(proposalClosingDate).first().should('contain.text', 'year');
|
|
||||||
cy.get(proposalClosingDate).should('contain.text', 'months');
|
|
||||||
cy.get(proposalClosingDate)
|
|
||||||
.last()
|
|
||||||
.invoke('text')
|
|
||||||
.should('match', /days|minutes/);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Newly created proposals list - able to filter by proposerID to show it in list', function () {
|
|
||||||
const proposerId = Cypress.env('vegaWalletPublicKey');
|
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
|
||||||
|
|
||||||
createFreeformProposal(proposalTitle);
|
|
||||||
getProposalIdFromList(proposalTitle);
|
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
|
||||||
cy.get('[data-testid="set-proposals-filter-visible"]').click();
|
|
||||||
cy.get('[data-testid="filter-input"]').type(proposerId);
|
|
||||||
cy.get(`#${proposalId}`).should('contain', proposalId);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Newly created proposals list - shows title and portion of summary', function () {
|
|
||||||
createRawProposal(this.minProposerBalance); // 3001-VOTE-052
|
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
|
||||||
getProposalIdFromList(rawProposal.rationale.title);
|
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
|
||||||
cy.get(openProposals).within(() => {
|
|
||||||
// 3001-VOTE-008
|
|
||||||
// 3001-VOTE-034
|
|
||||||
cy.get(`#${proposalId}`)
|
|
||||||
// 3001-VOTE-097
|
|
||||||
.should('contain', rawProposal.rationale.title)
|
|
||||||
.and('be.visible');
|
|
||||||
cy.get(`#${proposalId}`)
|
|
||||||
.should(
|
|
||||||
'contain',
|
|
||||||
rawProposal.rationale.description.substring(0, 59)
|
|
||||||
)
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Newly created proposals list - shows open proposals in an open state', function () {
|
|
||||||
// 3001-VOTE-004
|
|
||||||
// 3001-VOTE-035
|
|
||||||
createRawProposal(this.minProposerBalance);
|
|
||||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
|
||||||
getSubmittedProposalFromProposalList(rawProposal.rationale.title).within(
|
|
||||||
() => {
|
|
||||||
cy.get(viewProposalButton).should('be.visible').click();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.get('@proposalIdText').then((proposalId) => {
|
|
||||||
getProposalInformationFromTable('ID')
|
|
||||||
.contains(String(proposalId))
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
getProposalInformationFromTable('State')
|
|
||||||
.contains('Open')
|
|
||||||
.and('be.visible');
|
|
||||||
getProposalInformationFromTable('Type')
|
|
||||||
.contains('Freeform')
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 3001-VOTE-071
|
|
||||||
it('Newly created freeform proposals list - shows proposal participation - both met and not', function () {
|
|
||||||
const proposalTitle = generateFreeFormProposalTitle();
|
|
||||||
|
|
||||||
createFreeformProposal(proposalTitle);
|
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() => {
|
|
||||||
// 3001-VOTE-039
|
|
||||||
cy.get(voteStatus).should('have.text', 'Participation not reached');
|
|
||||||
cy.get(viewProposalButton).click();
|
|
||||||
});
|
|
||||||
voteForProposal('for');
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
getSubmittedProposalFromProposalList(proposalTitle).within(() => {
|
|
||||||
cy.get(voteStatus).should('have.text', 'Set to pass');
|
|
||||||
cy.get(viewProposalButton).click();
|
|
||||||
});
|
|
||||||
getProposalInformationFromTable('Token participation met')
|
|
||||||
.contains('👍')
|
|
||||||
.should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
+34
-37
@@ -1,21 +1,3 @@
|
|||||||
import {
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
waitForSpinner,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
clickOnValidatorFromList,
|
|
||||||
closeStakingDialog,
|
|
||||||
stakingPageAssociateTokens,
|
|
||||||
stakingValidatorPageAddStake,
|
|
||||||
waitForBeginningOfEpoch,
|
|
||||||
} from '../../support/staking.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import {
|
|
||||||
depositAsset,
|
|
||||||
vegaWalletTeardown,
|
|
||||||
} from '../../support/wallet-teardown.functions';
|
|
||||||
|
|
||||||
const vegaAssetAddress = '0x67175Da1D5e966e40D11c4B2519392B2058373de';
|
const vegaAssetAddress = '0x67175Da1D5e966e40D11c4B2519392B2058373de';
|
||||||
const vegaWalletUnstakedBalance =
|
const vegaWalletUnstakedBalance =
|
||||||
'[data-testid="vega-wallet-balance-unstaked"]';
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
@@ -25,31 +7,30 @@ const rewardsTimeOut = { timeout: 60000 };
|
|||||||
|
|
||||||
context('rewards - flow', { tags: '@slow' }, function () {
|
context('rewards - flow', { tags: '@slow' }, function () {
|
||||||
before('set up environment to allow rewards', function () {
|
before('set up environment to allow rewards', function () {
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
depositAsset(vegaAssetAddress, '1000', 18);
|
cy.deposit_asset(vegaAssetAddress, '1000');
|
||||||
cy.validatorsSelfDelegate();
|
cy.validatorsSelfDelegate();
|
||||||
ethereumWalletConnect();
|
cy.ethereum_wallet_connect();
|
||||||
cy.connectVegaWallet();
|
cy.connectVegaWallet();
|
||||||
cy.VegaWalletTopUpRewardsPool(30, 200);
|
topUpRewardsPool();
|
||||||
navigateTo(navigation.validators);
|
cy.navigate_to('validators');
|
||||||
vegaWalletTeardown();
|
cy.vega_wallet_teardown();
|
||||||
stakingPageAssociateTokens('6000');
|
cy.staking_page_associate_tokens('6000');
|
||||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
'contain',
|
'contain',
|
||||||
'6,000.0',
|
'6,000.0',
|
||||||
txTimeout
|
txTimeout
|
||||||
);
|
);
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
clickOnValidatorFromList(0);
|
cy.click_on_validator_from_list(0);
|
||||||
stakingValidatorPageAddStake('3000');
|
cy.staking_validator_page_add_stake('3000');
|
||||||
closeStakingDialog();
|
cy.close_staking_dialog();
|
||||||
navigateTo(navigation.validators);
|
cy.navigate_to('validators');
|
||||||
clickOnValidatorFromList(1);
|
cy.click_on_validator_from_list(1);
|
||||||
stakingValidatorPageAddStake('3000');
|
cy.staking_validator_page_add_stake('3000');
|
||||||
closeStakingDialog();
|
cy.close_staking_dialog();
|
||||||
navigateTo(navigation.rewards);
|
cy.navigate_to('rewards');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should display rewards per epoch', function () {
|
it('Should display rewards per epoch', function () {
|
||||||
@@ -57,7 +38,7 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
cy.getByTestId(rewardsTable)
|
cy.getByTestId(rewardsTable)
|
||||||
.first()
|
.first()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.getByTestId('asset', rewardsTimeOut).should('have.text', 'Vega');
|
cy.getByTestId('asset').should('have.text', 'Vega');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD').should('have.text', '1');
|
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD').should('have.text', '1');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE').should(
|
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE').should(
|
||||||
'have.text',
|
'have.text',
|
||||||
@@ -73,7 +54,7 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('h2').first().invoke('text').as('epochNumber');
|
cy.get('h2').first().invoke('text').as('epochNumber');
|
||||||
});
|
});
|
||||||
waitForBeginningOfEpoch();
|
cy.wait_for_beginning_of_epoch();
|
||||||
cy.get('@epochNumber').then((epochNumber) => {
|
cy.get('@epochNumber').then((epochNumber) => {
|
||||||
cy.getByTestId(rewardsTable)
|
cy.getByTestId(rewardsTable)
|
||||||
.first()
|
.first()
|
||||||
@@ -94,7 +75,7 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('h2').first().should('contain.text', 'EPOCH');
|
cy.get('h2').first().should('contain.text', 'EPOCH');
|
||||||
cy.getByTestId('individual-rewards-asset').should('have.text', 'Vega');
|
cy.getByTestId('individual-rewards-asset').should('have.text', 'Vega');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD', rewardsTimeOut)
|
cy.getByTestId('ACCOUNT_TYPE_GLOBAL_REWARD')
|
||||||
.should('contain.text', '0.4415')
|
.should('contain.text', '0.4415')
|
||||||
.and('contain.text', '(44.15%)');
|
.and('contain.text', '(44.15%)');
|
||||||
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE')
|
cy.getByTestId('ACCOUNT_TYPE_FEES_INFRASTRUCTURE')
|
||||||
@@ -103,4 +84,20 @@ context('rewards - flow', { tags: '@slow' }, function () {
|
|||||||
cy.getByTestId('total').should('have.text', '0.4419');
|
cy.getByTestId('total').should('have.text', '0.4419');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function topUpRewardsPool() {
|
||||||
|
// Must ensure that test wallet contains assets already and that the tests are within the start and end epochs
|
||||||
|
cy.exec(
|
||||||
|
`vega wallet transaction send --wallet ${Cypress.env(
|
||||||
|
'vegaWalletName'
|
||||||
|
)} --pubkey ${Cypress.env(
|
||||||
|
'vegaWalletPublicKey'
|
||||||
|
)} -p "./src/fixtures/wallet/passphrase" --network DV '{"transfer":{"fromAccountType":4,"toAccountType":12,"to":"0000000000000000000000000000000000000000000000000000000000000000","asset":"b4f2726571fbe8e33b442dc92ed2d7f0d810e21835b7371a7915a365f07ccd9b","amount":"1000000000000000000","recurring":{"startEpoch":30, "endEpoch": 200, "factor":"1"}}}' --home ${Cypress.env(
|
||||||
|
'vegaWalletLocation'
|
||||||
|
)}`,
|
||||||
|
{ failOnNonZeroExit: false }
|
||||||
|
)
|
||||||
|
.its('stderr')
|
||||||
|
.should('contain', '');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,876 @@
|
|||||||
|
/// <reference types="cypress" />
|
||||||
|
const stakeValidatorListTotalStake = '[col-id="stake"] > div > span';
|
||||||
|
const stakeValidatorListTotalShare = '[col-id="stakeShare"] > div > span';
|
||||||
|
const stakeValidatorListValidatorStake = '[col-id="stake"] > div > span';
|
||||||
|
const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]';
|
||||||
|
const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]';
|
||||||
|
const stakeTokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
||||||
|
const stakeNextEpochValue = '[data-testid="stake-next-epoch"]';
|
||||||
|
const stakeThisEpochValue = '[data-testid="stake-this-epoch"]';
|
||||||
|
const stakeAddStakeRadioButton = '[data-testid="add-stake-radio"]';
|
||||||
|
const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]';
|
||||||
|
const totalStake = '[data-testid="total-stake"]';
|
||||||
|
const stakeShare = '[data-testid="stake-percentage"]';
|
||||||
|
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
||||||
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
|
const vegaWalletUnstakedBalance =
|
||||||
|
'[data-testid="vega-wallet-balance-unstaked"]:visible';
|
||||||
|
const vegaWalletStakedBalances =
|
||||||
|
'[data-testid="vega-wallet-balance-staked-validators"]';
|
||||||
|
const ethWalletAssociatedBalances =
|
||||||
|
'[data-testid="eth-wallet-associated-balances"]';
|
||||||
|
const ethWalletTotalAssociatedBalance =
|
||||||
|
'[data-testid="currency-locked"]:visible';
|
||||||
|
const ethWalletContainer = '[data-testid="ethereum-wallet"]:visible';
|
||||||
|
const vegaWallet = '[data-testid="vega-wallet"]';
|
||||||
|
const partValidatorId = '…';
|
||||||
|
const txTimeout = Cypress.env('txTimeout');
|
||||||
|
const epochTimeout = Cypress.env('epochTimeout');
|
||||||
|
|
||||||
|
context(
|
||||||
|
'Staking Tab - with eth and vega wallets connected',
|
||||||
|
{ tags: '@slow' },
|
||||||
|
function () {
|
||||||
|
// 2001-STKE-002, 2001-STKE-032
|
||||||
|
before('visit staking tab and connect vega wallet', function () {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Eth wallet - contains VEGA tokens', function () {
|
||||||
|
beforeEach(
|
||||||
|
'teardown wallet & drill into a specific validator',
|
||||||
|
function () {
|
||||||
|
cy.reload();
|
||||||
|
cy.wait_for_spinner();
|
||||||
|
cy.connectVegaWallet();
|
||||||
|
cy.ethereum_wallet_connect();
|
||||||
|
cy.vega_wallet_teardown();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it('Able to stake against a validator - using vega from wallet', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('3.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort, txTimeout)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 3.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
// 2001-STKE-031
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
// 2001-STKE-033, 2001-STKE-034, 2001-STKE-037
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
// 2001-STKE-039
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', partValidatorId);
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout) // 2001-STKE-016 2001-STKE-038
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(stakeThisEpochValue, epochTimeout) // 2001-STKE-013
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
// 2002-SINC-007
|
||||||
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
|
'0',
|
||||||
|
'2.00',
|
||||||
|
'100.00%'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to stake against a validator - using vega from vesting contract', function () {
|
||||||
|
cy.staking_page_associate_tokens('3', { type: 'contract' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('3.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort, txTimeout)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 3.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', partValidatorId);
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
|
'0',
|
||||||
|
'2.00',
|
||||||
|
'100.00%'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to stake against a validator - using vega from both wallet and vesting contract', function () {
|
||||||
|
cy.staking_page_associate_tokens('3', { type: 'contract' });
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
cy.staking_page_associate_tokens('4', { type: 'wallet' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
7.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('3.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('4.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
4.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('6');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 6.0, txTimeout)
|
||||||
|
.and('contain', partValidatorId);
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(6.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
|
.contains(6.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
|
'0',
|
||||||
|
'6.00',
|
||||||
|
'100.00%'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to stake against multiple validators', function () {
|
||||||
|
cy.staking_page_associate_tokens('5');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
5.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.parent()
|
||||||
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(1);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('1');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('have.length', 2, txTimeout)
|
||||||
|
.eq(0)
|
||||||
|
.should('contain', 2.0, txTimeout);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.eq(1)
|
||||||
|
.should('contain', 1.0, txTimeout);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.get(`[row-id="${0}"]`).within(() => {
|
||||||
|
cy.get(stakeValidatorListTotalStake)
|
||||||
|
.should('have.text', '2.00')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListTotalShare)
|
||||||
|
.should('have.text', '66.67%')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListValidatorStake)
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('have.text', '2.00')
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(`[row-id="${1}"]`).within(() => {
|
||||||
|
cy.get(stakeValidatorListTotalStake)
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('have.text', '1.00')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListTotalShare)
|
||||||
|
.should('have.text', '33.33%')
|
||||||
|
.and('be.visible');
|
||||||
|
cy.get(stakeValidatorListValidatorStake)
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('have.text', '1.00')
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2001-STKE-041
|
||||||
|
it(
|
||||||
|
'Able to remove part of a stake against a validator',
|
||||||
|
{ tags: '@smoke' },
|
||||||
|
function () {
|
||||||
|
cy.staking_page_associate_tokens('4');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
4.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('3');
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(3.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
// 2001-STKE-040
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
// 2001-STKE-044, 2001-STKE-048
|
||||||
|
cy.staking_validator_page_remove_stake('1');
|
||||||
|
|
||||||
|
// 2001-STKE-049
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout).contains(2.0, epochTimeout);
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(totalStake, epochTimeout).should('contain.text', '2');
|
||||||
|
cy.get(stakeShare, epochTimeout).should('have.text', '100%');
|
||||||
|
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
|
'0',
|
||||||
|
'2.00',
|
||||||
|
'100.00%'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2001-STKE-045
|
||||||
|
it('Able to remove a full stake against a validator', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('1');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list('0');
|
||||||
|
|
||||||
|
cy.staking_validator_page_remove_stake('1');
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(0.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(0.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(stakeThisEpochValue, epochTimeout)
|
||||||
|
.contains(0.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'not.exist',
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share('0', '0.00', '0.00%');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unable to remove a stake with a negative value for a validator', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.get(stakeRemoveStakeRadioButton, txTimeout).click();
|
||||||
|
|
||||||
|
cy.get(stakeTokenAmountInputBox).type('-0.1');
|
||||||
|
|
||||||
|
cy.contains('Waiting for next epoch to start', epochTimeout);
|
||||||
|
|
||||||
|
cy.get(stakeTokenSubmitButton)
|
||||||
|
.should('be.disabled', epochTimeout)
|
||||||
|
.and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`)
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unable to remove a stake greater than staked amount next epoch for a validator', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(stakeNextEpochValue, epochTimeout)
|
||||||
|
.contains(2.0, epochTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.get(stakeRemoveStakeRadioButton).click();
|
||||||
|
|
||||||
|
cy.get(stakeTokenAmountInputBox).type(4);
|
||||||
|
|
||||||
|
cy.contains('Waiting for next epoch to start', epochTimeout);
|
||||||
|
|
||||||
|
cy.get(stakeTokenSubmitButton)
|
||||||
|
.should('be.disabled', epochTimeout)
|
||||||
|
.and('contain', `Remove 4 $VEGA tokens at the end of epoch`)
|
||||||
|
.and('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Disassociating all wallet tokens max - removes all staked tokens', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list('1');
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_disassociate_all_tokens('wallet');
|
||||||
|
|
||||||
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, txTimeout).should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('0.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'0.00'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'not.exist',
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share('0', '0.00', '0.00%');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Disassociating all vesting contract tokens max - removes all staked tokens', function () {
|
||||||
|
cy.staking_page_associate_tokens('3', { type: 'contract' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list('1');
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_disassociate_all_tokens('contract');
|
||||||
|
|
||||||
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, txTimeout).should('not.exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('0.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'0.00'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'not.exist',
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share('0', '0.00', '0.00%');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
2.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_disassociate_tokens('1');
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('2.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'2.00'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', 2.0, txTimeout)
|
||||||
|
.and('contain', partValidatorId);
|
||||||
|
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.validate_validator_list_total_stake_and_share(
|
||||||
|
'0',
|
||||||
|
'2.00',
|
||||||
|
'100.00%'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
||||||
|
// 2001-STKE-004
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_associate_tokens('4');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
7.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Associating vesting contract tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
||||||
|
// 2001-STKE-004
|
||||||
|
cy.staking_page_associate_tokens('3', { type: 'contract' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_associate_tokens('4', { type: 'contract' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
7.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Associating vesting contract tokens - when wallet tokens already staked - auto stakes tokens to staked validator', function () {
|
||||||
|
// 2001-STKE-004
|
||||||
|
cy.staking_page_associate_tokens('3', { type: 'wallet' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_associate_tokens('4', { type: 'contract' });
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
7.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Associating tokens - with multiple validators already staked - auto stakes to staked validators - abiding by existing stake ratio', function () {
|
||||||
|
// 2001-STKE-004
|
||||||
|
cy.staking_page_associate_tokens('6');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
6.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(1);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('4');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
cy.staking_page_associate_tokens('6');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'12.00'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', '4.0', txTimeout)
|
||||||
|
.and('contain', partValidatorId);
|
||||||
|
|
||||||
|
cy.get(vegaWalletStakedBalances, txTimeout)
|
||||||
|
.should('contain', '8.0')
|
||||||
|
.and('contain', partValidatorId);
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
0.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Selecting use maximum where tokens are already staked - suggests the unstaked token amount', function () {
|
||||||
|
cy.staking_page_associate_tokens('3');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
3.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.staking_validator_page_add_stake('2');
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
1.0,
|
||||||
|
txTimeout
|
||||||
|
);
|
||||||
|
cy.close_staking_dialog();
|
||||||
|
|
||||||
|
cy.click_on_validator_from_list(0);
|
||||||
|
|
||||||
|
cy.get(stakeAddStakeRadioButton).click();
|
||||||
|
|
||||||
|
cy.get(stakeMaximumTokens, { timeout: 60000 }).click();
|
||||||
|
|
||||||
|
cy.get(stakeTokenSubmitButton).should('contain', 'Add 1 $VEGA tokens');
|
||||||
|
});
|
||||||
|
|
||||||
|
after('teardown wallet', function () {
|
||||||
|
cy.vega_wallet_teardown();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,509 +0,0 @@
|
|||||||
/// <reference types="cypress" />
|
|
||||||
import {
|
|
||||||
verifyUnstakedBalance,
|
|
||||||
verifyStakedBalance,
|
|
||||||
verifyEthWalletTotalAssociatedBalance,
|
|
||||||
verifyEthWalletAssociatedBalance,
|
|
||||||
waitForSpinner,
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
clickOnValidatorFromList,
|
|
||||||
closeStakingDialog,
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated,
|
|
||||||
stakingPageAssociateTokens,
|
|
||||||
stakingPageDisassociateAllTokens,
|
|
||||||
stakingPageDisassociateTokens,
|
|
||||||
stakingValidatorPageAddStake,
|
|
||||||
stakingValidatorPageRemoveStake,
|
|
||||||
validateValidatorListTotalStakeAndShare,
|
|
||||||
waitForBeginningOfEpoch,
|
|
||||||
} from '../../support/staking.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import {
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
|
||||||
vegaWalletTeardown,
|
|
||||||
} from '../../support/wallet-teardown.functions';
|
|
||||||
const stakeValidatorListTotalStake = 'total-stake';
|
|
||||||
const stakeValidatorListTotalShare = 'total-stake-share';
|
|
||||||
const stakeValidatorListStakePercentage = 'stake-percentage';
|
|
||||||
const userStakeBtn = 'my-stake-btn';
|
|
||||||
const userStake = 'user-stake';
|
|
||||||
const userStakeShare = 'user-stake-share';
|
|
||||||
const viewAllValidatorsToggle = 'validators-view-toggle-all';
|
|
||||||
const viewStakedByMeToggle = 'validators-view-toggle-myStake';
|
|
||||||
const stakeRemoveStakeRadioButton = 'remove-stake-radio';
|
|
||||||
const stakeTokenAmountInputBox = 'token-amount-input';
|
|
||||||
const stakeTokenSubmitButton = 'token-input-submit-button';
|
|
||||||
const stakeAddStakeRadioButton = 'add-stake-radio';
|
|
||||||
const stakeMaximumTokens = 'token-amount-use-maximum';
|
|
||||||
const vegaWalletAssociatedBalance = 'currency-value';
|
|
||||||
const vegaWalletStakedBalances = 'vega-wallet-balance-staked-validators';
|
|
||||||
const ethWallet = 'ethereum-wallet';
|
|
||||||
const vegaWallet = 'vega-wallet';
|
|
||||||
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
|
||||||
const epochTimeout = Cypress.env('epochTimeout');
|
|
||||||
|
|
||||||
const getEthereumWallet = () => cy.get(`[data-testid="${ethWallet}"]:visible`);
|
|
||||||
const getVegaWallet = () => cy.get(`[data-testid="${vegaWallet}"]:visible`);
|
|
||||||
|
|
||||||
context(
|
|
||||||
'Staking Tab - with eth and vega wallets connected',
|
|
||||||
{ tags: '@slow' },
|
|
||||||
function () {
|
|
||||||
// 2001-STKE-002, 2001-STKE-032
|
|
||||||
before('visit staking tab and connect vega wallet', function () {
|
|
||||||
cy.visit('/');
|
|
||||||
ethereumWalletConnect();
|
|
||||||
// this is a workaround for #2422 which can be removed once issue is resolved
|
|
||||||
cy.associateTokensToVegaWallet('4');
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Eth wallet - contains VEGA tokens', function () {
|
|
||||||
beforeEach(
|
|
||||||
'teardown wallet & drill into a specific validator',
|
|
||||||
function () {
|
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
cy.connectVegaWallet();
|
|
||||||
ethereumWalletConnect();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('Able to stake against a validator - using vega from wallet', function () {
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
verifyEthWalletTotalAssociatedBalance('3.0');
|
|
||||||
verifyEthWalletAssociatedBalance('3.0');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
// 2001-STKE-031
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
// 2001-STKE-033, 2001-STKE-034, 2001-STKE-037
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
// 2001-STKE-039
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
verifyNextEpochValue(2.0); // 2001-STKE-016 2001-STKE-038
|
|
||||||
verifyThisEpochValue(2.0); // 2001-STKE-013
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
|
|
||||||
// 2002-SINC-007
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to view validators staked by me', function () {
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('4');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
cy.getByTestId(userStake, epochTimeout)
|
|
||||||
.first()
|
|
||||||
.should('have.text', '2.00');
|
|
||||||
cy.getByTestId('total-stake').first().realHover();
|
|
||||||
cy.getByTestId('staked-by-user-tooltip')
|
|
||||||
.first()
|
|
||||||
.should('have.text', 'Staked by me: 2.00');
|
|
||||||
cy.getByTestId('total-pending-stake').first().realHover();
|
|
||||||
cy.getByTestId('pending-user-stake-tooltip')
|
|
||||||
.first()
|
|
||||||
.should('have.text', 'My pending stake: 0.00');
|
|
||||||
cy.getByTestId(userStakeShare).invoke('text').should('not.be.empty'); // Adjust when #3286 is resolved
|
|
||||||
cy.getByTestId(userStakeBtn).should('exist').click();
|
|
||||||
verifyThisEpochValue(2.0);
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
cy.getByTestId(viewStakedByMeToggle).click();
|
|
||||||
cy.getByTestId(userStakeBtn).should('have.length', 1);
|
|
||||||
cy.getByTestId(viewAllValidatorsToggle).click();
|
|
||||||
clickOnValidatorFromList(1);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
cy.getByTestId(viewStakedByMeToggle).click();
|
|
||||||
cy.getByTestId(userStakeBtn).should('have.length', 2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to stake against a validator - using vega from vesting contract', function () {
|
|
||||||
stakingPageAssociateTokens('3', { type: 'contract' });
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
verifyEthWalletTotalAssociatedBalance('3.0');
|
|
||||||
verifyEthWalletAssociatedBalance('3.0');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
verifyNextEpochValue(2.0);
|
|
||||||
verifyThisEpochValue(2.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to stake against a validator - using vega from both wallet and vesting contract', function () {
|
|
||||||
vegaWalletTeardown();
|
|
||||||
stakingPageAssociateTokens('3', { type: 'contract' });
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
stakingPageAssociateTokens('4', { type: 'wallet' });
|
|
||||||
verifyUnstakedBalance(7.0);
|
|
||||||
verifyEthWalletTotalAssociatedBalance('3.0');
|
|
||||||
verifyEthWalletTotalAssociatedBalance('4.0');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('6');
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
verifyStakedBalance(6.0);
|
|
||||||
verifyNextEpochValue(6.0);
|
|
||||||
verifyThisEpochValue(6.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '6.00', '100.00%');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to stake against multiple validators', function () {
|
|
||||||
stakingPageAssociateTokens('5');
|
|
||||||
verifyUnstakedBalance(5.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.getByTestId(vegaWalletStakedBalances, txTimeout)
|
|
||||||
.parent()
|
|
||||||
.should('contain', 2.0, txTimeout);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
clickOnValidatorFromList(1);
|
|
||||||
stakingValidatorPageAddStake('1');
|
|
||||||
verifyUnstakedBalance(2.0);
|
|
||||||
cy.getByTestId(vegaWalletStakedBalances, txTimeout)
|
|
||||||
.should('have.length', 4, txTimeout)
|
|
||||||
.eq(0)
|
|
||||||
.should('contain', 2.0, txTimeout);
|
|
||||||
cy.getByTestId(vegaWalletStakedBalances, txTimeout)
|
|
||||||
.eq(1)
|
|
||||||
.should('contain', 1.0, txTimeout);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
cy.get(`[row-id="${0}"]`)
|
|
||||||
.eq(1)
|
|
||||||
.within(() => {
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
|
||||||
.should('have.text', '2.00')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(stakeValidatorListTotalShare)
|
|
||||||
.should('have.text', '66.67%')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('have.text', '2.00')
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
cy.get(`[row-id="${1}"]`)
|
|
||||||
.eq(1)
|
|
||||||
.within(() => {
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('have.text', '1.00')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(stakeValidatorListTotalShare)
|
|
||||||
.should('have.text', '33.33%')
|
|
||||||
.and('be.visible');
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake)
|
|
||||||
.scrollIntoView()
|
|
||||||
.should('have.text', '1.00')
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 2001-STKE-041
|
|
||||||
it(
|
|
||||||
'Able to remove part of a stake against a validator',
|
|
||||||
{ tags: '@smoke' },
|
|
||||||
function () {
|
|
||||||
ensureSpecifiedUnstakedTokensAreAssociated('4');
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('3');
|
|
||||||
verifyNextEpochValue(3.0);
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
// 2001-STKE-040
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
// 2001-STKE-044, 2001-STKE-048
|
|
||||||
stakingValidatorPageRemoveStake('1');
|
|
||||||
// 2001-STKE-049
|
|
||||||
verifyNextEpochValue(2.0);
|
|
||||||
verifyUnstakedBalance(2.0);
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
verifyNextEpochValue(2.0);
|
|
||||||
verifyThisEpochValue(2.0);
|
|
||||||
cy.getByTestId(stakeValidatorListTotalStake, epochTimeout).should(
|
|
||||||
'contain.text',
|
|
||||||
'2'
|
|
||||||
);
|
|
||||||
waitForBeginningOfEpoch();
|
|
||||||
cy.getByTestId(stakeValidatorListStakePercentage).should(
|
|
||||||
'have.text',
|
|
||||||
'100%'
|
|
||||||
);
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// 2001-STKE-045
|
|
||||||
it('Able to remove a full stake against a validator', function () {
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('1');
|
|
||||||
verifyUnstakedBalance(2.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageRemoveStake('1');
|
|
||||||
verifyNextEpochValue(0.0);
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
verifyNextEpochValue(0.0);
|
|
||||||
verifyThisEpochValue(0.0);
|
|
||||||
cy.getByTestId(vegaWalletStakedBalances, txTimeout).should(
|
|
||||||
'not.exist',
|
|
||||||
txTimeout
|
|
||||||
);
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '0.00', '0.00%');
|
|
||||||
|
|
||||||
cy.getByTestId(userStakeBtn).should('not.exist');
|
|
||||||
cy.getByTestId(userStake).should('not.exist');
|
|
||||||
cy.getByTestId(userStakeShare).should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Unable to remove a stake with a negative value for a validator', function () {
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyNextEpochValue(2.0);
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
cy.getByTestId(stakeRemoveStakeRadioButton, txTimeout).click();
|
|
||||||
cy.getByTestId(stakeTokenAmountInputBox).type('-0.1');
|
|
||||||
cy.contains('Waiting for next epoch to start', epochTimeout);
|
|
||||||
cy.getByTestId(stakeTokenSubmitButton)
|
|
||||||
.should('be.disabled', epochTimeout)
|
|
||||||
.and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`)
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Unable to remove a stake greater than staked amount next epoch for a validator', function () {
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyNextEpochValue(2.0);
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
cy.getByTestId(stakeRemoveStakeRadioButton).click();
|
|
||||||
cy.getByTestId(stakeTokenAmountInputBox).type('4');
|
|
||||||
cy.contains('Waiting for next epoch to start', epochTimeout);
|
|
||||||
cy.getByTestId(stakeTokenSubmitButton)
|
|
||||||
.should('be.disabled', epochTimeout)
|
|
||||||
.and('contain', `Remove 4 $VEGA tokens at the end of epoch`)
|
|
||||||
.and('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Disassociating all wallet tokens max - removes all staked tokens', function () {
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(1);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageDisassociateAllTokens();
|
|
||||||
getEthereumWallet().within(() => {
|
|
||||||
cy.contains(vegaWalletPublicKeyShort, txTimeout).should('not.exist');
|
|
||||||
});
|
|
||||||
verifyEthWalletTotalAssociatedBalance('0.0');
|
|
||||||
getVegaWallet().within(() => {
|
|
||||||
cy.getByTestId(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
'0.00'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.getByTestId(vegaWalletStakedBalances, txTimeout).should(
|
|
||||||
'not.exist',
|
|
||||||
txTimeout
|
|
||||||
);
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '0.00', '0.00%');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Disassociating all vesting contract tokens max - removes all staked tokens', function () {
|
|
||||||
stakingPageAssociateTokens('3', { type: 'contract' });
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(1);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageDisassociateAllTokens('contract');
|
|
||||||
getEthereumWallet().within(() => {
|
|
||||||
cy.contains(vegaWalletPublicKeyShort, txTimeout).should('not.exist');
|
|
||||||
});
|
|
||||||
verifyEthWalletTotalAssociatedBalance('0.0');
|
|
||||||
getVegaWallet().within(() => {
|
|
||||||
cy.getByTestId(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
'0.00'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.getByTestId(vegaWalletStakedBalances, txTimeout).should(
|
|
||||||
'not.exist',
|
|
||||||
txTimeout
|
|
||||||
);
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '0.00', '0.00%');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Disassociating some tokens - prioritizes unstaked tokens', function () {
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageDisassociateTokens('1');
|
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
|
||||||
getVegaWallet().within(() => {
|
|
||||||
cy.getByTestId(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
'2.00'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
verifyStakedBalance(2.0);
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
validateValidatorListTotalStakeAndShare('0', '2.00', '100.00%');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Associating wallet tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
|
||||||
// 2001-STKE-004
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('3');
|
|
||||||
verifyStakedBalance(3.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageAssociateTokens('4');
|
|
||||||
verifyUnstakedBalance(0.0);
|
|
||||||
verifyStakedBalance(7.0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Associating vesting contract tokens - when some already staked - auto stakes tokens to staked validator', function () {
|
|
||||||
// 2001-STKE-004
|
|
||||||
stakingPageAssociateTokens('3', { type: 'contract' });
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('3');
|
|
||||||
verifyStakedBalance(3.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageAssociateTokens('4', { type: 'contract' });
|
|
||||||
verifyUnstakedBalance(0.0);
|
|
||||||
verifyStakedBalance(7.0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Associating vesting contract tokens - when wallet tokens already staked - auto stakes tokens to staked validator', function () {
|
|
||||||
// 2001-STKE-004
|
|
||||||
stakingPageAssociateTokens('3', { type: 'wallet' });
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('3');
|
|
||||||
verifyStakedBalance(3.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageAssociateTokens('4', { type: 'contract' });
|
|
||||||
verifyUnstakedBalance(0.0);
|
|
||||||
verifyStakedBalance(7.0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Associating tokens - with multiple validators already staked - auto stakes to staked validators - abiding by existing stake ratio', function () {
|
|
||||||
// 2001-STKE-004
|
|
||||||
stakingPageAssociateTokens('6');
|
|
||||||
verifyUnstakedBalance(6.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(0.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
clickOnValidatorFromList(1);
|
|
||||||
stakingValidatorPageAddStake('4');
|
|
||||||
verifyUnstakedBalance(0.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
stakingPageAssociateTokens('6');
|
|
||||||
getVegaWallet().within(() => {
|
|
||||||
cy.getByTestId(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
'12.00'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
verifyStakedBalance(4.0);
|
|
||||||
verifyStakedBalance(8.0);
|
|
||||||
verifyUnstakedBalance(0.0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Selecting use maximum where tokens are already staked - suggests the unstaked token amount', function () {
|
|
||||||
stakingPageAssociateTokens('3');
|
|
||||||
verifyUnstakedBalance(3.0);
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
stakingValidatorPageAddStake('2');
|
|
||||||
verifyUnstakedBalance(1.0);
|
|
||||||
closeStakingDialog();
|
|
||||||
clickOnValidatorFromList(0);
|
|
||||||
cy.getByTestId(stakeAddStakeRadioButton).click();
|
|
||||||
cy.getByTestId(stakeMaximumTokens, { timeout: 60000 }).click();
|
|
||||||
cy.getByTestId(stakeTokenSubmitButton).should(
|
|
||||||
'contain',
|
|
||||||
'Add 1 $VEGA tokens'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach('Teardown Wallet', function () {
|
|
||||||
vegaWalletTeardown();
|
|
||||||
});
|
|
||||||
|
|
||||||
function verifyNextEpochValue(amount: number) {
|
|
||||||
cy.getByTestId('stake-next-epoch', epochTimeout)
|
|
||||||
.contains(amount, epochTimeout)
|
|
||||||
.should('be.visible');
|
|
||||||
}
|
|
||||||
|
|
||||||
function verifyThisEpochValue(amount: number) {
|
|
||||||
cy.getByTestId('stake-this-epoch', epochTimeout) // 2001-STKE-013
|
|
||||||
.contains(amount, epochTimeout)
|
|
||||||
.should('be.visible');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,388 @@
|
|||||||
|
const ethWalletContainer = '[data-testid="ethereum-wallet"]';
|
||||||
|
const ethWalletAssociatedBalances =
|
||||||
|
'[data-testid="eth-wallet-associated-balances"]';
|
||||||
|
const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]';
|
||||||
|
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
||||||
|
const vegaWalletUnstakedBalance =
|
||||||
|
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||||
|
const txTimeout = Cypress.env('txTimeout');
|
||||||
|
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
||||||
|
const ethWalletAssociateButton = '[href="/token/associate"]';
|
||||||
|
const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]';
|
||||||
|
const tokenAmountInputBox = '[data-testid="token-amount-input"]';
|
||||||
|
const tokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
||||||
|
const ethWalletDissociateButton = '[href="/token/disassociate"]';
|
||||||
|
const vestingContractSection = '[data-testid="vega-in-vesting-contract"]';
|
||||||
|
const vegaInWalletSection = '[data-testid="vega-in-wallet"]';
|
||||||
|
const connectedVegaKey = '[data-testid="connected-vega-key"]';
|
||||||
|
const associatedKey = '[data-testid="associated-key"]';
|
||||||
|
const associatedAmount = '[data-testid="associated-amount"]';
|
||||||
|
const associateCompleteText = '[data-testid="transaction-complete-body"]';
|
||||||
|
const disassociationWarning = '[data-testid="disassociation-warning"]';
|
||||||
|
const vegaWallet = '[data-testid="vega-wallet"]';
|
||||||
|
|
||||||
|
context(
|
||||||
|
'Token association flow - with eth and vega wallets connected',
|
||||||
|
{ tags: '@slow' },
|
||||||
|
function () {
|
||||||
|
before('visit staking tab and connect vega wallet', function () {
|
||||||
|
cy.visit('/');
|
||||||
|
// 0005-ETXN-001
|
||||||
|
cy.vega_wallet_set_specified_approval_amount('1000');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Eth wallet - contains VEGA tokens', function () {
|
||||||
|
beforeEach(
|
||||||
|
'teardown wallet & drill into a specific validator',
|
||||||
|
function () {
|
||||||
|
cy.reload();
|
||||||
|
cy.wait_for_spinner();
|
||||||
|
cy.ethereum_wallet_connect();
|
||||||
|
cy.connectVegaWallet();
|
||||||
|
cy.vega_wallet_teardown();
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it('Able to associate tokens - from wallet', function () {
|
||||||
|
//1004-ASSO-003
|
||||||
|
//1004-ASSO-005
|
||||||
|
//1004-ASSO-009
|
||||||
|
//1004-ASSO-030
|
||||||
|
//1004-ASSO-012
|
||||||
|
//1004-ASSO-013
|
||||||
|
//1004-ASSO-014
|
||||||
|
//1004-ASSO-015
|
||||||
|
//1004-ASSO-030
|
||||||
|
//0005-ETXN-006
|
||||||
|
//0005-ETXN-003
|
||||||
|
//0005-ETXN-005
|
||||||
|
cy.staking_page_associate_tokens('2', { skipConfirmation: true });
|
||||||
|
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'have.length.above',
|
||||||
|
3
|
||||||
|
);
|
||||||
|
cy.validate_wallet_currency('Associated', '0.00');
|
||||||
|
cy.validate_wallet_currency('Pending association', '2.00');
|
||||||
|
cy.validate_wallet_currency('Total associated after pending', '2.00');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||||
|
|
||||||
|
// 0005-ETXN-002
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent(txTimeout)
|
||||||
|
.should('contain', 2.0);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('2.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to disassociate all associated tokens - manually', function () {
|
||||||
|
// 1004-ASSO-025
|
||||||
|
// 1004-ASSO-027
|
||||||
|
// 1004-ASSO-028
|
||||||
|
// 1004-ASSO-029
|
||||||
|
// 1004-ASSO-031
|
||||||
|
|
||||||
|
cy.staking_page_associate_tokens('2');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent(txTimeout)
|
||||||
|
.should('contain', 2.0);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('2.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_tokens('2');
|
||||||
|
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'have.length.above',
|
||||||
|
3
|
||||||
|
);
|
||||||
|
cy.validate_wallet_currency('Associated', '2.00');
|
||||||
|
cy.validate_wallet_currency('Pending association', '2.00');
|
||||||
|
cy.validate_wallet_currency('Total associated after pending', '0.00');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout).should('not.exist');
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('0.00', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
||||||
|
//1004-ASSO-011
|
||||||
|
cy.staking_page_associate_tokens('1001', { approve: true });
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent()
|
||||||
|
.should('contain', '1,001.00', txTimeout);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('1,001.00', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
||||||
|
'contain',
|
||||||
|
'1,001.00'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to disassociate a partial amount of tokens currently associated', function () {
|
||||||
|
cy.staking_page_associate_tokens('2');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_tokens('1');
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent(txTimeout)
|
||||||
|
.should('contain', 1.0);
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent(txTimeout)
|
||||||
|
.should('contain', 1.0);
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 1.0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to disassociate all tokens - using max', function () {
|
||||||
|
// 1004-ASSO-026
|
||||||
|
const warningText =
|
||||||
|
'Warning: Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.';
|
||||||
|
|
||||||
|
cy.staking_page_associate_tokens('2');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
|
||||||
|
cy.get(ethWalletDissociateButton).click();
|
||||||
|
cy.get(disassociationWarning).should('contain', warningText);
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_all_tokens();
|
||||||
|
|
||||||
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
|
'not.exist'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(ethWalletContainer).within(() => {
|
||||||
|
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
||||||
|
'not.exist'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 0.0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to associate and disassociate vesting contract tokens', function () {
|
||||||
|
// 1004-ASSO-006
|
||||||
|
// 1004-ASSO-007
|
||||||
|
// 1004-ASSO-018
|
||||||
|
// 1004-ASSO-024
|
||||||
|
// 1004-ASSO-023
|
||||||
|
|
||||||
|
cy.staking_page_associate_tokens('2', {
|
||||||
|
type: 'contract',
|
||||||
|
skipConfirmation: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'have.length.above',
|
||||||
|
3
|
||||||
|
);
|
||||||
|
cy.validate_wallet_currency('Associated', '0.00');
|
||||||
|
cy.validate_wallet_currency('Pending association', '2.00');
|
||||||
|
cy.validate_wallet_currency('Total associated after pending', '2.00');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent(txTimeout)
|
||||||
|
.should('contain', 2.0);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('2.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
cy.staking_page_disassociate_tokens('1', {
|
||||||
|
type: 'contract',
|
||||||
|
skipConfirmation: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'have.length.above',
|
||||||
|
3
|
||||||
|
);
|
||||||
|
cy.validate_wallet_currency('Associated', '2.00');
|
||||||
|
cy.validate_wallet_currency('Pending association', '1.00');
|
||||||
|
cy.validate_wallet_currency('Total associated after pending', '1.00');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociatedBalances, txTimeout)
|
||||||
|
.contains(vegaWalletPublicKeyShort)
|
||||||
|
.parent(txTimeout)
|
||||||
|
.should('contain', 1.0);
|
||||||
|
|
||||||
|
cy.get(ethWalletTotalAssociatedBalance, txTimeout)
|
||||||
|
.contains('1.0', txTimeout)
|
||||||
|
.should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to associate & disassociate both wallet and vesting contract tokens', function () {
|
||||||
|
// 1004-ASSO-019
|
||||||
|
// 1004-ASSO-020
|
||||||
|
// 1004-ASSO-021
|
||||||
|
// 1004-ASSO-022
|
||||||
|
|
||||||
|
cy.staking_page_associate_tokens('21', { type: 'wallet' });
|
||||||
|
cy.get('button').contains('Select a validator to nominate').click();
|
||||||
|
cy.staking_page_associate_tokens('37', { type: 'contract' });
|
||||||
|
|
||||||
|
cy.get(vestingContractSection).within(() => {
|
||||||
|
cy.get(associatedKey).should(
|
||||||
|
'contain',
|
||||||
|
Cypress.env('vegaWalletPublicKeyShort')
|
||||||
|
);
|
||||||
|
cy.get(associatedAmount, txTimeout).should('contain', 37);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaInWalletSection).within(() => {
|
||||||
|
cy.get(associatedKey).should(
|
||||||
|
'contain',
|
||||||
|
Cypress.env('vegaWalletPublicKeyShort')
|
||||||
|
);
|
||||||
|
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 58);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_tokens('6', { type: 'contract' });
|
||||||
|
cy.get(vestingContractSection).within(() => {
|
||||||
|
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 52);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.navigate_to('validators');
|
||||||
|
|
||||||
|
cy.staking_page_disassociate_tokens('9', { type: 'wallet' });
|
||||||
|
cy.get(vegaInWalletSection).within(() => {
|
||||||
|
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
||||||
|
});
|
||||||
|
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 43);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Not able to associate more tokens than owned', function () {
|
||||||
|
// 1004-ASSO-008
|
||||||
|
// 1004-ASSO-010
|
||||||
|
// No warning visible as described in AC, but the button is disabled
|
||||||
|
|
||||||
|
cy.get(ethWalletAssociateButton).first().click();
|
||||||
|
cy.get(associateWalletRadioButton, { timeout: 30000 }).click();
|
||||||
|
cy.get(tokenSubmitButton, txTimeout).should('be.disabled'); // button disabled with no input
|
||||||
|
cy.get(tokenAmountInputBox, { timeout: 10000 }).type(6500000);
|
||||||
|
cy.get(tokenSubmitButton, txTimeout).should('be.disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 1004-ASSO-004
|
||||||
|
|
||||||
|
it('Pending association outside of app is shown', function () {
|
||||||
|
cy.vega_wallet_associate('2');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'have.length.above',
|
||||||
|
3
|
||||||
|
);
|
||||||
|
cy.validate_wallet_currency('Associated', '0.00');
|
||||||
|
cy.validate_wallet_currency('Pending association', '2.00');
|
||||||
|
cy.validate_wallet_currency('Total associated after pending', '2.00');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||||
|
cy.validate_wallet_currency('Associated', '2.00');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Disassociation outside of app is shown', function () {
|
||||||
|
cy.staking_page_associate_tokens('2');
|
||||||
|
cy.validate_wallet_currency('Associated', '2.00');
|
||||||
|
cy.vega_wallet_disassociate('2');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should(
|
||||||
|
'have.length.above',
|
||||||
|
3
|
||||||
|
);
|
||||||
|
cy.validate_wallet_currency('Associated', '2.00');
|
||||||
|
cy.validate_wallet_currency('Pending association', '2.00');
|
||||||
|
cy.validate_wallet_currency('Total associated after pending', '0.00');
|
||||||
|
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||||
|
cy.validate_wallet_currency('Associated', '0.00');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to associate tokens to different public key of connected vega wallet', function () {
|
||||||
|
cy.get(ethWalletAssociateButton).first().click();
|
||||||
|
cy.get(associateWalletRadioButton).click();
|
||||||
|
cy.get(connectedVegaKey).should(
|
||||||
|
'have.text',
|
||||||
|
Cypress.env('vegaWalletPublicKey')
|
||||||
|
);
|
||||||
|
|
||||||
|
cy.get('[data-testid="manage-vega-wallet"]').click();
|
||||||
|
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
|
||||||
|
cy.get(connectedVegaKey).should(
|
||||||
|
'have.text',
|
||||||
|
Cypress.env('vegaWalletPublicKey2')
|
||||||
|
);
|
||||||
|
cy.staking_page_associate_tokens('2');
|
||||||
|
cy.get(vegaWallet).within(() => {
|
||||||
|
cy.get(vegaWalletAssociatedBalance, txTimeout).should('contain', 2.0);
|
||||||
|
});
|
||||||
|
cy.get(associateCompleteText).should(
|
||||||
|
'have.text',
|
||||||
|
`Vega key ${Cypress.env(
|
||||||
|
'vegaWalletPublicKey2Short'
|
||||||
|
)} can now participate in governance and nominate a validator with your associated $VEGA.`
|
||||||
|
);
|
||||||
|
cy.staking_page_disassociate_all_tokens();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,399 +0,0 @@
|
|||||||
import {
|
|
||||||
verifyEthWalletTotalAssociatedBalance,
|
|
||||||
verifyEthWalletAssociatedBalance,
|
|
||||||
waitForSpinner,
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
stakingPageAssociateTokens,
|
|
||||||
stakingPageDisassociateAllTokens,
|
|
||||||
stakingPageDisassociateTokens,
|
|
||||||
validateWalletCurrency,
|
|
||||||
} from '../../support/staking.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import {
|
|
||||||
vegaWalletAssociate,
|
|
||||||
vegaWalletDisassociate,
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
|
||||||
vegaWalletTeardown,
|
|
||||||
} from '../../support/wallet-teardown.functions';
|
|
||||||
|
|
||||||
const ethWalletContainer = '[data-testid="ethereum-wallet"]';
|
|
||||||
const vegaWalletAssociatedBalance = '[data-testid="currency-value"]';
|
|
||||||
const vegaWalletUnstakedBalance =
|
|
||||||
'[data-testid="vega-wallet-balance-unstaked"]';
|
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
|
||||||
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
|
||||||
const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible';
|
|
||||||
const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]';
|
|
||||||
const tokenAmountInputBox = '[data-testid="token-amount-input"]';
|
|
||||||
const tokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
|
||||||
const ethWalletDissociateButton = '[href="/token/disassociate"]:visible';
|
|
||||||
const vestingContractSection = '[data-testid="vega-in-vesting-contract"]';
|
|
||||||
const vegaInWalletSection = '[data-testid="vega-in-wallet"]';
|
|
||||||
const connectedVegaKey = '[data-testid="connected-vega-key"]';
|
|
||||||
const associatedKey = '[data-testid="associated-key"]';
|
|
||||||
const associatedAmount = '[data-testid="associated-amount"]';
|
|
||||||
const associateCompleteText = '[data-testid="transaction-complete-body"]';
|
|
||||||
const disassociationWarning = '[data-testid="disassociation-warning"]';
|
|
||||||
const vegaWallet = '[data-testid="vega-wallet"]';
|
|
||||||
|
|
||||||
context(
|
|
||||||
'Token association flow - with eth and vega wallets connected',
|
|
||||||
{ tags: '@slow' },
|
|
||||||
function () {
|
|
||||||
before('visit staking tab and connect vega wallet', function () {
|
|
||||||
cy.visit('/');
|
|
||||||
// 0005-ETXN-001
|
|
||||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Eth wallet - contains VEGA tokens', function () {
|
|
||||||
beforeEach(
|
|
||||||
'teardown wallet & drill into a specific validator',
|
|
||||||
function () {
|
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
cy.connectVegaWallet();
|
|
||||||
ethereumWalletConnect();
|
|
||||||
vegaWalletTeardown();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it('Able to associate tokens - from wallet', function () {
|
|
||||||
//1004-ASSO-003
|
|
||||||
//1004-ASSO-005
|
|
||||||
//1004-ASSO-009
|
|
||||||
//1004-ASSO-030
|
|
||||||
//1004-ASSO-012
|
|
||||||
//1004-ASSO-013
|
|
||||||
//1004-ASSO-014
|
|
||||||
//1004-ASSO-015
|
|
||||||
//1004-ASSO-030
|
|
||||||
//0005-ETXN-006
|
|
||||||
//0005-ETXN-003
|
|
||||||
//0005-ETXN-005
|
|
||||||
stakingPageAssociateTokens('2', { skipConfirmation: true });
|
|
||||||
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
|
||||||
'have.length.above',
|
|
||||||
6
|
|
||||||
);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
|
||||||
validateWalletCurrency('Total associated after pending', '2.00');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
|
||||||
|
|
||||||
// 0005-ETXN-002
|
|
||||||
verifyEthWalletAssociatedBalance('2.0');
|
|
||||||
|
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
|
||||||
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to disassociate all associated tokens - manually', function () {
|
|
||||||
// 1004-ASSO-025
|
|
||||||
// 1004-ASSO-027
|
|
||||||
// 1004-ASSO-028
|
|
||||||
// 1004-ASSO-029
|
|
||||||
// 1004-ASSO-031
|
|
||||||
|
|
||||||
stakingPageAssociateTokens('2');
|
|
||||||
verifyEthWalletAssociatedBalance('2.0');
|
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
stakingPageDisassociateTokens('2');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
|
||||||
'have.length.above',
|
|
||||||
6
|
|
||||||
);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
|
||||||
validateWalletCurrency('Total associated after pending', '0.00');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
|
||||||
cy.getByTestId('eth-wallet-associated-balances', txTimeout).should(
|
|
||||||
'not.exist'
|
|
||||||
);
|
|
||||||
verifyEthWalletTotalAssociatedBalance('0.00');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () {
|
|
||||||
//1004-ASSO-011
|
|
||||||
stakingPageAssociateTokens('1001', { approve: true });
|
|
||||||
verifyEthWalletAssociatedBalance('1,001.00');
|
|
||||||
verifyEthWalletTotalAssociatedBalance('1,001.00');
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.last()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
'1,001.00'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to disassociate a partial amount of tokens currently associated', function () {
|
|
||||||
stakingPageAssociateTokens('2');
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
stakingPageDisassociateTokens('1');
|
|
||||||
verifyEthWalletAssociatedBalance('1.0');
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
1.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to disassociate all tokens - using max', function () {
|
|
||||||
// 1004-ASSO-026
|
|
||||||
const warningText =
|
|
||||||
'Warning: Any tokens that have been nominated to a node will sacrifice rewards they are due for the current epoch. If you do not wish to sacrifice these, you should remove stake from a node at the end of an epoch before disassociation.';
|
|
||||||
stakingPageAssociateTokens('2');
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
cy.get(ethWalletDissociateButton).click();
|
|
||||||
cy.get(disassociationWarning).should('contain', warningText);
|
|
||||||
stakingPageDisassociateAllTokens();
|
|
||||||
cy.get(ethWalletContainer)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
|
||||||
'not.exist'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.get(ethWalletContainer)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should(
|
|
||||||
'not.exist'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
0.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to associate and disassociate vesting contract tokens', function () {
|
|
||||||
// 1004-ASSO-006
|
|
||||||
// 1004-ASSO-007
|
|
||||||
// 1004-ASSO-018
|
|
||||||
// 1004-ASSO-024
|
|
||||||
// 1004-ASSO-023
|
|
||||||
// 1004-ASSO-032
|
|
||||||
|
|
||||||
stakingPageAssociateTokens('2', {
|
|
||||||
type: 'contract',
|
|
||||||
skipConfirmation: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
|
||||||
'have.length.above',
|
|
||||||
6
|
|
||||||
);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
|
||||||
validateWalletCurrency('Total associated after pending', '2.00');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
|
||||||
verifyEthWalletAssociatedBalance('2.0');
|
|
||||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.get(vegaWalletUnstakedBalance, txTimeout).should('contain', 2.0);
|
|
||||||
stakingPageDisassociateTokens('1', {
|
|
||||||
type: 'contract',
|
|
||||||
skipConfirmation: true,
|
|
||||||
});
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
|
||||||
'have.length.above',
|
|
||||||
6
|
|
||||||
);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
|
||||||
validateWalletCurrency('Pending association', '1.00');
|
|
||||||
validateWalletCurrency('Total associated after pending', '1.00');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
|
||||||
verifyEthWalletAssociatedBalance('1.0');
|
|
||||||
verifyEthWalletTotalAssociatedBalance('1.0');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to associate & disassociate both wallet and vesting contract tokens', function () {
|
|
||||||
// 1004-ASSO-019
|
|
||||||
// 1004-ASSO-020
|
|
||||||
// 1004-ASSO-021
|
|
||||||
// 1004-ASSO-022
|
|
||||||
stakingPageAssociateTokens('21', { type: 'wallet' });
|
|
||||||
cy.get('button').contains('Select a validator to nominate').click();
|
|
||||||
stakingPageAssociateTokens('37', { type: 'contract' });
|
|
||||||
cy.get(vestingContractSection)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(associatedKey).should(
|
|
||||||
'contain',
|
|
||||||
Cypress.env('vegaWalletPublicKeyShort')
|
|
||||||
);
|
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 37);
|
|
||||||
});
|
|
||||||
cy.get(vegaInWalletSection)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(associatedKey).should(
|
|
||||||
'contain',
|
|
||||||
Cypress.env('vegaWalletPublicKeyShort')
|
|
||||||
);
|
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 21);
|
|
||||||
});
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
58
|
|
||||||
);
|
|
||||||
});
|
|
||||||
stakingPageDisassociateTokens('6', { type: 'contract' });
|
|
||||||
cy.get(vestingContractSection)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 31);
|
|
||||||
});
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
52
|
|
||||||
);
|
|
||||||
});
|
|
||||||
navigateTo(navigation.validators);
|
|
||||||
stakingPageDisassociateTokens('9', { type: 'wallet' });
|
|
||||||
cy.get(vegaInWalletSection)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(associatedAmount, txTimeout).should('contain', 12);
|
|
||||||
});
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
43
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Not able to associate more tokens than owned', function () {
|
|
||||||
// 1004-ASSO-008
|
|
||||||
// 1004-ASSO-010
|
|
||||||
// No warning visible as described in AC, but the button is disabled
|
|
||||||
cy.get(ethWalletAssociateButton).click();
|
|
||||||
cy.get(associateWalletRadioButton, { timeout: 30000 }).click();
|
|
||||||
cy.get(tokenSubmitButton, txTimeout).should('be.disabled'); // button disabled with no input
|
|
||||||
cy.get(tokenAmountInputBox, { timeout: 10000 }).type('6500000');
|
|
||||||
cy.get(tokenSubmitButton, txTimeout).should('be.disabled');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 1004-ASSO-004
|
|
||||||
it('Pending association outside of app is shown', function () {
|
|
||||||
vegaWalletAssociate('2');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
|
||||||
'have.length.above',
|
|
||||||
6
|
|
||||||
);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
|
||||||
validateWalletCurrency('Total associated after pending', '2.00');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Disassociation outside of app is shown', function () {
|
|
||||||
stakingPageAssociateTokens('2');
|
|
||||||
cy.wrap(validateWalletCurrency('Associated', '2.00')).then(() => {
|
|
||||||
vegaWalletDisassociate('2');
|
|
||||||
});
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should(
|
|
||||||
'have.length.above',
|
|
||||||
6
|
|
||||||
);
|
|
||||||
validateWalletCurrency('Associated', '2.00');
|
|
||||||
validateWalletCurrency('Pending association', '2.00');
|
|
||||||
validateWalletCurrency('Total associated after pending', '0.00');
|
|
||||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
|
||||||
validateWalletCurrency('Associated', '0.00');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to associate tokens to different public key of connected vega wallet', function () {
|
|
||||||
cy.get(ethWalletAssociateButton).click();
|
|
||||||
cy.get(associateWalletRadioButton).click();
|
|
||||||
cy.get(connectedVegaKey).should(
|
|
||||||
'have.text',
|
|
||||||
Cypress.env('vegaWalletPublicKey')
|
|
||||||
);
|
|
||||||
|
|
||||||
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
|
||||||
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
|
|
||||||
cy.get(connectedVegaKey).should(
|
|
||||||
'have.text',
|
|
||||||
Cypress.env('vegaWalletPublicKey2')
|
|
||||||
);
|
|
||||||
stakingPageAssociateTokens('2');
|
|
||||||
cy.get(vegaWallet)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(vegaWalletAssociatedBalance, txTimeout).should(
|
|
||||||
'contain',
|
|
||||||
2.0
|
|
||||||
);
|
|
||||||
});
|
|
||||||
cy.get(associateCompleteText).should(
|
|
||||||
'have.text',
|
|
||||||
`Vega key ${Cypress.env(
|
|
||||||
'vegaWalletPublicKey2Short'
|
|
||||||
)} can now participate in governance and nominate a validator with your associated $VEGA.`
|
|
||||||
);
|
|
||||||
stakingPageDisassociateAllTokens();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
const withdraw = 'withdraw';
|
||||||
|
const selectAsset = 'select-asset';
|
||||||
|
const ethAddressInput = 'eth-address-input';
|
||||||
|
const amountInput = 'amount-input';
|
||||||
|
const balanceAvailable = 'BALANCE_AVAILABLE_value';
|
||||||
|
const withdrawalThreshold = 'WITHDRAWAL_THRESHOLD_value';
|
||||||
|
const delayTime = 'DELAY_TIME_value';
|
||||||
|
const submitWithdrawalButton = 'submit-withdrawal';
|
||||||
|
const dialogTitle = 'dialog-title';
|
||||||
|
const dialogClose = 'dialog-close';
|
||||||
|
const txExplorerLink = 'tx-block-explorer';
|
||||||
|
const withdrawalAssetSymbol = 'withdrawal-asset-symbol';
|
||||||
|
const withdrawalAmount = 'withdrawal-amount';
|
||||||
|
const withdrawalRecipient = 'withdrawal-recipient';
|
||||||
|
const withdrawFundsButton = 'withdraw-funds';
|
||||||
|
const completeWithdrawalButton = 'complete-withdrawal';
|
||||||
|
const usdtName = 'USDC (local)';
|
||||||
|
const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0';
|
||||||
|
const usdcSymbol = 'tUSDC';
|
||||||
|
const truncatedWithdrawalEthAddress = '0xEe7D…22d94F';
|
||||||
|
const formValidationError = 'input-error-text';
|
||||||
|
const txTimeout = Cypress.env('txTimeout');
|
||||||
|
|
||||||
|
context(
|
||||||
|
'Withdrawals - with eth and vega wallet connected',
|
||||||
|
{ tags: '@slow' },
|
||||||
|
function () {
|
||||||
|
before('visit withdrawals and connect vega wallet', function () {
|
||||||
|
cy.updateCapsuleMultiSig(); // When running tests locally, will fail if run without restarting capsule
|
||||||
|
cy.deposit_asset(usdcEthAddress, '100000000000000000000');
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach('Navigate to withdrawal page', function () {
|
||||||
|
cy.reload();
|
||||||
|
cy.visit('/');
|
||||||
|
cy.wait_for_spinner();
|
||||||
|
cy.navigate_to('withdraw');
|
||||||
|
cy.connectVegaWallet();
|
||||||
|
cy.ethereum_wallet_connect();
|
||||||
|
cy.vega_wallet_teardown();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to open withdrawal form with vega wallet connected', function () {
|
||||||
|
// needs to reload page for withdrawal form to be displayed in ci - not reproducible outside of ci
|
||||||
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
|
cy.getByTestId(selectAsset)
|
||||||
|
.find('option')
|
||||||
|
.should('have.length.at.least', 2);
|
||||||
|
cy.getByTestId(ethAddressInput).should('be.visible');
|
||||||
|
cy.getByTestId(amountInput).should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unable to submit withdrawal with invalid fields', function () {
|
||||||
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
|
cy.getByTestId(selectAsset).select(usdtName);
|
||||||
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
cy.getByTestId(formValidationError).should('have.length', 1);
|
||||||
|
cy.getByTestId(amountInput).clear().click().type('0.0000001');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
cy.getByTestId(formValidationError).should(
|
||||||
|
'have.text',
|
||||||
|
'Value is below minimum'
|
||||||
|
);
|
||||||
|
cy.getByTestId(amountInput).clear().click().type('10');
|
||||||
|
cy.getByTestId(ethAddressInput).click().type('123');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
cy.getByTestId(formValidationError).should(
|
||||||
|
'have.text',
|
||||||
|
'Invalid Ethereum address'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Able to withdraw asset: -eth wallet connected -withdraw funds button', function () {
|
||||||
|
// fill in withdrawal form
|
||||||
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
|
cy.getByTestId(selectAsset).select(usdtName);
|
||||||
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
|
cy.getByTestId(withdrawalThreshold).should('have.text', '100,000.00000T');
|
||||||
|
cy.getByTestId(delayTime).should('have.text', 'None');
|
||||||
|
cy.getByTestId(amountInput).click().type('100');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
|
||||||
|
cy.contains('Awaiting network confirmation').should('be.visible');
|
||||||
|
// assert withdrawal request
|
||||||
|
cy.getByTestId(dialogTitle, txTimeout).should(
|
||||||
|
'have.text',
|
||||||
|
'Transaction complete'
|
||||||
|
);
|
||||||
|
cy.getByTestId(txExplorerLink)
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('contain', '/txs/');
|
||||||
|
cy.getByTestId(withdrawalAssetSymbol).should('have.text', usdcSymbol);
|
||||||
|
cy.getByTestId(withdrawalAmount).should('have.text', '100.00');
|
||||||
|
cy.getByTestId(withdrawalRecipient)
|
||||||
|
.should('have.text', truncatedWithdrawalEthAddress)
|
||||||
|
.and('have.attr', 'href')
|
||||||
|
.and('contain', `/address/${Cypress.env('ethWalletPublicKey')}`);
|
||||||
|
cy.getByTestId(withdrawFundsButton).click();
|
||||||
|
// withdrawal complete
|
||||||
|
cy.getByTestId(dialogTitle, txTimeout).should(
|
||||||
|
'have.text',
|
||||||
|
'Withdraw asset complete'
|
||||||
|
);
|
||||||
|
cy.getByTestId(dialogClose).click();
|
||||||
|
|
||||||
|
// need to reload page to see withdrawal history complete
|
||||||
|
cy.reload();
|
||||||
|
waitForAssetsDisplayed(usdtName);
|
||||||
|
|
||||||
|
// withdrawal history for complete withdrawal displayed
|
||||||
|
cy.get('[col-id="txHash"]', txTimeout)
|
||||||
|
.should('have.length.above', 1)
|
||||||
|
.eq(1)
|
||||||
|
.parent()
|
||||||
|
.within(() => {
|
||||||
|
cy.get('[col-id="asset.symbol"]').should('have.text', usdcSymbol);
|
||||||
|
cy.get('[col-id="amount"]').should('have.text', '100.00');
|
||||||
|
cy.get('[col-id="details.receiverAddress"]')
|
||||||
|
.find('a')
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('contain', 'https://sepolia.etherscan.io/address/');
|
||||||
|
cy.get('[col-id="withdrawnTimestamp"]').should('not.be.empty');
|
||||||
|
cy.get('[col-id="status"]').should('have.text', 'Completed');
|
||||||
|
cy.get('[col-id="txHash"]')
|
||||||
|
.find('a')
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('contain', 'https://sepolia.etherscan.io/tx/');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Skipping because of bug #1857
|
||||||
|
it.skip('Able to withdraw asset: -eth wallet not connected', function () {
|
||||||
|
const ethWalletAddress = Cypress.env('ethWalletPublicKey');
|
||||||
|
cy.reload();
|
||||||
|
waitForAssetsDisplayed(usdtName);
|
||||||
|
// fill in withdrawal form
|
||||||
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
|
cy.getByTestId(selectAsset).select(usdtName);
|
||||||
|
cy.getByTestId(ethAddressInput).should('be.empty');
|
||||||
|
cy.getByTestId(amountInput).click().type('100');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
|
||||||
|
// Need eth address to submit withdrawal
|
||||||
|
cy.getByTestId(formValidationError).should('have.length', 1);
|
||||||
|
cy.getByTestId(ethAddressInput).click().type(ethWalletAddress);
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
|
||||||
|
cy.contains('Awaiting network confirmation').should('be.visible');
|
||||||
|
// assert withdrawal request
|
||||||
|
cy.getByTestId(dialogTitle, txTimeout).should(
|
||||||
|
'have.text',
|
||||||
|
'Transaction complete'
|
||||||
|
);
|
||||||
|
cy.getByTestId(dialogClose).click();
|
||||||
|
|
||||||
|
cy.getByTestId(completeWithdrawalButton)
|
||||||
|
.eq(0)
|
||||||
|
.parent()
|
||||||
|
.parent()
|
||||||
|
.within(() => {
|
||||||
|
cy.get('[col-id="asset.symbol"]').should('have.text', usdcSymbol);
|
||||||
|
cy.get('[col-id="amount"]').should('have.text', '100.00');
|
||||||
|
cy.get('[col-id="details.receiverAddress"]')
|
||||||
|
.find('a')
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('contain', 'https://sepolia.etherscan.io/address/');
|
||||||
|
cy.get('[col-id="createdTimestamp"]').should('not.be.empty');
|
||||||
|
cy.getByTestId(completeWithdrawalButton).click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Unable to withdraw asset on pub key view', function () {
|
||||||
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
||||||
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
|
// Disconnect vega wallet
|
||||||
|
cy.getByTestId('manage-vega-wallet').click();
|
||||||
|
cy.getByTestId('disconnect').click();
|
||||||
|
|
||||||
|
cy.connectPublicKey(vegaWalletPubKey);
|
||||||
|
cy.getByTestId(withdraw).should('be.visible').click();
|
||||||
|
cy.getByTestId(selectAsset).select(usdtName);
|
||||||
|
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
||||||
|
cy.getByTestId(amountInput).click().type('100');
|
||||||
|
cy.getByTestId(submitWithdrawalButton).click();
|
||||||
|
|
||||||
|
cy.getByTestId('dialog-content').within(() => {
|
||||||
|
cy.get('h1').should('have.text', 'Transaction failed');
|
||||||
|
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function waitForAssetsDisplayed(expectedAsset) {
|
||||||
|
cy.contains(expectedAsset, txTimeout).should('be.visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,224 +0,0 @@
|
|||||||
import {
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
waitForSpinner,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
|
||||||
import { depositAsset } from '../../support/wallet-teardown.functions';
|
|
||||||
|
|
||||||
const withdraw = 'withdraw';
|
|
||||||
const withdrawalForm = 'withdraw-form';
|
|
||||||
const ethAddressInput = 'eth-address-input';
|
|
||||||
const amountInput = 'amount-input';
|
|
||||||
const balanceAvailable = 'BALANCE_AVAILABLE_value';
|
|
||||||
const withdrawalThreshold = 'WITHDRAWAL_THRESHOLD_value';
|
|
||||||
const delayTime = 'DELAY_TIME_value';
|
|
||||||
const submitWithdrawalButton = 'submit-withdrawal';
|
|
||||||
const dialogTitle = 'dialog-title';
|
|
||||||
const dialogClose = 'dialog-close';
|
|
||||||
const txExplorerLink = 'tx-block-explorer';
|
|
||||||
const withdrawalAssetSymbol = 'withdrawal-asset-symbol';
|
|
||||||
const withdrawalAmount = 'withdrawal-amount';
|
|
||||||
const withdrawalRecipient = 'withdrawal-recipient';
|
|
||||||
const withdrawFundsButton = 'withdraw-funds';
|
|
||||||
const completeWithdrawalButton = 'complete-withdrawal';
|
|
||||||
const tableTxHash = '[col-id="txHash"]';
|
|
||||||
const tableAssetSymbol = '[col-id="asset.symbol"]';
|
|
||||||
const tableAmount = '[col-id="amount"]';
|
|
||||||
const tableReceiverAddress = '[col-id="details.receiverAddress"]';
|
|
||||||
const tableWithdrawnTimeStamp = '[col-id="withdrawnTimestamp"]';
|
|
||||||
const tableWithdrawnStatus = '[col-id="status"]';
|
|
||||||
const tableCreatedTimeStamp = '[col-id="createdTimestamp"]';
|
|
||||||
const usdtName = 'USDC (local)';
|
|
||||||
const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0';
|
|
||||||
const usdcSymbol = 'tUSDC';
|
|
||||||
const usdtSelectValue =
|
|
||||||
'993ed98f4f770d91a796faab1738551193ba45c62341d20597df70fea6704ede';
|
|
||||||
const truncatedWithdrawalEthAddress = '0xEe7D…22d94F';
|
|
||||||
const formValidationError = 'input-error-text';
|
|
||||||
const txTimeout = Cypress.env('txTimeout');
|
|
||||||
|
|
||||||
context(
|
|
||||||
'Withdrawals - with eth and vega wallet connected',
|
|
||||||
{ tags: '@slow' },
|
|
||||||
function () {
|
|
||||||
before('visit withdrawals and connect vega wallet', function () {
|
|
||||||
cy.visit('/');
|
|
||||||
// When running tests locally, will fail if run without restarting capsule
|
|
||||||
cy.updateCapsuleMultiSig().then(() => {
|
|
||||||
ethereumWalletConnect();
|
|
||||||
depositAsset(usdcEthAddress, '1000', 5);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach('Navigate to withdrawal page', function () {
|
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
navigateTo(navigation.withdraw);
|
|
||||||
cy.connectVegaWallet();
|
|
||||||
ethereumWalletConnect();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to open withdrawal form with vega wallet connected', function () {
|
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
|
||||||
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
|
||||||
cy.get('select').find('option').should('have.length.at.least', 2);
|
|
||||||
cy.getByTestId(ethAddressInput).should('be.visible');
|
|
||||||
cy.getByTestId(amountInput).should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Unable to submit withdrawal with invalid fields', function () {
|
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
|
||||||
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
|
||||||
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
cy.getByTestId(formValidationError).should('have.length', 1);
|
|
||||||
cy.getByTestId(amountInput).clear().click().type('0.0000001');
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
cy.getByTestId(formValidationError).should(
|
|
||||||
'have.text',
|
|
||||||
'Value is below minimum'
|
|
||||||
);
|
|
||||||
cy.getByTestId(amountInput).clear().click().type('10');
|
|
||||||
cy.getByTestId(ethAddressInput).click().type('123');
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
cy.getByTestId(formValidationError).should(
|
|
||||||
'have.text',
|
|
||||||
'Invalid Ethereum address'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Able to withdraw asset: -eth wallet connected -withdraw funds button', function () {
|
|
||||||
// fill in withdrawal form
|
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
|
||||||
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
|
||||||
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
|
||||||
cy.getByTestId(withdrawalThreshold).should(
|
|
||||||
'have.text',
|
|
||||||
'100,000.00000T'
|
|
||||||
);
|
|
||||||
cy.getByTestId(delayTime).should('have.text', 'None');
|
|
||||||
cy.getByTestId(amountInput).click().type('120');
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.contains('Awaiting network confirmation').should('be.visible');
|
|
||||||
// assert withdrawal request
|
|
||||||
cy.getByTestId(dialogTitle, txTimeout).should(
|
|
||||||
'have.text',
|
|
||||||
'Transaction complete'
|
|
||||||
);
|
|
||||||
cy.getByTestId(txExplorerLink)
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', '/txs/');
|
|
||||||
cy.getByTestId(withdrawalAssetSymbol).should('have.text', usdcSymbol);
|
|
||||||
cy.getByTestId(withdrawalAmount).should('have.text', '120.00');
|
|
||||||
cy.getByTestId(withdrawalRecipient)
|
|
||||||
.should('have.text', truncatedWithdrawalEthAddress)
|
|
||||||
.and('have.attr', 'href')
|
|
||||||
.and('contain', `/address/${Cypress.env('ethWalletPublicKey')}`);
|
|
||||||
cy.getByTestId(withdrawFundsButton).click();
|
|
||||||
// withdrawal complete
|
|
||||||
cy.getByTestId(dialogTitle, txTimeout).should(
|
|
||||||
'have.text',
|
|
||||||
'Withdraw asset complete'
|
|
||||||
);
|
|
||||||
cy.getByTestId(dialogClose).click();
|
|
||||||
// withdrawal history for complete withdrawal displayed
|
|
||||||
cy.get(tableWithdrawnStatus)
|
|
||||||
.eq(1, txTimeout)
|
|
||||||
.should('have.text', 'Completed')
|
|
||||||
.parent()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(tableAssetSymbol).should('have.text', usdcSymbol);
|
|
||||||
cy.get(tableAmount).should('have.text', '120.00');
|
|
||||||
cy.get(tableReceiverAddress)
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', 'https://sepolia.etherscan.io/address/');
|
|
||||||
cy.get(tableWithdrawnTimeStamp).should('not.be.empty');
|
|
||||||
cy.get(tableTxHash)
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', 'https://sepolia.etherscan.io/tx/');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Skipping because of bug #1857
|
|
||||||
it('Able to withdraw asset: -eth wallet not connected', function () {
|
|
||||||
const ethWalletAddress = Cypress.env('ethWalletPublicKey');
|
|
||||||
cy.reload();
|
|
||||||
waitForAssetsDisplayed(usdtName);
|
|
||||||
// fill in withdrawal form
|
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
|
||||||
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
|
||||||
cy.getByTestId(ethAddressInput).should('be.empty');
|
|
||||||
cy.getByTestId(amountInput).click().type('110');
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
|
|
||||||
// Need eth address to submit withdrawal
|
|
||||||
cy.getByTestId(formValidationError).should('have.length', 1);
|
|
||||||
cy.getByTestId(ethAddressInput).click().type(ethWalletAddress);
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.contains('Awaiting network confirmation').should('be.visible');
|
|
||||||
// assert withdrawal request
|
|
||||||
cy.getByTestId(dialogTitle, txTimeout).should(
|
|
||||||
'have.text',
|
|
||||||
'Transaction complete'
|
|
||||||
);
|
|
||||||
cy.getByTestId(dialogClose).click();
|
|
||||||
cy.get(tableTxHash)
|
|
||||||
.eq(1)
|
|
||||||
.should('have.text', 'Complete withdrawal')
|
|
||||||
.parent()
|
|
||||||
.within(() => {
|
|
||||||
cy.get(tableAssetSymbol).should('have.text', usdcSymbol);
|
|
||||||
cy.get(tableAmount).should('have.text', '110.00');
|
|
||||||
cy.get(tableReceiverAddress)
|
|
||||||
.find('a')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', 'https://sepolia.etherscan.io/address/');
|
|
||||||
cy.get(tableCreatedTimeStamp).should('not.be.empty');
|
|
||||||
cy.getByTestId(completeWithdrawalButton).click();
|
|
||||||
// Unable to complete withdrawal in Capsule
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Unable to withdraw asset on pub key view', function () {
|
|
||||||
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
|
||||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
|
||||||
|
|
||||||
// Disconnect vega wallet
|
|
||||||
cy.getByTestId('manage-vega-wallet').last().click();
|
|
||||||
cy.getByTestId('disconnect').click();
|
|
||||||
|
|
||||||
cy.connectPublicKey(vegaWalletPubKey);
|
|
||||||
cy.getByTestId(withdraw).should('be.visible').click();
|
|
||||||
cy.getByTestId(withdrawalForm, txTimeout).within(() => {
|
|
||||||
cy.get('select').select(usdtSelectValue, { force: true });
|
|
||||||
cy.getByTestId(balanceAvailable, txTimeout).should('exist');
|
|
||||||
cy.getByTestId(amountInput).click().type('100');
|
|
||||||
cy.getByTestId(submitWithdrawalButton).click();
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.getByTestId('dialog-content')
|
|
||||||
.last()
|
|
||||||
.within(() => {
|
|
||||||
cy.get('h1').should('have.text', 'Transaction failed');
|
|
||||||
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function waitForAssetsDisplayed(expectedAsset: string) {
|
|
||||||
cy.getByTestId('currency-title').should('contain.text', expectedAsset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
|
||||||
|
before('visit token home page', function () {
|
||||||
|
cy.visit('/');
|
||||||
|
cy.get('nav', { timeout: 10000 }).should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with wallets disconnected', function () {
|
||||||
|
describe('Links and buttons', function () {
|
||||||
|
it('should have link for proposal page', function () {
|
||||||
|
cy.getByTestId('home-proposals').within(() => {
|
||||||
|
cy.get('[href="/proposals"]')
|
||||||
|
.should('exist')
|
||||||
|
.and('have.text', 'Browse, vote, and propose');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should show open or enacted proposals with proposal summary', function () {
|
||||||
|
cy.get('body').then(($body) => {
|
||||||
|
if (!$body.find('[data-testid="proposals-list-item"]').length) {
|
||||||
|
cy.createMarket();
|
||||||
|
cy.reload();
|
||||||
|
cy.wait_for_spinner();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
cy.getByTestId('proposals-list-item')
|
||||||
|
.should('have.length.at.least', 1)
|
||||||
|
.first()
|
||||||
|
.within(() => {
|
||||||
|
cy.getByTestId('proposal-title')
|
||||||
|
.invoke('text')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId('proposal-type')
|
||||||
|
.invoke('text')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId('proposal-description')
|
||||||
|
.invoke('text')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId('proposal-details')
|
||||||
|
.invoke('text')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId('proposal-status')
|
||||||
|
.invoke('text')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId('vote-details')
|
||||||
|
.invoke('text')
|
||||||
|
.should('not.be.empty');
|
||||||
|
cy.getByTestId('view-proposal-btn').should('be.visible');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have external link for governance', function () {
|
||||||
|
cy.getByTestId('home-proposals').within(() => {
|
||||||
|
cy.getByTestId('external-link')
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and('contain', 'https://vega.xyz/governance');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have link for validator page', function () {
|
||||||
|
cy.getByTestId('home-validators').within(() => {
|
||||||
|
cy.get('[href="/validators"]')
|
||||||
|
.first()
|
||||||
|
.should('exist')
|
||||||
|
.and('have.text', 'Browse, and stake');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have external link for validators', function () {
|
||||||
|
cy.getByTestId('home-validators').within(() => {
|
||||||
|
cy.getByTestId('external-link')
|
||||||
|
.should('have.attr', 'href')
|
||||||
|
.and(
|
||||||
|
'contain',
|
||||||
|
'https://community.vega.xyz/c/mainnet-validator-candidates'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have information on active nodes', function () {
|
||||||
|
cy.getByTestId('node-information')
|
||||||
|
.first()
|
||||||
|
.should('contain.text', '2')
|
||||||
|
.and('contain.text', 'active nodes');
|
||||||
|
});
|
||||||
|
it('should have information on consensus nodes', function () {
|
||||||
|
cy.getByTestId('node-information')
|
||||||
|
.last()
|
||||||
|
.should('contain.text', '2')
|
||||||
|
.and('contain.text', 'consensus nodes');
|
||||||
|
});
|
||||||
|
it('should contain link to specific validators', function () {
|
||||||
|
cy.getByTestId('validators')
|
||||||
|
.should('have.length', '2')
|
||||||
|
.each(($validator) => {
|
||||||
|
cy.wrap($validator).find('a').should('have.attr', 'href');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have link for rewards page', function () {
|
||||||
|
cy.getByTestId('home-rewards').within(() => {
|
||||||
|
cy.get('[href="/rewards"]')
|
||||||
|
.first()
|
||||||
|
.should('exist')
|
||||||
|
.and('have.text', 'See rewards');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('should have link for withdrawal page', function () {
|
||||||
|
cy.getByTestId('home-vega-token').within(() => {
|
||||||
|
cy.get('[href="/token/withdraw"]')
|
||||||
|
.first()
|
||||||
|
.should('exist')
|
||||||
|
.and('have.text', 'Manage tokens');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
import { waitForSpinner } from '../../support/common.functions';
|
|
||||||
|
|
||||||
context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
|
|
||||||
before('visit token home page', function () {
|
|
||||||
cy.visit('/');
|
|
||||||
cy.get('nav', { timeout: 10000 }).should('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Links and buttons', function () {
|
|
||||||
it('should have link for proposal page', function () {
|
|
||||||
cy.getByTestId('home-proposals').within(() => {
|
|
||||||
cy.get('[href="/proposals"]')
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Browse, vote, and propose');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display announcement banner', function () {
|
|
||||||
cy.getByTestId('app-announcement')
|
|
||||||
.should('contain.text', 'TEST ANNOUNCEMENT!')
|
|
||||||
.within(() => {
|
|
||||||
cy.getByTestId('external-link')
|
|
||||||
.should('have.attr', 'href', 'https://fairground.wtf')
|
|
||||||
.and('have.text', 'CLICK LINK');
|
|
||||||
});
|
|
||||||
cy.getByTestId('app-announcement-close').should('be.visible').click();
|
|
||||||
cy.getByTestId('app-announcement').should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should show open or enacted proposals without proposal summary', function () {
|
|
||||||
cy.get('body').then(($body) => {
|
|
||||||
if (!$body.find('[data-testid="proposals-list-item"]').length) {
|
|
||||||
cy.createMarket();
|
|
||||||
cy.reload();
|
|
||||||
waitForSpinner();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cy.getByTestId('proposals-list-item')
|
|
||||||
.should('have.length.at.least', 1)
|
|
||||||
.first()
|
|
||||||
.within(() => {
|
|
||||||
cy.getByTestId('proposal-title')
|
|
||||||
.invoke('text')
|
|
||||||
.should('not.be.empty');
|
|
||||||
cy.getByTestId('proposal-type').invoke('text').should('not.be.empty');
|
|
||||||
cy.getByTestId('proposal-status')
|
|
||||||
.invoke('text')
|
|
||||||
.should('not.be.empty');
|
|
||||||
cy.getByTestId('vote-details').invoke('text').should('not.be.empty');
|
|
||||||
cy.getByTestId('view-proposal-btn').should('be.visible');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have external link for governance', function () {
|
|
||||||
cy.getByTestId('home-proposals').within(() => {
|
|
||||||
cy.getByTestId('external-link')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and('contain', 'https://vega.xyz/governance');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have link for validator page', function () {
|
|
||||||
cy.getByTestId('home-validators').within(() => {
|
|
||||||
cy.get('[href="/validators"]')
|
|
||||||
.first()
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Browse, and stake');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have external link for validators', function () {
|
|
||||||
cy.getByTestId('home-validators').within(() => {
|
|
||||||
cy.getByTestId('external-link')
|
|
||||||
.should('have.attr', 'href')
|
|
||||||
.and(
|
|
||||||
'contain',
|
|
||||||
'https://community.vega.xyz/c/mainnet-validator-candidates'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have information on active nodes', function () {
|
|
||||||
cy.getByTestId('node-information')
|
|
||||||
.first()
|
|
||||||
.should('contain.text', '2')
|
|
||||||
.and('contain.text', 'active nodes');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have information on consensus nodes', function () {
|
|
||||||
cy.getByTestId('node-information')
|
|
||||||
.last()
|
|
||||||
.should('contain.text', '2')
|
|
||||||
.and('contain.text', 'consensus nodes');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should contain link to specific validators', function () {
|
|
||||||
cy.getByTestId('validators')
|
|
||||||
.should('have.length', '2')
|
|
||||||
.each(($validator) => {
|
|
||||||
cy.wrap($validator).find('a').should('have.attr', 'href');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have link for rewards page', function () {
|
|
||||||
cy.getByTestId('home-rewards').within(() => {
|
|
||||||
cy.get('[href="/rewards"]')
|
|
||||||
.first()
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'See rewards');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have link for withdrawal page', function () {
|
|
||||||
cy.getByTestId('home-vega-token').within(() => {
|
|
||||||
cy.get('[href="/token/withdraw"]')
|
|
||||||
.first()
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Manage tokens');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display network data', function () {
|
|
||||||
cy.getByTestId('git-network-data')
|
|
||||||
.should('contain.text', 'Reading network data from')
|
|
||||||
.within(() => {
|
|
||||||
cy.get('span')
|
|
||||||
.first()
|
|
||||||
.should('have.text', 'http://localhost:3008/graphql');
|
|
||||||
cy.getByTestId('link').should('exist');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display eth data', function () {
|
|
||||||
cy.getByTestId('git-eth-data')
|
|
||||||
.should('contain.text', 'Reading Ethereum data from')
|
|
||||||
.within(() => {
|
|
||||||
cy.get('span').should('have.text', 'http://localhost:8545');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should contain link for known issues on Github', function () {
|
|
||||||
cy.getByTestId('git-info').within(() => {
|
|
||||||
cy.contains('Known issues and feedback on')
|
|
||||||
.find('[data-testid="link"]')
|
|
||||||
.should(
|
|
||||||
'have.attr',
|
|
||||||
'href',
|
|
||||||
'https://github.com/vegaprotocol/feedback/discussions'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Mobile view - navigation bar', function () {
|
|
||||||
before('Change to mobile resolution', function () {
|
|
||||||
cy.viewport('iphone-xr');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have burger button', () => {
|
|
||||||
cy.getByTestId('button-menu-drawer').should('be.visible').click();
|
|
||||||
cy.getByTestId('menu-drawer').should('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have link for proposal page', function () {
|
|
||||||
cy.getByTestId('menu-drawer').within(() => {
|
|
||||||
cy.get('[href="/proposals"]')
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Proposals');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('should have link for validator page', function () {
|
|
||||||
cy.getByTestId('menu-drawer').within(() => {
|
|
||||||
cy.get('[href="/validators"]')
|
|
||||||
.first()
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Validators');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have link for rewards page', function () {
|
|
||||||
cy.getByTestId('menu-drawer').within(() => {
|
|
||||||
cy.get('[href="/rewards"]')
|
|
||||||
.first()
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Rewards');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('should have link for withdrawal page', function () {
|
|
||||||
cy.getByTestId('menu-drawer').within(() => {
|
|
||||||
cy.get('[href="/token/withdraw"]')
|
|
||||||
.first()
|
|
||||||
.should('exist')
|
|
||||||
.and('have.text', 'Withdraw');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
after(function () {
|
|
||||||
cy.viewport(
|
|
||||||
Cypress.config('viewportWidth'),
|
|
||||||
Cypress.config('viewportHeight')
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,284 @@
|
|||||||
|
context(
|
||||||
|
'Landing pages - verifies required elements',
|
||||||
|
{ tags: '@smoke' },
|
||||||
|
() => {
|
||||||
|
const navbar = 'nav .navbar';
|
||||||
|
const mobileNav = '[data-testid="menu-drawer"]';
|
||||||
|
|
||||||
|
const topLevelLinks = [
|
||||||
|
{
|
||||||
|
name: 'Proposals',
|
||||||
|
selector: '[href="/proposals"]',
|
||||||
|
tests: () => {
|
||||||
|
it('should be able to see a working link for - find out more about Vega governance', function () {
|
||||||
|
const governanceDocsUrl = 'https://vega.xyz/governance';
|
||||||
|
const proposalDocumentationLink =
|
||||||
|
'[data-testid="proposal-documentation-link"]';
|
||||||
|
// 3001-VOTE-001
|
||||||
|
cy.get(proposalDocumentationLink)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Find out more about Vega governance')
|
||||||
|
.and('have.attr', 'href')
|
||||||
|
.and('equal', governanceDocsUrl);
|
||||||
|
|
||||||
|
// 3002-PROP-001
|
||||||
|
cy.request(governanceDocsUrl)
|
||||||
|
.its('body')
|
||||||
|
.then((body) => {
|
||||||
|
if (!body.includes('Govern the network')) {
|
||||||
|
assert.include(
|
||||||
|
body,
|
||||||
|
'Govern the network',
|
||||||
|
`Checking that governance link destination includes 'Govern the network' text`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be able to see button for - new proposal', function () {
|
||||||
|
// 3001-VOTE-002
|
||||||
|
const newProposalLink = '[data-testid="new-proposal-link"]';
|
||||||
|
cy.get(newProposalLink)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'New proposal')
|
||||||
|
.and('have.attr', 'href')
|
||||||
|
.and('equal', '/proposals/propose');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Validators',
|
||||||
|
selector: '[href="/validators"]',
|
||||||
|
tests: () => {
|
||||||
|
it('Should have Staking Guide link visible', function () {
|
||||||
|
// 2001-STKE-003
|
||||||
|
cy.get('[data-testid="staking-guide-link"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Read more about staking on Vega')
|
||||||
|
.and(
|
||||||
|
'have.attr',
|
||||||
|
'href',
|
||||||
|
'https://docs.vega.xyz/mainnet/concepts/vega-chain/#staking-on-vega'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Rewards',
|
||||||
|
selector: '[href="/rewards"]',
|
||||||
|
header: 'Rewards and fees',
|
||||||
|
tests: () => {
|
||||||
|
it('should have epoch warning', () => {
|
||||||
|
cy.get('[data-testid="callout"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.and(
|
||||||
|
'have.text',
|
||||||
|
'Rewards are credited less than a minute after the epoch ends.This delay is set by a network parameter'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('should have toggle for seeing total vs individual rewards', () => {
|
||||||
|
cy.get('[data-testid="epoch-reward-view-toggle-total"]').should(
|
||||||
|
'be.visible'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const secondLevelLinks = [
|
||||||
|
{
|
||||||
|
trigger: true,
|
||||||
|
name: 'Token',
|
||||||
|
selector: '[data-testid="state-trigger"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Token',
|
||||||
|
selector: '[href="/token"]',
|
||||||
|
header: 'The $VEGA token',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Supply & Vesting',
|
||||||
|
selector: '[href="/token/tranches"]',
|
||||||
|
header: 'Vesting tranches',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Withdraw',
|
||||||
|
selector: '[href="/token/withdraw"]',
|
||||||
|
header: 'Withdrawals',
|
||||||
|
tests: () => {
|
||||||
|
it('should have connect Vega wallet button', function () {
|
||||||
|
cy.get('[data-testid="connect-to-vega-wallet-btn"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Connect Vega wallet');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Redeem',
|
||||||
|
selector: '[href="/token/redeem"]',
|
||||||
|
header: 'Vesting',
|
||||||
|
tests: () => {
|
||||||
|
// 1005-VEST-018
|
||||||
|
it('should have connect Eth wallet button', function () {
|
||||||
|
cy.get('[data-testid="connect-to-eth-btn"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Connect Ethereum wallet');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Associate',
|
||||||
|
selector: '[href="/token/associate"]',
|
||||||
|
header: 'Associate $VEGA tokens with Vega Key',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Disassociate',
|
||||||
|
selector: '[href="/token/disassociate"]',
|
||||||
|
header: 'Disassociate $VEGA tokens from a Vega key',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const expand = () => {
|
||||||
|
const trigger = secondLevelLinks.find((l) => l.trigger).selector;
|
||||||
|
cy.get(trigger).then((el) => {
|
||||||
|
if (el.attr('aria-expanded') === 'false') {
|
||||||
|
el.trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const collapse = () => {
|
||||||
|
const trigger = secondLevelLinks.find((l) => l.trigger).selector;
|
||||||
|
cy.get(trigger).then((el) => {
|
||||||
|
if (el.attr('aria-expanded') === 'true') {
|
||||||
|
el.trigger('click');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const ensureHeader = (text) => {
|
||||||
|
cy.get('main header h1').should('have.text', text);
|
||||||
|
};
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
// goes to HOME
|
||||||
|
cy.visit('/');
|
||||||
|
// and waits for it to load
|
||||||
|
cy.get(navbar, { timeout: 10000 }).should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Navigation (desktop)', () => {
|
||||||
|
for (const { name, selector } of topLevelLinks) {
|
||||||
|
it(`should have ${name} nav link`, () => {
|
||||||
|
cy.get(navbar).within(() => {
|
||||||
|
cy.get(selector).should('be.visible');
|
||||||
|
cy.get(selector).should('have.text', name);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const { name, selector, trigger } of secondLevelLinks) {
|
||||||
|
it(`should have ${name} ${
|
||||||
|
trigger ? 'as trigger button' : ''
|
||||||
|
} second level nav link`, () => {
|
||||||
|
cy.get(navbar).within(() => {
|
||||||
|
cy.get(selector).should('be.visible');
|
||||||
|
cy.get(selector).should('have.text', name);
|
||||||
|
if (trigger) cy.get(selector).click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
collapse();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Navigation (mobile)', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
// iphone xr
|
||||||
|
cy.viewport(414, 896);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have burger button', () => {
|
||||||
|
cy.get('[data-testid="button-menu-drawer"]').should('be.visible');
|
||||||
|
cy.get('[data-testid="button-menu-drawer"]').click();
|
||||||
|
cy.get(mobileNav).should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const { name, selector } of topLevelLinks) {
|
||||||
|
it(`should have ${name} nav link`, () => {
|
||||||
|
cy.get(mobileNav).within(() => {
|
||||||
|
cy.get(selector).should('be.visible');
|
||||||
|
cy.get(selector).should('have.text', name);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const { name, selector, trigger } of secondLevelLinks) {
|
||||||
|
it(`should have ${name} ${
|
||||||
|
trigger ? 'as trigger button' : ''
|
||||||
|
} second level nav link`, () => {
|
||||||
|
cy.get(mobileNav).within(() => {
|
||||||
|
cy.get(selector).should('be.visible');
|
||||||
|
cy.get(selector).should('have.text', name);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
cy.get('[data-testid="button-menu-drawer"]').click();
|
||||||
|
cy.viewport(
|
||||||
|
Cypress.config('viewportWidth'),
|
||||||
|
Cypress.config('viewportHeight')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Elements', () => {
|
||||||
|
for (const { name, selector, header, tests } of topLevelLinks) {
|
||||||
|
describe(`${name} page`, () => {
|
||||||
|
it(`navigates to ${name}`, () => {
|
||||||
|
cy.get(navbar).within(() => {
|
||||||
|
cy.log(`goes to ${name}`);
|
||||||
|
cy.get(selector).click();
|
||||||
|
cy.log(`ensures ${name} is highlighted`);
|
||||||
|
cy.get(selector).should('have.attr', 'aria-current');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('displays header', () => {
|
||||||
|
ensureHeader(header || name);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (tests) tests.apply(this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const { name, selector, header, tests } of secondLevelLinks.filter(
|
||||||
|
(l) => !l.trigger
|
||||||
|
)) {
|
||||||
|
describe(`${name} page`, () => {
|
||||||
|
it(`navigates to ${name}`, () => {
|
||||||
|
cy.get(navbar).within(() => {
|
||||||
|
expand();
|
||||||
|
cy.log(`goes to ${name}`);
|
||||||
|
cy.get(selector).click();
|
||||||
|
expand();
|
||||||
|
cy.log(`ensures ${name} is highlighted`);
|
||||||
|
cy.get(selector).should('have.attr', 'aria-current');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('displays header', () => {
|
||||||
|
ensureHeader(header || name);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (tests) tests.apply(this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
after(() => {
|
||||||
|
collapse();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
import {
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
verifyPageHeader,
|
|
||||||
verifyTabHighlighted,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
goToMakeNewProposal,
|
|
||||||
governanceProposalType,
|
|
||||||
} from '../../support/governance.functions';
|
|
||||||
import { mockNetworkUpgradeProposal } from '../../support/proposal.functions';
|
|
||||||
|
|
||||||
const proposalDocumentationLink = '[data-testid="proposal-documentation-link"]';
|
|
||||||
const newProposalLink = '[data-testid="new-proposal-link"]';
|
|
||||||
const governanceDocsUrl = 'https://vega.xyz/governance';
|
|
||||||
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
|
|
||||||
|
|
||||||
context(
|
|
||||||
'Governance Page - verify elements on page',
|
|
||||||
{ tags: '@smoke' },
|
|
||||||
function () {
|
|
||||||
before('navigate to governance page', function () {
|
|
||||||
cy.visit('/');
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have governance tab highlighted', function () {
|
|
||||||
verifyTabHighlighted(navigation.proposals);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have GOVERNANCE header visible', function () {
|
|
||||||
verifyPageHeader('Proposals');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be able to see a working link for - find out more about Vega governance', function () {
|
|
||||||
// 3001-VOTE-001
|
|
||||||
cy.get(proposalDocumentationLink)
|
|
||||||
.should('be.visible')
|
|
||||||
.and('have.text', 'Find out more about Vega governance')
|
|
||||||
.and('have.attr', 'href')
|
|
||||||
.and('equal', governanceDocsUrl);
|
|
||||||
|
|
||||||
// 3002-PROP-001
|
|
||||||
cy.request(governanceDocsUrl)
|
|
||||||
.its('body')
|
|
||||||
.then((body) => {
|
|
||||||
if (!body.includes('Govern the network')) {
|
|
||||||
assert.include(
|
|
||||||
body,
|
|
||||||
'Govern the network',
|
|
||||||
`Checking that governance link destination includes 'Govern the network' text`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be able to see button for - new proposal', function () {
|
|
||||||
// 3001-VOTE-002
|
|
||||||
cy.get(newProposalLink)
|
|
||||||
.should('be.visible')
|
|
||||||
.and('have.text', 'New proposal')
|
|
||||||
.and('have.attr', 'href')
|
|
||||||
.and('equal', '/proposals/propose');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () {
|
|
||||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
|
||||||
cy.get(connectToVegaWalletButton)
|
|
||||||
.should('be.visible')
|
|
||||||
.and('have.text', 'Connect Vega wallet');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should see open network upgrade proposal on homepage', function () {
|
|
||||||
mockNetworkUpgradeProposal();
|
|
||||||
cy.visit('/');
|
|
||||||
cy.getByTestId('home-proposal-list').within(() => {
|
|
||||||
cy.getByTestId('protocol-upgrade-proposals-list-item').should('exist');
|
|
||||||
cy.getByTestId('protocol-upgrade-proposal-title').should(
|
|
||||||
'have.text',
|
|
||||||
'Vega release v1'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should see network upgrade proposals in proposals list', function () {
|
|
||||||
mockNetworkUpgradeProposal();
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
cy.getByTestId('open-proposals').within(() => {
|
|
||||||
cy.get('li')
|
|
||||||
.eq(0)
|
|
||||||
.should(
|
|
||||||
'have.attr',
|
|
||||||
'data-testid',
|
|
||||||
'protocol-upgrade-proposals-list-item'
|
|
||||||
)
|
|
||||||
.within(() => {
|
|
||||||
cy.get('h2').should('have.text', 'Vega release v1');
|
|
||||||
cy.getByTestId('protocol-upgrade-proposal-type').should(
|
|
||||||
'have.text',
|
|
||||||
'Network Upgrade'
|
|
||||||
);
|
|
||||||
cy.getByTestId('protocol-upgrade-proposal-release-tag').should(
|
|
||||||
'have.text',
|
|
||||||
'Vega release tag: v1'
|
|
||||||
);
|
|
||||||
cy.getByTestId('protocol-upgrade-proposal-block-height').should(
|
|
||||||
'have.text',
|
|
||||||
'Upgrade block height: 2015942'
|
|
||||||
);
|
|
||||||
cy.getByTestId('protocol-upgrade-proposal-status').should(
|
|
||||||
'have.text',
|
|
||||||
'Approved '
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
cy.getByTestId('closed-proposals').within(() => {
|
|
||||||
cy.getByTestId('protocol-upgrade-proposals-list-item').should(
|
|
||||||
'have.length',
|
|
||||||
1
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should see details of network upgrade proposal', function () {
|
|
||||||
mockNetworkUpgradeProposal();
|
|
||||||
navigateTo(navigation.proposals);
|
|
||||||
cy.getByTestId('protocol-upgrade-proposals-list-item')
|
|
||||||
.first()
|
|
||||||
.find('[data-testid="view-proposal-btn"]')
|
|
||||||
.click();
|
|
||||||
cy.getByTestId('protocol-upgrade-proposal').within(() => {
|
|
||||||
cy.get('h1').should('have.text', 'Vega Release v1');
|
|
||||||
cy.getByTestId('protocol-upgrade-block-height').should(
|
|
||||||
'have.text',
|
|
||||||
'2015942 (currently 2014133)'
|
|
||||||
);
|
|
||||||
cy.getByTestId('protocol-upgrade-state').should(
|
|
||||||
'have.text',
|
|
||||||
'Approved'
|
|
||||||
);
|
|
||||||
cy.getByTestId('protocol-upgrade-release-tag').should(
|
|
||||||
'have.text',
|
|
||||||
'v1'
|
|
||||||
);
|
|
||||||
cy.getByTestId('protocol-upgrade-approval-status')
|
|
||||||
.should('contain.text', '99.98% approval (% validator voting power)')
|
|
||||||
.and('contain.text', '(67% voting power required)');
|
|
||||||
cy.get('h2').should('contain.text', 'Approvers (4/4 validators)');
|
|
||||||
cy.getByTestId('validator-name')
|
|
||||||
.should('have.length', 4)
|
|
||||||
.each(($validator) => {
|
|
||||||
cy.wrap($validator).find('a').should('have.attr', 'href');
|
|
||||||
});
|
|
||||||
cy.getByTestId('validator-voting-power').each(
|
|
||||||
($validatorVotingPower) => {
|
|
||||||
cy.wrap($validatorVotingPower)
|
|
||||||
.invoke('text')
|
|
||||||
.should('contain', '%');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
+18
-32
@@ -1,61 +1,47 @@
|
|||||||
/// <reference types="cypress" />
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
import {
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
waitForSpinner,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import {
|
|
||||||
enterUniqueFreeFormProposalBody,
|
|
||||||
goToMakeNewProposal,
|
|
||||||
} from '../../support/governance.functions';
|
|
||||||
import { vegaWalletFaucetAssetsWithoutCheck } from '../../support/wallet-vega.functions';
|
|
||||||
|
|
||||||
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey2');
|
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey2');
|
||||||
const vegaPubkeyTruncated = Cypress.env('vegaWalletPublicKey2Short');
|
const vegaPubkeyTruncated = Cypress.env('vegaWalletPublicKey2Short');
|
||||||
const banner = 'view-banner';
|
const banner = 'view-banner';
|
||||||
|
|
||||||
context('View functionality with public key', { tags: '@smoke' }, function () {
|
context('View functionality with public key', { tags: '@smoke' }, function () {
|
||||||
before('send asset to wallet', function () {
|
before('send asset to wallet', function () {
|
||||||
vegaWalletFaucetAssetsWithoutCheck(
|
cy.vega_wallet_faucet_assets_without_check(
|
||||||
'816af99af60d684502a40824758f6b5377e6af48e50a9ee8ef478ecb879ea8bc',
|
'fUSDC',
|
||||||
'1000000',
|
'1000000',
|
||||||
vegaWalletPubKey
|
vegaWalletPubKey
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach('visit home page', function () {
|
beforeEach('visit home page', function () {
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
waitForSpinner();
|
cy.wait_for_spinner();
|
||||||
cy.connectPublicKey(vegaWalletPubKey);
|
cy.connectPublicKey(vegaWalletPubKey);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Able to connect public key via wallet', function () {
|
||||||
|
verifyConnectedToPubKey();
|
||||||
|
cy.getByTestId('currency-title', Cypress.env('epochTimeout')).should(
|
||||||
|
'contain.text',
|
||||||
|
'USDC (fake)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('Able to connect public key using url', function () {
|
it('Able to connect public key using url', function () {
|
||||||
cy.getByTestId('exit-view').click();
|
cy.getByTestId('exit-view').click();
|
||||||
cy.visit(`/?address=${vegaWalletPubKey}`);
|
cy.visit(`/?address=${vegaWalletPubKey}`);
|
||||||
verifyConnectedToPubKey();
|
verifyConnectedToPubKey();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to connect public key via wallet and view assets in wallet', function () {
|
|
||||||
verifyConnectedToPubKey();
|
|
||||||
cy.getByTestId('currency-title', { timeout: 10000 })
|
|
||||||
.should('have.length.at.least', 4)
|
|
||||||
.and('contain.text', 'USDC (fake)');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Unable to submit proposal with public key', function () {
|
it('Unable to submit proposal with public key', function () {
|
||||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||||
|
|
||||||
navigateTo(navigation.proposals);
|
cy.navigate_to('proposals');
|
||||||
goToMakeNewProposal('Freeform');
|
cy.go_to_make_new_proposal('Freeform');
|
||||||
enterUniqueFreeFormProposalBody('50', 'pub key proposal test');
|
cy.enter_unique_freeform_proposal_body('50', 'pub key proposal test');
|
||||||
cy.getByTestId('dialog-content')
|
cy.getByTestId('dialog-content').within(() => {
|
||||||
.first()
|
cy.get('h1').should('have.text', 'Transaction failed');
|
||||||
.within(() => {
|
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
||||||
cy.get('h1').should('have.text', 'Transaction failed');
|
});
|
||||||
cy.getByTestId('Error').should('have.text', expectedErrorTxt);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Able to disconnect via banner', function () {
|
it('Able to disconnect via banner', function () {
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
import {
|
|
||||||
navigateTo,
|
|
||||||
navigation,
|
|
||||||
verifyPageHeader,
|
|
||||||
} from '../../support/common.functions';
|
|
||||||
import { waitForBeginningOfEpoch } from '../../support/staking.functions';
|
|
||||||
|
|
||||||
const viewToggle = '[data-testid="epoch-reward-view-toggle-total"]';
|
|
||||||
const warning = '[data-testid="callout"]';
|
|
||||||
|
|
||||||
context(
|
|
||||||
'Rewards Page - verify elements on page',
|
|
||||||
{ tags: '@regression' },
|
|
||||||
function () {
|
|
||||||
before('navigate to rewards page', function () {
|
|
||||||
cy.clearLocalStorage();
|
|
||||||
cy.visit('/');
|
|
||||||
navigateTo(navigation.rewards);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('with wallets disconnected', function () {
|
|
||||||
it('should have REWARDS tab highlighted', function () {
|
|
||||||
verifyPageHeader('Rewards and fees');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have rewards header visible', function () {
|
|
||||||
verifyPageHeader('Rewards and fees');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have epoch warning', function () {
|
|
||||||
cy.get(warning)
|
|
||||||
.should('be.visible')
|
|
||||||
.and(
|
|
||||||
'have.text',
|
|
||||||
'Rewards are credited less than a minute after the epoch ends.This delay is set by a network parameter'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have toggle for seeing total vs individual rewards', function () {
|
|
||||||
cy.get(viewToggle).should('be.visible');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Skipping due to bug #3471 causing flaky failuress
|
|
||||||
it.skip('should have option to view go to next and previous page', function () {
|
|
||||||
waitForBeginningOfEpoch();
|
|
||||||
cy.getByTestId('page-info')
|
|
||||||
.should('contain.text', 'Page ')
|
|
||||||
.invoke('text')
|
|
||||||
.then(($currentPage) => {
|
|
||||||
const currentPageNumber = Number($currentPage.slice(5));
|
|
||||||
cy.getByTestId('goto-next-page').click();
|
|
||||||
cy.getByTestId('page-info')
|
|
||||||
.invoke('text')
|
|
||||||
.then(($newPageNumber) => {
|
|
||||||
const newPageNumber = Number($newPageNumber.slice(5));
|
|
||||||
expect(newPageNumber).to.be.greaterThan(currentPageNumber);
|
|
||||||
cy.getByTestId('goto-previous-page').click();
|
|
||||||
cy.getByTestId('page-info').should(
|
|
||||||
'contain.text',
|
|
||||||
$currentPage
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have option to go to last and newest page', function () {
|
|
||||||
waitForBeginningOfEpoch();
|
|
||||||
cy.getByTestId('goto-last-page').click();
|
|
||||||
cy.getByTestId('epoch-total-rewards-table')
|
|
||||||
.last()
|
|
||||||
.find('h2')
|
|
||||||
.first()
|
|
||||||
.should('have.text', 'EPOCH 1');
|
|
||||||
cy.getByTestId('goto-first-page').click();
|
|
||||||
cy.get('h2').should('not.contain.text', 'EPOCH 1');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user