Skip to content

Commit

Permalink
Merge branch 'dev' into fix_long_token_names_cover_balance
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Sep 23, 2024
2 parents aab69ba + 815cb89 commit 562bef2
Show file tree
Hide file tree
Showing 252 changed files with 7,115 additions and 3,725 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ NEXT_PUBLIC_FIREBASE_VAPID_KEY_PRODUCTION=
NEXT_PUBLIC_FIREBASE_OPTIONS_STAGING=
NEXT_PUBLIC_FIREBASE_VAPID_KEY_STAGING=

# Redefine
NEXT_PUBLIC_REDEFINE_API=
# Blockaid
NEXT_PUBLIC_BLOCKAID_CLIENT_ID

# Social Login
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING=
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ runs:
NEXT_PUBLIC_SAFE_RELAY_SERVICE_URL_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_GELATO_RELAY_SERVICE_URL_PRODUCTION }}
NEXT_PUBLIC_SAFE_RELAY_SERVICE_URL_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SAFE_GELATO_RELAY_SERVICE_URL_STAGING }}
NEXT_PUBLIC_IS_OFFICIAL_HOST: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_IS_OFFICIAL_HOST }}
NEXT_PUBLIC_REDEFINE_API: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_REDEFINE_API }}
NEXT_PUBLIC_BLOCKAID_CLIENT_ID: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_BLOCKAID_CLIENT_ID }}
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_STAGING }}
NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_SOCIAL_WALLET_OPTIONS_PRODUCTION }}
NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION: ${{ fromJSON(inputs.secrets).NEXT_PUBLIC_FIREBASE_OPTIONS_PRODUCTION }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: 'CLA Assistant'
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
# Beta Release
uses: contributor-assistant/[email protected].1
uses: contributor-assistant/[email protected].2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
Expand All @@ -24,7 +24,7 @@ jobs:
# branch should not be protected
branch: 'main'
# user names of users allowed to contribute without CLA
allowlist: lukasschor,rmeissner,germartinez,Uxio0,dasanra,francovenica,tschubotz,luarx,DaniSomoza,iamacook,yagopv,usame-algan,schmanu,DiogoSoaress,JagoFigueroa,fmrsabino,mike10ca,jmealy,compojoom,TanyaEfremova,bot*
allowlist: clovisdasilvaneto,lukasschor,rmeissner,germartinez,Uxio0,dasanra,francovenica,tschubotz,luarx,DaniSomoza,iamacook,yagopv,usame-algan,schmanu,DiogoSoaress,JagoFigueroa,fmrsabino,mike10ca,jmealy,compojoom,TanyaEfremova,bot*

# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
# enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ concurrency:

jobs:
eslint:
permissions:
checks: write
pull-requests: read
statuses: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/yarn

- uses: Maggi64/eslint-plus-action@master
- uses: CatChen/eslint-suggestion-action@v2
with:
npmInstall: false
request-changes: true # optional
fail-check: true # optional
github-token: ${{ secrets.GITHUB_TOKEN }} # optional
directory: './' # optional
targets: 'src' # optional
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/safe-global/safe-wallet-web)
[![GitPOAP Badge](https://public-api.gitpoap.io/v1/repo/safe-global/safe-wallet-web/badge)](https://www.gitpoap.io/gh/safe-global/safe-wallet-web)

The default Safe web interface.
Safe{Wallet} is a smart contract wallet for Ethereum and other EVM chains. Based on Gnosis Safe multisig contracts.

This repository is the frontend of the Safe{Wallet} app.

## Contributing

Expand Down
22 changes: 21 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { defineConfig } from 'cypress'
import 'dotenv/config'
import * as fs from 'fs'

import path, { dirname } from 'path'
import { fileURLToPath } from 'url'
import matter from 'gray-matter'
import { configureVisualRegression } from 'cypress-visual-regression'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig({
projectId: 'exhdra',
trashAssetsBeforeRuns: true,
Expand All @@ -18,6 +22,20 @@ export default defineConfig({
e2e: {
screenshotsFolder: './cypress/snapshots/actual',
setupNodeEvents(on, config) {
// Read and parse the terms Markdown file
try {
const filePath = path.resolve(__dirname, './src/markdown/terms/terms.md')

const content = fs.readFileSync(filePath, 'utf8')
const parsed = matter(content)
const frontmatter = parsed.data

// Set Cookie term version on the cypress env - this way we can access it in the tests
config.env.CURRENT_COOKIE_TERMS_VERSION = frontmatter.version
} catch (error) {
console.error('Error reading or parsing terms.md file:', error)
}

configureVisualRegression(on),
on('task', {
log(message) {
Expand All @@ -34,6 +52,8 @@ export default defineConfig({
}
}
})

return config
},
env: {
...process.env,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/happypath/sendfunds_connected_wallet.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function visit(url) {
describe('Send funds with connected signer happy path tests', { defaultCommandTimeout: 60000 }, () => {
before(async () => {
cy.clearLocalStorage().then(() => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies_1_1, ls.cookies.acceptedCookies)
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies, ls.cookies.acceptedCookies)
main.addToLocalStorage(
constants.localStorageKeys.SAFE_v2__tokenlist_onboarding,
ls.cookies.acceptedTokenListOnboarding,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/happypath/sendfunds_queue_1.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function executeTransactionFlow(fromSafe) {
describe('Send funds from queue happy path tests 1', () => {
before(async () => {
cy.clearLocalStorage().then(() => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies_1_1, ls.cookies.acceptedCookies)
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies, ls.cookies.acceptedCookies)
main.addToLocalStorage(
constants.localStorageKeys.SAFE_v2__tokenlist_onboarding,
ls.cookies.acceptedTokenListOnboarding,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/happypath/sendfunds_relay.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function visit(url) {
describe('Send funds with relay happy path tests', { defaultCommandTimeout: 300000 }, () => {
before(async () => {
cy.clearLocalStorage().then(() => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies_1_1, ls.cookies.acceptedCookies)
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies, ls.cookies.acceptedCookies)
main.addToLocalStorage(
constants.localStorageKeys.SAFE_v2__tokenlist_onboarding,
ls.cookies.acceptedTokenListOnboarding,
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/happypath/tx_history_filter_hp_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let staticSafes = []
describe('Tx history happy path tests 2', () => {
before(async () => {
cy.clearLocalStorage().then(() => {
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies_1_1, ls.cookies.acceptedCookies)
main.addToLocalStorage(constants.localStorageKeys.SAFE_v2_cookies, ls.cookies.acceptedCookies)
main.addToLocalStorage(
constants.localStorageKeys.SAFE_v2__tokenlist_onboarding,
ls.cookies.acceptedTokenListOnboarding,
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/pages/create_tx.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const editBtnStr = 'Edit'
const executionParamsStr = 'Execution parameters'
const noLaterStr = 'No, later'
const signBtnStr = 'Sign'
const confirmBtnStr = 'Confirm'
const expandAllBtnStr = 'Expand all'
const collapseAllBtnStr = 'Collapse all'
export const messageNestedStr = `"nestedString": "Test message 3 off-chain"`
Expand Down Expand Up @@ -484,7 +485,6 @@ export function openExecutionParamsModal() {

export function verifyAndSubmitExecutionParams() {
cy.contains(executionParamsStr).parents('form').as('Paramsform')

const arrayNames = ['Wallet nonce', 'Max priority fee (Gwei)', 'Max fee (Gwei)', 'Gas limit']
arrayNames.forEach((element) => {
cy.get('@Paramsform').find('label').contains(`${element}`).next().find('input').should('not.be.disabled')
Expand All @@ -505,6 +505,10 @@ export function clickOnSignTransactionBtn() {
cy.get('button').contains(signBtnStr).click()
}

export function clickOnConfirmTransactionBtn() {
cy.get('button').contains(confirmBtnStr).click()
}

export function waitForProposeRequest() {
cy.intercept('POST', constants.proposeEndpoint).as('ProposeTx')
cy.wait('@ProposeTx')
Expand Down
8 changes: 7 additions & 1 deletion cypress/e2e/pages/create_wallet.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const choiceBtn = '[data-testid="choice-btn"]'
const addFundsBtn = '[data-testid="add-funds-btn"]'
const createTxBtn = '[data-testid="create-tx-btn"]'
const qrCodeSwitch = '[data-testid="qr-code-switch"]'
export const activateAccountBtn = '[data-testid="activate-account-btn"]'
export const activateAccountBtn = '[data-testid="activate-account-btn-cf"]'
const notificationsSwitch = '[data-testid="notifications-switch"]'
export const addFundsSection = '[data-testid="add-funds-section"]'
export const noTokensAlert = '[data-testid="no-tokens-alert"]'
Expand All @@ -49,8 +49,14 @@ const initialSteps = '0 of 2 steps completed'
export const addSignerStr = 'Add signer'
export const accountRecoveryStr = 'Account recovery'
export const sendTokensStr = 'Send tokens'
const noWalletConnectedMsg = 'No wallet connected'
export const deployWalletStr = 'about to deploy this Safe Account'

const connectWalletBtn = '[data-testid="connect-wallet-btn"]'

export function waitForConnectionMsgDisappear() {
cy.contains(noWalletConnectedMsg).should('not.exist')
}
export function checkNotificationsSwitchIs(status) {
cy.get(notificationsSwitch).find('input').should(`be.${status}`)
}
Expand Down
9 changes: 9 additions & 0 deletions cypress/e2e/pages/main.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,12 @@ export function getIframeBody(iframe) {
export const checkButtonByTextExists = (buttonText) => {
cy.get('button').contains(buttonText).should('exist')
}

export function getAddedSafeAddressFromLocalStorage(chainId, index) {
return cy.window().then((win) => {
const addedSafes = win.localStorage.getItem(constants.localStorageKeys.SAFE_v2__addedSafes)
const addedSafesObj = JSON.parse(addedSafes)
const safeAddress = Object.keys(addedSafesObj[chainId])[index]
return safeAddress
})
}
4 changes: 2 additions & 2 deletions cypress/e2e/pages/navigation.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function clickOnSideNavigation(option) {
cy.get(option).should('exist').click()
}

export function clickOnModalCloseBtn() {
cy.get(modalCloseIcon).eq(0).trigger('click')
export function clickOnModalCloseBtn(index) {
cy.get(modalCloseIcon).eq(index).trigger('click')
}

export function clickOnNewTxBtn() {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/add_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Add Owners tests', () => {
describe('[PROD] Add Owners tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/create_tx.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function happyPathToStepTwo() {
createtx.clickOnNextBtn()
}

describe.skip('Create transactions tests', () => {
describe.skip('[PROD] Create transactions tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/load_safe.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const INVALID_ADDRESS_ERROR_MSG = 'Address given is not a valid Safe address'
const OWNER_ENS_DEFAULT_NAME = 'test20.eth'
const OWNER_ADDRESS = constants.EOA

describe('Load Safe tests', () => {
describe('[PROD] Load Safe tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/messages_onchain.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let staticSafes = []

const typeMessagesOnchain = msg_data.type.onChain

describe('Onchain Messages tests', () => {
describe('[PROD] Onchain Messages tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/nfts.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let nftsSafes,
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe.skip('NFTs tests', () => {
describe.skip('[PROD] NFTs tests', () => {
before(() => {
getSafes(CATEGORIES.nfts)
.then((nfts) => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/recovery.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getSafes, CATEGORIES } from '../../support/safes/safesHandler.js'
let recoverySafes,
staticSafes = []

describe('Production recovery health check tests', { defaultCommandTimeout: 50000 }, () => {
describe('[PROD] Production recovery health check tests', { defaultCommandTimeout: 50000 }, () => {
before(() => {
getSafes(CATEGORIES.recovery)
.then((recoveries) => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/remove_owner.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Remove Owners tests', () => {
describe('[PROD] Remove Owners tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/sidebar.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let staticSafes = []
const walletCredentials = JSON.parse(Cypress.env('CYPRESS_WALLET_CREDENTIALS'))
const signer = walletCredentials.OWNER_4_PRIVATE_KEY

describe('Sidebar tests', () => {
describe('[PROD] Sidebar tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/sidebar_3.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const signer = walletCredentials.OWNER_4_PRIVATE_KEY
const signer1 = walletCredentials.OWNER_1_PRIVATE_KEY
const signer2 = walletCredentials.OWNER_3_PRIVATE_KEY

describe.skip('Sidebar tests 3', () => {
describe.skip('[PROD] Sidebar tests 3', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/spending_limits.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const tokenAmount = 0.1
const newTokenAmount = 0.001
const spendingLimitBalance = '(0.15 ETH)'

describe('Spending limits tests', () => {
describe('[PROD] Spending limits tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/swaps_history_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let staticSafes = []

const swapsHistory = swaps_data.type.history

describe('Swaps history tests 2', () => {
describe('[PROD] Swaps history tests 2', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/swaps_tokens.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const signer = walletCredentials.OWNER_4_PRIVATE_KEY

let iframeSelector = `iframe[src*="${constants.swapWidget}"]`

describe('[SMOKE] Swaps token tests', () => {
describe('[PROD] Swaps token tests', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/prodhealthcheck/tokens.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const FIAT_AMOUNT_COLUMN = 2

let staticSafes = []

describe('Prod tokens tests', () => {
describe('[PROD] Prod tokens tests', () => {
const fiatRegex = assets.fiatRegex

before(async () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/prodhealthcheck/tx_history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const typeDeleteAllowance = data.type.deleteSpendingLimit
const typeSideActions = data.type.sideActions
const typeGeneral = data.type.general

describe('Tx history tests 1', () => {
describe('[PROD] Tx history tests 1', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand All @@ -27,7 +27,7 @@ describe('Tx history tests 1', () => {
constants.stagingCGWSafes
}${staticSafes.SEP_STATIC_SAFE_7.substring(4)}/transactions/history**`,
(req) => {
req.url = `https://safe-client.safe.global/v1/chains/11155111/safes/0x5912f6616c84024cD1aff0D5b55bb36F5180fFdb/transactions/history?timezone_offset=7200000&trusted=false&cursor=limit=100&offset=1`
req.url = `https://safe-client.safe.global/v1/chains/11155111/safes/0x5912f6616c84024cD1aff0D5b55bb36F5180fFdb/transactions/history?timezone=Europe/Berlin&trusted=false&cursor=limit=100&offset=1`
req.continue()
},
).as('allTransactions')
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/prodhealthcheck/tx_history_2.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const typeSideActions = data.type.sideActions
const typeGeneral = data.type.general
const typeUntrustedToken = data.type.untrustedReceivedToken

describe('Tx history tests 2', () => {
describe('[PROD] Tx history tests 2', () => {
before(async () => {
staticSafes = await getSafes(CATEGORIES.static)
})
Expand All @@ -30,7 +30,7 @@ describe('Tx history tests 2', () => {
constants.stagingCGWSafes
}${staticSafes.SEP_STATIC_SAFE_7.substring(4)}/transactions/history**`,
(req) => {
req.url = `https://safe-client.safe.global/v1/chains/11155111/safes/0x5912f6616c84024cD1aff0D5b55bb36F5180fFdb/transactions/history?timezone_offset=7200000&trusted=false&cursor=limit=100&offset=1`
req.url = `https://safe-client.safe.global/v1/chains/11155111/safes/0x5912f6616c84024cD1aff0D5b55bb36F5180fFdb/transactions/history?timezone=Europe/Berlin&trusted=false&cursor=limit=100&offset=1`
req.continue()
},
).as('allTransactions')
Expand Down
Loading

0 comments on commit 562bef2

Please sign in to comment.