Skip to content

test(e2e): Cover delivery through a custom domain (CNAME) - #1353

Open
utkarshcloudinary wants to merge 4 commits into
test/responsive-breakpoints-lazy-load-e2efrom
test/WPP-1240-cname-delivery-e2e
Open

utkarshcloudinary wants to merge 4 commits into
test/responsive-breakpoints-lazy-load-e2efrom
test/WPP-1240-cname-delivery-e2e

Conversation

@utkarshcloudinary

@utkarshcloudinary utkarshcloudinary commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an e2e spec for delivery through a custom domain (CNAME). The spec connects with a fake domain in the connection string and checks that the image block, the Gallery widget and the Cloudinary video player use it. It also checks that private_cdn=false keeps the cloud name in the path.

Stacked on #1342. This PR targets the #1342 branch, because the spec checks srcset URLs and needs its parseSrcset() fix. Both PRs are in GitHub stack #1354, so merge #1342 first.

Approach

  • cloudinary-cname-delivery.spec.js (@serial) connects with ?cname=cdn.e2e-cloudinary.test before the upload, as the ticket suggests. The plugin only checks the domain format and never resolves it.
  • routeCnameToCloudinary() sends requests for the fake domain on to res.cloudinary.com, and adds the cloud name to the path for a private CDN. So the images really load, and the Gallery widget reaches data-ready="true". This also proves that the path the plugin builds is a valid Cloudinary path.
  • Image block: the src and every srcset URL use the domain, and the path does not start with /<cloud_name>/. Lazy load is off and breakpoints are on, so the server writes a Cloudinary srcset to check.
  • Gallery: shows 3 images, and every widget <img> URL uses the domain.
  • Video (optional criterion): the Cloudinary player iframe gets cloudinary[cname], cloudinary[secure_distribution] and cloudinary[private_cdn].
  • private_cdn=false: the URLs use the domain, and the path starts with /<cloud_name>/.
  • afterAll connects without the domain first, then restores the settings and deletes the posts and attachments. So the other delivery specs in the same serial run get plain res.cloudinary.com URLs.
  • ensureCloudinaryConnected() accepts { cname, privateCdn }. It now fails if the plugin does not save the new connection string, which the plugin does when the API test of the string fails.
  • expectCloudinaryUrl() accepts { host, cloudName, privateCdn }. A plain cloud name still works as before.
  • The gallery helpers move to tests/e2e/utils/gallery.js. The gallery spec uses them and works as before.

QA notes

  • npm run test:e2e:serial -- cloudinary-cname-delivery
  • npm run test:e2e:serial (the other delivery specs must still pass after this spec in the same run)

@utkarshcloudinary
utkarshcloudinary marked this pull request as draft November 2, 2026 12:17
@utkarshcloudinary
utkarshcloudinary changed the base branch from develop to test/responsive-breakpoints-lazy-load-e2e November 2, 2026 12:23
@utkarshcloudinary
utkarshcloudinary marked this pull request as ready for review November 2, 2026 12:24
Move galleryBlock(), openGallery() and collectImageUrls() out of the
gallery delivery spec into tests/e2e/utils/gallery.js, so the custom
domain spec can render the Gallery block the same way.
- ensureCloudinaryConnected() accepts { cname, privateCdn } and adds
  them to the connection string. It now fails when the plugin does
  not save the new string.
- expectCloudinaryUrl() accepts { host, cloudName, privateCdn }.
- routeCnameToCloudinary() sends requests for a fake custom domain on
  to res.cloudinary.com, so the images still load.
Connect with a fake custom domain and check that the image block,
the Gallery widget and the Cloudinary video player use it. Check that
private_cdn=false keeps the cloud name in the path. Restore the plain
connection in afterAll.

Refs WPP-1240
Replace the local saveSettings() copy with the one in
tests/e2e/utils/settings.js.

This branch has not been deployed

No deployments
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.

2 participants