Styles, templates, and other assets for primo-customization CDN for use with primo customization
Start the local primo-explore-devenv for a particular view:
docker compose pull
VIEW=01NYU_INST-NYU_DEV docker compose up primo-explore-devenvThen view your edits in primo-customization/01NYU_INST-NYU_DEV/ at http://localhost:8003/discovery/search?vid=01NYU_INST:NYU_DEV
Signing in works directly against http://localhost:8003. No /etc/hosts changes, no TLS, and no
self-signed certificates are needed.
Clicking sign-in redirects the browser to Ex Libris, SAML completes there, and you are returned to
localhost with a primoExploreJwt query parameter. The devenv serves the local index.html for
that URL, and the app then uses the JWT to authorize the API calls that the devenv proxies to real
Primo. Because the session travels in that token rather than in a cookie scoped to
exlibrisgroup.com, the browser does not need to be on the real hostname.
This depends on the devenv being run with gulp's --saml flag, which docker-compose.yml passes
for you. Without it, the login endpoints are proxied server-side, the browser never navigates to
Ex Libris, and the sign-in fails. The flag isn't in Ex Libris's documentation; it was added upstream
in ExLibrisGroup/primo-explore-devenv#84.
Signing out, however, does not work locally: Shibboleth rejects a logout return URL on
localhost. That is enforced at the IdP and cannot be fixed from this repo. To get back to a
signed-out state, clear site data for localhost:8003.
We utilize Playwright for our E2E tests.
- Install
- Start the local primo-explore-devenv for a particular view
- Make sure to match the local Primo and e2e test views. Not doing so can lead to inaccurate test results.
- Run tests
cd e2e/
yarn installNote: E2E tests are Docker-only. The
test:e2e:*scripts ine2e/package.jsonare meant to run inside thee2econtainer, which goes through thee2e-tlsproxy and thehttps://e2e.nyu.primo.exlibrisgroup.comorigin. Running them directly on the host withyarnwill not work.
# Docker-based E2E runs go through a dedicated HTTPS proxy (`e2e-tls`).
# In the containerized setup, Primo app pages and customization assets are
# served from the same secure e2e origin:
# https://e2e.nyu.primo.exlibrisgroup.com
#
# The e2e container runs `unit_tests/` before launching Playwright.
#
# The `e2e/` test code is copied into the image, so when you change Playwright
# tests, config, or the e2e Dockerfile, rebuild or use `--build`.
VIEW=[VIEW] docker compose up --build e2eHow the containerized E2E proxy works:
- The browser only talks to
https://e2e.nyu.primo.exlibrisgroup.com. e2e-tlsis built fromDockerfile.nginx-e2e, which bakesnginx/conf.d-e2e/into the image instead of relying on a bind mount.nginx/conf.d-e2e/default.confproxies Primo app traffic toprimo-explore-devenvand customization assets tocdn-server.- Docker marks
e2e-tlshealthy via a local/healthzendpoint, while thee2econtainer still waits for/discovery/searchbefore launching Playwright. - JS responses that still contain baked CDN URLs are rewritten to the e2e origin before they reach the browser.
- The shared rewrite block lives in nginx/conf.d-e2e/includes/js-rewrites.inc so the same
sub_filterrules do not have to be repeated in multiple nginxlocationblocks. proxy_set_header Accept-Encoding "";is part of that include because nginxsub_filterneeds the upstream JS response to be uncompressed.
All Playwright specs import test and expect from e2e/fixtures.js. Its
automatic fixture
blocks Matomo scripts and collection requests before navigation, so E2E visits do
not enter dev or production analytics. Service workers are disabled to keep them
from bypassing the block. See the
request routing documentation
for the service-worker restriction and the effect on HTTP caching.
For example:
# Tests https://e2e.nyu.primo.exlibrisgroup.com/discovery/search?vid=01NYU_INST:NYU_DEV
VIEW=01NYU_INST-NYU_DEV docker compose up --build e2eUpdate golden files:
# Tests https://e2e.nyu.primo.exlibrisgroup.com/discovery/search?vid=01NYU_INST:NYU_DEV
VIEW=01NYU_INST-NYU_DEV docker compose up --build e2e-update-golden-filesUpdate chatwidget PNG files for NYU views:
VIEW=[VIEW] docker compose up --build e2e-update-screenshotsFor example:
VIEW=01NYU_INST-NYU_DEV docker compose up --build e2e-update-screenshots