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

test: bump Synpress to v4 #2262

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f192283
build: bump to synpress v4
fionnachan Feb 11, 2025
323f77d
yarn.lock
fionnachan Feb 11, 2025
7527148
Merge remote-tracking branch 'origin/master' into synpress-v4
fionnachan Feb 11, 2025
eac8ec0
remove ts-node
fionnachan Feb 11, 2025
87ce240
set up synpress
fionnachan Feb 11, 2025
cfaa94b
use env-cmd
fionnachan Feb 11, 2025
39cabda
update prettier
fionnachan Feb 11, 2025
9667a97
Merge remote-tracking branch 'origin/master' into synpress-v4
fionnachan Feb 12, 2025
ccd652a
change postcss.config.js to ts
fionnachan Feb 12, 2025
99f64aa
fix prettier config file
fionnachan Feb 12, 2025
00d98fc
add tailwind config to prettier
fionnachan Feb 12, 2025
5526001
change method names
fionnachan Feb 12, 2025
0058b4b
prettier again
fionnachan Feb 13, 2025
aa38705
additional.d.ts
fionnachan Feb 13, 2025
9cd34f7
fix additional.d.ts
fionnachan Feb 13, 2025
24bc0b7
jest config file
fionnachan Feb 13, 2025
d622440
make wallet cache work
fionnachan Feb 13, 2025
93d7b8d
edit command
fionnachan Feb 13, 2025
fab0e59
fix eslint
fionnachan Feb 14, 2025
13d3c89
setup mm wallet
fionnachan Feb 14, 2025
8b008a1
change package structure and types
fionnachan Feb 17, 2025
0f45e09
Merge remote-tracking branch 'origin/master' into synpress-v4
fionnachan Feb 17, 2025
23b76b7
set up wallet in support file
fionnachan Feb 17, 2025
1e6df3c
move sample file
fionnachan Feb 17, 2025
af9f552
remove install chrome
fionnachan Feb 17, 2025
2f54b80
Merge remote-tracking branch 'origin/master' into synpress-v4
fionnachan Feb 28, 2025
8444c92
update synpress
fionnachan Feb 28, 2025
b13a10e
yarn.lock
fionnachan Mar 3, 2025
4cd8796
Merge branch 'master' into synpress-v4
fionnachan Mar 3, 2025
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
13 changes: 8 additions & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
node_modules
dist
synpress.config.ts
cypress.config.ts
cypress.cctp.config.ts
tailwind.config.js
additional.d.ts
jest.config.ts
postcss.config.js

