Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Deploy 'main' to production #157

Merged
merged 32 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1580289
feat: initial setup for wallet-app test cases
rabi-siddique Mar 12, 2024
db4826e
chore: adding @agoric/synpress
rabi-siddique Mar 13, 2024
7ee5d12
chore: remove frazpress from package.json
rabi-siddique Mar 13, 2024
8aeb1c0
chore: replacing frazpress with @agoric/synpress and updating README.md
rabi-siddique Mar 13, 2024
d0e35c6
feat: setup linting for e2e test cases
rabi-siddique Mar 15, 2024
658e2a3
chore: add screenshots and videos folder in synpress config
rabi-siddique Mar 18, 2024
450f808
refact: modify ReactDOM imports to resolve build issues
rabi-siddique Mar 18, 2024
ca1d4b2
chore: provision the wallet using emerynet
rabi-siddique Mar 18, 2024
a433bba
Merge pull request #143 from Agext-Pakistan/rs-wallet-app-test-cases
samsiegart Mar 19, 2024
c60192c
ci: setting up ci workflow for running e2e tests
rabi-siddique Mar 19, 2024
4e07943
refact: switched from using synthetixio/docker-e2e base image to manu…
rabi-siddique Mar 19, 2024
01b4c9b
chore: remove the video container from docker-compose services
rabi-siddique Mar 19, 2024
ba86720
Merge pull request #144 from rabi-siddique/rs-ci-setup-for-wallet-app
samsiegart Mar 19, 2024
f899dbe
test: check for existence of tokens after connecting with wallet (#145)
rabi-siddique Mar 22, 2024
d65dd9c
test: adding bash script for CLI operations for bidding
rabi-siddique Mar 22, 2024
9f4643d
test: adding e2e tests for placing bids
rabi-siddique Mar 22, 2024
5483728
ci: added daily scheduled run to e2e test workflow (#147)
frazarshad Mar 26, 2024
e455419
ci: configuring agoric-sdk inside the docker container
rabi-siddique Mar 22, 2024
32e8b1e
test: add tests for verifying a bid and cancelling a bid from wallet UI
rabi-siddique Mar 27, 2024
2911e34
test: view auction from the CLI
rabi-siddique Mar 29, 2024
788806b
chore: bump @agoric-synpress to 3.8.1-beta.1
rabi-siddique Mar 28, 2024
9720a3a
test: add keys via agd and improving bidding scripts
rabi-siddique Mar 29, 2024
43a4e3e
chore: resolve merge conflicts
rabi-siddique Mar 29, 2024
6af632b
chore: check IST balance before and after placing bids
rabi-siddique Mar 29, 2024
329da66
added cf-log-fetcher github action to fetch deployment logs (#149)
jkhokhar1 Apr 8, 2024
56a1cf2
feat: add stkatom icon
samsiegart Apr 17, 2024
02b15f6
feat: add stkATOM stOSMO stTIA IBC transfer
samsiegart Apr 17, 2024
e7e6bcd
fix: change explorer from bigdipper to nodesguru
samsiegart Apr 17, 2024
6bfa837
ci: add concurrency configuration to e2e Github Actions workflow
rabi-siddique Mar 30, 2024
e3c8735
chore: remove ses@^0.18.1 and ses@^0.18.4 from yarn.lock
rabi-siddique Apr 18, 2024
a684537
Merge pull request #148 from rabi-siddique/rs-bidding-test-cases
rabi-siddique Apr 18, 2024
8188ec6
build: fix cloudflare memory limit
samsiegart Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/cf-logs-fetcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CF Deployment Logs
on:
issue_comment:
types: [created, edited]
jobs:
fetch_comment_log:
if: ${{ (github.event.issue.pull_request) && (github.event.comment.user.login == 'cloudflare-pages[bot]' ) }}
runs-on: [ubuntu-latest]
steps:

- name: Fetch & Print The Deployment Logs
uses: agoric-labs/cf-logs-fetcher@v1
with:
cf_account_id: "0c4635effffcd7f36d1b9f0425a4367a"
cf_project: "wallet-app"
cf_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}

- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Cloudflare deployment logs are available [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
comment_tag: cflogs
64 changes: 64 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: E2E Tests

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

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 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: |
test/e2e/cypress/videos
test/e2e/cypress/screenshots
continue-on-error: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ packages/ui-components/compiled
packages/ui-components/dist
build
public/wallet


# Synpress directories and files
screenshots
videos
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ghcr.io/agoric/agoric-sdk:latest
# Add the Agoric CLI to the PATH so that 'agops' can be accessed from anywhere in the command line.
ENV PATH="/usr/src/agoric-sdk/packages/agoric-cli/bin:${PATH}"

# Install necessary dependencies
RUN apt-get update \
&& apt-get install -y wget gnupg ca-certificates jq expect xvfb

# Install Chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable

# Setup Wallet App
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"lint:check": "yarn lint",
"lint": "yarn lint:types && yarn lint:eslint",
"lint:types": "tsc -p jsconfig.json",
"lint:eslint": "eslint '**/*.js'"
"lint:eslint": "eslint '**/*.js'",
"test:e2e": "EXTENSION=keplr synpress run --configFile=test/e2e/synpress.config.cjs",
"test:e2e:ci": "yarn build && start-server-and-test 'yarn preview' http-get://localhost:3001 'yarn test:e2e'"
},
"exports": {
"./package.json": "./package.json",
Expand All @@ -33,6 +35,7 @@
"devDependencies": {
"@agoric/eslint-config": "^0.3.21",
"@agoric/eventual-send": "^0.13.27",
"@agoric/synpress": "^3.8.1",
"@endo/eslint-config": "^0.3.9",
"@jessie.js/eslint-plugin": "^0.1.3",
"@material/mwc-dialog": "^0.21.0",
Expand All @@ -58,6 +61,7 @@
"rollup-plugin-summary": "^1.3.0",
"rollup-plugin-terser": "^7.0.2",
"ses": "^1.3.0",
"start-server-and-test": "^2.0.3",
"typescript": "^4.2.3"
},
"eslintConfig": {
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const path = require('path');
const synpressPath = path.join(process.cwd(), '/node_modules/@agoric/synpress');

module.exports = {
extends: `${synpressPath}/.eslintrc.js`,
};
81 changes: 81 additions & 0 deletions test/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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/test/e2e/videos
- ./cypress/screenshots:/app/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 && 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

networks:
x11:
134 changes: 134 additions & 0 deletions test/e2e/specs/test.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/* eslint-disable ui-testing/no-disabled-tests */
describe('Wallet App Test Cases', () => {
context('Test commands', () => {
it(`should connect with Agoric Chain`, () => {
cy.visit('/');

cy.acceptAccess().then((taskCompleted) => {
expect(taskCompleted).to.be.true;
});
});

it('should connect with keplr wallet and succeed in provisioning a new wallet', () => {
cy.visit('/wallet/');

cy.get('input.PrivateSwitchBase-input').click();
cy.contains('Proceed').click();

cy.get('button[aria-label="Settings"]').click();

cy.get('#demo-simple-select').click();
cy.get('li[data-value="testnet"]').click();
cy.contains('button', 'Connect').click();

cy.acceptAccess().then((taskCompleted) => {
expect(taskCompleted).to.be.true;
});

cy.reload();

cy.acceptAccess().then((taskCompleted) => {
expect(taskCompleted).to.be.true;
});

cy.get('span').contains('ATOM').should('exist');
cy.get('span').contains('BLD').should('exist');
});

it('should add keys using agd from the CLI successfully', () => {
cy.exec('bash ./test/e2e/test-scripts/add-keys.sh').then((result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('Keys added successfully');
});
});

it('should place a bid by discount from the CLI successfully', () => {
cy.addNewTokensFound();
cy.getTokenAmount('IST').then((initialTokenValue) => {
cy.exec('bash ./test/e2e/test-scripts/place-bid-by-discount.sh').then(
(result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('Your bid has been accepted');
cy.getTokenAmount('IST').then((tokenValue) => {
expect(tokenValue).to.lessThan(initialTokenValue);
});
},
);
});
});

it('should see an offer placed in the previous test case', () => {
cy.visit('/wallet/');

cy.contains('Offer').should('be.visible');
cy.contains('Give Bid').should('be.visible');
cy.contains('2.00 IST').should('be.visible');
cy.contains('from IST').should('be.visible');
cy.contains('Arguments').should('be.visible');
});

it('should cancel the bid by discount and verify IST balance', () => {
cy.getTokenAmount('IST').then((initialTokenValue) => {
cy.visit('/wallet/');
cy.get('.Controls .MuiChip-root').contains('Exit').click();
cy.acceptAccess().then((taskCompleted) => {
expect(taskCompleted).to.be.true;
});
cy.get('.Body .MuiChip-label')
.contains('Accepted', { timeout: 120000 })
.should('exist');
cy.getTokenAmount('IST').then((tokenValue) => {
expect(tokenValue).to.greaterThan(initialTokenValue);
});
});
});

it('should place a bid by price from the CLI successfully and verify IST balance', () => {
cy.getTokenAmount('IST').then((initialTokenValue) => {
cy.exec('bash ./test/e2e/test-scripts/place-bid-by-price.sh').then(
(result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('Your bid has been accepted');
cy.getTokenAmount('IST').then((tokenValue) => {
expect(tokenValue).to.lessThan(initialTokenValue);
});
},
);
});
});

it('should see an offer placed in the previous test case', () => {
cy.visit('/wallet/');
cy.contains('Offer').should('be.visible');
cy.contains('Give Bid').should('be.visible');
cy.contains('1.00 IST').should('be.visible');
cy.contains('from IST').should('be.visible');
cy.contains('Arguments').should('be.visible');
});

it('should cancel the bid by price and verify IST balance', () => {
cy.getTokenAmount('IST').then((initialTokenValue) => {
cy.visit('/wallet/');
cy.get('.Controls .MuiChip-root').contains('Exit').click();
cy.acceptAccess().then((taskCompleted) => {
expect(taskCompleted).to.be.true;
});
cy.get('.Body .MuiChip-label')
.contains('Accepted', { timeout: 120000 })
.should('exist');
cy.getTokenAmount('IST').then((tokenValue) => {
expect(tokenValue).to.greaterThan(initialTokenValue);
});
});
});

it('should view the auction from the CLI successfully', () => {
cy.exec('bash ./test/e2e/test-scripts/view-auction.sh', {
failOnNonZeroExit: false,
}).then((result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('All required fields are present');
});
});
});
});
14 changes: 14 additions & 0 deletions test/e2e/synpress.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const config = require('@agoric/synpress/synpress.config');
const { defineConfig } = require('cypress');

module.exports = defineConfig({
...config,
e2e: {
...config.e2e,
baseUrl: 'http://localhost:3001',
specPattern: 'test/e2e/specs/**/*spec.{js,jsx,ts,tsx}',
supportFile: 'test/support.js',
screenshotsFolder: 'test/e2e/screenshots',
videosFolder: 'test/e2e/videos'
},
});
Loading
Loading