Inject an image
On an open device, you can inject an image to simulate the use of a camera. In this way, you can test apps that rely on camera usage, for example, barcode readers check scanners used by banks. Image files with the following extensions are supported: .jpeg, .jpg, .png, and .bmp. The file size cannot exceed 150 MB.
Prerequisites: For image injection to work, the application to test must be preinstalled with sensor instrumentation enabled. In addition, the app must stay in the foreground.
To learn how to work with image injection in Scriptless Mobile, watch this video or review the instructions following the video.
To inject an image:
- On an open device, start the application you want to test and activate the camera. Ensure that the app stays in the foreground.
- In the widgets pane, click the Environment button
.
- On the Environment tab, click Inject Image.
-
In the Inject Image widget, do the following:
-
Select the location of your image file: Repository (default) or Computer.
-
Depending on your selection in step a, do the following:
-
Repository: Search for and select the file you want to use.
You can search by tag name, if applicable. If a file is associated with tags, a tag symbol appears below the file name, along with the number of tags associated with the file. To view the tag names, move the pointer over the tag icon
.
-
Computer:
- Click Upload a file.
- Browse to the file you want to use.
- Select the file and click Open.
The file is uploaded.
-
-
(Optional) To get your images automatically resized, select the Auto-resize image checkbox.
This option is helpful if image injection does not work with the original image size. By adjusting its size, you can proceed with your tests without resizing it manually.
Important: Auto-resize is a helper tool not intended for regular use but to facilitate smoother testing and help you observe your application’s behavior when handling different image sizes. We recommend using the correct image sizes when testing.Restriction: The auto-resize option is available for image injection on Android devices only.This functionality is available but will only take effect after your cloud upgrades to the new instrumentation service, which is in progress and will reach all clouds.
-
To specify the testing method, select the required checkbox next to these options:
-
Execute the selected action on the device.
-
Add the selected action to the test.
-
-
Select the file and click APPLY.
Scriptless Mobile injects the file and wait until the file is visible in your app. - (Optional) To halt the image injection process, at the bottom, click STOP.
- (Optional) To return to the Environment tab, at the top, click Back.
-