From 356bf83a9ee6bfd014dfd49a0a69f2dd0dfacf27 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 19 Mar 2024 08:12:28 +0100 Subject: [PATCH] automatic os tests --- .circleci/config.yml | 6 +- apps/remixdesktop/package.json | 8 +- apps/remixdesktop/test/nighwatch.app.ts | 121 ++++++------------------ 3 files changed, 35 insertions(+), 100 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0440c145fc..3f9e487c21 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -130,7 +130,7 @@ jobs: name: "Run tests" command: | cd apps/remixdesktop/ - yarn run build:e2e && yarn run test:app:linux + yarn run build:e2e && yarn run test build-remixdesktop-linux: machine: @@ -267,7 +267,7 @@ jobs: cd "apps/remixdesktop/" yarn -v sleep 15 - yarn run test:app:win + yarn run test shell: powershell.exe # see https://docs.digicert.com/en/software-trust-manager/ci-cd-integrations/script-integrations/github-integration-ksp.html sign-remixdesktop-windows: @@ -507,7 +507,7 @@ jobs: command: | nvm use 20 cd apps/remixdesktop - yarn run test:app:mac + yarn run test uploadartifacts: docker: diff --git a/apps/remixdesktop/package.json b/apps/remixdesktop/package.json index a61915b4a1..cbb4ece79b 100644 --- a/apps/remixdesktop/package.json +++ b/apps/remixdesktop/package.json @@ -28,13 +28,7 @@ "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", - "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:maclocalarm64": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=maclocalarm64", - "test:app:winlocal": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=winlocal", - "test:app:linux": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=linux", - "test:app:mac": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=mac", - "test:app:win": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js --env=win", + "test": "yarn run build:e2e && nightwatch --config build-e2e/remixdesktop/test/nighwatch.app.js", "build:e2e": "tsc -p tsconfig.e2e.json" }, "devDependencies": { diff --git a/apps/remixdesktop/test/nighwatch.app.ts b/apps/remixdesktop/test/nighwatch.app.ts index b794bf59ee..69a422526c 100644 --- a/apps/remixdesktop/test/nighwatch.app.ts +++ b/apps/remixdesktop/test/nighwatch.app.ts @@ -1,8 +1,9 @@ +const os = require('os'); + module.exports = { src_folders: ['build-e2e/remixdesktop/test/tests/app'], output_folder: './reports/tests', custom_commands_path: ['build-e2e/remix-ide-e2e/src/commands'], - custom_assertions_path: '', page_objects_path: '', globals_path: '', test_settings: { @@ -22,101 +23,41 @@ module.exports = { webdriver: { start_process: true, timeout_options: { - timeout: 60000, // 15 seconds + timeout: 60000, retry_attempts: 3 } }, - }, - maclocal: { desiredCapabilities: { browserName: 'chrome', javascriptEnabled: true, acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "release/mac/Remix-Desktop.app/Contents/MacOS/Remix-Desktop", - "args": [ - "--e2e-local", - ] - } - } - }, - maclocalarm64: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "release/mac-arm64/Remix-Desktop.app/Contents/MacOS/Remix-Desktop", - "args": [ - "--e2e-local", - ] - } - } - }, - linuxlocal: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "release/linux-unpacked/remixdesktop", - "args": [ - "--e2e-local", - ] - } - } - }, - linux: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "release/linux-unpacked/remixdesktop", - "args": [ - "--e2e", - ] - } - } - }, - mac: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "release/mac-arm64/Remix-Desktop.app/Contents/MacOS/Remix-Desktop", - "args": [ - "--e2e", - ] - } - } - }, - winlocal: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "./release/win-unpacked/Remix-Desktop.exe", - "args": [ - "--e2e-local", - ] - } - } - }, - win: { - desiredCapabilities: { - browserName: 'chrome', - javascriptEnabled: true, - acceptSslCerts: true, - 'goog:chromeOptions': { - "binary": "./release/win-unpacked/Remix-Desktop.exe", - "args": [ - "--e2e", - ] - } + 'goog:chromeOptions': (() => { + const type = os.type(); + const arch = os.arch(); + let binaryPath = ""; + // Check if running on CircleCI or locally + let args = process.env.CIRCLECI ? ["--e2e"] : ["--e2e-local"]; + + switch (type) { + case 'Windows_NT': + binaryPath = "./release/win-unpacked/Remix-Desktop.exe"; + break; + case 'Darwin': + binaryPath = arch === 'x64' ? + "release/mac/Remix-Desktop.app/Contents/MacOS/Remix-Desktop" : + "release/mac-arm64/Remix-Desktop.app/Contents/MacOS/Remix-Desktop"; + break; + case 'Linux': + binaryPath = "release/linux-unpacked/remixdesktop"; + break; + } + + return { + binary: binaryPath, + args: args + }; + })() } - }, + } } - } \ No newline at end of file +};