Skip to content

refactor: centralize module testing#98

Merged
andre8244 merged 3 commits into
mainfrom
copilot/refactor-centralize-module-testing
May 4, 2026
Merged

refactor: centralize module testing#98
andre8244 merged 3 commits into
mainfrom
copilot/refactor-centralize-module-testing

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

Migrates to the NS8 standard testing infrastructure via NethServer/ns8-github-actions reusable workflows, replacing the bespoke test-module.sh-based setup.

Changes

  • .github/workflows/test-module.yml — replaced with reusable workflow call (ns8-github-actions/.github/workflows/test-module.yml@v1), ui_tests_strategy: always
  • tests/15_ui.robot — new UI screenshot test; runs after install (10_install_mail.robot) and before functional tests (20_imapsync.robot), using the ${MID} global variable set during install
  • test-module.sh — deleted
  • tests/pythonreq.txt — deleted
  • .gitignore — added tests/outputs/
  • README.md## Testing section replaced with ## Running tests locally pointing to the ns8-github-actions docs

Ref: NethServer/dev#7281

Original prompt

refactor: centralize module testing

Ref:

Please make the following changes:

1. Replace .github/workflows/test-module.yml

Replace the entire content of .github/workflows/test-module.yml with:

name: Test module

on:
  workflow_dispatch:
    inputs:
      debug_shell:
        description: "Debug shell"
        required: true
        type: boolean
  workflow_run:
    workflows: ["Publish images"]
    types: [completed]

jobs:
  run:
    name: "Run tests"
    uses: NethServer/ns8-github-actions/.github/workflows/test-module.yml@v1
    with:
      ui_tests_strategy: always
      debug_shell: ${{ github.event.inputs.debug_shell == 'true' }}
    secrets:
      do_token: ${{ secrets.do_token }}

(Note: ui_tests_strategy: always must be at line 19.)

2. Update .gitignore

Add tests/outputs/ to .gitignore if it's not already present.

3. Update README.md

Replace the existing ## Testing section (currently contains references to test-module.sh and Robot Framework) with the following section. Use ## Running tests locally as the new header:

## Running tests locally

This module uses the NS8 standard testing infrastructure. For instructions on how to run the test suite locally, refer to the [Running tests locally](https://github.com/NethServer/ns8-github-actions/blob/v1/README.md#running-tests-locally) section of the ns8-github-actions repository.

4. Delete test-module.sh

Delete the file test-module.sh from the root of the repository.

5. Delete tests/pythonreq.txt

Delete the file tests/pythonreq.txt.

6. Add UI tests robot file

The file ui/src/App.vue exists, so UI tests must be added.

The tests directory has multiple robot files (excluding __init__.robot):

  • tests/10_install_mail.robot — installs the module (contains add-module), uses Set Global Variable ${MID} ${output.module_id}
  • tests/20_imapsync.robot — tests imapsync
  • tests/90_uninstall.robot — uninstalls

Robot files use single underscore naming (e.g. 10_install_mail.robot).

Create a new file tests/15_ui.robot for UI tests. The module ID variable is ${MID} (set as a Global Variable in 10_install_mail.robot).

The content of tests/15_ui.robot should be:

*** Settings ***
Library           Browser

*** Variables ***
${ADMIN_USER}    admin
${ADMIN_PASSWORD}    Nethesis,1234
${MID}    ${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/1._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/2._Settings.png
    Close Browser

Commit message

Use refactor: centralize module testing as the commit message.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Create a PR for the following repositories:

  • Nethserver/ns8-ejabberd
  • Nethserver/ns8-imapsync

PR title and commit message are "refactor: centralize module testing"

PR description is the following:
Ref:

The changes to perform are the following:

This pull request was created from Copilot chat.

Agent-Logs-Url: https://github.com/NethServer/ns8-imapsync/sessions/00434d5a-2625-4ff3-8747-eb837cea25f3

Co-authored-by: andre8244 <4612169+andre8244@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor: centralize module testing refactor: centralize module testing May 4, 2026
Copilot AI requested a review from andre8244 May 4, 2026 08:12
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

UI Test Screenshots rl1

1. Status

1._Status.png

2. Settings

2._Settings.png

@andre8244 andre8244 force-pushed the copilot/refactor-centralize-module-testing branch from e4da26c to e0afeec Compare May 4, 2026 11:36
@andre8244 andre8244 marked this pull request as ready for review May 4, 2026 11:39
@andre8244 andre8244 merged commit dbe904f into main May 4, 2026
3 of 5 checks passed
@andre8244 andre8244 deleted the copilot/refactor-centralize-module-testing branch May 4, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants