Skip to content
Merged
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
264 changes: 264 additions & 0 deletions .github/workflows/dataverse_jsf_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
name: Dataverse JSF Frontend Tests Workflow

on:
workflow_dispatch:
push:
branches:
- develop
- master
paths-ignore:
- "doc/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
- ".github/*.md"
pull_request:
branches:
- develop
- master
paths-ignore:
- "doc/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
- ".github/*.md"

concurrency:
group: "dataverse-jsf-frontend-tests-${{ github.ref }}"
cancel-in-progress: true

jobs:
main-jsf-tests-workflow:
runs-on: ubuntu-latest
timeout-minutes: 90

defaults:
run:
shell: bash

permissions:
contents: read

steps:

# ---------------------------
# CHECKOUT
# ---------------------------
- name: Checkout repository
uses: actions/checkout@v7
# ---------------------------
# VERIFY DOCKER
# ---------------------------
- name: Verify Docker
run: |
set -euo pipefail
docker version

# ---------------------------
# SETUP JAVA + MAVEN
# ---------------------------
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
cache: "maven"

- name: Verify Maven
run: |
set -euo pipefail
mvn -version

# ---------------------------
# BUILD IMAGES (Dataverse-native)
# ---------------------------
- name: Build Dataverse containers via Maven
run: |
set -euo pipefail
mvn -Pct -T 1C package

# ---------------------------
# START CONTAINERS (BACKGROUND)
# ---------------------------
- name: Start Dataverse stack
run: |
set -euo pipefail
mvn -Pct docker:start \
-Ddataverse.feature.index-harvested-metadata-source=true \
-Ddataverse.oai.server.maxidentifiers=2 \
-Ddataverse.oai.server.maxrecords=2

# ---------------------------
# WAIT FOR API READINESS
# ---------------------------
- name: Wait for Dataverse API readiness
run: |
set -euo pipefail
URL="http://localhost:8080/api/info/version"
MAX_ATTEMPTS=10
SLEEP_TIME=15
echo "Waiting for Dataverse readiness..."
for attempt in $(seq 1 $MAX_ATTEMPTS); do
echo "Attempt $attempt..."
RESPONSE=$(curl -s --max-time 15 "$URL" || true)
STATUS=$(echo "$RESPONSE" | jq -r '.status' 2>/dev/null || echo "NOT_READY")
if [ "$STATUS" = "OK" ]; then
echo "Dataverse endpoint is READY."
echo "Waiting 30 more seconds for full readiness..."
sleep 30
echo "Response: $RESPONSE"
exit 0
fi
echo "Not ready. Sleeping ${SLEEP_TIME}s..."
sleep $SLEEP_TIME
if [ $SLEEP_TIME -lt 60 ]; then
SLEEP_TIME=$((SLEEP_TIME * 2))
if [ $SLEEP_TIME -gt 60 ]; then
SLEEP_TIME=60
fi
fi
done
echo "Dataverse failed to become ready."
docker ps
CONTAINERS="$(docker ps -aq)"
if [ -n "$CONTAINERS" ]; then
for cid in $CONTAINERS; do
echo "===== Logs for container $cid ====="
docker logs "$cid" || true
done
else
echo "No running containers to show logs for."
fi
exit 1

# ---------------------------
# MAP LOCALSTACK TO LOCALHOST
# ---------------------------
- name: Map localstack to localhost for Maven tests
run: echo "127.0.0.1 localstack" | sudo tee -a /etc/hosts

# ---------------------------
# CONFIGURE DATAVERSE FOR TESTS
# ---------------------------
- name: Configure Dataverse API Settings
run: |
set -euo pipefail

echo "Setting API Database Settings via internal container curl..."

declare -A settings=(
[":BuiltinUsersKey"]="burrito"
[":ProvCollectionEnabled"]="true"
[":AllowApiTokenLookupViaApi"]="true"
[":AllowSignUp"]="true"
)
for key in "${!settings[@]}"; do
echo "Setting $key..."
docker exec dev_dataverse curl --fail-with-body -sS -X PUT -d "${settings[$key]}" "http://localhost:8080/api/admin/settings/$key"
echo ""
done

# ---------------------------
# PRE-TEST INJECTIONS
# ---------------------------
- name: Put SUSHI config file in place
run: |
set -euo pipefail

SOURCE_FILE="${{ github.workspace }}/src/test/java/edu/harvard/iq/dataverse/makedatacount/sushi_sample_logs.json"

echo "Injecting local file into container..."
docker exec -i dev_dataverse sh -c "cat > /tmp/sushi_sample_logs.json" < "$SOURCE_FILE"

docker exec dev_dataverse ls -l /tmp/sushi_sample_logs.json
docker exec dev_dataverse head -n 5 /tmp/sushi_sample_logs.json

