Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 9 additions & 8 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,31 @@ jobs:

- name: Checkout 🛎️
uses: actions/checkout@v2
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- name: Restore Node Modules
id: cache-restore
uses: actions/cache@v3
with:
cache: npm
node-version: '22.14.0'
cache-dependency-path: 'package-lock.json'
path: |
node_modules
key: node_modules_${{ hashFiles('package-lock.json') }}
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- name: Setup node and npm
uses: actions/setup-node@v3
with:
cache: npm
node-version: '22.14.0'
cache-dependency-path: 'package-lock.json'
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- name: Install npm dependencies
run: 'npm ci --ignore-scripts || npm i --ignore-scripts --force'
shell: bash
env:
NODE_AUTH_TOKEN: ${{ github.token }}
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- name: Awaiting WEB deployment to be ready
uses: UnlyEd/github-action-await-vercel@v1.1.1
Expand All @@ -54,9 +57,11 @@ jobs:
with:
deployment-url: ${{ steps.preview.outputs.preview_url }}
timeout: 600
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- name: Run tests
env:
Expand All @@ -68,11 +73,7 @@ jobs:
GUARDIAN_UI_ALCHEMY_API_KEY: ${{ secrets.GUARDIAN_UI_ALCHEMY_API_KEY }}
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
run: npm run e2e

- name: Sanitize reports before upload
if: ${{ failure() }}
run: |
find ./playwright-report/ -name "*.html" -exec sed -i 's/${{ secrets.[A-Z_]* }}/***/g' {} \;
if: ${{ steps.preview.outputs.deployment_state != 'CANCELED' }}

