Skip to content

Feature Request: Add API endpoint to save images to Photo Library #1125

@drunkdream

Description

@drunkdream

Summary

Request to add a new API endpoint (e.g., /wda/device/install_media) that allows saving images to the device's Photo Library/Camera Roll so they can be recognized and accessed by the native Photos app.

Motivation

Currently, there's no way to save images directly to the device's Photo Library. This capability is essential for:

  1. Testing Photo Picker functionality - Apps that allow users to select photos from the library need test images available in the Photos app
  2. Testing image upload features - Many apps have image upload functionality that requires selecting images from the Photos app
  3. E2E testing workflows - Complete end-to-end testing of user journeys that involve photo selection and upload
  4. Automated test setup - Programmatically prepare test data (images) in Photo Library before running test suites

Current Problem

Currently, testers must manually add images to the simulator/device before running tests, which is:

  • ❌ Time-consuming and cannot be automated
  • ❌ Not reproducible across different test environments
  • ❌ Makes CI/CD integration difficult
  • ❌ Requires manual intervention for each test run

The only photo library-related code in WebDriverAgent is PHPhotoLibrary.requestAuthorization in FBAlertViewController.m, which only triggers the permission dialog but doesn't actually save any images.

Proposed Solution

Add a new API endpoint that accepts image data (base64-encoded) and saves it to the device's Photo Library, making it accessible through the native Photos app.

The saved images must:

  • ✅ Be visible and accessible in the iOS Photos app
  • ✅ Be selectable through UIImagePickerController or PHPickerViewController
  • ✅ Appear in the Camera Roll or a designated album
  • ✅ Have proper metadata (creation date, image format, etc.)

Use Cases

Scenario 1: Testing image upload in social media apps

  • Need to add test images to Photo Library
  • User taps "Upload Photo" button in app
  • App opens native photo picker
  • Test needs to select the previously added test image

Scenario 2: Testing profile picture update

  • Add test avatar image to Photo Library
  • Navigate to profile settings
  • Select "Change Photo" → opens Photos app
  • Select the test avatar from Photo Library
  • Verify profile picture is updated

Scenario 3: CI/CD automated testing

  • Test pipeline needs to run on fresh simulators
  • Before tests run, programmatically add required test images
  • Execute test suite that relies on photo selection
  • Clean up after tests complete

We need equivalent functionality for iOS that makes images available in the Photos app.

Benefits

  • ✅ Enables fully automated E2E testing of photo-related features
  • ✅ No manual preparation needed for test environments
  • ✅ Consistent and reproducible test data across environments
  • ✅ Cross-platform parity with Android testing capabilities
  • ✅ Aligns with WebDriverAgent's goal of comprehensive iOS automation

Thank you for considering this feature request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions