> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qawolf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS photo library management

> Add, list, and delete photos in the device photo library to set up test state or verify your app saved photos.

## Examples

**Save, list, and delete photos:**

```javascript theme={null}
import { device } from "@qawolf/flows/ios";

// driver is provided by the flow callback when using:
// launch: { bundleId: "com.apple.mobileslideshow" }

// Save a photo to the library
const imagePath = "/home/wolf/files/large.jpg";
await device.savePhoto(driver, imagePath);

// Verify the photo was saved
const photosAfterSave = await device.listPhotos(driver);
expect(photosAfterSave.success).toBe(true);
expect(photosAfterSave.totalCount).toBe(1);

// Clean up
await device.deleteAllPhotos(driver);

const photosAfterDelete = await device.listPhotos(driver);
expect(photosAfterDelete.success).toBe(true);
expect(photosAfterDelete.totalCount).toBe(0);
```

## When to use

* Your app saves photos and you need to verify they appear in the library.
* Your app reads from the photo library and you need to set up known state before the test runs.
* You need to clean up photos between test runs to avoid state carrying over.

<Warning>
  `deleteAllPhotos` permanently removes all photos from the device library. Use it only on test devices.
</Warning>

## Full sample test

```js theme={null}
import { flow, device, expect } from "@qawolf/flows/ios";

export default flow(
  "iOS Media - Photo management in gallery",
  {
    target: "iOS - iPhone 15 (iOS 26)",
    launch: { bundleId: "com.apple.mobileslideshow" },
  },
  async ({ driver, test }) => {
    await test("Photo push and save and list and delete", async () => {
	  const baseDir = process.env.IMAGE_BASE_DIR;
	  const fileName = "large.jpg";
	  const imagePath = `${baseDir}/${fileName}`;

      await device.savePhoto(driver, imagePath);

      const photosAfterPush = await device.listPhotos(driver);
      expect(photosAfterPush.success).toBe(true);
      expect(photosAfterPush.totalCount).toBe(1);

      await device.deleteAllPhotos(driver);

      const photosAfterDelete = await device.listPhotos(driver);
      expect(photosAfterDelete.success).toBe(true);
      expect(photosAfterDelete.totalCount).toBe(0);
    });
  },
);
```