- uses: actions/upload-artifact@v4
if: ${{ failure() }}
Expand Down
5 changes: 5 additions & 0 deletions e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const walletTitles = {

export const addresses = {
withGNO: '0xb5afcEbCA5C1A55E149b4DDF02B9681541Dd29D6',
genesisAdmin: '0x6Da6B1EfCCb7216078B9004535941b71EeD30b0F',
}

export const genesisAddress = {
Expand All @@ -37,3 +38,7 @@ export const genesisAddress = {
}

export const feeRecipient = '0x16c1dc6d901abed2bac1aece138800e45d762e50'
export const metaVault = '0x15639e82d2072fa510e5d2b5f0db361c823bcad3'

export const minimalAmount = 100000000000000n // 0.0001
export const maxUint256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935n // (2n ** 256n) - 1n
10 changes: 8 additions & 2 deletions e2e/extendTest.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { test as base } from '@guardianui/test'

import {
api,
sdk,
user,
swap,
vault,
queue,
anvil,
wallet,
osToken,
graphql,
rewards,
element,
helpers,
settings,
Expand All @@ -17,12 +20,15 @@ import {


const baseTest = base.extend<E2E.ExtendedTest>({
api,
sdk,
user,
swap,
queue,
vault,
anvil,
wallet,
rewards,
osToken,
graphql,
element,
helpers,
Expand Down
15 changes: 15 additions & 0 deletions e2e/fixtures/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { createMockEstimateGas, MockEstimateGas } from './mockEstimateGas'


export type ApiFixture = {
mockEstimateGas: MockEstimateGas
}

const api: E2E.Fixture<ApiFixture> = async ({ page }, use) => {
await use({
mockEstimateGas: createMockEstimateGas({ page }),
})
}


export default api
33 changes: 33 additions & 0 deletions e2e/fixtures/api/mockEstimateGas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { Route } from '@playwright/test'


type Wrapper = E2E.FixtureMethod<MockEstimateGas, 'page'>

type Unroute = () => Promise<void>

export type MockEstimateGas = () => Promise<Unroute>

export const createMockEstimateGas: Wrapper = ({ page }) => (
async () => {
const handler = async (route: Route) => {
const request = route.request()
const response = await route.fetch()
const json = await response.json()

if (json.error) {
const payload = JSON.parse(request.postData() || '{}')

if (payload.method === 'eth_estimateGas') {
json.error = undefined
json.result = '0x5f62'
}
}

await route.fulfill({ response, json })
}

await page.route(/:8545/, handler)

return () => page.unroute(/:8545/, handler)
}
)
13 changes: 0 additions & 13 deletions e2e/fixtures/graphql/helpers/allocatorMock.ts

This file was deleted.

1 change: 0 additions & 1 deletion e2e/fixtures/graphql/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { default as allocatorMock } from './allocatorMock'
export { default as mockCustomData } from './mockCustomData'
export { default as mockCustomDataOnce } from './mockCustomDataOnce'
30 changes: 0 additions & 30 deletions e2e/fixtures/graphql/index.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,25 @@
import { createMockUserApy, MockUserApy } from './mockUserApy'
import { createMockSwapApy, MockSwapApy } from './mockSwapApy'
import { createMockPosition, MockPosition } from './mockPosition'
import { createMockBoostData, MockBoostData } from './mockBoostData'
import { createMockExitQueue, MockExitQueue } from './mockExitQueue'
import { createMockSwapStats, MockSwapStats } from './mockSwapStats'
import { createMockVaultData, MockVaultData } from './mockVaultData'
import { createMockCustomData, MockCustomData } from './mockCustomData'
import { createMockStakeStats, MockStakeStats } from './mockStakeStats'
import { createMockTransaction, MockTransaction } from './mockTransaction'
import { createMockUserRewards, MockUserRewards } from './mockUserRewards'
import { createWaitForResponse, WaitForResponse } from './waitForResponse'
import { createMockMintTokenApy, MockMintTokenApy } from './mockMintTokenApy'
import { createMockAllocatorsData, MockAllocatorsData } from './mockAllocatorsData'
import { createMockCustomDataOnce, MockCustomDataOnce } from './mockCustomDataOnce'
import { createMockMintTokenBalance, MockMintTokenBalance } from './mockMintTokenBalance'


export type GraphqlFixture = {
mockUserApy: MockUserApy
mockSwapApy: MockSwapApy
mockPosition: MockPosition
mockVaultData:MockVaultData
mockBoostData: MockBoostData
mockExitQueue: MockExitQueue
mockSwapStats: MockSwapStats
mockStakeStats: MockStakeStats
mockCustomData: MockCustomData
mockTransaction: MockTransaction
mockUserRewards: MockUserRewards
waitForResponse: WaitForResponse
mockMintTokenApy: MockMintTokenApy
mockAllocatorsData: MockAllocatorsData
mockCustomDataOnce: MockCustomDataOnce
mockMintTokenBalance: MockMintTokenBalance
}

const graphql: E2E.Fixture<GraphqlFixture> = async ({ page }, use) => {
await use({
mockUserApy: createMockUserApy({ page }),
mockSwapApy: createMockSwapApy({ page }),
mockPosition: createMockPosition({ page }),
mockVaultData: createMockVaultData({ page }),
mockExitQueue: createMockExitQueue({ page }),
mockSwapStats: createMockSwapStats({ page }),
mockBoostData: createMockBoostData({ page }),
mockStakeStats: createMockStakeStats({ page }),
mockCustomData: createMockCustomData({ page }),
waitForResponse: createWaitForResponse({ page }),
mockTransaction: createMockTransaction({ page }),
mockUserRewards: createMockUserRewards({ page }),
mockMintTokenApy: createMockMintTokenApy({ page }),
mockCustomDataOnce: createMockCustomDataOnce({ page }),
mockAllocatorsData: createMockAllocatorsData({ page }),
mockMintTokenBalance: createMockMintTokenBalance({ page }),
Expand Down
53 changes: 0 additions & 53 deletions e2e/fixtures/graphql/mockBoostData.ts

This file was deleted.

50 changes: 0 additions & 50 deletions e2e/fixtures/graphql/mockExitQueue.ts

This file was deleted.

18 changes: 0 additions & 18 deletions e2e/fixtures/graphql/mockMintTokenApy.ts

This file was deleted.

Loading
Loading