From 8a24c10cd26531a9518a5352fa912898491504a6 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:11:54 +0200 Subject: [PATCH 01/17] prepare config for CI --- example/bellatrix.config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/example/bellatrix.config.ts b/example/bellatrix.config.ts index 48d6ed3..3fd98f7 100644 --- a/example/bellatrix.config.ts +++ b/example/bellatrix.config.ts @@ -5,7 +5,7 @@ const config: BellatrixConfigurationOverride = { testSettings: { testTimeout: 300000, testFramework: 'vitest', // vitest, jasmine, mocha, jest, playwright - testReporter: 'console-only', + testReporter: 'junit', testReportDirectory: './reports', testReportName: `result`, parallelExecution: false, // not functional yet @@ -29,9 +29,9 @@ const config: BellatrixConfigurationOverride = { executionSettings: { browserAutomationTool: 'playwright', // playwright, selenium browser: 'edge', // chrome, firefox, safari, edge - // viewport: { width: 1920, height: 1080 }, - startMaximized: true, - headless: false, + viewport: { width: 1920, height: 1080 }, + startMaximized: false, + headless: true, executionType: 'local', // remote baseUrl: 'https://demos.bellatrix.solutions/' }, From f6d8f02178a0804f60248344c8816c76c761ff7c Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:19:40 +0200 Subject: [PATCH 02/17] added workflow to ci-test --- .github/workflows/node.js.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..6b0f3d8 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,23 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + workflow_dispatch: + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.6 + uses: actions/setup-node@v4 + with: + node-version: 20.6 + cache: 'npm' + - run: npm ci + working-directory: example + - run: npm test \ No newline at end of file From 3fde99430986df8a9b255042ee9084ca8a585da7 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:22:45 +0200 Subject: [PATCH 03/17] Debug --- .github/workflows/node.js.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 6b0f3d8..a822d1b 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,6 +18,7 @@ jobs: with: node-version: 20.6 cache: 'npm' + - run: ls - run: npm ci working-directory: example - - run: npm test \ No newline at end of file + - run: npm test From eaf39c5fb2d1536ffd5d0c14cc83db16a3eba132 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:30:46 +0200 Subject: [PATCH 04/17] changed npm ci to npm i --- .github/workflows/node.js.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index a822d1b..9e32a13 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,7 +18,6 @@ jobs: with: node-version: 20.6 cache: 'npm' - - run: ls - - run: npm ci + - run: npm i working-directory: example - run: npm test From 2bf629a13c33ace1f4ab2946b9bc0cd210709194 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:34:02 +0200 Subject: [PATCH 05/17] Update node.js.yml --- .github/workflows/node.js.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 9e32a13..7807011 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -13,11 +13,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js 20.6 + - name: Use Node.js 20.6.0 uses: actions/setup-node@v4 with: - node-version: 20.6 + node-version: 20.6.0 cache: 'npm' - - run: npm i + - run: npm clean-install --legacy-peer-deps working-directory: example - run: npm test From 8cfbd2d517e747e0e1f2b75ba5de23eb6472d5eb Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:35:29 +0200 Subject: [PATCH 06/17] changed clean-install to install --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7807011..5d8884a 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,6 +18,6 @@ jobs: with: node-version: 20.6.0 cache: 'npm' - - run: npm clean-install --legacy-peer-deps + - run: npm install --legacy-peer-deps working-directory: example - run: npm test From fdd6baba6fa927ab90475a9a4ded4229c651df47 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:39:05 +0200 Subject: [PATCH 07/17] change example folder place --- .github/workflows/node.js.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 5d8884a..45cdd8a 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,6 +18,6 @@ jobs: with: node-version: 20.6.0 cache: 'npm' - - run: npm install --legacy-peer-deps - working-directory: example + - run: npm install - run: npm test + working-directory: ./example From 107a606bc67e619b469d050d159d2a25b6248442 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:39:28 +0200 Subject: [PATCH 08/17] change npm i to ci --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 45cdd8a..2440cb8 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,6 +18,6 @@ jobs: with: node-version: 20.6.0 cache: 'npm' - - run: npm install + - run: npm ci - run: npm test working-directory: ./example From 8b5f5d6aebedd02d5258a82e0b7f306faa066e5c Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:42:54 +0200 Subject: [PATCH 09/17] changed playwright to selenium --- example/bellatrix.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/bellatrix.config.ts b/example/bellatrix.config.ts index 3fd98f7..2d6f958 100644 --- a/example/bellatrix.config.ts +++ b/example/bellatrix.config.ts @@ -27,7 +27,7 @@ const config: BellatrixConfigurationOverride = { delayBeforeAction: 0, }, executionSettings: { - browserAutomationTool: 'playwright', // playwright, selenium + browserAutomationTool: 'selenium', // playwright, selenium browser: 'edge', // chrome, firefox, safari, edge viewport: { width: 1920, height: 1080 }, startMaximized: false, From 0be7dfb284e9a27172f6900e63fbf18f7756b2a0 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:49:06 +0200 Subject: [PATCH 10/17] disabled default hook timeouts --- @bellatrix/core/src/test/vitest.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/@bellatrix/core/src/test/vitest.ts b/@bellatrix/core/src/test/vitest.ts index d7f29d2..1d5a6ad 100644 --- a/@bellatrix/core/src/test/vitest.ts +++ b/@bellatrix/core/src/test/vitest.ts @@ -34,7 +34,7 @@ export function SuiteDecorator(target: ParameterlessCto const title = target.name; // or passed as @Suite('title') or similar nativeLibrary.describe(title, () => { - nativeLibrary.beforeAll(async () => await testClassSymbolMethods.beforeAll.call(testClassInstance)); + nativeLibrary.beforeAll(async () => await testClassSymbolMethods.beforeAll.call(testClassInstance), 0); nativeLibrary.beforeEach(async () => { const regex = new RegExp(`.*\\b.* > ${title} > \\b(.*)`); @@ -42,14 +42,14 @@ export function SuiteDecorator(target: ParameterlessCto const currentTestName = (match?.length ?? 0) > 1 ? match![1] : ''; setCurrentTest(currentTestName, testClassInstance[currentTestName as keyof T] as (...args: unknown[]) => (Promise | void), testClass.constructor); await testClassSymbolMethods.beforeEach.call(testClassInstance); - }); + }, 0); nativeLibrary.afterEach(async () => { await testClassSymbolMethods.afterEach.call(testClassInstance); unsetCurrentTest(testClass.constructor); - }); + }, 0); - nativeLibrary.afterAll(async () => await testClassSymbolMethods.afterAll.call(testClassInstance)); + nativeLibrary.afterAll(async () => await testClassSymbolMethods.afterAll.call(testClassInstance), 0); for (const testMethod of testMethods) { nativeLibrary.test(testMethod, async () => { From 2a2f0f4e0d532c5a6bc484e8df7ed8252448020a Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 15:54:39 +0200 Subject: [PATCH 11/17] changed to playwright --- example/bellatrix.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/bellatrix.config.ts b/example/bellatrix.config.ts index 2d6f958..3fd98f7 100644 --- a/example/bellatrix.config.ts +++ b/example/bellatrix.config.ts @@ -27,7 +27,7 @@ const config: BellatrixConfigurationOverride = { delayBeforeAction: 0, }, executionSettings: { - browserAutomationTool: 'selenium', // playwright, selenium + browserAutomationTool: 'playwright', // playwright, selenium browser: 'edge', // chrome, firefox, safari, edge viewport: { width: 1920, height: 1080 }, startMaximized: false, From d17458470d3c087acbaa936671f369a198d8261b Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 16:04:21 +0200 Subject: [PATCH 12/17] Update node.js.yml --- .github/workflows/node.js.yml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2440cb8..95e1d63 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,23 +1,36 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: Node.js CI +name: Example Tests CI on: workflow_dispatch: jobs: - build: + test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Use Node.js 20.6.0 + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Set up Node.js version 20.9.0 (minumum supported) uses: actions/setup-node@v4 with: - node-version: 20.6.0 + node-version: 20.9.0 cache: 'npm' - - run: npm ci - - run: npm test + + - name: Install Node.js dependencies + run: npm ci + + - name: Run tests in the example directory + run: npm test working-directory: ./example + + - name: Report test results + uses: dorny/test-reporter@v1.9.1 + with: + name: Example Tests + path: './example/reports/result.xml' + reporter: java-junit From 4729e1b50bb9d20321b90f142f82999d86f90780 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 16:05:03 +0200 Subject: [PATCH 13/17] updated minimum supported NPM version (eslint dependency) --- @bellatrix/runner/bellatrix.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/@bellatrix/runner/bellatrix.js b/@bellatrix/runner/bellatrix.js index 5546bc9..9addb1c 100755 --- a/@bellatrix/runner/bellatrix.js +++ b/@bellatrix/runner/bellatrix.js @@ -3,8 +3,8 @@ console.log('DEBUG: starting bellatrix'); // DEBUG const nodeVersion = process.versions.node.split('.'); -if (parseInt(nodeVersion[0].replace()) < 20 || (parseInt(nodeVersion[0]) == 20 && parseInt(nodeVersion[1]) < 6)) { - throw Error(`You need Node runtime version 20.6.0 minimum. Current version: ${process.versions.node}`); +if (parseInt(nodeVersion[0].replace()) < 20 || (parseInt(nodeVersion[0]) == 20 && parseInt(nodeVersion[1]) < 9)) { + throw Error(`You need Node runtime version 20.9.0 minimum. Current version: ${process.versions.node}`); } import { spawnSync } from 'child_process'; From e75d02379f3b6fc9ec359a7d9c4af3bf29b4e399 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 16:08:14 +0200 Subject: [PATCH 14/17] updated name for consistency --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 95e1d63..afed40c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -31,6 +31,6 @@ jobs: - name: Report test results uses: dorny/test-reporter@v1.9.1 with: - name: Example Tests + name: results path: './example/reports/result.xml' reporter: java-junit From 5c1ebb7f9dcf78a5da8e622b5e8a915d9407855e Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 16:10:41 +0200 Subject: [PATCH 15/17] selenium test --- example/bellatrix.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/bellatrix.config.ts b/example/bellatrix.config.ts index 3fd98f7..2d6f958 100644 --- a/example/bellatrix.config.ts +++ b/example/bellatrix.config.ts @@ -27,7 +27,7 @@ const config: BellatrixConfigurationOverride = { delayBeforeAction: 0, }, executionSettings: { - browserAutomationTool: 'playwright', // playwright, selenium + browserAutomationTool: 'selenium', // playwright, selenium browser: 'edge', // chrome, firefox, safari, edge viewport: { width: 1920, height: 1080 }, startMaximized: false, From a0605f40ea2321decd67d7738e8cec81b4323a79 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 16:11:10 +0200 Subject: [PATCH 16/17] revert to playwright --- example/bellatrix.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/bellatrix.config.ts b/example/bellatrix.config.ts index 2d6f958..3fd98f7 100644 --- a/example/bellatrix.config.ts +++ b/example/bellatrix.config.ts @@ -27,7 +27,7 @@ const config: BellatrixConfigurationOverride = { delayBeforeAction: 0, }, executionSettings: { - browserAutomationTool: 'selenium', // playwright, selenium + browserAutomationTool: 'playwright', // playwright, selenium browser: 'edge', // chrome, firefox, safari, edge viewport: { width: 1920, height: 1080 }, startMaximized: false, From 7b69b4ef198a14eccfcf8e9bc4424d7974d07a51 Mon Sep 17 00:00:00 2001 From: Teodor Nikolov Date: Mon, 27 Jan 2025 16:22:56 +0200 Subject: [PATCH 17/17] updated pipeline to run on pull request and to report all test results --- .github/workflows/node.js.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index afed40c..9d46ca5 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -4,6 +4,10 @@ name: Example Tests CI on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] workflow_dispatch: jobs: @@ -27,6 +31,7 @@ jobs: - name: Run tests in the example directory run: npm test working-directory: ./example + continue-on-error: true - name: Report test results uses: dorny/test-reporter@v1.9.1