From 9a06e8022e05652a46020ebdf5ebfb4761b3402d Mon Sep 17 00:00:00 2001 From: filip mertens Date: Thu, 25 Apr 2024 07:58:22 +0200 Subject: [PATCH] paralel test --- .circleci/config.yml | 3 +- apps/remix-ide/src/remixAppManager.js | 2 +- apps/remixdesktop/run_ci_test.sh | 14 ++++++++ apps/remixdesktop/splice_tests.js | 35 +++++++++++++++++++ apps/remixdesktop/src/plugins/xtermPlugin.ts | 2 +- apps/remixdesktop/test/tests/app/git.test.ts | 1 + .../test/tests/app/offline.test.ts | 1 + 7 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 apps/remixdesktop/run_ci_test.sh create mode 100644 apps/remixdesktop/splice_tests.js diff --git a/.circleci/config.yml b/.circleci/config.yml index d2b2c89f79..a7c90873d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -110,6 +110,7 @@ jobs: resource_class: xlarge working_directory: ~/remix-project + parallelism: 10 steps: - run: ldd --version - checkout @@ -130,7 +131,7 @@ jobs: name: "Run tests" command: | cd apps/remixdesktop/ - yarn run build:e2e && yarn run test:offline && yarn run test && yarn run test:isogit + ./run_test.sh build-remixdesktop-linux: machine: diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 919b04a132..4d800b164b 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -282,7 +282,7 @@ export class RemixAppManager extends PluginManager { } return plugins.map(plugin => { - if (plugin.name === 'dgit' && Registry.getInstance().get('platform').api.isDesktop()) { plugin.url = 'https://dgit4-76cc9.web.app/' } // temporary fix + if (plugin.name === 'dgit') return null if (plugin.name === testPluginName) plugin.url = testPluginUrl return new IframePlugin(plugin) }) diff --git a/apps/remixdesktop/run_ci_test.sh b/apps/remixdesktop/run_ci_test.sh new file mode 100644 index 0000000000..8366b3bdf1 --- /dev/null +++ b/apps/remixdesktop/run_ci_test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e + +yarn run build:e2e && node ./splice_tests.js +TESTFILES=$(./splice_tests.js | circleci tests split --split-by=timings) +for TESTFILE in $TESTFILES; do + yarn run test --test ${TESTFILE} || TEST_EXITCODE=1 +done + +echo "$TEST_EXITCODE" +if [ "$TEST_EXITCODE" -eq 1 ] +then + exit 1 +fi diff --git a/apps/remixdesktop/splice_tests.js b/apps/remixdesktop/splice_tests.js new file mode 100644 index 0000000000..e930de24f4 --- /dev/null +++ b/apps/remixdesktop/splice_tests.js @@ -0,0 +1,35 @@ +const fs = require('fs'); +const path = require('path'); + +// Directory to read files from +const testDirectory = './build-e2e/remixdesktop/test/tests/app/'; + +// Function to read files in a directory and return their paths +function getTestFiles(directory) { + return fs.readdirSync(directory) + .filter(file => file.endsWith('.test.js')) // Get only .test.js files + .map(file => path.join(directory, file)); // Return full path of each file +} + +// Function to check if a file contains a specific word +function fileContainsWord(filePath, word) { + const content = fs.readFileSync(filePath, 'utf-8'); // Read file content + return content.includes(word); // Check if word is in content +} + +// Function to filter out files that do not contain the specified word +function filterFilesByWord(files, word) { + return files.filter(file => fileContainsWord(file, word)); // Return files that do not contain the word +} + +// Get all test files in the specified directory +const testFiles = getTestFiles(testDirectory); + +// Filter out files that do not contain "@offline" +const filteredFiles = filterFilesByWord(testFiles, ''); + +// Output the list of filtered files +//console.log('Files without "@offline":', filteredFiles); +for (let i = 0; i < filteredFiles.length; i++) { + console.log(filteredFiles[i]); +} diff --git a/apps/remixdesktop/src/plugins/xtermPlugin.ts b/apps/remixdesktop/src/plugins/xtermPlugin.ts index db50d4bb94..8bbfdf629b 100644 --- a/apps/remixdesktop/src/plugins/xtermPlugin.ts +++ b/apps/remixdesktop/src/plugins/xtermPlugin.ts @@ -157,7 +157,7 @@ class XtermPluginClient extends ElectronBasePluginClient { name: 'xterm-color', cols: 80, rows: 20, - cwd: path || process.cwd(), + cwd: path || this.workingDir || process.cwd(), env: env, encoding: 'utf8', }); diff --git a/apps/remixdesktop/test/tests/app/git.test.ts b/apps/remixdesktop/test/tests/app/git.test.ts index 106b6707d4..9cc26be3d0 100644 --- a/apps/remixdesktop/test/tests/app/git.test.ts +++ b/apps/remixdesktop/test/tests/app/git.test.ts @@ -2,6 +2,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { + '@isogit': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { done() }, diff --git a/apps/remixdesktop/test/tests/app/offline.test.ts b/apps/remixdesktop/test/tests/app/offline.test.ts index 0a95b56d66..040e587e5e 100644 --- a/apps/remixdesktop/test/tests/app/offline.test.ts +++ b/apps/remixdesktop/test/tests/app/offline.test.ts @@ -2,6 +2,7 @@ import { NightwatchBrowser } from 'nightwatch' module.exports = { + '@offline': true, before: function (browser: NightwatchBrowser, done: VoidFunction) { done() },