Skip to content

Commit 2f43318

Browse files
authored
Merge pull request #8 from AutomateThePlanet/ci-test
added example CI pipeline
2 parents 7e139b8 + 4565fa6 commit 2f43318

File tree

4 files changed

+36
-18
lines changed

4 files changed

+36
-18
lines changed

.github/workflows/node.js.yml

+26-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,41 @@
11
# 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
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
33

4-
name: Node.js CI
4+
name: Example Tests CI
55

66
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
711
workflow_dispatch:
812

913
jobs:
10-
build:
14+
test:
1115

1216
runs-on: ubuntu-latest
1317

1418
steps:
15-
- uses: actions/checkout@v4
16-
- name: Use Node.js 20.6
19+
- name: Checkout the repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Node.js version 20.9.0 (minumum supported)
1723
uses: actions/setup-node@v4
1824
with:
19-
node-version: 20.6
25+
node-version: 20.9.0
2026
cache: 'npm'
21-
- run: npm ci
22-
working-directory: example
23-
- run: npm test
27+
28+
- name: Install Node.js dependencies
29+
run: npm ci
30+
31+
- name: Run tests in the example directory
32+
run: npm test
33+
working-directory: ./example
34+
continue-on-error: true
35+
36+
- name: Report test results
37+
uses: dorny/[email protected]
38+
with:
39+
name: results
40+
path: './example/reports/result.xml'
41+
reporter: java-junit

@bellatrix/core/src/test/vitest.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ export function SuiteDecorator<T extends BellatrixTest>(target: ParameterlessCto
3434
const title = target.name; // or passed as @Suite('title') or similar
3535

3636
nativeLibrary.describe(title, () => {
37-
nativeLibrary.beforeAll(async () => await testClassSymbolMethods.beforeAll.call(testClassInstance));
37+
nativeLibrary.beforeAll(async () => await testClassSymbolMethods.beforeAll.call(testClassInstance), 0);
3838

3939
nativeLibrary.beforeEach(async () => {
4040
const regex = new RegExp(`.*\\b.* > ${title} > \\b(.*)`);
4141
const match = regex.exec(nativeLibrary.expect.getState().currentTestName ?? '');
4242
const currentTestName = (match?.length ?? 0) > 1 ? match![1] : '';
4343
setCurrentTest(currentTestName, testClassInstance[currentTestName as keyof T] as (...args: unknown[]) => (Promise<void> | void), testClass.constructor);
4444
await testClassSymbolMethods.beforeEach.call(testClassInstance);
45-
});
45+
}, 0);
4646

4747
nativeLibrary.afterEach(async () => {
4848
await testClassSymbolMethods.afterEach.call(testClassInstance);
4949
unsetCurrentTest(testClass.constructor);
50-
});
50+
}, 0);
5151

52-
nativeLibrary.afterAll(async () => await testClassSymbolMethods.afterAll.call(testClassInstance));
52+
nativeLibrary.afterAll(async () => await testClassSymbolMethods.afterAll.call(testClassInstance), 0);
5353

5454
for (const testMethod of testMethods) {
5555
nativeLibrary.test(testMethod, async () => {

@bellatrix/runner/bellatrix.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
console.log('DEBUG: starting bellatrix'); // DEBUG
44

55
const nodeVersion = process.versions.node.split('.');
6-
if (parseInt(nodeVersion[0].replace()) < 20 || (parseInt(nodeVersion[0]) == 20 && parseInt(nodeVersion[1]) < 6)) {
7-
throw Error(`You need Node runtime version 20.6.0 minimum. Current version: ${process.versions.node}`);
6+
if (parseInt(nodeVersion[0].replace()) < 20 || (parseInt(nodeVersion[0]) == 20 && parseInt(nodeVersion[1]) < 9)) {
7+
throw Error(`You need Node runtime version 20.9.0 minimum. Current version: ${process.versions.node}`);
88
}
99

1010
import { spawnSync } from 'child_process';

example/bellatrix.config.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const config: BellatrixConfigurationOverride = {
55
testSettings: {
66
testTimeout: 300000,
77
testFramework: 'vitest', // vitest, jasmine, mocha, jest, playwright
8-
testReporter: 'console-only',
8+
testReporter: 'junit',
99
testReportDirectory: './reports',
1010
testReportName: `result`,
1111
parallelExecution: false, // not functional yet
@@ -29,9 +29,9 @@ const config: BellatrixConfigurationOverride = {
2929
executionSettings: {
3030
browserAutomationTool: 'playwright', // playwright, selenium
3131
browser: 'edge', // chrome, firefox, safari, edge
32-
// viewport: { width: 1920, height: 1080 },
33-
startMaximized: true,
34-
headless: false,
32+
viewport: { width: 1920, height: 1080 },
33+
startMaximized: false,
34+
headless: true,
3535
executionType: 'local', // remote
3636
baseUrl: 'https://demos.bellatrix.solutions/'
3737
},

0 commit comments

Comments
 (0)