Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

7 watching

Forks

Repository files navigation

Primo Customization CDN for NYU

Styles, templates, and other assets for primo-customization CDN for use with primo customization

Usage

Start the local primo-explore-devenv for a particular view:

docker compose pull
VIEW=01NYU_INST-NYU_DEV docker compose up primo-explore-devenv

Then view your edits in primo-customization/01NYU_INST-NYU_DEV/ at http://localhost:8003/discovery/search?vid=01NYU_INST:NYU_DEV

Local Login

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.

E2E tests

We utilize Playwright for our E2E tests.

Prerequisites

Getting started

Install

cd e2e/
yarn install

Run tests

Note: E2E tests are Docker-only. The test:e2e:* scripts in e2e/package.json are meant to run inside the e2e container, which goes through the e2e-tls proxy and the https://e2e.nyu.primo.exlibrisgroup.com origin. Running them directly on the host with yarn will 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 e2e

How the containerized E2E proxy works:

  • The browser only talks to https://e2e.nyu.primo.exlibrisgroup.com.
  • e2e-tls is built from Dockerfile.nginx-e2e, which bakes nginx/conf.d-e2e/ into the image instead of relying on a bind mount.
  • nginx/conf.d-e2e/default.conf proxies Primo app traffic to primo-explore-devenv and customization assets to cdn-server.
  • Docker marks e2e-tls healthy via a local /healthz endpoint, while the e2e container still waits for /discovery/search before 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_filter rules do not have to be repeated in multiple nginx location blocks.
  • proxy_set_header Accept-Encoding ""; is part of that include because nginx sub_filter needs 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 e2e

Update 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-files

Update chatwidget PNG files for NYU views:

VIEW=[VIEW] docker compose up --build e2e-update-screenshots

For example:

VIEW=01NYU_INST-NYU_DEV docker compose up --build e2e-update-screenshots

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages