diff --git a/assets/images/mobile-app-testing/media-injection/Step3.png b/assets/images/mobile-app-testing/media-injection/Step3.png new file mode 100644 index 000000000..9441e89be Binary files /dev/null and b/assets/images/mobile-app-testing/media-injection/Step3.png differ diff --git a/assets/images/mobile-app-testing/media-injection/Step4.png b/assets/images/mobile-app-testing/media-injection/Step4.png new file mode 100644 index 000000000..5db50cb25 Binary files /dev/null and b/assets/images/mobile-app-testing/media-injection/Step4.png differ diff --git a/assets/images/mobile-app-testing/media-injection/Step5.png b/assets/images/mobile-app-testing/media-injection/Step5.png new file mode 100644 index 000000000..f609aedc2 Binary files /dev/null and b/assets/images/mobile-app-testing/media-injection/Step5.png differ diff --git a/assets/images/mobile-app-testing/media-injection/Stepfinal.png b/assets/images/mobile-app-testing/media-injection/Stepfinal.png new file mode 100644 index 000000000..ee8893517 Binary files /dev/null and b/assets/images/mobile-app-testing/media-injection/Stepfinal.png differ diff --git a/assets/images/mobile-app-testing/media-injection/Stepfinalx.png b/assets/images/mobile-app-testing/media-injection/Stepfinalx.png new file mode 100644 index 000000000..c4a0ccdbe Binary files /dev/null and b/assets/images/mobile-app-testing/media-injection/Stepfinalx.png differ diff --git a/docs/camera-image-injection-on-real-devices.md b/docs/camera-image-injection-on-real-devices.md index 015103b0f..d3e9403e9 100644 --- a/docs/camera-image-injection-on-real-devices.md +++ b/docs/camera-image-injection-on-real-devices.md @@ -1,7 +1,7 @@ --- id: camera-image-injection-on-real-devices -title: Camera Image Injection on Real Devices -sidebar_label: Camera Image Injection +title: Media Injection on Real Devices +sidebar_label: Media Injection description: Test camera features on real devices with LambdaTest's Image Injection. Easily inject custom images for QR codes, photos, and more. keywords: - image injection @@ -49,26 +49,26 @@ import TabItem from '@theme/TabItem'; }} > -LambdaTest's Camera Image Injection empowers you to test various camera-related functionalities of your app across a vast array of real mobile devices. This innovative feature supports image capture testing, QR code scanning verification and Barcode scanning assessment. +LambdaTest's Media Injection empowers you to test various camera-related functionalities (Image Injection and Video Injection) of your app across a vast array of real mobile devices. This innovative feature supports image capture testing, QR code scanning verification and Barcode scanning assessment. ## Use Cases - URL-embedded QR code scans - Digital check processing -- Profile photo capture -- In-app image upload functionality +- Real-time video streaming and playback +- Video capture and upload workflows ## How It Works -The Image Injection process leverages **Sensor Instrumentation** technology. When activated for a test session, it injects LambdaTest's proprietary camera module into your application and emulates or supersedes the native Android/iOS camera SDK +The Image and Video Injection processes leverages **Sensor Instrumentation** technology. When activated for a test session, it injects LambdaTest's proprietary camera module into your application and emulates or supersedes the native Android/iOS camera SDK ### Key Features -- Extensive device compatibility (3000+ real devices) -- Comprehensive support for image-based functionalities +- Extensive device compatibility (10000+ real devices) +- Comprehensive support for image and video based functionalities - Effortless integration with existing test environments + :::warning note -- Video capture and other media types are not currently supported. - For iOS apps signed with Enterprise Certificates, app resigning (a prerequisite for using the Image Injection tool) is not available. ::: @@ -103,32 +103,31 @@ Below given is the list of Camera APIs which are supported by LambdaTest Image I -## Image Injection in Real Device App Testing +## Image and Video Injection in Real Device App Testing -This feature helps you inject any image which you want your app to click or scan through the device camera. You just need to follow the steps given below: +This feature helps you inject any video or image which you want your app to click or scan through the device camera. You just need to follow the steps given below: **Step 1:** Click on the **Real Devices** > **App Testing** **Step 2:** Select your required device and upload your application which supports the camera APIs listed above. -**Step 3:** Now, hover over your app and click on the **Settings** icon. Toggle the **Image Injection** option and click on **Save Changes** button. Click on **Start** to run your app on the selected device. +**Step 3:** Now, hover over your app and click on the **Settings** icon. Toggle the **Image Injection** and **Video Injection** option and click on **Save Changes** button. Click on **Start** to run your app on the selected device. +Native Mobile App Testing -**Step 4:** After the above config, click on the **Start** button to start the session. Now, go to **Device Controls** in the toolbar as shown below. Select Image Injection and click **Upload Image** to inject the desired image from your computer to the app. +**Step 4:** You can see the video and image preview in the Media Injection section. You can +**delete**, **reupload** and **inject** the image or video from here. -**Step 5:** You can see the image preview in the Image Injection section. You can **delete** or **reupload** the image from here. +Native Mobile App Testing -**Step 6:** Now go to camera feature in your app, the camera pops up. When you click the image from your app, you will see a black image. Please proceed with the same by clicking on **Use Photo**. +**Step 5:** After the above config, click on the **Start** button to start the session. Now, go to **Device Controls** in the toolbar as shown below. Select Media Injection and click **Inject** to upload the desired video or image from your computer to the app. -**Step 7:** The black image is now replaced with an injected image. +Native Mobile App Testing + -
- -
- -
-
+**Step 6:** Now go to camera feature in your app, the camera pops up. When you click the image from your app, you will see a black image. Please proceed with the same by clicking on **Use Photo**. +**Step 7:** The black image is now replaced with an injected image or video. :::info diff --git a/docs/camera-image-injection.md b/docs/camera-image-injection.md index 19f3cad18..6b8ac8f42 100644 --- a/docs/camera-image-injection.md +++ b/docs/camera-image-injection.md @@ -67,7 +67,6 @@ LambdaTest utilizes **Sensor Instrumentation** to integrate with various mobile - Seamless integration with your existing app testing workflow :::warning note -- Video capture and other media types are not currently supported. - For iOS apps signed with Enterprise Certificates, app resigning (a prerequisite for using the Image Injection tool) is not available. ::: diff --git a/docs/video-injection.md b/docs/video-injection.md new file mode 100644 index 000000000..5c455e45b --- /dev/null +++ b/docs/video-injection.md @@ -0,0 +1,176 @@ +--- +id: video-injection +title: Video Injection +sidebar_label: Video Injection +description: Now you can test image capturing and QR code or Barcode scanning in your app on LambdaTest Real Device Cloud Platform with 3000+ real mobile devices. +keywords: + - image injection + - app test automation + - camera image + - QR code scanning + - Barcode scanning + - lambdatest capture code + - framework on lambdatest + - app testing appium + - app testing + - real devices +url: https://www.lambdatest.com/support/docs/video-injection/ +site_name: LambdaTest +slug: video-injection/ +--- + +import CodeBlock from '@theme/CodeBlock'; +import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + +Video Injection feature enables you to test video-based functionalities such as **live streaming, real-time video capture,** and **video processing** in your app across 10000+ real devices on the LambdaTest Real Device Cloud platform. + +This tool is ideal for testing features such as: + +- Real-time video streaming and playback +- Video-based verification (e.g., identity verification using live video) +- Video capture and upload workflows +- In-app video recording features + +## How It Works +LambdaTest utilizes **Sensor Instrumentation** to integrate with various mobile sensors, including the camera. When you enable Video Injection for a session, LambdaTest injects its camera code module into your app through Sensor Instrumentation. This module then mocks or overrides the iOS SDK used in your app. + +:::warning note +- This feature is currently available on iOS only. Support for Android will be available soon. +::: + + +## Video Injection in App Automation + +This section explains how to use Video Injection with App automation. This section will also teach you how to use video injection for all the possible test cases for your app along with other useful information. + +### Step 1: Upload video to LambdaTest + +You can use the following curl command to upload any video of your choice to the LambdaTest cloud. Please note that we support only **MP4 format is only supported and the video can be 50 MB or less**. + +
+ +{`curl -u "${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}" -X POST "https://mobile-mgm.lambdatest.com/mfs/v1.0/media/upload" -F "media_file=@"/Users/macuser/Downloads/video.mp4"" -F "type="video"" -F "custom_id="SampleVideo""`} + +
+ +Response of above cURL will be a JSON object containing the `media_url` of the format - lt://MEDIA123456789123456789 as shown below. + +```js +{ +"media_url":"lt://MEDIA123456789123456789", +"name":"Video_123.mp4", +"status":"success", +"custom_id":"SampleVideo" +} +``` + +### Step 2: Enable Video injection in the Appium Session + +You can use the appium capability to turn the video injection on in your application. Just add `"enableVideoInjection": True` in the desired capabilities while writing the automation script. By adding this capability the app undergoes Sensor Instrumentation, which was described earlier in the documentation. Also adding media url `"media": "lt://MEDIA123456789123456789"` in the capabilities to inject the video is now optional and can be passed in LambdaHook as mentioned in step 3. + + + + +
+ + {`desired_capabilities = { + "enableVideoInjection": True, + "media": "lt://MEDIAf446d4170cd946aa9ec307d10cb679b9", #Add media_url here (optional) + }`} + +
+
+ + + +
+ + {`DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); +desiredCapabilities.setCapability("enableVideoInjection", "true");`} + +
+
+
+ +### Step 3: Inject the video + +Refer to the code snippets given below to upload the video with the action `VideoInjection`. Please make sure that the video needs to be injected before the camera is triggered in your application. This is due to the fact that the camera only captures the video injected at the last. + + + + +
+ + {`driver.execute_script("lambda-video-injection=media_url") #Add media_url here`} + +
+
+ + + +
+ + {`driver.execute_script("lambda-video-injection=media_url") //Add media_url here`} + +
+
+
+ +:::info + +**Use Case**: This feature can be used when you want to test injecting more than one video in single test at different instances. The video injected through above process will replace the video which you put in previous steps. + +::: + +### Step 4: Capture the desired video through camera + +You need to first add a logic to inject the uploaded video in the script. Thereafter add the logic to click the camera button in the mobile app. This will show you the last injected video on your mobile app screen. + +> 📕 Check the [documentation for Media Injection](/support/docs/camera-image-injection-on-real-devices/) feature in Manual App Testing on Real devices + + + diff --git a/sidebars.js b/sidebars.js index de519c9da..5255d0e16 100644 --- a/sidebars.js +++ b/sidebars.js @@ -2587,6 +2587,7 @@ module.exports = { label: "Features", items: [ "camera-image-injection", + "video-injection", "biometric-authentication", "regular-expression-appium", "appium-upload-media",