Skip to content

Commit

Permalink
Merge pull request #135 from Agoric/rs-test-invitations
Browse files Browse the repository at this point in the history
Add Tests for Invitation Acceptance, Proposal Submission, and Voting Processes
  • Loading branch information
rabi-siddique authored Oct 8, 2024
2 parents ac03280 + 7525fd9 commit a82872a
Show file tree
Hide file tree
Showing 14 changed files with 725 additions and 93 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/e2e_invitation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: E2E tests for Invitation

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 0 * * *'

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label ||
github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
e2e:
runs-on: ubuntu-latest

permissions:
contents: 'read'
id-token: 'write'

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Start agd
run: docker compose -f tests/e2e/docker-compose-invitation.yml --profile agd up -d

- name: Wait for enough blocks
run: sleep 120

- name: Setup committee and charter
run: docker exec -i agoric_chain bash setup-committee.sh

- name: Run e2e tests
run: |
docker compose -f tests/e2e/docker-compose-invitation.yml --profile $SYNPRESS_PROFILE up --build --exit-code-from synpress
env:
# conditionals based on github event
SYNPRESS_PROFILE: 'synpress'
CYPRESS_AGORIC_NET: 'local'
# for docker-compose.yml
A3P_IMAGE_TAG: ${{ inputs.a3p_image_tag || 'latest' }}
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1
DOCKER_DEFAULT_PLATFORM: linux/amd64
NGROK_AUTH: ${{ secrets.NGROK_AUTH }}
NGROK_BASIC_AUTH: ${{ secrets.NGROK_BASIC_AUTH }}
CYPRESS_PRIVATE_KEY_WITH_FUNDS: ${{ secrets.CYPRESS_PRIVATE_KEY_WITH_FUNDS }}
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
GH_PAT: ${{ secrets.GH_PAT }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
# cypress dashboard
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
COMMIT_INFO_SHA: ${{ github.event.pull_request.head.sha }}

- name: Archive e2e artifacts locally
uses: actions/upload-artifact@v3
with:
name: e2e-artifacts
path: |
tests/e2e/docker/videos
tests/e2e/docker/screenshots
continue-on-error: true

- name: Notify About Failure
if: >
failure() && github.event_name != 'pull_request' &&
github.repository_owner == 'agoric'
uses: ./.github/actions/notify-status
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
continue-on-error: true
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
yarn.lock
tests/e2e/scripts

# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"postinstall": "patch-package",
"test": "vitest",
"coverage": "vitest run --coverage",
"test:e2e": "EXTENSION=keplr SKIP_EXTENSION_SETUP=true synpress run --configFile=tests/e2e/synpress.config.cjs",
"test:e2e:ci": "start-server-and-test 'yarn dev' http-get://localhost:5173 'yarn test:e2e'"
"test:e2e": "EXTENSION=keplr SKIP_EXTENSION_SETUP=true synpress run --configFile=tests/e2e/synpress.config.cjs"
},
"dependencies": {
"@agoric/casting": "^0.4.2",
Expand Down Expand Up @@ -72,7 +71,6 @@
"patch-package": "^6.5.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.7.1",
"start-server-and-test": "^2.0.3",
"typescript": "^4.9.3",
"vite": "^3.2.7",
"vite-tsconfig-paths": "^3.5.1",
Expand Down
21 changes: 21 additions & 0 deletions tests/e2e/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# UNTIL https:/Agoric/dapp-econ-gov/issues/138
FROM ghcr.io/agoric/agoric-3-proposals:latest

RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/*

ENV PATH="/usr/src/agoric-sdk/packages/agoric-cli/bin:${PATH}"

WORKDIR /setup-committee

RUN mkdir -p /setup-committee/scripts

COPY scripts/replace-committee-A3P_INTEGRATION-permit.json /setup-committee/
COPY scripts/replace-committee-A3P_INTEGRATION.js /setup-committee/
COPY scripts/b1-2197fbaf5b94e79dd80546b3ce6aab47e52679667668ad1af614869aeb0bbadc529b34acfc01c37ae6cc5cd328d6aaf59f7818bcf15dc315405f7bda3a4d3472.json /setup-committee/
COPY scripts/b1-f9881996d17ce444c7fa34f3a8ea20ecbec403344b83a805b91f35f06bb65bd7c09519d9bc1560d5e55aed0fca547a5f3851234c45720b85c11c9143a48364e7.json /setup-committee/
COPY scripts/setup-committee.sh /setup-committee/
COPY scripts/run-chain.sh /setup-committee/

EXPOSE 26657 1317 9090

ENTRYPOINT ["/setup-committee/run-chain.sh"]
132 changes: 132 additions & 0 deletions tests/e2e/docker-compose-invitation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
version: '3.9'

services:
synpress:
profiles:
- synpress
- daily-tests
container_name: synpress
build: ../..
environment:
- DISPLAY=display:0.0
- CYPRESS_PRIVATE_KEY_WITH_FUNDS=${CYPRESS_PRIVATE_KEY_WITH_FUNDS}
- DEBUG=${DEBUG}
- CYPRESS_DOCKER_RUN=true
- GH_PAT=${GH_PAT}
- GH_USERNAME=${GH_USERNAME}
- CI=${CI}
# cypress dashboard
- CYPRESS_GROUP=${CYPRESS_GROUP}
- GITHUB_TOKEN=${GITHUB_TOKEN}
- CYPRESS_PROJECT_ID=${CYPRESS_PROJECT_ID}
- CYPRESS_RECORD_KEY=${CYPRESS_RECORD_KEY}
- COMMIT_INFO_MESSAGE=${COMMIT_INFO_MESSAGE}
- COMMIT_INFO_SHA=${COMMIT_INFO_SHA}
# passing required CI variables
- GITHUB_ACTIONS=${GITHUB_ACTIONS}
- GITHUB_WORKFLOW=${GITHUB_WORKFLOW}
- GITHUB_ACTION=${GITHUB_ACTION}
- GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME}
- GITHUB_RUN_ID=${GITHUB_RUN_ID}
- GITHUB_RUN_ATTEMPT=${GITHUB_RUN_ATTEMPT}
- GITHUB_REPOSITORY=${GITHUB_REPOSITORY}
- GH_BRANCH=${GH_BRANCH}
- GITHUB_SHA=${GITHUB_SHA}
- GITHUB_REF=${GITHUB_REF}
- GITHUB_BASE_REF=${GITHUB_BASE_REF}
- GITHUB_HEAD_REF=${GITHUB_HEAD_REF}
# Variables for dapp-psm
- CYPRESS_AGORIC_NET=${CYPRESS_AGORIC_NET}
- SECRET_WORDS="orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology"
depends_on:
- display
- video
entrypoint: []
working_dir: /app
volumes:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c '
echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " &&
pnpm wait-on http://display:8080 &&
echo -n "======> remote noVNC URL: " &&
curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url &&
if [ "$CYPRESS_AGORIC_NET" == "local" ]; then
nginx
fi &&
yarn dev & sleep 5 &&
yarn test:e2e --spec tests/e2e/specs/invitation.spec.js
'
networks:
- x11

display:
profiles:
- synpress
- daily-tests
container_name: display
image: synthetixio/display:016121eafdfff448414894d0ca5a50b1d72b62eb-base
environment:
- RUN_XTERM=no
- DISPLAY_WIDTH=1920
- DISPLAY_HEIGHT=1080
ports:
- '8080:8080'
networks:
- x11

ngrok:
profiles:
- ngrok
container_name: ngrok
image: synthetixio/ngrok:016121eafdfff448414894d0ca5a50b1d72b62eb-base
ports:
- '4040:4040'
command: ['ngrok', 'http', 'display:8080', '--authtoken', '${NGROK_AUTH}']
environment:
- NGROK_AUTH=${NGROK_AUTH}
- NGROK_BASIC_AUTH=${NGROK_BASIC_AUTH}
depends_on:
- display
networks:
- x11

video:
profiles:
- synpress
- daily-tests
container_name: video
image: synthetixio/video:457bb48776c3b14de232d9dda620ba9188dc40ac-base
volumes:
- ./docker/videos:/videos
environment:
- FILE_NAME=CI-full-video.mp4
- SE_SCREEN_WIDTH=1920
- SE_SCREEN_HEIGHT=1080
depends_on:
- display
networks:
- x11
# UNTIL https:/Agoric/dapp-econ-gov/issues/138
agd:
profiles:
- agd
container_name: agoric_chain
build:
context: .
logging:
driver: none
platform: linux/amd64
ports:
- '26656:26656'
- '26657:26657'
- '1317:1317'
environment:
DEST: 1
DEBUG: 'SwingSet:ls,SwingSet:vat'
networks:
- x11

networks:
x11:
12 changes: 11 additions & 1 deletion tests/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ services:
- ./docker/videos:/app/tests/e2e/videos
- ./docker/screenshots:/app/tests/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && if [ "$CYPRESS_AGORIC_NET" == "local" ]; then nginx; fi && yarn test:e2e:ci'
bash -c '
echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " &&
pnpm wait-on http://display:8080 &&
echo -n "======> remote noVNC URL: " &&
curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url &&
if [ "$CYPRESS_AGORIC_NET" == "local" ]; then
nginx
fi &&
yarn dev & sleep 5 &&
yarn test:e2e --spec tests/e2e/specs/proposal.spec.js
'
networks:
- x11

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions tests/e2e/scripts/replace-committee-A3P_INTEGRATION-permit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"consume": {
"psmKit": true,
"governedContractKits": true,
"chainStorage": true,
"highPrioritySendersManager": true,
"namesByAddressAdmin": true,
"board": true,
"startUpgradable": true,
"agoricNamesAdmin": "makeCoreProposalBehavior",
"vatAdminSvc": "makeCoreProposalBehavior",
"zoe": "makeCoreProposalBehavior"
},
"produce": {
"econCharterKit": true,
"economicCommitteeKit": true,
"economicCommitteeCreatorFacet": true
},
"installation": {
"consume": {
"committee": true,
"binaryVoteCounter": true,
"econCommitteeCharter": true
},
"produce": "makeCoreProposalBehavior"
},
"instance": {
"produce": {
"economicCommittee": true,
"econCommitteeCharter": true
}
},
"evaluateBundleCap": "makeCoreProposalBehavior",
"modules": {
"utils": {
"runModuleBehaviors": "makeCoreProposalBehavior"
}
}
}
Loading

0 comments on commit a82872a

Please sign in to comment.