packages/arb-token-bridge/craco.config.js
packages/arb-token-bridge/prettier.config.js
packages/arb-token-bridge/build/static/js/*.js
packages/arb-token-bridge/tests/**/*.ts
packages/arb-token-bridge-ui/prettier.config.js
packages/arb-token-bridge-ui/build/static/js/*.js
packages/arb-token-bridge-ui/tests/**/*.ts
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ module.exports = {
"plugin:jest/recommended",
"next",
],
overrides: [
{
files: ["*.config.js"],
env: {
node: true,
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.eslint.json", "./packages/*/tsconfig.json"],
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ yarn-error.log
.DS_Store
tsconfig.tsbuildinfo
__auto-generated-denylist.json

.cache-synpress
**/downloads
**/cypress/screenshots
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
**/dist
.github/
**/src/styles/
**/.cache-synpress
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
"prettier:format": "./node_modules/.bin/prettier --write .",
"lint": "yarn workspace arb-token-bridge-ui lint",
"lint:fix": "yarn workspace arb-token-bridge-ui lint:fix",
"postinstall": "yarn install:chromium",
"install:chromium": "npx @puppeteer/browsers install chrome@$npm_package_config_chromeVersion --path $npm_package_config_chromePath",
"test:e2e": "yarn workspace arb-token-bridge-ui env-cmd --silent --file .e2e.env yarn synpress run --configFile synpress.config.ts",
"test:e2e:cctp": "yarn test:e2e --configFile synpress.cctp.config.ts",
"test:e2e:build-wallet-cache": "yarn workspace arb-token-bridge-e2e synpress ./wallet-setup/",
"test:e2e": "yarn workspace arb-token-bridge-e2e env-cmd --silent --file .e2e.env yarn cypress run --headed --browser chrome",
"test:e2e:cctp": "yarn test:e2e --config cypress.cctp.config.ts",
"test:e2e:orbit": "E2E_ORBIT=true yarn test:e2e",
"test:e2e:orbit:custom-gas-token": "E2E_ORBIT_CUSTOM_GAS_TOKEN=true yarn test:e2e"
},
Expand All @@ -35,7 +34,8 @@
"keywords": [],
"author": "",
"workspaces": [
"packages/*"
"packages/*",
"packages/arb-token-bridge-ui/tests"
],
"devDependencies": {
"audit-ci": "^6.3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { BigNumber, Contract, Wallet, utils } from 'ethers'
import { defineConfig } from 'cypress'
import { Provider, StaticJsonRpcProvider } from '@ethersproject/providers'
import synpressPlugins from '@synthetixio/synpress/plugins'
import logsPrinter from 'cypress-terminal-report/src/installLogsPrinter'
import { configureSynpressForMetaMask } from '@synthetixio/synpress/cypress'

import { getCommonSynpressConfig } from './tests/e2e/getCommonSynpressConfig'
import {
setupCypressTasks,
Expand Down Expand Up @@ -237,13 +238,20 @@ export default defineConfig({
await createCctpTx('deposit', customAddress as Address, '0.00013')
}

configureSynpressForMetaMask(on, config)
setupCypressTasks(on, { requiresNetworkSetup: false })
synpressPlugins(on, config)

config.browsers = [
{
...browserConfig,
family: 'chromium' // type issue if not added here
}
]

return config
},
baseUrl: 'http://localhost:3000',
specPattern: tests,
supportFile: 'tests/support/index.ts',
browsers: [browserConfig]
supportFile: 'tests/support/e2e.ts'
}
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const nextJest = require('next/jest')
import nextJest from 'next/jest'

const createJestConfig = nextJest({
dir: './'
Expand Down
13 changes: 6 additions & 7 deletions packages/arb-token-bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
"lint": "tsc && eslint 'src/**/*.{js,ts,tsx}'",
"lint:fix": "tsc && eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
"prettier:format": "prettier --config-precedence file-override --write \"src/**/*.{tsx,ts,scss,md,json}\"",
"generateDenylist": "ts-node --project ./scripts/tsconfig.json ./scripts/generateDenylist.ts",
"generateOpenGraphImages": "ts-node --project ./scripts/tsconfig.json ./src/generateOpenGraphImages.tsx",
"generateCoreChainsToMonitor": "ts-node --project ./scripts/tsconfig.json ./scripts/generateCoreChainsToMonitor.ts",
"generateOrbitChainsToMonitor": "ts-node --project ./scripts/tsconfig.json ./scripts/generateOrbitChainsToMonitor.ts"
"generateDenylist": "env-cmd --silent --file .env tsx ./scripts/generateDenylist.ts",
"generateOpenGraphImages": "env-cmd --silent --file .env tsx ./scripts/generateOpenGraphImages.tsx",
"generateCoreChainsToMonitor": "env-cmd --silent --file .env tsx ./scripts/generateCoreChainsToMonitor.ts",
"generateOrbitChainsToMonitor": "env-cmd --silent --file .env tsx ./scripts/generateOrbitChainsToMonitor.ts"
},
"browserslist": {
"production": [
Expand All @@ -83,11 +83,10 @@
},
"devDependencies": {
"@next/eslint-plugin-next": "^13.1.5",
"@synthetixio/synpress": "3.7.3",
"@testing-library/react": "^16.1.0",
"@types/jest": "^29.5.1",
"@types/lodash-es": "^4.17.6",
"@types/node": "^16.6.1",
"@types/node": "^22.13.1",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@types/react-syntax-highlighter": "^15.5.13",
Expand All @@ -96,7 +95,6 @@
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^6.13.2",
"autoprefixer": "^10.4.13",
"cypress-terminal-report": "^5.3.10",
"env-cmd": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-next": "^14.0.3",
Expand All @@ -119,6 +117,7 @@
"start-server-and-test": "^2.0.9",
"tailwindcss": "^3.4.16",
"ts-node": "^10.9.2",
"tsx": "^4.19.2",
"typescript": "^5.2.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ import React from 'react'
import satori, { Font } from 'satori'
import sharp from 'sharp'
import fs from 'fs'
import path from 'path'
import dotenv from 'dotenv'

// this has to be called before import from "networks.ts"
// to ensure that the environment variables are loaded
dotenv.config({ path: path.resolve(__dirname, '../.env') })

import { isNetwork } from './util/networks'
import { ChainId } from './types/ChainId'
import { getBridgeUiConfigForChain } from './util/bridgeUiConfig'
import { orbitMainnets, orbitTestnets } from './util/orbitChainsList'
import { ChainId } from '../src/types/ChainId.js'
import { getBridgeUiConfigForChain } from '../src/util/bridgeUiConfig.js'
import { orbitMainnets, orbitTestnets } from '../src/util/orbitChainsList.js'
import { isNetwork } from '../src/util/networks.js'

const dimensions = {
width: 1200,
Expand Down
16 changes: 1 addition & 15 deletions packages/arb-token-bridge-ui/scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
{
// This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases
"extends": "ts-node/node16/tsconfig.json",
// Most ts-node options can be specified here using their programmatic names.
"ts-node": {
// It is faster to skip typechecking.
// Remove if you want ts-node to do typechecking.
"transpileOnly": true,
"files": true,
"compilerOptions": {
// compilerOptions specified here will override those declared below,
// but *only* in ts-node. Useful if you want ts-node and tsc to use
// different options with a single tsconfig.json.
}
},
"compilerOptions": {
// typescript options here
"module": "NodeNext",
"moduleResolution": "NodeNext",
"jsx": "react"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/components/TopNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTransactionReminderInfo } from './TransactionHistory/useTransactionR
function StyledTab({ children, ...props }: PropsWithChildren) {
return (
<Tab
className="flex h-full items-center justify-center gap-2 rounded p-1 text-lg ui-selected:bg-black/75"
className="ui-selected:bg-black/75 flex h-full items-center justify-center gap-2 rounded p-1 text-lg"
{...props}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function PendingDepositWarning() {
page until the transaction succeeds.
</p>
</div>
<ChevronRightIcon className="ml-auto h-3 w-3 shrink-0 ui-open:rotate-90 ui-open:transform" />
<ChevronRightIcon className="ui-open:rotate-90 ui-open:transform ml-auto h-3 w-3 shrink-0" />
</Disclosure.Button>
<Disclosure.Panel className="flex flex-col gap-2 pl-4">
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export function HeaderAccountPopover({
'ui-open:bg-white/20 ui-not-open:bg-transparent ui-not-open:hover:bg-white/20',
'sm:w-max sm:rounded sm:border sm:px-2 sm:py-1',
isTestnet
? 'sm:border-white sm:ui-not-open:bg-white/20'
: 'sm:border-gray-1 sm:ui-not-open:bg-gray-1 sm:ui-not-open:hover:bg-white/10'
? 'sm:ui-not-open:bg-white/20 sm:border-white'
: 'sm:ui-not-open:bg-gray-1 sm:ui-not-open:hover:bg-white/10 sm:border-gray-1'
)}
style={destinationChainStyle}
role="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const Switch = ({
checked={checked}
onChange={onChange}
className={twMerge(
'relative inline-flex h-3 w-7 items-center rounded-full transition-colors ui-checked:bg-white ui-not-checked:bg-white/50 [&:disabled]:cursor-not-allowed',
'duration-200 [&_span]:bg-black [&_span]:ui-checked:translate-x-[22px] [&_span]:ui-not-checked:translate-x-[3px] [&~*]:ui-checked:text-white',
'ui-checked:bg-white ui-not-checked:bg-white/50 relative inline-flex h-3 w-7 items-center rounded-full transition-colors [&:disabled]:cursor-not-allowed',
'[&_span]:ui-checked:translate-x-[22px] [&_span]:ui-not-checked:translate-x-[3px] [&~*]:ui-checked:text-white duration-200 [&_span]:bg-black',
className
)}
disabled={disabled}
Expand Down
3 changes: 0 additions & 3 deletions packages/arb-token-bridge-ui/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export const ORBIT_QUICKSTART_LINK =
export const CCTP_DOCUMENTATION =
'https://www.circle.com/en/cross-chain-transfer-protocol'

export const MULTICALL_TESTNET_ADDRESS =
'0xcA11bde05977b3631167028862bE2a173976CA11'

export const ETHER_TOKEN_LOGO = '/images/EthereumLogoRound.svg'

export const ether = { name: 'Ether', symbol: 'ETH', decimals: 18 } as const
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/util/TokenListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import CoinGeckoLogo from '@/images/lists/coinGecko.svg'
import ArbitrumLogo from '@/images/lists/ArbitrumLogo.png'
import { ArbTokenBridge } from '../hooks/arbTokenBridge.types'
import { ChainId } from '../types/ChainId'
import orbitChainsData from './orbitChainsData.json'
import orbitChainsData from './orbitChainsData.json' assert { type: 'json' }

export const SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID =
'SPECIAL_ARBITRUM_TOKEN_TOKEN_LIST_ID'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArbitrumNetwork } from '@arbitrum/sdk'
import { type ArbitrumNetwork } from '@arbitrum/sdk'

import { ChainId } from '../types/ChainId'

Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/util/orbitChainsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NativeCurrencyBase } from '../hooks/useNativeCurrency'
import { ChainId } from '../types/ChainId'
import { isE2eTestingEnvironment } from './CommonUtils'
import { ChainWithRpcUrl } from './networks'
import orbitChainsData from './orbitChainsData.json'
import orbitChainsData from './orbitChainsData.json' assert { type: 'json' }

export type NetworkType =
| 'Ethereum'
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
'./src/**/*.{js,ts,jsx,tsx}',
'../../node_modules/@offchainlabs/cobalt/**/*.{js,ts,jsx,tsx}'
],
plugins: [require('@headlessui/tailwindcss')],
plugins: ['@headlessui/tailwindcss'],
theme: {
extend: {
backgroundImage: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ PRIVATE_KEY_CUSTOM=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520

PRIVATE_KEY_CCTP=

# We set up MetaMask ourselves
SKIP_METAMASK_SETUP=true

# Private key of the user wallet with enough deposits and withdrawals on Sepolia to pass the tx history tests
# Also funded by E2E_PRIVATE_KEY wallet and used for all the tests
PRIVATE_KEY_USER=c791f745783e3545f83e7b4f0adcc0c2f591c5c8bc796e042c639824ec5d7bf0
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {
import { formatUnits, parseUnits } from 'ethers/lib/utils'
import { defineConfig } from 'cypress'
import { StaticJsonRpcProvider } from '@ethersproject/providers'
import synpressPlugins from '@synthetixio/synpress/plugins'
import { configureSynpressForMetaMask } from '@synthetixio/synpress/cypress'
import { TestERC20__factory } from '@arbitrum/sdk/dist/lib/abi/factories/TestERC20__factory'
import { TestWETH9__factory } from '@arbitrum/sdk/dist/lib/abi/factories/TestWETH9__factory'
import { Erc20Bridger, EthBridger } from '@arbitrum/sdk'
import logsPrinter from 'cypress-terminal-report/src/installLogsPrinter'
import { getL2ERC20Address } from './src/util/TokenUtils'
import specFiles from './tests/e2e/specfiles.json'
import { contractAbi, contractByteCode } from './testErc20Token'
import { getL2ERC20Address } from './support/helpers'
import specFiles from './e2e/specfiles.json' assert { type: 'json' }
import { contractAbi, contractByteCode } from './support/testErc20Token'
import {
checkForAssertions,
generateActivityOnChains,
Expand All @@ -27,16 +27,15 @@ import {
ERC20TokenDecimals,
ERC20TokenName,
getNativeTokenDecimals
} from './tests/support/common'
} from './support/common'

import { registerLocalNetwork } from './src/util/networks'
import { registerLocalNetwork } from './support/helpers'
import {
defaultL2Network,
defaultL3Network,
defaultL3CustomGasTokenNetwork
} from './src/util/networksNitroTestnode'
import { getCommonSynpressConfig } from './tests/e2e/getCommonSynpressConfig'
import { browserConfig } from './tests/e2e/browser.config'
} from './support/networksNitroTestnode'
import { getCommonSynpressConfig } from './e2e/getCommonSynpressConfig'

const tests = process.env.TEST_FILE
? [process.env.TEST_FILE]
Expand Down Expand Up @@ -204,7 +203,6 @@ export default defineConfig({
config.env.PRIVATE_KEY = userWallet.privateKey
config.env.INFURA_KEY = process.env.NEXT_PUBLIC_INFURA_KEY
config.env.ERC20_TOKEN_ADDRESS_PARENT_CHAIN = l1ERC20Token.address
config.env.LOCAL_WALLET_PRIVATE_KEY = localWallet.privateKey
config.env.ORBIT_TEST = isOrbitTest ? '1' : '0'
config.env.NATIVE_TOKEN_SYMBOL = isCustomFeeToken ? 'TN' : 'ETH'
config.env.NATIVE_TOKEN_ADDRESS = ethBridger.nativeToken
Expand All @@ -227,15 +225,18 @@ export default defineConfig({
config.env.REDEEM_RETRYABLE_TEST_TX =
await generateTestTxForRedeemRetryable()

synpressPlugins(on, config)
setupCypressTasks(on, { requiresNetworkSetup: true })

configureSynpressForMetaMask(on, config, true)

return config
},
baseUrl: 'http://localhost:3000',
specPattern: tests,
supportFile: 'tests/support/index.ts',
supportFile: './support/e2e.ts',
defaultCommandTimeout: 20_000,
browsers: [browserConfig]
defaultBrowser: 'chrome',
testIsolation: false
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
findMoveFundsButton,
clickMoveFundsButton,
findSelectTokenButton,
openTransactionDetails,
openTransactionHistoryDetails,
closeTransactionDetails,
findTransactionDetailsCustomDestinationAddress,
findTransactionInTransactionHistory,
Expand Down Expand Up @@ -64,7 +64,7 @@ declare global {
findMoveFundsButton: typeof findMoveFundsButton
clickMoveFundsButton: typeof clickMoveFundsButton
findSelectTokenButton: typeof findSelectTokenButton
openTransactionDetails: typeof openTransactionDetails
openTransactionHistoryDetails: typeof openTransactionHistoryDetails
closeTransactionDetails: typeof closeTransactionDetails
switchToTransferPanelTab: typeof switchToTransferPanelTab
switchToTransactionHistoryTab: typeof switchToTransactionHistoryTab
Expand Down
Loading
Loading