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
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,14 @@ jobs:
install-chrome: true
install-chromedriver: false
install-geckodriver: false
- run:
name: "📦 Downgrading Chrome to version 135"
command: |
echo "📦 Downgrading Chrome to version 135"
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
sudo dpkg -i /tmp/chrome135.deb || true
sudo apt-get install -f -y
google-chrome --version
- run: yarn install_webdriver
- run: google-chrome --version
- when:
Expand Down
103 changes: 103 additions & 0 deletions apps/remix-ide-e2e/chrome-driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/env bash
# Usage: chrome-driver.sh [install_dir]
# Determine install directory from first argument or ORB_PARAM_DRIVER_INSTALL_DIR
INSTALL_DIR=${1:-${ORB_PARAM_DRIVER_INSTALL_DIR:-"./tmp/webdrivers"}}
echo "Installing ChromeDriver into $INSTALL_DIR"

# Determine the OS platform
OS="$(uname)"

if [ "$OS" == "Darwin" ]; then
# macOS systems
if [ -e "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
echo "Google Chrome version on macOS: $version"
else
echo "Google Chrome is not installed on your macOS."
fi
elif [ "$OS" == "Linux" ]; then
# Linux systems
if command -v google-chrome >/dev/null; then
version=$(google-chrome --version)
echo "Google Chrome version on Linux: $version"
else
echo "Google Chrome is not installed on your Linux."
# exit without error
exit 0
fi
else
echo "Unsupported OS."
exit 0
fi

MAJORVERSION=$(echo "$version" | grep -Eo '[0-9]+' | head -1)
echo "CHROME DRIVER INSTALL $MAJORVERSION"

# Determine target platform for ChromeDriver download
case "$OS" in
Darwin)
if [[ "$(uname -m)" == "arm64" ]]; then
PLATFORM="mac-arm64"
else
PLATFORM="mac-x64"
fi
;;
Linux)
PLATFORM="linux64"
;;
*)
echo "Unsupported OS: $OS"; exit 1
;;
esac
echo "Detected platform for download: $PLATFORM"

# Determine ChromeDriver version and download URL
if [ "$MAJORVERSION" -lt 115 ]; then
# Chrome <115: use storage.googleapis.com
CHROMEDRIVER_VERSION=$(curl -sS "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${MAJORVERSION}" | tr -d '\r')
CHROMEDRIVER_DOWNLOAD_URL="https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_${PLATFORM}.zip"
else
# Chrome >=115: use Chrome for Testing JSON feed
FEED_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json"
CHROMEDRIVER_VERSION=$(curl -sS "$FEED_URL" | jq -r ".milestones.\"$MAJORVERSION\".version")
CHROMEDRIVER_DOWNLOAD_URL=$(curl -sS "$FEED_URL" \
| jq -r ".milestones.\"$MAJORVERSION\".downloads.chromedriver[] \
| select(.platform==\"$PLATFORM\").url")
fi

echo "Matching ChromeDriver version: $CHROMEDRIVER_VERSION"
echo "Downloading ChromeDriver from $CHROMEDRIVER_DOWNLOAD_URL"

# Prepare install directory
mkdir -p "$INSTALL_DIR"

# Download and install ChromeDriver
ZIP_PATH="${INSTALL_DIR}/chromedriver_${PLATFORM}.zip"
curl -sS -o "$ZIP_PATH" "$CHROMEDRIVER_DOWNLOAD_URL"
unzip -o "$ZIP_PATH" -d "$INSTALL_DIR"

# Move the extracted chromedriver binary to the root of INSTALL_DIR
EXTRACTED_DIR="${INSTALL_DIR}/chromedriver-${PLATFORM}"
ALT_DIR="${INSTALL_DIR}/chromedriver_${PLATFORM}"

if [ -f "${EXTRACTED_DIR}/chromedriver" ]; then
mv "${EXTRACTED_DIR}/chromedriver" "$INSTALL_DIR/chromedriver"
elif [ -f "${ALT_DIR}/chromedriver" ]; then
mv "${ALT_DIR}/chromedriver" "$INSTALL_DIR/chromedriver"
else
# Fallback: try to find chromedriver file inside any subdir
FOUND=$(find "$INSTALL_DIR" -type f -name chromedriver | head -n1)
if [ -n "$FOUND" ]; then
mv "$FOUND" "$INSTALL_DIR/chromedriver"
else
echo "Error: chromedriver binary not found"
exit 1
fi
fi

