Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/manual-test-matrix-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -63,15 +63,15 @@ 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"
run: "npm install"
- 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
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/on-pull-request-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/reusable-build-project-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -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 }}"
8 changes: 4 additions & 4 deletions .github/workflows/scheduled-run-all-tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -63,15 +63,15 @@ 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"
run: "npm install"
- 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
Expand All @@ -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"
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
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

```
HAL_IMAGE=quay.io/myorg/hal WILDFLY_IMAGE=quay.io/myorg/wildfly npm test ...
```
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@
"@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",
"cypress": "^15.2.0",
"del": "7.0.0",
"del-cli": "5.0.0",
"eslint": "8.36.0",
"eslint-config-prettier": "8.7.0",
"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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
43 changes: 29 additions & 14 deletions packages/testsuite/open-cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@ import * as cypress from "cypress";

import { Berg } from "@berg/berg";

(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)}`,
},
},
});
await berg.stop();
(() => {
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);
});
})
.catch((exception) => {
console.log(exception);
});
})();
3 changes: 2 additions & 1 deletion packages/testsuite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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",
Expand Down
59 changes: 38 additions & 21 deletions packages/testsuite/run-e2e-tests.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -12,25 +12,42 @@ const optionDefinitions: OptionDefinition[] = [
},
];

(async () => {
() => {
const options = commandLineArgs(optionDefinitions);
console.log("Processing the run-e2e-test.ts");
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(","),
},
},
});
await berg.stop();
if (testRunResult.status == "failed" || testRunResult.totalFailed > 0) {
process.exit(1);
}
})();
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(() => {
console.log(testRunResult);
process.exit(1);
})
.catch((exception) => {
console.log(exception);
});
})
.catch((exception) => {
console.log(exception);
});
})
.catch((exception) => {
console.log(exception);
});
};
Loading