# ---------------------------
# SETUP NODE.JS
# ---------------------------
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"

# ---------------------------
# CHECKOUT dataverse-jsf-tests
# ---------------------------
- name: Checkout dataverse-jsf-tests
uses: actions/checkout@v7
with:
repository: gdcc/dataverse-jsf-tests
path: dataverse-jsf-tests

- name: Install dataverse-jsf-tests dependencies
run: npm ci
working-directory: dataverse-jsf-tests

- name: Install Playwright browsers
run: npx playwright install --with-deps
working-directory: dataverse-jsf-tests

# ---------------------------
# RUN PLAYWRIGHT FRONTEND TESTS
# ---------------------------
- name: Run Playwright frontend tests
run: npx playwright test
working-directory: dataverse-jsf-tests
env:
BASE_URL: "http://localhost:8080"
LOGIN_ADAPTER: "builtin"
DV_USERNAME: "dataverseAdmin"
DV_PASSWORD: "admin1"
DV_FULL_NAME: "Dataverse Admin"
ROOT_DATAVERSE: "/dataverse/root"
SKIP_PREFLIGHT: "true"
DOTENV_CONFIG_QUIET: "true"

# ---------------------------
# UPLOAD PLAYWRIGHT REPORT
# ---------------------------
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: dataverse-jsf-tests/playwright-report/
retention-days: 14

# ---------------------------
# COLLECT DOCKER LOGS (ALWAYS)
# ---------------------------
- name: Collect Docker logs (mapped)
if: always()
run: |
mkdir -p docker-logs
echo "Gathering container metadata..."
docker ps -a --format '{{.Names}}|{{.Image}}|{{.Status}}' > docker-logs/container-summary.txt
while IFS='|' read -r name image status; do
label="$name"
case "$name" in
*dataverse*) label="dataverse-app" ;;
*postgres*) label="postgres-db" ;;
*solr*) label="solr-index" ;;
*localstack*)label="localstack-s3" ;;
esac
echo "Collecting logs for $name ($label)"
{
echo "===== CONTAINER: $name ====="
echo "Label: $label"
echo "Image: $image"
echo "Status: $status"
echo ""
echo "===== LOGS ====="
docker logs --timestamps "$name" 2>&1 || true
} > "docker-logs/${label}__${name}.log"
done < docker-logs/container-summary.txt

# ---------------------------
# UPLOAD DOCKER LOGS (ALWAYS)
# ---------------------------
- name: Upload Docker logs
if: always()
uses: actions/upload-artifact@v7
with:
name: docker-logs
path: docker-logs/
retention-days: 14
Comment thread
pdurbin marked this conversation as resolved.
18 changes: 13 additions & 5 deletions doc/sphinx-guides/source/developers/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,19 @@ Developers who contribute front-end UI code are responsible for understanding th

There are browser developer tools such as the `Wave toolbar <https://wave.webaim.org/extension/>`__ by WebAIM (available for Chrome, Firefox) and the `Siteimprove Accessibility Checker <https://siteimprove.com/en-us/core-platform/integrations/browser-extensions/>`__ (available for Chrome, Firefox) that will generate reports for a single page. It is required that developers utilize these tools to catch any accessibility issues with pages or features that are being added to the application UI.

Browser-Based Testing
---------------------

Browser-Based Testing of JSF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The JSF frontend is being tested with Playwright via a GitHub Action that runs a test suite from https://github.com/gdcc/dataverse-jsf-tests (see https://github.com/IQSS/dataverse/pull/12526).

Browser-Based Testing of the SPA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

https://github.com/IQSS/dataverse-frontend uses Cypress.

Future Work
-----------

Expand All @@ -518,11 +531,6 @@ Future Work on Integration Tests
- Consistent logging of API Tests. Show test name at the beginning and end and status codes returned.
- expected passing and known/expected failing integration tests: https://github.com/IQSS/dataverse/issues/4438

Browser-Based Testing
~~~~~~~~~~~~~~~~~~~~~

- Revisit Selenium/Open Sauce: https://github.com/IQSS/dataverse/commit/8a26404 and https://saucelabs.com/u/esodvn and https://saucelabs.com/u/wdjs and http://sauceio.com/index.php/2013/05/a-browser-matrix-widget-for-the-open-source-community/

Installation Testing
~~~~~~~~~~~~~~~~~~~~

Expand Down
29 changes: 0 additions & 29 deletions tests/access_dvn.py

This file was deleted.

8 changes: 0 additions & 8 deletions tests/config.py

This file was deleted.

62 changes: 0 additions & 62 deletions tests/create_account.py

This file was deleted.

Loading