chmod +x "$INSTALL_DIR/chromedriver"
# Cleanup extracted directory and zip
rm -rf "$EXTRACTED_DIR"
rm -f "$ZIP_PATH"

echo "ChromeDriver installed at $INSTALL_DIR/chromedriver"
31 changes: 3 additions & 28 deletions apps/remix-ide-e2e/install-webdriver.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,4 @@
#!/bin/bash

# Determine the OS platform
OS="$(uname)"

if [ "$OS" == "Darwin" ]; then
# macOS systems
if [ -e "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ]; then
version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
echo "Google Chrome version on macOS: $version"
else
echo "Google Chrome is not installed on your macOS."
fi
elif [ "$OS" == "Linux" ]; then
# Linux systems
if command -v google-chrome >/dev/null; then
version=$(google-chrome --version)
echo "Google Chrome version on Linux: $version"
else
echo "Google Chrome is not installed on your Linux."
fi
else
echo "Unsupported OS."
fi

MAJORVERSION=$(echo "$version" | grep -Eo '[0-9]+\.' | head -1 | cut -d'.' -f1)
echo "CHROME DRIVER INSTALL $MAJORVERSION"

# Specify the directory to check
directory="./tmp/webdrivers"

Expand All @@ -39,4 +12,6 @@ fi


yarn init -y --cwd "$directory" || exit 1
yarn add -D chromedriver@135.0.4 geckodriver --cwd "$directory" || yarn add -D chromedriver@135.0.4 geckodriver --cwd "$directory" || yarn add -D chromedriver geckodriver --cwd "$directory" || exit 1
yarn add -D geckodriver --cwd "$directory" || exit 1

bash apps/remix-ide-e2e/chrome-driver.sh || exit 1
2 changes: 1 addition & 1 deletion apps/remix-ide-e2e/nightwatch-chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
webdriver: {
start_process: true,
port: 9515,
server_path: './tmp/webdrivers/node_modules/chromedriver/bin/chromedriver',
server_path: './tmp/webdrivers/chromedriver',
},

test_settings: {
Expand Down
6 changes: 3 additions & 3 deletions apps/remix-ide-e2e/src/commands/addFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import EventEmitter from 'events'

class AddFile extends EventEmitter {
command(this: NightwatchBrowser, name: string, content: NightwatchContractContent, readMeFile?:string): NightwatchBrowser {
if(!readMeFile)
readMeFile = 'README.txt'
if (!readMeFile)
readMeFile = 'README.txt'
this.api.perform((done) => {
addFile(this.api, name, content, readMeFile, () => {
done()
Expand Down Expand Up @@ -63,7 +63,7 @@ function addFile(browser: NightwatchBrowser, name: string, content: NightwatchCo
})
.setEditorValue(content.content)
.getEditorValue((result) => {
if(result != content.content) {
if (result != content.content) {
browser.setEditorValue(content.content)
}
})
Expand Down
40 changes: 40 additions & 0 deletions apps/remix-ide-e2e/src/commands/assistantAddContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class AssistantAddCtx extends EventEmitter {
command(this: NightwatchBrowser, prompt: string): NightwatchBrowser {
this.api.perform((done) => {
selectCtx(this.api, prompt, () => {
done()
this.emit('complete')
})
})
return this
}
}

function selectCtx(browser: NightwatchBrowser, ctx: string, done: VoidFunction) {
browser
.waitForElementVisible('*[data-id="remix-ai-assistant"]')
.waitForElementVisible('*[data-id="composer-ai-add-context"]')
.click('*[data-id="composer-ai-add-context"]')
.waitForElementVisible('*[data-id="currentFile-context-option"]')
.perform(async ()=> {
switch (ctx) {
case 'currentFile':
browser.click('*[data-id="currentFile-context-option"]');
break;
case 'workspace':
browser.click('*[data-id="workspace-context-option"]');
break;
case 'openedFiles':
browser.click('*[data-id="allOpenedFiles-context-option"]');
break;
default:
break;
}
})
done()
}

module.exports = AssistantAddCtx;
32 changes: 32 additions & 0 deletions apps/remix-ide-e2e/src/commands/assistantGenerate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class AssistantGenerate extends EventEmitter {
command(this: NightwatchBrowser, prompt: string, provider: string): NightwatchBrowser {
this.api.perform((done) => {
generate(this.api, prompt, provider, () => {
done()
this.emit('complete')
})
})
return this
}
}

function generate(browser: NightwatchBrowser, prompt: string, provider: string, done: VoidFunction) {
browser
.click('*[data-id="composer-textarea"]')
.waitForElementVisible('*[data-id="composer-textarea"]')
.assistantSetProvider(provider)
.pause(1000)
.execute(function (prompt) {
(window as any).sendChatMessage(`/generate ${prompt}`);
}, [prompt])
.waitForElementVisible({
locateStrategy: 'xpath',
selector: `//*[@data-id="remix-ai-assistant" and contains(.,"/generate ${prompt}")]`
})
done()
}

module.exports = AssistantGenerate;
29 changes: 29 additions & 0 deletions apps/remix-ide-e2e/src/commands/assistantSetProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class SetAssistantProvider extends EventEmitter {
command(this: NightwatchBrowser, provider: string): NightwatchBrowser {
this.api.perform((done) => {
setAssistant( this.api, provider, () => {
done()
this.emit('complete')
})
})
return this
}
}

function setAssistant(browser: NightwatchBrowser, provider: string, done: VoidFunction) {
browser
.waitForElementVisible('*[data-id="composer-textarea"]')
.execute(function (provider) {
(window as any).sendChatMessage(`/setAssistant ${provider}`);
}, [provider])
.waitForElementVisible({
locateStrategy: 'xpath',
selector: '//*[@data-id="remix-ai-assistant" and contains(.,"AI Provider set to")]'
})
done()
}

module.exports = SetAssistantProvider
28 changes: 28 additions & 0 deletions apps/remix-ide-e2e/src/commands/assistantWorkspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class AssistantWorkspace extends EventEmitter {
command(this: NightwatchBrowser, prompt: string, provider: string): NightwatchBrowser {
this.api.perform((done) => {
workspaceGenerate(this.api, prompt, provider, () => {
done()
this.emit('complete')
})
})
return this
}
}

function workspaceGenerate(browser: NightwatchBrowser, prompt: string, provider: string, done: VoidFunction) {
browser
.waitForElementVisible('*[data-id="remix-ai-assistant"]')
.waitForElementVisible('*[data-id="composer-textarea"]')
.assistantSetProvider(provider)
.pause(1000)
.execute(function (prompt) {
(window as any).sendChatMessage(`/workspace ${prompt}`);
}, [prompt])
done()
}

module.exports = AssistantWorkspace;
7 changes: 3 additions & 4 deletions apps/remix-ide-e2e/src/commands/enableClipBoard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'

class EnableClipBoard extends EventEmitter {
command (this: NightwatchBrowser, remember:boolean, accept: boolean): NightwatchBrowser {
command (this: NightwatchBrowser,): NightwatchBrowser {
const browser = this.api
if(browser.browserName.indexOf('chrome') > -1){

if (browser.browserName.indexOf('chrome') > -1){
const chromeBrowser = (browser as any).chrome
chromeBrowser.setPermission('clipboard-read', 'granted')
chromeBrowser.setPermission('clipboard-write', 'granted')
// test it
browser.executeAsyncScript(function (done) {
navigator.clipboard.writeText('test').then(function () {
navigator.clipboard.readText().then(function (text) {
console.log('Pasted content: ', text)
done(text)
}).catch(function (err) {
console.error('Failed to read clipboard contents: ', err)
Expand Down
1 change: 0 additions & 1 deletion apps/remix-ide-e2e/src/helpers/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
.url(url || 'http://127.0.0.1:8080')
.pause(5000)
.switchBrowserTab(0)
.hidePopupPanel()
.perform((done) => {
if (!loadPlugin) return done()
browser
Expand Down
Loading