Skip to content

test(e2e): Cover the media storage modes - #1366

Open
utkarshcloudinary wants to merge 1 commit into
developfrom
test/storage-modes-e2e
Open

utkarshcloudinary wants to merge 1 commit into
developfrom
test/storage-modes-e2e

Conversation

@utkarshcloudinary

Copy link
Copy Markdown
Collaborator

Adds an e2e spec for the three storage settings: "Cloudinary only", "Cloudinary and WordPress" and "Cloudinary and WordPress (low resolution)". No spec covered them before, and a bug here can remove the only local copy of a file.

Approach

  • cloudinary-storage-modes.spec.js (@serial) pins lazy load off and auto sync on, sets offload for each test, and restores the settings in afterAll.
  • "Cloudinary only": after the first sync the local file stays and the delete delay starts. The spec moves the delay start back instead of waiting Storage::DELETE_DELAY, syncs again, and checks that the main file and every size file are removed and _cloudinary_storage is cld. The image must still load from Cloudinary.
  • "Cloudinary and WordPress": the same attachment is synced back. The local file must have the same size as the uploaded original, and every size file must be generated again.
  • Low resolution: a new upload keeps a local file that is smaller than the original, and delivery still uses Cloudinary.
  • The spec syncs only its own attachments through process_assets(), not wp cloudinary sync. A storage change replaces or removes the local files of every synced attachment, so a library-wide sync changes media that other specs or developers left in the test site.
  • afterAll removes the Cloudinary assets through the API before it deletes the attachments. Delete sync removes an asset only when Sync::is_synced() is true, and after a storage change it is not, so the assets stayed in the account.

QA notes

  • npm run test:e2e:serial -- cloudinary-storage-modes
  • After the run, the Cloudinary account has no storage-* assets, and cloudinary_sync_media.offload is back to its value before the run.

Add an e2e spec for the three storage settings. It checks that
"Cloudinary only" keeps the local files during the delete delay and
removes them after it, that "Cloudinary and WordPress" downloads the
full-quality files again, and that the low resolution mode keeps a
smaller local copy. In each mode the image must still load from
Cloudinary.

Cleanup removes the Cloudinary assets through the API. Deleting an
attachment removes its asset only when the plugin thinks it is synced,
and after a storage change it is not.

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