Skip to content

Fixed the WCAG 2.1 accessibility violations on the enrollment flow st… #8

Fixed the WCAG 2.1 accessibility violations on the enrollment flow st…

Fixed the WCAG 2.1 accessibility violations on the enrollment flow st… #8

name: COmanage Registry E2E SAML Enrollment Flow
on:
workflow_dispatch:
push:
pull_request:
jobs:
e2e-saml-tests:
name: e2e-saml-tests (php=8.4, db=${{ matrix.db.engine }})
runs-on:
- codebuild-comanage-pipeline-${{ github.run_id }}-${{ github.run_attempt }}
strategy:
fail-fast: false
matrix:
db:
- engine: postgres
image: postgres:16-alpine
port: 5432
health_cmd: 'pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"'
# - engine: mysql
# image: mysql:8.0
# port: 3306
# health_cmd: 'mysqladmin ping -h 127.0.0.1 -uroot -p"$MYSQL_ROOT_PASSWORD" --silent'
# - engine: mariadb
# image: mariadb:11
# port: 3306
# health_cmd: 'mariadb-admin ping -h 127.0.0.1 -uroot -p"$MARIADB_ROOT_PASSWORD" --silent'
services:
db:
image: ${{ matrix.db.image }}
ports:
- ${{ matrix.db.port }}:${{ matrix.db.port }}
env:
POSTGRES_DB: registry_test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
MYSQL_DATABASE: registry_test
MYSQL_USER: test_user
MYSQL_PASSWORD: test_password
MYSQL_ROOT_PASSWORD: root_password
MARIADB_DATABASE: registry_test
MARIADB_USER: test_user
MARIADB_PASSWORD: test_password
MARIADB_ROOT_PASSWORD: root_password
options: >-
--health-cmd "${{ matrix.db.health_cmd }}"
--health-interval 10s
--health-timeout 5s
--health-retries 20
env:
COMANAGE_REGISTRY_DIR: /srv/comanage-registry
DB_ENGINE: ${{ matrix.db.engine }}
# Values used by setup / bootstrap
COMANAGE_REGISTRY_ADMIN_GIVEN_NAME_TEST: Admin
COMANAGE_REGISTRY_ADMIN_FAMILY_NAME_TEST: User
COMANAGE_REGISTRY_ADMIN_USERNAME_TEST: admin
COMANAGE_REGISTRY_SECURITY_SALT_TEST: phpunit-security-salt
# DB creds
COMANAGE_REGISTRY_DATABASE_TEST: registry_test
COMANAGE_REGISTRY_DATABASE_USER_TEST: test_user
COMANAGE_REGISTRY_DATABASE_USER_PASSWORD_TEST: test_password
COMANAGE_REGISTRY_DATABASE_PERSISTENT_TEST: "false"
# SAML Mock IdP config
COMANAGE_REGISTRY_SAML_IDP_HOST: "127.0.0.1"
COMANAGE_REGISTRY_SAML_IDP_PORT: "8080"
COMANAGE_REGISTRY_SAML_IDP_ENTITYID: "http://localhost:8080/simplesaml/saml2/idp/metadata.php"
steps:
- name: Checkout repository at the exact commit
shell: bash
run: |
set -euxo pipefail
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" "${COMANAGE_REGISTRY_DIR}"
cd "${COMANAGE_REGISTRY_DIR}"
git fetch --no-tags --prune --depth=1 origin "${GITHUB_SHA}"
git checkout --force "${GITHUB_SHA}"
git rev-parse HEAD
- name: Upgrade OS packages
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get upgrade -y
- name: Install PHP 8.4 and extensions
shell: bash
run: |
set -euxo pipefail
sudo apt-get install -y --no-install-recommends \
software-properties-common ca-certificates gnupg
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
PHP_VER="8.4"
sudo apt-get install -y --no-install-recommends \
libapache2-mod-php${PHP_VER} \
php${PHP_VER}-cli \
php${PHP_VER}-mbstring \
php${PHP_VER}-intl \
php${PHP_VER}-ldap \
php${PHP_VER}-xml \
php${PHP_VER}-zip \
php${PHP_VER}-pdo \
php${PHP_VER}-mysql \
php${PHP_VER}-pgsql \
php${PHP_VER}-gd \
php${PHP_VER}-xsl \
php${PHP_VER}-memcached \
php${PHP_VER}-curl
sudo update-alternatives --set php /usr/bin/php${PHP_VER}
sudo ln -sf /usr/bin/php${PHP_VER} /usr/local/bin/php
echo "/usr/local/bin" >> "$GITHUB_PATH"
- name: Install OS packages needed for E2E tests
shell: bash
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
wget curl tar ca-certificates \
git unzip openssl socat \
libicu-dev \
libxml2 \
zlib1g \
tree \
apache2 \
shibboleth-sp-utils \
libapache2-mod-shib || true
- name: Wait for DB to be ready (inside the service container)
shell: bash
run: |
set -euxo pipefail
case "${DB_ENGINE}" in
postgres)
docker exec "${{ job.services.db.id }}" sh -lc 'for i in $(seq 1 60); do pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB" && exit 0; sleep 1; done; exit 1'
;;
mysql)
docker exec "${{ job.services.db.id }}" sh -lc 'for i in $(seq 1 60); do mysqladmin ping -h 127.0.0.1 -uroot -p"$MYSQL_ROOT_PASSWORD" --silent && exit 0; sleep 1; done; exit 1'
;;
mariadb)
docker exec "${{ job.services.db.id }}" sh -lc 'for i in $(seq 1 60); do mariadb-admin ping -h 127.0.0.1 -uroot -p"$MARIADB_ROOT_PASSWORD" --silent && exit 0; sleep 1; done; exit 1'
;;
*)
echo "Unknown DB_ENGINE=${DB_ENGINE}"
exit 1
;;
esac
- name: Determine DB host/port for published ports
shell: bash
run: |
set -euxo pipefail
if [ -f /.dockerenv ]; then
DB_HOST="$(ip route | awk '/default/ {print $3; exit}')"
else
DB_HOST="127.0.0.1"
fi
DB_PORT="${{ matrix.db.port }}"
{
echo "COMANAGE_REGISTRY_DATABASE_HOST_TEST=${DB_HOST}"
echo "COMANAGE_REGISTRY_DATABASE_PORT_TEST=${DB_PORT}"
} >> "$GITHUB_ENV"
- name: Smoke test DB TCP connectivity (from the job environment)
shell: bash
run: |
set -euxo pipefail
php -r '
$h=getenv("COMANAGE_REGISTRY_DATABASE_HOST_TEST"); $p=(int)getenv("COMANAGE_REGISTRY_DATABASE_PORT_TEST");
$fp=@fsockopen($h,$p,$errno,$errstr,5);
if(!$fp){fwrite(STDERR,"TCP connect failed to $h:$p: $errno $errstr\n"); exit(1);}
fclose($fp);
echo "TCP connect OK to $h:$p\n";
'
- name: Create local/config database and security configurations
shell: bash
run: |
set -euxo pipefail
sudo mkdir -p "${COMANAGE_REGISTRY_DIR}/local/config"
cd "${COMANAGE_REGISTRY_DIR}/local/config"
sudo tee database.php > /dev/null <<'PHP'
<?php
return [
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres',
'persistent' => false,
'host' => getenv('COMANAGE_REGISTRY_DATABASE_HOST_TEST') ?: '127.0.0.1',
'port' => (int)(getenv('COMANAGE_REGISTRY_DATABASE_PORT_TEST') ?: 5432),
'username' => getenv('COMANAGE_REGISTRY_DATABASE_USER_TEST') ?: 'test_user',
'password' => getenv('COMANAGE_REGISTRY_DATABASE_USER_PASSWORD_TEST') ?: 'test_password',
'database' => getenv('COMANAGE_REGISTRY_DATABASE_TEST') ?: 'registry_test',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
],
],
];
PHP
echo -n "${COMANAGE_REGISTRY_SECURITY_SALT_TEST}" | sudo tee security.salt > /dev/null
sudo chown -R www-data:www-data "${COMANAGE_REGISTRY_DIR}/local" || true
- name: Composer update phpunit only
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app
run: |
set -euxo pipefail
composer update phpunit/phpunit --with-all-dependencies
- name: Bootstrap SAML IdP (Cirrus SimpleSAMLphp)
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app
run: |
set -euxo pipefail
bash tests/e2e/enrollmentflows/scripts/bootstrap-idp.sh
- name: Bootstrap Shibboleth SP and Apache
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app
run: |
set -euxo pipefail
bash tests/e2e/enrollmentflows/scripts/bootstrap-shibboleth.sh || true
bash tests/e2e/enrollmentflows/scripts/bootstrap-apache.sh || true
- name: Bootstrap COmanage Data (Platform Admin, CO, EnvSource, Flow)
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app
run: |
set -euxo pipefail
php tests/e2e/enrollmentflows/scripts/bootstrap-comanage.php
- name: Setup Node.js for Playwright E2E Tests
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Playwright Dependencies & Browsers
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app/tests/e2e
run: |
set -euxo pipefail
npm install
npx playwright install --with-deps chromium
- name: Run Playwright SAML E2E Browser Suite
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app/tests/e2e
run: |
set -euxo pipefail
npx playwright test
- name: Upload Playwright Test Report Artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: ${{ env.COMANAGE_REGISTRY_DIR }}/app/tests/e2e/playwright-report/
retention-days: 7
- name: Run PHPUnit E2E Validation Tests
shell: bash
working-directory: ${{ env.COMANAGE_REGISTRY_DIR }}/app
run: |
set -euxo pipefail
echo "Running PHPUnit E2E SAML Enrollment flow validation suite..."
vendor/bin/phpunit --group e2e-saml --testdox
- name: Stop Mock SAML IdP
if: always()
shell: bash
run: |
set -euxo pipefail
docker rm -f saml-idp || true