Skip to content

Commit

Permalink
Merge pull request #2 from ethereum/master
Browse files Browse the repository at this point in the history
  • Loading branch information
OKEAMAH authored Apr 21, 2024
2 parents 1d1295c + 890d631 commit 0215add
Show file tree
Hide file tree
Showing 98 changed files with 4,203 additions and 1,441 deletions.
96 changes: 17 additions & 79 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ jobs:
type: string
parallelism: 10
steps:
- checkout
- attach_workspace:
at: .
- run: unzip ./persist/dist.zip
- run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules || yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules
- run: mkdir node_modules/hardhat && wget https://unpkg.com/hardhat/console.sol -O node_modules/hardhat/console.sol
- run: ls -la ./dist/apps/remix-ide/assets/js
- when:
condition:
equal: [ "chrome", << parameters.browser >> ]
Expand All @@ -366,47 +373,19 @@ jobs:
install-chrome: true
install-chromedriver: false
install-geckodriver: false
- install-chromedriver-custom-linux
- run: yarn install_webdriver
- run: google-chrome --version
- run: chromedriver --version
- run: rm LICENSE.chromedriver 2> /dev/null || true
- when:
condition:
equal: [ "firefox", << parameters.browser >> ]
steps:
- browser-tools/install-browser-tools:
install-firefox: true
install-chrome: false
install-geckodriver: true
install-geckodriver: false
install-chromedriver: false
- run: yarn install_webdriver
- run: firefox --version
- run: geckodriver --version
- checkout
- attach_workspace:
at: .
- run: unzip ./persist/dist.zip
- run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules
- run: mkdir node_modules/hardhat && wget https://unpkg.com/hardhat/console.sol -O node_modules/hardhat/console.sol
- run: ls -la ./dist/apps/remix-ide/assets/js
- run: yarn run selenium-install --singleDriverInstall=firefox
- when:
condition:
equal: [ "chrome", << parameters.browser >> ]
steps:
- run: mkdir -p node_modules/selenium-standalone/.selenium/chromedriver/latest-x64/
- run: cp ~/bin/chromedriver /home/circleci/remix-project/node_modules/selenium-standalone/.selenium/chromedriver/latest-x64/
- run:
name: run selenium
command: yarn selenium-standalone start --singleDriverStart=chrome
background: true
- when:
condition:
equal: [ "firefox", << parameters.browser >> ]
steps:
- run:
name: run selenium
command: yarn selenium-standalone start --singleDriverStart=firefox
background: true
- run: ./apps/remix-ide/ci/<< parameters.script >> << parameters.browser >> << parameters.jobsize >> << parameters.job >>
- store_test_results:
path: ./reports/tests
Expand All @@ -433,28 +412,19 @@ jobs:
default: 1
parallelism: << parameters.parallelism >>
steps:
- checkout
- attach_workspace:
at: .
- run: unzip ./persist/dist.zip
- run: unzip ./persist/plugin-<< parameters.plugin >>.zip
- run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules || yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules
- browser-tools/install-browser-tools:
install-firefox: false
install-chrome: true
install-geckodriver: false
install-chromedriver: false
- install-chromedriver-custom-linux
- run: yarn install_webdriver
- run: google-chrome --version
- run: chromedriver --version
- run: rm LICENSE.chromedriver 2> /dev/null || true
- checkout
- attach_workspace:
at: .
- run: unzip ./persist/dist.zip
- run: unzip ./persist/plugin-<< parameters.plugin >>.zip
- run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules
- run: yarn run selenium-install --singleDriverInstall=firefox
- run: mkdir -p node_modules/selenium-standalone/.selenium/chromedriver/latest-x64/
- run: cp ~/bin/chromedriver /home/circleci/remix-project/node_modules/selenium-standalone/.selenium/chromedriver/latest-x64/
- run:
name: Start Selenium
command: yarn run selenium --singleDriverStart=chrome
background: true
- run: ./apps/remix-ide/ci/browser_test_plugin.sh << parameters.plugin >>
- store_test_results:
path: ./reports/tests
Expand Down Expand Up @@ -621,35 +591,3 @@ workflows:
only: remix_beta

# VS Code Extension Version: 1.5.1
commands:
install-chromedriver-custom-linux:
description: Custom script to install chromedriver with better version support for linux
steps:
- run:
name: install-chromedriver-custom-linux
command: |
google-chrome --version > version.txt
VERSION=$(grep -Eo '[0-9]+\.' < version.txt | head -1)
# CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json' | jq '.channels.Stable.downloads.chromedriver[] | select(.platform == "linux64") | .url' | tr -d '"')
CHROMEDRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json' | jq --arg v "$VERSION" '.versions[] | select(.version | startswith($v)) | .downloads.chromedriver[] | select(.platform == "linux64") | .url' | tail -n1 | tr -d '"')
echo $CHROMEDRIVER_URL
ZIPFILEPATH="/tmp/chromedriver.zip"
echo "Downloading from $CHROMEDRIVER_URL"
curl -f --silent $CHROMEDRIVER_URL > "$ZIPFILEPATH"
BINFILEPATH="$HOME/bin/chromedriver-linux"
echo "Extracting to $BINFILEPATH"
unzip -p "$ZIPFILEPATH" chromedriver-linux64/chromedriver > "$BINFILEPATH"
echo Setting execute flag
chmod +x "$BINFILEPATH"
echo Updating symlink
ln -nfs "$BINFILEPATH" ~/bin/chromedriver
echo Removing ZIP file
rm "$ZIPFILEPATH"
rm version.txt
echo Done
chromedriver -v
2 changes: 1 addition & 1 deletion .github/workflows/pr-reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
freeze-date: '2024-04-08T18:00:00Z'
freeze-date: '2024-04-22T18:00:00Z'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ apps/remixdesktop/release/
apps/remix-ide/src/assets/list.json
apps/remix-ide/src/assets/esbuild.wasm
apps/remixdesktop/build*
logs
22 changes: 2 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,11 @@ For example, to run unit tests of `remix-analyzer`, use `nx test remix-analyzer`

## Browser Testing

To run the Selenium tests via Nightwatch:
To run the tests via Nightwatch:

- Install Selenium for the first time: `yarn run selenium-install`
- Run a selenium server: `yarn run selenium`
- Install webdrivers for the first time: `yarn install_webdriver`
- Build & Serve Remix: `yarn serve`
- Run all the end-to-end tests:

for Firefox: `yarn run nightwatch_local_firefox`, or

for Google Chrome: `yarn run nightwatch_local_chrome`
- Run a specific test case instead, use a command like this:

- yarn run nightwatch_local_ballot
The package.json file contains a list of all the tests you can run.
**NOTE:**

Expand All @@ -173,8 +163,6 @@ To run the Selenium tests via Nightwatch:
gist_token = <token> // token should have permission to create a gist
```

### Using 'select_test' for locally running specific tests

There is a script to allow selecting the browser and a specific test to run:

```
Expand Down Expand Up @@ -246,12 +234,6 @@ This script will give you an options menu, just select the test you want
```
yarn run select_test
```
#### method 2

```
yarn run group_test --test=debugger --group=10 --env=chromeDesktop
```
- specify chromeDesktop to see the browser action, use 'chrome' to run it headless

### Run the same (flaky) test across all instances in CircleCI

Expand Down
4 changes: 2 additions & 2 deletions apps/learneth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ Root directories are individual workshops, the name used will be the name of the

### README.md

The readme in each directry contains an explanation of what the workshop is about. If an additional summary property is provided in the config.yml that will be used in the overview section of the plugin.
The readme in each directory contains an explanation of what the workshop is about. If an additional summary property is provided in the config.yml that will be used in the overview section of the plugin.

### config.yml

This config file contains meta data describing some properties of your workshop, for example
This config file contains metadata describing some properties of your workshop, for example

```
---
Expand Down
42 changes: 42 additions & 0 deletions apps/remix-ide-e2e/install-webdriver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/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"

# Check if the directory exists
if [ -d "$directory" ]; then
echo "Directory exists: $directory"
else
echo "Directory does not exist. Creating directory: $directory"
mkdir -p "$directory"
fi


yarn init -y --cwd "$directory" || exit 1
yarn add -D chromedriver@$MAJORVERSION geckodriver --cwd "$directory" || yarn add -D chromedriver@$MAJORVERSION geckodriver --cwd "$directory" || yarn add -D chromedriver geckodriver --cwd "$directory" || exit 1
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import * as fs from 'fs'

const crxFile = fs.readFileSync('apps/remix-ide-e2e/src/extensions/chrome/11.13.1_0.crx')
const metamaskExtension = crxFile.toString('base64')

module.exports = {
src_folders: ['dist/apps/remix-ide-e2e/src/tests'],
output_folder: './reports/tests',
Expand All @@ -6,10 +11,14 @@ module.exports = {
page_objects_path: '',
globals_path: '',

webdriver: {
start_process: true,
port: 9515,
server_path: './tmp/webdrivers/node_modules/chromedriver/bin/chromedriver',
},

test_settings: {
'default': {
selenium_port: 4444,
selenium_host: 'localhost',
globals: {
waitForConditionTimeout: 10000,
asyncHookTimeout: 100000
Expand All @@ -31,12 +40,12 @@ module.exports = {
'goog:chromeOptions': {
args: [
'window-size=2560,1440',
'start-fullscreen',
'--no-sandbox',
'--headless',
'--headless=new',
'--verbose',
'--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
]
],
extensions: [metamaskExtension]
}
}
},
Expand All @@ -47,40 +56,31 @@ module.exports = {
'javascriptEnabled': true,
'acceptSslCerts': true,
'goog:chromeOptions': {
args: ['window-size=2560,1440', 'start-fullscreen', '--no-sandbox']
args: ['window-size=2560,1440', 'start-fullscreen', '--no-sandbox', '--verbose']
}
}
},

'chrome-runAndDeploy': {
'chromeDesktopMetamask': {
desiredCapabilities: {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
'goog:chromeOptions': {
args: ['window-size=2560,1440', 'start-fullscreen', '--no-sandbox', '--headless', '--verbose']
}
}
},

'firefoxDesktop': {
desiredCapabilities: {
'browserName': 'firefox',
'javascriptEnabled': true,
'acceptSslCerts': true,
'moz:firefoxOptions': {
args: ['-width=2560', '-height=1440']
args: ['window-size=2560,1440', '--no-sandbox', '--verbose']
,extensions: [metamaskExtension]
}
}
},

'firefox': {
'chrome-runAndDeploy': {
desiredCapabilities: {
'browserName': 'firefox',
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
'moz:firefoxOptions': {
args: ['-headless', '-width=2560', '-height=1440']
'goog:chromeOptions': {
args: ['window-size=2560,1440', 'start-fullscreen', '--no-sandbox', '--headless', '--verbose'],
extensions: [metamaskExtension]
}
}
}
Expand Down
54 changes: 54 additions & 0 deletions apps/remix-ide-e2e/nightwatch-firefox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module.exports = {
src_folders: ['dist/apps/remix-ide-e2e/src/tests'],
output_folder: './reports/tests',
custom_commands_path: ['dist/apps/remix-ide-e2e/src/commands'],
custom_assertions_path: '',
page_objects_path: '',
globals_path: '',

webdriver: {
start_process: true,
port: 4444,
server_path: './tmp/webdrivers/node_modules/geckodriver/bin/geckodriver.js',
},

test_settings: {
selenium_port: 4444,
selenium_host: 'localhost',
'default': {
globals: {
waitForConditionTimeout: 10000,
asyncHookTimeout: 100000
},
screenshots: {
enabled: true,
path: './reports/screenshots',
on_failure: true,
on_error: true
},
exclude: ['dist/apps/remix-ide-e2e/src/tests/runAndDeploy.test.js', 'dist/apps/remix-ide-e2e/src/tests/pluginManager.test.ts']
},

'firefoxDesktop': {
desiredCapabilities: {
'browserName': 'firefox',
'javascriptEnabled': true,
'acceptSslCerts': true,
'moz:firefoxOptions': {
args: ['-width=2560', '-height=1440']
}
}
},

'firefox': {
desiredCapabilities: {
'browserName': 'firefox',
'javascriptEnabled': true,
'acceptSslCerts': true,
'moz:firefoxOptions': {
args: ['-headless', '-width=2560', '-height=1440']
}
}
}
}
}
Loading

0 comments on commit 0215add

Please sign in to comment.