From f396f5e6b2fadeefe0397c52e3365f280142e727 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 13 Mar 2024 11:09:37 +0100 Subject: [PATCH] mac tests --- .circleci/config.yml | 57 ++++++++++++++++++- apps/remixdesktop/package.json | 7 ++- ...ium.config.js => selenium-linux.config.js} | 0 apps/remixdesktop/selenium-mac.config.js | 15 +++++ apps/remixdesktop/test/nighwatch.app.ts | 21 +++++-- .../test/tests/app/compiler.test.ts | 1 - .../remixdesktop/test/tests/app/xterm.test.ts | 2 +- 7 files changed, 91 insertions(+), 12 deletions(-) rename apps/remixdesktop/{selenium.config.js => selenium-linux.config.js} (100%) create mode 100644 apps/remixdesktop/selenium-mac.config.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 9e2046d492..a422a6b980 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -126,12 +126,12 @@ jobs: yarn --ignore-optional yarn add @remix-project/remix-ws-templates yarn dist - yarn run selenium-install + yarn run selenium-install-linux - run: name: "Run selenium" command: | cd apps/remixdesktop/ - yarn run selenium + yarn run selenium-linux background: true - run: name: "Run tests" @@ -332,7 +332,58 @@ jobs: - store_artifacts: path: apps/remixdesktop/release/ destination: remixdesktop-mac - + + test-remixdesktop-mac: + macos: + xcode: 14.2.0 + resource_class: + macos.m1.large.gen1 + working_directory: ~/remix-project + steps: + - checkout + - attach_workspace: + at: . + - run: unzip ./persist/desktopbuild.zip + - run: + command: | + ls -la dist/apps/remix-ide + nvm install 20.0.0 + nvm use 20.0.0 + - restore_cache: + keys: + - remixdesktop-deps-mac-{{ checksum "apps/remixdesktop/yarn.lock" }} + - run: + command: | + nvm use 20.0.0 + cd apps/remixdesktop && yarn + yarn add @remix-project/remix-ws-templates + - save_cache: + key: remixdesktop-deps-mac-{{ checksum "apps/remixdesktop/yarn.lock" }} + paths: + - apps/remixdesktop/node_modules + # use USE_HARD_LINK=false https://github.com/electron-userland/electron-builder/issues/3179 + - run: + command: | + nvm use 20.0.0 + mkdir apps/remixdesktop/build + cp -r dist/apps/remix-ide apps/remixdesktop/build + cd apps/remixdesktop + yarn + yarn installRipGrepMacOXarm64 + PUBLISH_FOR_PULL_REQUEST='true' USE_HARD_LINKS=false yarn dist --mac --arm64 + yarn run selenium-install-mac + - run: + name: "Run selenium" + command: | + cd apps/remixdesktop/ + yarn run selenium-mac + background: true + - run: + name: "Run tests" + command: | + cd apps/remixdesktop/ + yarn run build:e2e && yarn run test:app:mac + lint: docker: - image: cimg/node:20.0.0-browsers diff --git a/apps/remixdesktop/package.json b/apps/remixdesktop/package.json index cd1a965ab6..f6582b2a49 100644 --- a/apps/remixdesktop/package.json +++ b/apps/remixdesktop/package.json @@ -28,8 +28,11 @@ "installRipGrepMacOXx64": "rm -rf node_modules/@vscode/ripgrep/bin && npm_config_arch=x64 node node_modules/@vscode/ripgrep/lib/postinstall.js", "installRipGrepMacOXarm64": "rm -rf node_modules/@vscode/ripgrep/bin && npm_config_arch=arm64 node node_modules/@vscode/ripgrep/lib/postinstall.js", "postinstall": "electron-builder install-app-deps", - "selenium-install": "selenium-standalone install --drivers.chromiumedge.version=114.0.1788.0 --drivers.chrome.version=114.0.1788.0 --drivers.chrome.baseURL=https://chromedriver.storage.googleapis.com", - "selenium": "selenium-standalone start --config=./selenium.config.js", + "selenium-install-linux": "selenium-standalone install --drivers.chromiumedge.version=114.0.1788.0 --drivers.chrome.version=114.0.1788.0 --drivers.chrome.baseURL=https://chromedriver.storage.googleapis.com", + "selenium-install-mac": "selenium-standalone install --drivers.chromiumedge.version=114.0.1788.0 --drivers.chrome.version=114.0.1788.0 --drivers.chrome.baseURL=https://chromedriver.storage.googleapis.com", + "selenium-linux": "selenium-standalone start --config=./selenium-linux.config.js", + "selenium-mac": "selenium-standalone start --config=./selenium-mac.config.js", + "selenium-win": "selenium-standalone start --config=./selenium-win.config.js", "test:app:linuxlocal": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=linuxlocal", "test:app:maclocal": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=maclocal", "test:app:winlocal": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=winlocal", diff --git a/apps/remixdesktop/selenium.config.js b/apps/remixdesktop/selenium-linux.config.js similarity index 100% rename from apps/remixdesktop/selenium.config.js rename to apps/remixdesktop/selenium-linux.config.js diff --git a/apps/remixdesktop/selenium-mac.config.js b/apps/remixdesktop/selenium-mac.config.js new file mode 100644 index 0000000000..9899217003 --- /dev/null +++ b/apps/remixdesktop/selenium-mac.config.js @@ -0,0 +1,15 @@ +module.exports = { + baseURL: 'https://selenium-release.storage.googleapis.com', + drivers: { + chrome: { + version: '114.0.1788.0', + arch: process.arch, + baseURL: 'https://chromedriver.storage.googleapis.com' + }, + chromiumedge: { + version: '114.0.1788.0', + arch: process.arch, + baseURL: 'https://msedgedriver.azureedge.net/' + } + } + } \ No newline at end of file diff --git a/apps/remixdesktop/test/nighwatch.app.ts b/apps/remixdesktop/test/nighwatch.app.ts index e3f96b57f7..cbea410e9c 100644 --- a/apps/remixdesktop/test/nighwatch.app.ts +++ b/apps/remixdesktop/test/nighwatch.app.ts @@ -21,17 +21,15 @@ module.exports = { }, }, - macos: { + maclocal: { desiredCapabilities: { browserName: 'chrome', javascriptEnabled: true, acceptSslCerts: true, 'goog:chromeOptions': { - "binary": "electron .", + "binary": "release/mac/Remix IDE.app/Contents/MacOS/Remix IDE", "args": [ - "--folder=test/contracts", - "--remix-ide-url=http://localhost:8080", - "--e2e" + "--e2e-local", ] } } @@ -62,6 +60,19 @@ module.exports = { } } }, + mac: { + desiredCapabilities: { + browserName: 'chrome', + javascriptEnabled: true, + acceptSslCerts: true, + 'goog:chromeOptions': { + "binary": "release/mac-arm64/Remix IDE.app/Contents/MacOS/Remix IDE", + "args": [ + "--e2e", + ] + } + } + }, windows: { desiredCapabilities: { browserName: 'chrome', diff --git a/apps/remixdesktop/test/tests/app/compiler.test.ts b/apps/remixdesktop/test/tests/app/compiler.test.ts index 4454aca55d..2fce46320c 100644 --- a/apps/remixdesktop/test/tests/app/compiler.test.ts +++ b/apps/remixdesktop/test/tests/app/compiler.test.ts @@ -33,6 +33,5 @@ module.exports = { "//a[@data-id='dropdown-item-soljson-v0.8.23+commit.f704f362.js']//*[contains(@class, 'fa-arrow-circle-down')]", locateStrategy: 'xpath' }) - .pause() } } \ No newline at end of file diff --git a/apps/remixdesktop/test/tests/app/xterm.test.ts b/apps/remixdesktop/test/tests/app/xterm.test.ts index c0f380bcd9..6ab641455a 100644 --- a/apps/remixdesktop/test/tests/app/xterm.test.ts +++ b/apps/remixdesktop/test/tests/app/xterm.test.ts @@ -17,7 +17,7 @@ module.exports = { .click('*[data-type="remixUIXT"]') .perform(function () { const actions = this.actions({ async: true }) - return actions.sendKeys('echo "Hello, World!" > example.txt').sendKeys(this.Keys.ENTER) + return actions.sendKeys('echo test > example.txt').sendKeys(this.Keys.ENTER) }) .waitForElementVisible('*[data-id="treeViewLitreeViewItemexample.txt"]', 10000) },