From 5c474ac0049bf56ad0ce2ad94aede3dcceb78d0b Mon Sep 17 00:00:00 2001 From: Andrea Leardini Date: Fri, 10 Apr 2026 13:47:32 +0200 Subject: [PATCH 01/12] feat: centralize module testing --- .github/workflows/test-module.yml | 40 +++---------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test-module.yml b/.github/workflows/test-module.yml index 8e653cdd..bed0af08 100644 --- a/.github/workflows/test-module.yml +++ b/.github/workflows/test-module.yml @@ -12,43 +12,9 @@ on: types: [completed] jobs: - module: - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == '' }} - uses: NethServer/ns8-github-actions/.github/workflows/module-info.yml@v1 - - chooser: - runs-on: ubuntu-latest - outputs: - node_a: ${{ steps.pick.outputs.node_a }} - node_b: ${{ steps.pick.outputs.node_b }} - steps: - - id: pick - run: | - if (( $GITHUB_RUN_NUMBER % 2 )); then - echo "node_a=rl1" >> "$GITHUB_OUTPUT" - echo "node_b=dn1" >> "$GITHUB_OUTPUT" - else - echo "node_a=dn1" >> "$GITHUB_OUTPUT" - echo "node_b=rl1" >> "$GITHUB_OUTPUT" - fi - - run_tests: - needs: [module, chooser] - strategy: - fail-fast: false - matrix: - scenario: [install, update] - uses: NethServer/ns8-github-actions/.github/workflows/test-on-digitalocean-infra.yml@v1 + run: + uses: NethServer/ns8-github-actions/.github/workflows/test-module.yml@refactor-testing with: - coremodules: ${{ matrix.scenario == 'install' && format('ghcr.io/{0}/{1}:{2}', needs.module.outputs.owner, needs.module.outputs.name, needs.module.outputs.tag) || '' }} - leader_nodes: >- - ${{ - matrix.scenario == 'install' - && needs.chooser.outputs.node_a - || needs.chooser.outputs.node_b - }} - args: ${{ format('ghcr.io/{0}/{1}:{2} -v SCENARIO:{3}', needs.module.outputs.owner, needs.module.outputs.name, needs.module.outputs.tag, matrix.scenario) }} - repo_ref: ${{ needs.module.outputs.sha }} - debug_shell: ${{ github.event.inputs.debug_shell == 'true' || false }} + debug_shell: ${{ github.event.inputs.debug_shell == 'true' }} secrets: do_token: ${{ secrets.do_token }} From 6a6620aeb48b0d947cfe5d27a16d935f336c3e4e Mon Sep 17 00:00:00 2001 From: Andrea Leardini Date: Fri, 10 Apr 2026 15:15:15 +0200 Subject: [PATCH 02/12] fix: add ui tests --- test-module.sh | 38 +------------------------------------- tests/15_ui.robot | 34 ++++++++++++++++++++++++++++++++++ ui/src/views/About.vue | 1 + 3 files changed, 36 insertions(+), 37 deletions(-) create mode 100644 tests/15_ui.robot diff --git a/test-module.sh b/test-module.sh index 563b6953..0e7220bb 100755 --- a/test-module.sh +++ b/test-module.sh @@ -5,40 +5,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later # -set -e -a - -SSH_KEYFILE=${SSH_KEYFILE:-$HOME/.ssh/id_rsa} - -LEADER_NODE="${1:?missing LEADER_NODE argument}" -IMAGE_URL="${2:?missing IMAGE_URL argument}" -shift 2 - -ssh_key="$(< $SSH_KEYFILE)" -venvroot=/usr/local/venv - -podman run -i \ - --volume=.:/srv/source:z \ - --volume=rftest-cache:${venvroot}:z \ - --replace --name=rftest \ - --env=ssh_key \ - --env=venvroot \ - --env=LEADER_NODE \ - --env=IMAGE_URL \ - docker.io/python:3.11-alpine \ - ash -l -s -- "${@}" <<'EOF' -set -e -echo "$ssh_key" > /tmp/idssh -if [ ! -x ${venvroot}/bin/robot ] ; then - python3 -mvenv ${venvroot} --upgrade - ${venvroot}/bin/pip3 install -q -r /srv/source/tests/pythonreq.txt -fi -cd /srv/source -mkdir -vp tests/outputs/ -exec ${venvroot}/bin/robot \ - -v NODE_ADDR:${LEADER_NODE} \ - -v IMAGE_URL:${IMAGE_URL} \ - -v SSH_KEYFILE:/tmp/idssh \ - --name mail \ - --skiponfailure unstable \ - -d tests/outputs "${@}" tests/ -EOF +echo "Local test file to be removed ////" diff --git a/tests/15_ui.robot b/tests/15_ui.robot new file mode 100644 index 00000000..db080d4c --- /dev/null +++ b/tests/15_ui.robot @@ -0,0 +1,34 @@ +*** Settings *** +Library Browser + +*** Variables *** +${ADMIN_USER} admin +${ADMIN_PASSWORD} Nethesis,1234 +${MODULE_ID} ${EMPTY} + +*** Keywords *** + +Login to cluster-admin + New Page https://${NODE_ADDR}/cluster-admin/ + Fill Text text="Username" ${ADMIN_USER} + Click button >> text="Continue" + Fill Text text="Password" ${ADMIN_PASSWORD} + Click button >> text="Log in" + Wait For Elements State css=#main-content visible timeout=10s + +*** Test Cases *** + +Take screenshots + [Tags] ui + New Browser chromium headless=True + New Context ignoreHTTPSErrors=True + Login to cluster-admin + Go To https://${NODE_ADDR}/cluster-admin/#/apps/${MID} + Wait For Elements State iframe >>> h2 >> text="Status" visible timeout=10s + Sleep 5s + Take Screenshot filename=${OUTPUT DIR}/browser/screenshot/status.png + Go To https://${NODE_ADDR}/cluster-admin/#/apps/${MID}?page=settings + Wait For Elements State iframe >>> h2 >> text="Settings" visible timeout=10s + Sleep 5s + Take Screenshot filename=${OUTPUT DIR}/browser/screenshot/settings.png + Close Browser diff --git a/ui/src/views/About.vue b/ui/src/views/About.vue index ea839077..078e2945 100644 --- a/ui/src/views/About.vue +++ b/ui/src/views/About.vue @@ -3,6 +3,7 @@ SPDX-License-Identifier: GPL-3.0-or-later -->