Skip to content

Commit

Permalink
chore: bump to latest release of @agoric/synpress
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Apr 5, 2024
1 parent 135a05d commit e8b5f4a
Show file tree
Hide file tree
Showing 10 changed files with 351 additions and 25 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

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

jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run E2E Tests
run: |
docker-compose -f ui/test/e2e/docker-compose.yml --profile agd up --build -d &&
docker-compose -f ui/test/e2e/docker-compose.yml --profile synpress up --build --exit-code-from synpress
env:
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 }}
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: Upload Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-artifacts
path: |
ui/test/e2e/cypress/videos
ui/test/e2e/cypress/screenshots
continue-on-error: true
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM --platform=linux/amd64 synthetixio/docker-e2e:18.16-ubuntu as base

RUN mkdir /app
WORKDIR /app

RUN apt update && apt install -y nginx

COPY ui/test/e2e/nginx.conf /etc/nginx/sites-available/default

COPY . .

RUN yarn install --frozen-lockfile
1 change: 1 addition & 0 deletions contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"docker:make": "docker compose exec agd make -C /workspace/contract",
"make:help": "make list",
"start": "yarn docker:make clean start-contract",
"send-funds": "docker compose exec agd bash /workspace/contract/scripts/send-funds.sh",
"build": "agoric run scripts/build-contract-deployer.js",
"test": "ava --verbose",
"lint": "eslint '**/*.js'",
Expand Down
28 changes: 28 additions & 0 deletions contract/scripts/run-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,31 @@ approveProposals() {
done
}

sendFunds() {
echo "Sending Funds....."
src=agoric1t83za2h5zc5anmkxvfag82qafshr538mvzmnmx
dest=agoric1p2aqakv3ulz4qfy2nut86j9gx0dx0yw09h96md
amt=55535300uist

echo "Sending ISTs"
agd tx bank send $src $dest $amt --keyring-backend=test --chain-id=agoriclocal \
--gas=auto --gas-adjustment=1.2 --yes -b block
echo "ISTs sent successfully"

amt=331000ubld
echo "Sending BLDs"
agd tx bank send $src $dest $amt --keyring-backend=test --chain-id=agoriclocal \
--gas=auto --gas-adjustment=1.2 --yes -b block
echo "BLDs sent successfully"

amt=9ibc/BA313C4A19DFBF943586C0387E6B11286F9E416B4DD27574E6909CABE0E342FA
echo "Sending ATOMs"
agd tx bank send $src $dest $amt --keyring-backend=test --chain-id=agoriclocal \
--gas=auto --gas-adjustment=1.2 --yes -b block
echo "ATOMs sent successfully"

}

# Start the chain in the background
/usr/src/upgrade-test-scripts/start_agd.sh &

Expand All @@ -63,8 +88,11 @@ waitForBlock 2
# Approve any proposals forever in the background.
approveProposals &

sendFunds

make -C /workspace/contract mint100
make -C /workspace/contract lower-bundle-cost
make -C /workspace/contract clean start-contract

# bring back chain process to foreground
wait
6 changes: 6 additions & 0 deletions contract/scripts/send-funds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
src=agoric1t83za2h5zc5anmkxvfag82qafshr538mvzmnmx
dest=agoric1p2aqakv3ulz4qfy2nut86j9gx0dx0yw09h96md
amt=5553530000uist

agd tx bank send $src $dest $amt --keyring-backend=test --chain-id=agoriclocal \
--gas=auto --gas-adjustment=1.2 --yes -b block
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
"build": "yarn workspaces run build"
},
"devDependencies": {
"@agoric/synpress": "^3.8.1-beta.1",
"@agoric/synpress": "^3.8.1",
"eslint-config-turbo": "^1.13.0",
"eslint-plugin-chai-friendly": "^0.7.4",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-testing-library": "^6.2.0",
"eslint-plugin-ui-testing": "^2.0.1"
"eslint-plugin-ui-testing": "^2.0.1",
"start-server-and-test": "^2.0.3"
}
}
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "tsc && vite build",
"test": "vitest spec",
"test:e2e": "EXTENSION=keplr synpress run --configFile=test/e2e/synpress.config.cjs",
"test:e2e:ci": "start-server-and-test 'yarn dev' http-get://localhost:5173 'yarn test:e2e'",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "yarn lint --fix",
"preview": "vite preview"
Expand Down
100 changes: 100 additions & 0 deletions ui/test/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
version: '3.9'

services:
synpress:
profiles:
- synpress
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}
# 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}
- 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
entrypoint: []
working_dir: /app
volumes:
- ./cypress/videos:/app/ui/test/e2e/videos
- ./cypress/screenshots:/app/ui/test/e2e/screenshots
command: >
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && yarn wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && yarn test:e2e:ci'
networks:
- x11

display:
profiles:
- synpress
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

agd:
profiles:
- agd
container_name: agoric_chain
image: ghcr.io/agoric/agoric-3-proposals:latest
platform: linux/amd64
ports:
- 26656:26656
- 26657:26657
- 1317:1317
environment:
DEST: 1
DEBUG: "SwingSet:ls,SwingSet:vat"
volumes:
- ../../..:/workspace
entrypoint: /workspace/contract/scripts/run-chain.sh
networks:
- x11

networks:
x11:
39 changes: 39 additions & 0 deletions ui/test/e2e/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
server {
listen 26656;
server_name localhost;

location / {
proxy_pass http://agoric_chain:26656;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server {
listen 26657;
server_name localhost;

location / {
proxy_pass http://agoric_chain:26657;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}


server {
listen 1317;
server_name localhost;

location / {
proxy_pass http://agoric_chain:1317;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Loading

0 comments on commit e8b5f4a

Please sign in to comment.