Examples
Save, list, and delete photos:
const driver = await wdio.startIos({
"appium:bundleId": "com.apple.mobileslideshow",
});
// Save a photo to the library
const imagePath = "/home/wolf/files/large.jpg";
await ios.savePhoto(driver, imagePath);
// Verify the photo was saved
const photosAfterSave = await ios.listPhotos(driver);
expect(photosAfterSave.success).toBe(true);
expect(photosAfterSave.totalCount).toBe(1);
// Clean up
await ios.deleteAllPhotos(driver);
const photosAfterDelete = await ios.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
deleteAllPhotos permanently removes all photos from the device library. Use it only on test devices.
Full sample test
import { flow } from "@qawolf/flows/ios";
import { expect } from "@qawolf/flows/web";
export default flow(
"iOS Media - Photo management in gallery",
"iOS - iPhone 15 (iOS 26)",
async ({ wdio, ios, test, ...testContext }) => {
await test("Photo push and save and list and delete", async () => {
const driver = await wdio.startIos({
"appium:bundleId": "com.apple.mobileslideshow",
});
const baseDir = process.env.IMAGE_BASE_DIR;
const fileName = "large.jpg";
const imagePath = `${baseDir}/${fileName}`;
await ios.savePhoto(driver, imagePath);
const photosAfterPush = await ios.listPhotos(driver);
expect(photosAfterPush.success).toBe(true);
expect(photosAfterPush.totalCount).toBe(1);
await ios.deleteAllPhotos(driver);
const photosAfterDelete = await ios.listPhotos(driver);
expect(photosAfterDelete.success).toBe(true);
expect(photosAfterDelete.totalCount).toBe(0);
});
},
);