Skip to content

Commit 509dc7b

Browse files
authored
Merge pull request #6068 from ethereum/fix-driver-metamask
Fix driver metamask
2 parents 0932e7a + bdbcae6 commit 509dc7b

File tree

4 files changed

+115
-29
lines changed

4 files changed

+115
-29
lines changed

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,14 @@ jobs:
692692
install-chrome: true
693693
install-chromedriver: false
694694
install-geckodriver: false
695+
- run:
696+
name: "📦 Downgrading Chrome to version 135"
697+
command: |
698+
echo "📦 Downgrading Chrome to version 135"
699+
wget -q https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_135.0.7049.114-1_amd64.deb -O /tmp/chrome135.deb
700+
sudo dpkg -i /tmp/chrome135.deb || true
701+
sudo apt-get install -f -y
702+
google-chrome --version
695703
- run: yarn install_webdriver
696704
- run: google-chrome --version
697705
- when:

apps/remix-ide-e2e/chrome-driver.sh

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env bash
2+
# Usage: chrome-driver.sh [install_dir]
3+
# Determine install directory from first argument or ORB_PARAM_DRIVER_INSTALL_DIR
4+
INSTALL_DIR=${1:-${ORB_PARAM_DRIVER_INSTALL_DIR:-"./tmp/webdrivers"}}
5+
echo "Installing ChromeDriver into $INSTALL_DIR"
6+
7+
# Determine the OS platform
8+
OS="$(uname)"
9+
10+
if [ "$OS" == "Darwin" ]; then
11+
# macOS systems
12+
if [ -e "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
13+
version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
14+
echo "Google Chrome version on macOS: $version"
15+
else
16+
echo "Google Chrome is not installed on your macOS."
17+
fi
18+
elif [ "$OS" == "Linux" ]; then
19+
# Linux systems
20+
if command -v google-chrome >/dev/null; then
21+
version=$(google-chrome --version)
22+
echo "Google Chrome version on Linux: $version"
23+
else
24+
echo "Google Chrome is not installed on your Linux."
25+
# exit without error
26+
exit 0
27+
fi
28+
else
29+
echo "Unsupported OS."
30+
exit 0
31+
fi
32+
33+
MAJORVERSION=$(echo "$version" | grep -Eo '[0-9]+' | head -1)
34+
echo "CHROME DRIVER INSTALL $MAJORVERSION"
35+
36+
# Determine target platform for ChromeDriver download
37+
case "$OS" in
38+
Darwin)
39+
if [[ "$(uname -m)" == "arm64" ]]; then
40+
PLATFORM="mac-arm64"
41+
else
42+
PLATFORM="mac-x64"
43+
fi
44+
;;
45+
Linux)
46+
PLATFORM="linux64"
47+
;;
48+
*)
49+
echo "Unsupported OS: $OS"; exit 1
50+
;;
51+
esac
52+
echo "Detected platform for download: $PLATFORM"
53+
54+
# Determine ChromeDriver version and download URL
55+
if [ "$MAJORVERSION" -lt 115 ]; then
56+
# Chrome <115: use storage.googleapis.com
57+
CHROMEDRIVER_VERSION=$(curl -sS "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${MAJORVERSION}" | tr -d '\r')
58+
CHROMEDRIVER_DOWNLOAD_URL="https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_${PLATFORM}.zip"
59+
else
60+
# Chrome >=115: use Chrome for Testing JSON feed
61+
FEED_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json"
62+
CHROMEDRIVER_VERSION=$(curl -sS "$FEED_URL" | jq -r ".milestones.\"$MAJORVERSION\".version")
63+
CHROMEDRIVER_DOWNLOAD_URL=$(curl -sS "$FEED_URL" \
64+
| jq -r ".milestones.\"$MAJORVERSION\".downloads.chromedriver[] \
65+
| select(.platform==\"$PLATFORM\").url")
66+
fi
67+
68+
echo "Matching ChromeDriver version: $CHROMEDRIVER_VERSION"
69+
echo "Downloading ChromeDriver from $CHROMEDRIVER_DOWNLOAD_URL"
70+
71+
# Prepare install directory
72+
mkdir -p "$INSTALL_DIR"
73+
74+
# Download and install ChromeDriver
75+
ZIP_PATH="${INSTALL_DIR}/chromedriver_${PLATFORM}.zip"
76+
curl -sS -o "$ZIP_PATH" "$CHROMEDRIVER_DOWNLOAD_URL"
77+
unzip -o "$ZIP_PATH" -d "$INSTALL_DIR"
78+
79+
# Move the extracted chromedriver binary to the root of INSTALL_DIR
80+
EXTRACTED_DIR="${INSTALL_DIR}/chromedriver-${PLATFORM}"
81+
ALT_DIR="${INSTALL_DIR}/chromedriver_${PLATFORM}"
82+
83+
if [ -f "${EXTRACTED_DIR}/chromedriver" ]; then
84+
mv "${EXTRACTED_DIR}/chromedriver" "$INSTALL_DIR/chromedriver"
85+
elif [ -f "${ALT_DIR}/chromedriver" ]; then
86+
mv "${ALT_DIR}/chromedriver" "$INSTALL_DIR/chromedriver"
87+
else
88+
# Fallback: try to find chromedriver file inside any subdir
89+
FOUND=$(find "$INSTALL_DIR" -type f -name chromedriver | head -n1)
90+
if [ -n "$FOUND" ]; then
91+
mv "$FOUND" "$INSTALL_DIR/chromedriver"
92+
else
93+
echo "Error: chromedriver binary not found"
94+
exit 1
95+
fi
96+
fi
97+
98+
chmod +x "$INSTALL_DIR/chromedriver"
99+
# Cleanup extracted directory and zip
100+
rm -rf "$EXTRACTED_DIR"
101+
rm -f "$ZIP_PATH"
102+
103+
echo "ChromeDriver installed at $INSTALL_DIR/chromedriver"
Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,4 @@
11
#!/bin/bash
2-
3-
# Determine the OS platform
4-
OS="$(uname)"
5-
6-
if [ "$OS" == "Darwin" ]; then
7-
# macOS systems
8-
if [ -e "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
9-
version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
10-
echo "Google Chrome version on macOS: $version"
11-
else
12-
echo "Google Chrome is not installed on your macOS."
13-
fi
14-
elif [ "$OS" == "Linux" ]; then
15-
# Linux systems
16-
if command -v google-chrome >/dev/null; then
17-
version=$(google-chrome --version)
18-
echo "Google Chrome version on Linux: $version"
19-
else
20-
echo "Google Chrome is not installed on your Linux."
21-
fi
22-
else
23-
echo "Unsupported OS."
24-
fi
25-
26-
MAJORVERSION=$(echo "$version" | grep -Eo '[0-9]+\.' | head -1 | cut -d'.' -f1)
27-
echo "CHROME DRIVER INSTALL $MAJORVERSION"
28-
292
# Specify the directory to check
303
directory="./tmp/webdrivers"
314

@@ -39,4 +12,6 @@ fi
3912

4013

4114
yarn init -y --cwd "$directory" || exit 1
42-
yarn add -D [email protected] geckodriver --cwd "$directory" || yarn add -D [email protected] geckodriver --cwd "$directory" || yarn add -D chromedriver geckodriver --cwd "$directory" || exit 1
15+
yarn add -D geckodriver --cwd "$directory" || exit 1
16+
17+
bash apps/remix-ide-e2e/chrome-driver.sh || exit 1

apps/remix-ide-e2e/nightwatch-chrome.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
webdriver: {
1212
start_process: true,
1313
port: 9515,
14-
server_path: './tmp/webdrivers/node_modules/chromedriver/bin/chromedriver',
14+
server_path: './tmp/webdrivers/chromedriver',
1515
},
1616

1717
test_settings: {

0 commit comments

Comments
 (0)