If another batch run is already in progress when you attempt to start a new batch run, and the cloud browser/device usage limit has been reached, the test will not start and will be treated as failed.
We recognize this as an issue and have created a ticket for it here:
As a workaround, we'll introduce a method using the MagicPod Web API GET /v1.0/{organization_name}/cloud-devices/, which retrieves the number of available cloud devices.
If you're automating test execution with a CI tool, you can delay test execution by adding a script that checks the number of available cloud devices before running the tests.
Below is an example of a shell script that runs tests with GitHub Actions.
#!/bin/bash -e
OS=mac
FILENAME=magicpod-api-client
curl -L "https://app.magicpod.com/api/v1.0/magicpod-clients/api/${OS}/latest/" -H "Authorization: Token ${MAGICPOD_API_TOKEN}" --output ${FILENAME}.zip
unzip -q ${FILENAME}.zip
export MAGICPOD_ORGANIZATION=<MagicPod organization name>
export MAGICPOD_PROJECT=<MagicPod project name>
# Wait until cloud devices become available (Max 10min)
DEVICE_TYPE=browser # Change to 'mobile_app' as needed
API_ENDPOINT="https://app.magicpod.com/api/v1.0/${MAGICPOD_ORGANIZATION}/cloud-devices/"
MAX_WAIT_TIME=600
POLL_INTERVAL=30
START_TIME=$(date +%s)
echo "Waiting for cloud device availability..."
while true; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
if [ $ELAPSED_TIME -ge $MAX_WAIT_TIME ]; then
echo "Timeout: No cloud device available after 10 minutes"
exit 1
fi
RESPONSE=$(curl -s -H "Authorization: Token ${MAGICPOD_API_TOKEN}" "${API_ENDPOINT}")
AVAILABLE=$(echo "$RESPONSE" | jq -r ".${DEVICE_TYPE}.batch_test_run.available")
if [ "$AVAILABLE" -ge 1 ]; then
echo "Cloud device is available. Starting test run..."
break
fi
echo "No available device. Retrying in ${POLL_INTERVAL} seconds..."
sleep $POLL_INTERVAL
done
# Run batch test
TEST_SETTING_NUMBER=<MagicPod test run settings number>
./magicpod-api-client batch-run -S ${TEST_SETTING_NUMBER}For more details on integration with GitHub Actions, please refer to:
For details such as the response content of the MagicPod Web API, please refer to:
Please note that the Standard plan includes 2 cloud devices for batch test runs by default, but additional devices can be added as an option.
Reference: How to increase test cases and projects
If you have any questions, please feel free to contact us.