Skip to content

CandidateSelectionTest testsuite#249

Merged
rkrenn merged 137 commits intomasterfrom
selenium
Nov 4, 2022
Merged

CandidateSelectionTest testsuite#249
rkrenn merged 137 commits intomasterfrom
selenium

Conversation

@rkrenn
Copy link
Copy Markdown
Collaborator

@rkrenn rkrenn commented Sep 22, 2022

this is the commit for our first End-To-End testsuite based on chrome webdriver/selenium server.
it is to be executed automatically by the GitHub java CI (see "Actions" https://github.com/phoenixctms/ctsms/actions).

the first use case covered now is the "Subject Candidate Selection", as raised by AGES Inspektion KPAM 398.

Test outline:

  • create phoenix instance, preload it with generated demo data
  • setup records required for the test:
    • department
    • user
    • trial
    • inquiry form (endocrinology form used at MUG)
    • some subject criteria:
      • all subjects
      • subject with a particular disease
      • subject with a particular disease and a particular therapy
  • open the phoenix web UI in a chrome browser instance to programatically
    • log in
    • create a subject
    • fill in the inquiry form, with 50% probability for the particular disease and 50% probability for the particular therapy
    • create and fill in 9 more subjects
    • run the 3 subject criteria, and verify the results
      • number of subjects listed
      • all expected subjects listed
      • no unexpected subjects listed
  • generate a test report and send results via email

An example of the generated test report PDF is attached below. It represent the documentation mandatory for software validation in regulated environments.

Proband Tests.pdf

Feel free to contact us if you need these test report documents as well.

Summary by CodeRabbit

  • New Features
    • None; no user-facing functionality added.
  • Improvements
    • More accurate MIME type detection for uploaded/imported files, reducing file-type mismatches.
  • Refactor
    • Unified handling of ink/sketch data in generated demo content for more consistent previews.
    • Streamlined process execution for more reliable background job handling.
  • Tests
    • New end-to-end UI test suite with HTML reports and optional email delivery to improve release confidence.
  • Chores
    • CI/CD upgrades, including newer GitHub Actions, ChromeDriver update, environment-preserving scripts, and modernized Selenium test flow.

@rkrenn rkrenn merged commit c2ba4cd into master Nov 4, 2022
@rkrenn rkrenn mentioned this pull request Nov 24, 2023
@rkrenn
Copy link
Copy Markdown
Collaborator Author

rkrenn commented Aug 20, 2025

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Updates CI workflows and scripts, refactors Selenium testing to Maven/TestNG with new helpers, introduces email reporting, adds utility classes (MIME detection, zipping, randomization, ink strokes), migrates MIME type logic from ExecUtil to CommonUtil, adjusts Tomcat setup, updates POMs, and adds comprehensive Selenium tests and Spring test configuration.

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/build.yml, .github/workflows/test.yml
Upgrade actions (checkout/cache), adjust Maven flags, introduce test metadata handling, preserve env with sudo -E, refactor Selenium steps, add demo data load, tweak email from-name.
Workflow Scripts
.github/workflows/init_database.sh, .github/workflows/setup_selenium.sh, .github/workflows/setup_tomcat.sh, .github/workflows/run_selenium_test.sh, .github/workflows/dbtool.sh
Use sudo -E, update ChromeDriver, comment Selenium server download, modify Tomcat unit (EnvironmentFile, ReadWritePaths), switch Selenium run to Maven Surefire with properties, comment CTSMS_* defaults; potential undefined VERSION/COMMIT in some scripts.
Removed Legacy Scripts
.github/workflows/seleniumtest.pl, core/src/test/java/.../testChrome.java
Delete Perl and simple Java Selenium test entry points.
Common Utilities and Dependencies
common/pom.xml, common/src/main/java/org/phoenixctms/ctsms/util/CommonUtil.java, common/src/main/java/org/phoenixctms/ctsms/util/Compress.java
Rework Batik deps, add javax.mail and tika-core; add MIME detection via Tika; add ZIP utility class.
Test Utility Classes
common/src/main/java/org/phoenixctms/ctsms/test/*
Add InkStroke, Random helper, and marker interfaces (InputFieldsEnum, InputFieldValuesEnum, SearchCriteriaEnum).
Core Exec Refactors
core/src/exec/java/.../DemoDataProvider.java
Replace inner Stroke with InkStroke; adopt Random; implement enum marker interfaces; switch MIME detection to CommonUtil; adjust method signatures accordingly.
MIME Type Migration
core/src/exec/java/.../FileSystemLoader.java, .../xls/InputFieldRowProcessor.java, core/src/exec/java/.../ExecUtil.java
Move MIME detection from ExecUtil to CommonUtil; remove ExecUtil MIME methods and Tika imports.
Process Management
core/src/main/java/.../CoreUtil.java
Add runProcess helpers and refactor launchJob to delegate.
Email Output Refactor
core/src/exec/java/.../JobOutput.java, common/src/main/java/org/phoenixctms/ctsms/test/JobEmailSenderBase.java
Introduce JobEmailSenderBase and make JobOutput extend it; centralize attachment handling and multipart preparation.
Selenium Test Framework
core/src/test/java/.../SeleniumTestBase.java, core/src/test/java/.../proband/CandidateSelectionTest.java, core/src/test/java/.../test/CustomReport.java, core/src/test/java/.../test/OutputLogger.java, core/src/test/java/.../test/ReportEmailSender.java
Add TestNG-based Selenium base class, comprehensive proband workflow test, custom HTML report, logging interface, and email sender for reports.
Test Spring Config
core/src/test/resources/applicationContextTest.xml, core/src/test/resources/applicationContext-localTestDataSource.xml, core/src/test/resources/log4j.properties
Add mail sender beans, autowiring, properties; adjust datasource comments; enhance logging (selenium logger, console).
Build Configs
pom.xml, core/pom.xml
Comment out several test deps; switch Tomcat plugin to tomcat7-maven-plugin; configure Surefire reports directory; adjust Selenium test dependency in core; ignore core/test-output in git.
Minor Code Cleanups
common/src/main/java/.../BundleControl.java, web/src/main/java/.../Application.java, core/.gitignore
Whitespace/import reorder; comment note; ignore test-output directory.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant GH as GitHub Actions
  participant VM as Runner VM
  participant Tomcat as Tomcat9 Service
  participant DB as PostgreSQL
  participant App as CTMS App
  participant Tests as Maven Surefire Tests
  participant Mail as SMTP

  GH->>VM: Checkout repo (actions/checkout@v3)
  GH->>VM: Setup JDK, cache Maven
  GH->>VM: Build (mvn install -DskipTests --no-transfer-progress)
  GH->>VM: Init DB (init_database.sh via sudo -E)
  GH->>VM: Setup Tomcat (setup_tomcat.sh)
  VM->>Tomcat: systemctl daemon-reload + start
  GH->>VM: Load demo data (dbtool.sh -ldd -f)
  GH->>Tests: run_selenium_test.sh (mvn surefire:test with -D props)
  Tests->>App: UI automation (ChromeDriver)
  Tests-->>Mail: Send report email (optional, via JavaMail)
Loading
sequenceDiagram
  autonumber
  participant Test as SeleniumTestBase
  participant Spring as Spring Context
  participant Reporter as CustomReport
  participant Email as ReportEmailSender
  participant SMTP as Mail Server

  Test->>Spring: load applicationContextTest.xml
  Test->>Test: execute @Test methods
  Test->>Reporter: aggregate results
  Test->>Email: add attachments (HTML/PDF, ZIP)
  alt recipients present
    Email->>SMTP: send(subject, multipart)
  else no recipients
    Email-->>Test: skip sending
  end
Loading
sequenceDiagram
  autonumber
  participant DDP as DemoDataProvider
  participant Rand as Random
  participant Ink as InkStroke
  participant Util as CommonUtil

  DDP->>Rand: getRandomDate/Boolean/Element/Long/Float
  DDP->>Ink: new InkStroke(color, path, value)
  DDP->>Util: getMimeType(file|bytes)
  DDP->>DDP: createSketchField/addInkRegions (using InkStroke)
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested reviewers

  • 01hasenberger

Poem

A rabbit taps keys in a Selenium dream,
New strokes of ink join the testing stream.
Tomcat wakes, reports take flight,
MIME finds types by Common’s light.
Random hops through fields anew—
CI hums, the carrots grew. 🥕✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.38.6)
common/src/main/java/org/phoenixctms/ctsms/util/CommonUtil.java
core/src/exec/java/org/phoenixctms/ctsms/executable/DemoDataProvider.java

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 393d851 and d004687.

📒 Files selected for processing (38)
  • .github/workflows/build.yml (2 hunks)
  • .github/workflows/dbtool.sh (1 hunks)
  • .github/workflows/init_database.sh (1 hunks)
  • .github/workflows/run_selenium_test.sh (1 hunks)
  • .github/workflows/seleniumtest.pl (0 hunks)
  • .github/workflows/setup_selenium.sh (1 hunks)
  • .github/workflows/setup_tomcat.sh (1 hunks)
  • .github/workflows/test.yml (5 hunks)
  • common/pom.xml (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/test/InkStroke.java (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/test/InputFieldValuesEnum.java (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/test/InputFieldsEnum.java (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/test/JobEmailSenderBase.java (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/test/Random.java (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/test/SearchCriteriaEnum.java (1 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/util/BundleControl.java (0 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/util/CommonUtil.java (4 hunks)
  • common/src/main/java/org/phoenixctms/ctsms/util/Compress.java (1 hunks)
  • core/.gitignore (1 hunks)
  • core/pom.xml (3 hunks)
  • core/src/exec/java/org/phoenixctms/ctsms/executable/DemoDataProvider.java (59 hunks)
  • core/src/exec/java/org/phoenixctms/ctsms/executable/FileSystemLoader.java (1 hunks)
  • core/src/exec/java/org/phoenixctms/ctsms/executable/xls/InputFieldRowProcessor.java (1 hunks)
  • core/src/exec/java/org/phoenixctms/ctsms/util/ExecUtil.java (0 hunks)
  • core/src/exec/java/org/phoenixctms/ctsms/util/JobOutput.java (6 hunks)
  • core/src/main/java/org/phoenixctms/ctsms/util/CoreUtil.java (2 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/selenium/SeleniumTestBase.java (1 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/selenium/proband/CandidateSelectionTest.java (1 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/selenium/testChrome.java (0 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/test/CustomReport.java (1 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/test/OutputLogger.java (1 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/test/ReportEmailSender.java (1 hunks)
  • core/src/test/java/org/phoenixctms/ctsms/test/SearchCriterion.java (1 hunks)
  • core/src/test/resources/applicationContext-localTestDataSource.xml (2 hunks)
  • core/src/test/resources/applicationContextTest.xml (1 hunks)
  • core/src/test/resources/log4j.properties (1 hunks)
  • pom.xml (6 hunks)
  • web/src/main/java/org/phoenixctms/ctsms/web/jersey/Application.java (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch selenium

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

1 participant