Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into web3authcoresdk
Browse files Browse the repository at this point in the history
  • Loading branch information
schmanu committed Oct 30, 2023
2 parents abdc544 + 61f0568 commit 1049858
Show file tree
Hide file tree
Showing 132 changed files with 5,650 additions and 628 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ COPY . .

# install deps
RUN yarn install --frozen-lockfile
RUN yarn after-install

ENV NODE_ENV production

Expand Down
9 changes: 0 additions & 9 deletions cypress/e2e/pages/balances.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const hiddenTokenDeselectAllBtn = 'span[data-track="assets: Deselect all hide di
const hiddenTokenIcon = 'svg[data-testid="VisibilityOffOutlinedIcon"]'

const hideTokenDefaultString = 'Hide tokens'
const gotItStr = 'Got it!'
const assetNameSortBtnStr = 'Asset'
const assetBalanceSortBtnStr = 'Balance'
const sendBtnStr = 'Send'
Expand Down Expand Up @@ -184,14 +183,6 @@ export function verifyEachRowHasCheckbox(state) {
})
}

export function acceptSpamWarning() {
cy.get('button').contains(gotItStr).click()
verifySpamWarningNotdisplayed()
}

export function verifySpamWarningNotdisplayed() {
cy.contains(gotItStr).should('not.exist')
}
export function verifyTokensTabIsSelected(option) {
cy.get(`a[aria-selected="${option}"]`).contains('Tokens')
}
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/pages/main.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export function clickOnSideMenuItem(item) {

export function acceptCookies() {
cy.wait(1000)

cy.findAllByText('Got it!')
.should('have.length.at.least', 0)
.each(($el) => $el.click())

cy.get('button')
.contains(acceptSelection)
.should(() => {})
Expand Down
24 changes: 15 additions & 9 deletions cypress/e2e/pages/safeapps.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,28 @@ export function verifyNoAppsTextPresent() {
}

export function pinApp(app, pin = true) {
let str = 'Unpin'
if (!pin) str = 'Pin'
cy.findByLabelText(app)
.click()
.should(($el) => {
const ariaLabel = $el.attr('aria-label')
expect(ariaLabel).to.include(str)
})
cy.findByLabelText(app).click()
cy.wait(200)
cy.findByLabelText(app).should(($el) => {
const ariaLabel = $el.attr('aria-label')
expect(ariaLabel).to.include(pin ? 'Unpin' : 'Pin')
})
}

export function clickOnBookmarkedAppsTab() {
cy.findByText(bookmarkedAppsStr).click()
}

export function verifyAppCount(count) {
cy.findByText(`ALL (${count})`).should('be.visible')
cy.findByText(`All apps (${count})`).should('be.visible')
}

export function verifyCustomAppCount(count) {
cy.findByText(`Custom apps (${count})`).should('be.visible')
}

export function verifyPinnedAppCount(count) {
cy.findByText(`My pinned apps (${count})`).should(count ? 'be.visible' : 'not.exist')
}

export function clickOnCustomAppsTab() {
Expand Down
8 changes: 3 additions & 5 deletions cypress/e2e/safe-apps/apps_list.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@ describe('Safe Apps tests', () => {
safeapps.clearSearchAppInput()
safeapps.pinApp(safeapps.pinWalletConnectStr)
safeapps.pinApp(safeapps.transactionBuilderStr)
safeapps.clickOnBookmarkedAppsTab()
safeapps.verifyAppCount(2)
safeapps.verifyPinnedAppCount(2)
})

it('Verify apps can be unpinned [C56134]', () => {
safeapps.pinApp(safeapps.pinWalletConnectStr)
safeapps.pinApp(safeapps.transactionBuilderStr)
safeapps.pinApp(safeapps.pinWalletConnectStr, false)
safeapps.pinApp(safeapps.transactionBuilderStr, false)
safeapps.clickOnBookmarkedAppsTab()
safeapps.verifyAppCount(0)
safeapps.verifyPinnedAppCount(0)
})

it('Verify there is an error when the app manifest is invalid [C56135]', () => {
Expand All @@ -70,7 +68,7 @@ describe('Safe Apps tests', () => {
safeapps.verifyAppTitle(myCustomAppTitle)
safeapps.acceptTC()
safeapps.clickOnAddBtn()
safeapps.verifyAppCount(1)
safeapps.verifyCustomAppCount(1)
safeapps.verifyAppDescription(myCustomAppDescrAdded)
})
})
2 changes: 0 additions & 2 deletions cypress/e2e/smoke/assets.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('Assets tests', () => {
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
cy.clearLocalStorage()
main.acceptCookies()
balances.acceptSpamWarning()
})

it('Verify that the token tab is selected by default and the table is visible [C56039]', () => {
Expand Down Expand Up @@ -107,7 +106,6 @@ describe('Assets tests', () => {
it('Verify that a tool tip is shown pointing to "Token list" dropdown [C56044]', () => {
//Spam warning message is removed in beforeEach hook
cy.reload()
balances.verifySpamWarningNotdisplayed()
})

it('Verify that Token list dropdown down options show/hide spam tokens [C56045]', () => {
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/smoke/balances.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('Balance tests', () => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies()
balances.acceptSpamWarning()
cy.contains('Assets')
cy.get(balances.balanceSingleRow).should('have.length.lessThan', ASSETS_LENGTH)
balances.selectTokenList(balances.tokenListOptions.allTokens)
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/smoke/balances_pagination.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe('Balance tests', () => {
// Table is loaded
cy.contains('Görli Ether')

cy.contains('button', 'Got it').click()
cy.contains('div', 'Default tokens').click()
cy.wait(100)
cy.contains('div', 'All tokens').click()
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/smoke/batch_tx.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as batch from '../pages/batches.pages'
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as balances from '../pages/balances.pages'

const currentNonce = 3
const funds_first_tx = '0.001'
Expand All @@ -12,7 +11,6 @@ describe('Batch transaction tests', () => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies()
balances.acceptSpamWarning()
})

it('Verify empty batch list can be opened [C56082]', () => {
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/smoke/create_tx.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as createtx from '../../e2e/pages/create_tx.pages'
import * as balances from '../pages/balances.pages'

const sendValue = 0.00002
const currentNonce = 1
Expand All @@ -11,7 +10,6 @@ describe('Create transactions tests', () => {
cy.clearLocalStorage()
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_5)
main.acceptCookies()
balances.acceptSpamWarning()
})

it('Verify a new send token transaction can be created [C56104]', () => {
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/smoke/tx_history.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ describe('Transaction history tests', () => {
cy.clearLocalStorage()
// Go to the test Safe transaction history
cy.visit(constants.transactionsHistoryUrl + constants.SEPOLIA_TEST_SAFE_5)

// So that tests that rely on this feature don't randomly fail
cy.window().then((win) => win.localStorage.setItem('SAFE_v2__AB_human-readable', true))

main.acceptCookies()
})

Expand Down
6 changes: 0 additions & 6 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,4 @@ before(() => {
}
}
})

cy.on('window:before:load', (window) => {
window.localStorage.setItem('SAFE_v2__show_terms', false)
// So that tests that rely on this feature don't randomly fail
window.localStorage.setItem('SAFE_v2__AB_human-readable', true)
})
})
16 changes: 4 additions & 12 deletions jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,7 @@ const customJestConfig = {
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
// Jest does not allow modification of transformIgnorePatterns within createJestConfig, therefore we add one entry after initializing the config
module.exports = async () => {
const jestConfig = await createJestConfig(customJestConfig)()
const existingTransformIgnorePatterns = jestConfig.transformIgnorePatterns.filter(
(pattern) => pattern !== '/node_modules/',
)

return {
...jestConfig,
transformIgnorePatterns: [...existingTransformIgnorePatterns, '/node_modules/(?!(@web3-onboard/common)/)'],
}
}
module.exports = async () => ({
...(await createJestConfig(customJestConfig)()),
transformIgnorePatterns: ['node_modules/(?!(uint8arrays|multiformats|@web3-onboard/common)/)'],
})
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"homepage": "https://github.com/safe-global/safe-wallet-web",
"license": "GPL-3.0",
"type": "module",
"version": "1.19.1",
"version": "1.20.0",
"scripts": {
"dev": "next dev",
"start": "next dev",
Expand Down Expand Up @@ -58,6 +58,8 @@
"@sentry/tracing": "^7.74.0",
"@tkey-mpc/common-types": "^8.2.2",
"@truffle/hdwallet-provider": "^2.1.4",
"@walletconnect/utils": "^2.10.2",
"@walletconnect/web3wallet": "^1.9.2",
"@web3-onboard/coinbase": "^2.2.6",
"@web3-onboard/core": "^2.21.2",
"@web3-onboard/injected-wallets": "^2.10.7",
Expand Down Expand Up @@ -114,6 +116,7 @@
"@types/react-qr-reader": "^2.1.5",
"@types/semver": "^7.3.10",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@walletconnect/types": "^2.10.1",
"cross-env": "^7.0.3",
"cypress": "^12.15.0",
"cypress-file-upload": "^5.0.8",
Expand Down
13 changes: 10 additions & 3 deletions public/images/common/batch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions public/images/common/connection-dots.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/common/nft-zapper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/images/common/notifications.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/images/common/question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/images/common/walletconnect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions public/images/notifications/bell.svg

This file was deleted.

14 changes: 11 additions & 3 deletions src/components/batch/BatchIndicator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,17 @@ const BatchIndicator = ({ onClick }: { onClick?: () => void }) => {
return (
<BatchTooltip>
<Track {...BATCH_EVENTS.BATCH_SIDEBAR_OPEN} label={length}>
<ButtonBase onClick={onClick} sx={{ p: 0.5 }} title="Batch">
<Badge variant="standard" color="secondary" badgeContent={length}>
<SvgIcon component={BatchIcon} inheritViewBox fontSize="small" />
<ButtonBase title="Batch" onClick={onClick} sx={{ p: 2 }}>
<Badge
variant="standard"
badgeContent={length}
color={'secondary'}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'right',
}}
>
<SvgIcon component={BatchIcon} inheritViewBox fontSize="medium" />
</Badge>
</ButtonBase>
</Track>
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/AddressInput/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ describe('AddressInput tests', () => {

const { input } = setup(`${mockChain.shortName}:${TEST_ADDRESS_A}`)

act(() => {
await act(() => {
fireEvent.change(input, { target: { value: `${mockChain.shortName}:${TEST_ADDRESS_B}` } })
return Promise.resolve()
})

await waitFor(() => expect(input.previousElementSibling?.textContent).toBe(''))
Expand Down
6 changes: 5 additions & 1 deletion src/components/common/ConnectWallet/AccountCenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export const AccountCenter = ({ wallet }: { wallet: ConnectedWallet }) => {
vertical: 'top',
horizontal: 'center',
}}
sx={{ marginTop: 1 }}
sx={{
'& > .MuiPaper-root': {
top: 'var(--header-height) !important',
},
}}
>
<Paper className={css.popoverContainer}>
<WalletInfo wallet={wallet} handleClose={closeWalletInfo} />
Expand Down
Loading

0 comments on commit 1049858

Please sign in to comment.