From 7f73f18198e78570e8a136ce86926d475da6c80d Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Thu, 11 Sep 2025 13:42:55 +0200 Subject: [PATCH 1/3] [HAL-2030] bum dependency versions --- README.md | 6 +++ package.json | 5 ++- .../test-configuration-update-channel.cy.ts | 2 +- packages/testsuite/open-cypress.ts | 32 ++++++++------ packages/testsuite/package.json | 3 +- packages/testsuite/run-e2e-tests.ts | 43 +++++++++++-------- 6 files changed, 54 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 0974e1a11..7edb15ebd 100644 --- a/README.md +++ b/README.md @@ -54,15 +54,21 @@ npm run develop ``` - If you want to execute whole testsuite, navigate to `packages/testsuite` and from within that directory execute `npm test` + - It is also possible to run on specific browser by supplying `--browser` argument, e.g + ``` npm test -- --browser=chrome ``` + - It is also possible to reduce the amount of specs executed by passing `--specs` flag. This flag must be relative to the `packages/testsuite` directory and supports glob patterns, e.g to execute only `ejb` related tests, run + ``` npm test -- --specs="cypress/e2e/ejb/*.cy.ts" ``` + - If you wish to run the test suite against custom HAL or WildFly images, you can use `HAL_IMAGE` and `WILDFLY_IMAGE` environment variables to specify custom images, e.g + ``` HAL_IMAGE=quay.io/myorg/hal WILDFLY_IMAGE=quay.io/myorg/wildfly npm test ... ``` diff --git a/package.json b/package.json index 6f20f3230..39d529e89 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@types/portscanner": "2.1.1", "@typescript-eslint/eslint-plugin": "5.55.0", "@typescript-eslint/parser": "5.55.0", - "axios": "1.3.4", + "axios": "^1.11.0", "copyfiles": "2.4.1", "del": "7.0.0", "del-cli": "5.0.0", @@ -39,11 +39,12 @@ "mochawesome-merge": "4.3.0", "mochawesome-report-generator": "6.2.0", "prettier": "2.8.5", - "testcontainers": "10.2.1", + "testcontainers": "^10.28.0", "typedoc": "0.23.28", "typescript": "5.0.2" }, "dependencies": { + "cypress": "15.2.0", "portscanner": "2.1.1" } } diff --git a/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts b/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts index 519ce10d3..94d52ff4c 100644 --- a/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts +++ b/packages/testsuite/cypress/e2e/update-manager/test-configuration-update-channel.cy.ts @@ -86,7 +86,7 @@ describe("TESTS: Update Manager => Channels", () => { it("Update url channel parameters", () => { cy.navigateToSpecificChannel(managementEndpoint, channels.url.name); cy.editForm(channelForm); - cy.get(".tm-tag-remove").click() + cy.get(".tm-tag-remove").click(); cy.formInput(channelForm, "repositories") .type(channels.updateUrl.repositories + "{enter}") .trigger("change"); diff --git a/packages/testsuite/open-cypress.ts b/packages/testsuite/open-cypress.ts index 926014602..7ce4bcb85 100644 --- a/packages/testsuite/open-cypress.ts +++ b/packages/testsuite/open-cypress.ts @@ -1,19 +1,23 @@ import * as cypress from "cypress"; import { Berg } from "@berg/berg"; +import { result } from "cypress/types/lodash"; -(async () => { - const berg = await Berg.getInstance(); - await cypress.open({ - env: { - NETWORK_NAME: berg.getNetwork().getName(), - HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), - }, - config: { - e2e: { - baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, +Berg.getInstance().then((berg) => { + cypress + .open({ + env: { + NETWORK_NAME: berg.getNetwork().getName(), + HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), }, - }, - }); - await berg.stop(); -})(); + config: { + e2e: { + baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, + }, + }, + }) + .then((result) => { + console.log(result); + berg.stop(); + }); +}); diff --git a/packages/testsuite/package.json b/packages/testsuite/package.json index a4b68e806..ee6f2f526 100644 --- a/packages/testsuite/package.json +++ b/packages/testsuite/package.json @@ -8,6 +8,7 @@ "dependencies": { "@berg/berg": "^1.0.0", "@berg/commands": "^1.0.0", + "axios": "1.11.0", "wait-port": "^1.0.4" }, "scripts": { @@ -21,7 +22,7 @@ "@types/command-line-args": "5.2.0", "@types/mochawesome": "6.2.1", "command-line-args": "5.2.1", - "cypress": "12.8.1", + "cypress": "^15.2.0", "cypress-multi-reporters": "1.6.3", "mocha-junit-reporter": "2.2.0", "mochawesome": "7.1.3", diff --git a/packages/testsuite/run-e2e-tests.ts b/packages/testsuite/run-e2e-tests.ts index aca8da4eb..7a698d129 100644 --- a/packages/testsuite/run-e2e-tests.ts +++ b/packages/testsuite/run-e2e-tests.ts @@ -12,25 +12,30 @@ const optionDefinitions: OptionDefinition[] = [ }, ]; -(async () => { +() => { const options = commandLineArgs(optionDefinitions); console.log(options); - const berg = await Berg.getInstance(); - const testRunResult = await cypress.run({ - browser: options.browser as string, - env: { - NETWORK_NAME: berg.getNetwork().getName(), - HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), - }, - config: { - e2e: { - baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, - specPattern: (options.specs as string).split(","), - }, - }, + Berg.getInstance().then((berg) => { + cypress + .run({ + browser: options.browser as string, + env: { + NETWORK_NAME: berg.getNetwork().getName(), + HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), + }, + config: { + e2e: { + baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, + specPattern: (options.specs as string).split(","), + }, + }, + }) + .then((testRunResult) => { + berg.stop().then(() => { + // if (testRunResult.status == "failed" || testRunResult.totalFailed > 0) { + process.exit(1); + // } + }); + }); }); - await berg.stop(); - if (testRunResult.status == "failed" || testRunResult.totalFailed > 0) { - process.exit(1); - } -})(); +}; From 5000c7f462d0747a58a4f7367e0beab694d37328 Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Thu, 11 Sep 2025 14:36:58 +0200 Subject: [PATCH 2/3] [HAL-2030] use NodeJS 22 in GitHub actions --- .github/workflows/manual-test-matrix-workflow.yaml | 4 ++-- .github/workflows/on-pull-request-workflow.yaml | 2 +- .github/workflows/reusable-build-project-workflow.yaml | 2 +- .github/workflows/scheduled-run-all-tests-workflow.yaml | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/manual-test-matrix-workflow.yaml b/.github/workflows/manual-test-matrix-workflow.yaml index 00f2bec93..4ec916d07 100644 --- a/.github/workflows/manual-test-matrix-workflow.yaml +++ b/.github/workflows/manual-test-matrix-workflow.yaml @@ -50,7 +50,7 @@ jobs: - name: "Setup NodeJS" uses: actions/setup-node@v4 with: - node-version: "16" + node-version: "22" - name: "Setup JDK" uses: actions/setup-java@v4 with: @@ -91,7 +91,7 @@ jobs: - name: "Setup NodeJS" uses: actions/setup-node@v4 with: - node-version: "16" + node-version: "22" - name: "Install necessary tools" run: npm install -g copyfiles gh-pages@3.0.0 mochawesome-merge mochawesome-report-generator - name: "Generate Mochawesome Report" diff --git a/.github/workflows/on-pull-request-workflow.yaml b/.github/workflows/on-pull-request-workflow.yaml index fa5ebcc6d..f03ac0de7 100644 --- a/.github/workflows/on-pull-request-workflow.yaml +++ b/.github/workflows/on-pull-request-workflow.yaml @@ -14,7 +14,7 @@ jobs: - name: "Setup NodeJS" uses: actions/setup-node@v4 with: - node-version: "16" + node-version: "22" - name: "Setup JDK" uses: actions/setup-java@v4 with: diff --git a/.github/workflows/reusable-build-project-workflow.yaml b/.github/workflows/reusable-build-project-workflow.yaml index 01198d10d..c92100c77 100644 --- a/.github/workflows/reusable-build-project-workflow.yaml +++ b/.github/workflows/reusable-build-project-workflow.yaml @@ -16,7 +16,7 @@ jobs: - name: "Setup NodeJS" uses: actions/setup-node@v4 with: - node-version: "16" + node-version: "22" - name: "Setup JDK" uses: actions/setup-java@v4 with: diff --git a/.github/workflows/scheduled-run-all-tests-workflow.yaml b/.github/workflows/scheduled-run-all-tests-workflow.yaml index 48d35f6a2..53bead845 100644 --- a/.github/workflows/scheduled-run-all-tests-workflow.yaml +++ b/.github/workflows/scheduled-run-all-tests-workflow.yaml @@ -50,7 +50,7 @@ jobs: - name: "Setup NodeJS" uses: actions/setup-node@v4 with: - node-version: "16" + node-version: "22" - name: "Setup JDK" uses: actions/setup-java@v4 with: @@ -91,7 +91,7 @@ jobs: - name: "Setup NodeJS" uses: actions/setup-node@v4 with: - node-version: "16" + node-version: "22" - name: "Install necessary tools" run: npm install -g copyfiles gh-pages@3.0.0 mochawesome-merge mochawesome-report-generator - name: "Generate Mochawesome Report" From fa8d04e4d84c81d829ecf24445fbf5fb17be9db3 Mon Sep 17 00:00:00 2001 From: Krystof Stekovic Date: Thu, 11 Sep 2025 14:55:35 +0200 Subject: [PATCH 3/3] [HAL-2030] update a lint errors --- .../manual-test-matrix-workflow.yaml | 4 +- .../workflows/on-pull-request-workflow.yaml | 2 +- .../reusable-build-project-workflow.yaml | 4 +- .../scheduled-run-all-tests-workflow.yaml | 4 +- README.md | 6 +- package.json | 2 +- packages/testsuite/open-cypress.ts | 45 +++++++++------ packages/testsuite/run-e2e-tests.ts | 56 +++++++++++-------- 8 files changed, 73 insertions(+), 50 deletions(-) diff --git a/.github/workflows/manual-test-matrix-workflow.yaml b/.github/workflows/manual-test-matrix-workflow.yaml index 4ec916d07..d09f3e84b 100644 --- a/.github/workflows/manual-test-matrix-workflow.yaml +++ b/.github/workflows/manual-test-matrix-workflow.yaml @@ -63,7 +63,7 @@ jobs: - name: Install Firefox uses: browser-actions/setup-firefox@v1 with: - firefox-version: "latest-esr" + firefox-version: "latest" - name: "Check docker status" run: systemctl status docker - name: "Run npm install" @@ -71,7 +71,7 @@ jobs: - name: "Run compile" run: "npm run compile" - name: "Run test(s)" - run: "cd packages/testsuite && npm test -- --browser=firefox --specs=cypress/e2e/${{ matrix.specs }}" + run: "cd packages/testsuite && npx cypress run --browser=firefox --spec=cypress/e2e/${{ matrix.specs }}" - name: "Archive test report(s) and video(s)" if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 diff --git a/.github/workflows/on-pull-request-workflow.yaml b/.github/workflows/on-pull-request-workflow.yaml index f03ac0de7..ab141e08d 100644 --- a/.github/workflows/on-pull-request-workflow.yaml +++ b/.github/workflows/on-pull-request-workflow.yaml @@ -38,4 +38,4 @@ jobs: run: | cd packages/testsuite SPECS=$(echo ${{ steps.changed-files-specific.outputs.all_changed_files }} | sed "s|packages/testsuite/||g") - KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:24.0 npm run test-compiled -- --browser=chrome --specs=$SPECS + KEYCLOAK_IMAGE=quay.io/keycloak/keycloak:24.0 npx cypress run --browser=chrome --spec=$SPECS diff --git a/.github/workflows/reusable-build-project-workflow.yaml b/.github/workflows/reusable-build-project-workflow.yaml index c92100c77..bcacbc122 100644 --- a/.github/workflows/reusable-build-project-workflow.yaml +++ b/.github/workflows/reusable-build-project-workflow.yaml @@ -29,7 +29,7 @@ jobs: - name: Install Firefox uses: browser-actions/setup-firefox@v1 with: - firefox-version: "latest-esr" + firefox-version: "latest" - name: "Run npm install" run: "npm install" - name: "Run compile" @@ -39,4 +39,4 @@ jobs: run: "cd packages/testsuite && npm test" - name: "Run specific test" if: "${{ github.event.inputs.spec != '' }}" - run: "cd packages/testsuite && npm test -- --specs=${{ inputs.spec }}" + run: "cd packages/testsuite && npx cypress run --spec=${{ inputs.spec }}" diff --git a/.github/workflows/scheduled-run-all-tests-workflow.yaml b/.github/workflows/scheduled-run-all-tests-workflow.yaml index 53bead845..b6ab2dd36 100644 --- a/.github/workflows/scheduled-run-all-tests-workflow.yaml +++ b/.github/workflows/scheduled-run-all-tests-workflow.yaml @@ -63,7 +63,7 @@ jobs: - name: Install Firefox uses: browser-actions/setup-firefox@v1 with: - firefox-version: "latest-esr" + firefox-version: "latest" - name: "Check docker status" run: "systemctl status docker" - name: "Run npm install" @@ -71,7 +71,7 @@ jobs: - name: "Run compile" run: "npm run compile" - name: "Run test(s)" - run: "cd packages/testsuite && npm test -- --browser=chrome --specs=cypress/e2e/${{ matrix.specs }}/*.cy.ts" + run: "cd packages/testsuite && npx cypress run --browser=chrome --spec=cypress/e2e/${{ matrix.specs }}/*.cy.ts" - name: "Archive test report(s) and video(s)" if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 diff --git a/README.md b/README.md index 7edb15ebd..28e297ea2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ TestContainers (https://github.com/testcontainers/testcontainers-node) serves to Following tools are required to run the test suite - [NodeJS](https://nodejs.org/en/) as a runtime environment - - recommended version is 16, in other versions you can get errors like `Unable to detect compiler type` + - recommended version is 22 - [Node Version Manager (nvm)](https://github.com/nvm-sh/nvm) is recommended optional tool to install & manage multiple Node environments - [npx](https://github.com/npm/npx) CLI tool used to exeute binaries from project's `node_modules` directly (instead of providing absolute/relative path to the commannds). It is used in multiple build steps. - [Podman](https://podman.io) | [Docker](https://www.docker.com) as a container runtime used by TestContainers. Note that when using Podman as container runtime you may need to export following environment variables and start podman socket: @@ -58,13 +58,13 @@ npm run develop - It is also possible to run on specific browser by supplying `--browser` argument, e.g ``` - npm test -- --browser=chrome + npx cypress run --browser=chrome ``` - It is also possible to reduce the amount of specs executed by passing `--specs` flag. This flag must be relative to the `packages/testsuite` directory and supports glob patterns, e.g to execute only `ejb` related tests, run ``` - npm test -- --specs="cypress/e2e/ejb/*.cy.ts" + npx cypress run --spec="cypress/e2e/homepage/*.cy.ts" ``` - If you wish to run the test suite against custom HAL or WildFly images, you can use `HAL_IMAGE` and `WILDFLY_IMAGE` environment variables to specify custom images, e.g diff --git a/package.json b/package.json index 39d529e89..896f17d0f 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@typescript-eslint/parser": "5.55.0", "axios": "^1.11.0", "copyfiles": "2.4.1", + "cypress": "^15.2.0", "del": "7.0.0", "del-cli": "5.0.0", "eslint": "8.36.0", @@ -44,7 +45,6 @@ "typescript": "5.0.2" }, "dependencies": { - "cypress": "15.2.0", "portscanner": "2.1.1" } } diff --git a/packages/testsuite/open-cypress.ts b/packages/testsuite/open-cypress.ts index 7ce4bcb85..97241cbb4 100644 --- a/packages/testsuite/open-cypress.ts +++ b/packages/testsuite/open-cypress.ts @@ -1,23 +1,34 @@ import * as cypress from "cypress"; import { Berg } from "@berg/berg"; -import { result } from "cypress/types/lodash"; -Berg.getInstance().then((berg) => { - cypress - .open({ - env: { - NETWORK_NAME: berg.getNetwork().getName(), - HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), - }, - config: { - e2e: { - baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, - }, - }, +(() => { + Berg.getInstance() + .then((berg) => { + console.log("Processing the open-cypress.ts"); + console.log("Network :" + berg.getNetwork().getName()); + cypress + .open({ + env: { + NETWORK_NAME: berg.getNetwork().getName(), + HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), + }, + config: { + e2e: { + baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, + }, + }, + }) + .then(() => { + berg.stop().catch((exception) => { + console.log(exception); + }); + }) + .catch((exception) => { + console.log(exception); + }); }) - .then((result) => { - console.log(result); - berg.stop(); + .catch((exception) => { + console.log(exception); }); -}); +})(); diff --git a/packages/testsuite/run-e2e-tests.ts b/packages/testsuite/run-e2e-tests.ts index 7a698d129..f7ad62e03 100644 --- a/packages/testsuite/run-e2e-tests.ts +++ b/packages/testsuite/run-e2e-tests.ts @@ -1,5 +1,5 @@ import { Berg } from "@berg/berg"; -import * as cypress from "cypress"; +import cypress from "cypress"; import commandLineArgs from "command-line-args"; import { OptionDefinition } from "command-line-args"; @@ -14,28 +14,40 @@ const optionDefinitions: OptionDefinition[] = [ () => { const options = commandLineArgs(optionDefinitions); + console.log("Processing the run-e2e-test.ts"); console.log(options); - Berg.getInstance().then((berg) => { - cypress - .run({ - browser: options.browser as string, - env: { - NETWORK_NAME: berg.getNetwork().getName(), - HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), - }, - config: { - e2e: { - baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, - specPattern: (options.specs as string).split(","), + Berg.getInstance() + .then((berg) => { + cypress + .run({ + browser: options.browser as string, + env: { + NETWORK_NAME: berg.getNetwork().getName(), + HAL_CONTAINER_PORT: berg.getHalContainer().getMappedPort(9090), }, - }, - }) - .then((testRunResult) => { - berg.stop().then(() => { - // if (testRunResult.status == "failed" || testRunResult.totalFailed > 0) { - process.exit(1); - // } + config: { + e2e: { + baseUrl: `http://localhost:${berg.getHalContainer().getMappedPort(9090)}`, + specPattern: (options.specs as string).split(","), + }, + }, + }) + .then((testRunResult) => { + berg + .stop() + .then(() => { + console.log(testRunResult); + process.exit(1); + }) + .catch((exception) => { + console.log(exception); + }); + }) + .catch((exception) => { + console.log(exception); }); - }); - }); + }) + .catch((exception) => { + console.log(exception); + }); };