Skip to content

Commit

Permalink
feat: anvil cypress CI action
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Apr 29, 2024
1 parent daf442c commit f3e6033
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: test

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

env:
FOUNDRY_PROFILE: ci

jobs:
tests:
name: Cypress tests
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.10.0
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install dependencies
run: yarn install

- name: Start Anvil
run: yarn test:anvil &

- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: yarn run build
start: yarn test:fund, yarn start

env:
SUPABASE_URL: "https://wfzpewmlyiozupulbuur.supabase.co"
SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs"
AMOUNT_IN_ETH: "0.1"
BENEFICIARY_ADDRESS: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
CHAIN_ID: "31337"
FRONTEND_URL: "http://localhost:8080"
PAYMENT_TOKEN_ADDRESS: "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
RPC_PROVIDER_URL: "http://localhost:8545"
UBIQUIBOT_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: ignore
6 changes: 5 additions & 1 deletion cypress/e2e/claim-portal-success.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ describe("Claims Portal Success", () => {

cy.get("#invalidator").should("not.be.visible");

cy.get("#claim-loader").should("be.visible");
cy.get("#claim-loader").should("be.visible").as("loader");

cy.wait(5000); // required for the action to complete

cy.get("@loader").should("not.be.visible");

cy.get("#view-claim").should("be.visible").and("include.text", "View Claim");

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"test:anvil": "tsx cypress/scripts/anvil.ts",
"test:start": "yarn start",
"test:run": "cypress run",
"test:open": "cypress open"
"test:open": "cypress open",
"test:fund": "cast rpc --rpc-url http://127.0.0.1:8545 anvil_impersonateAccount 0xba12222222228d8ba445958a75a0704d566bf2c8 & cast send --rpc-url http://127.0.0.1:8545 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d --unlocked --from 0xba12222222228d8ba445958a75a0704d566bf2c8 'transfer(address,uint256)(bool)' 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 337888400000000000000000 & cast send --rpc-url http://127.0.0.1:8545 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d --unlocked --from 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 'approve(address,uint256)(bool)' 0x000000000022D473030F116dDEE9F6B43aC78BA3 9999999999999991111111119999999999999999 & cast send --rpc-url http://127.0.0.1:8545 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d --unlocked --from 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 'approve(address,uint256)(bool)' 0x000000000022D473030F116dDEE9F6B43aC78BA3 999999999999999111119999999999999999"
},
"keywords": [
"typescript",
Expand Down Expand Up @@ -84,4 +85,4 @@
"@commitlint/config-conventional"
]
}
}
}

0 comments on commit f3e6033

Please sign in to comment.