-
Notifications
You must be signed in to change notification settings - Fork 5
feat: testing tool #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Code Coverage
|
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
|
||
- name: Add Client ID | ||
env: | ||
CLIENT_ID: ${{ secrets.CLIENT_ID }} | ||
run: ./gradlew updateLocalsXmlFile | ||
|
||
- name: Build APKs | ||
run: | | ||
./gradlew :demo:assembleDebug :demo:assembleAndroidTest | ||
|
||
- name: Upload App to BrowserStack | ||
env: | ||
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
run: | | ||
APP_APK_PATH=./demo/build/outputs/apk/debug/demo-debug.apk | ||
TEST_APK_PATH=./demo/build/outputs/apk/androidTest/debug/demo-debug-androidTest.apk | ||
|
||
echo "App APK path: $APP_APK_PATH" | ||
echo "Test APK path: $TEST_APK_PATH" | ||
|
||
if [[ -z "$APP_APK_PATH" || -z "$TEST_APK_PATH" ]]; then | ||
echo "Error: APK file not found." | ||
exit 1 | ||
fi | ||
|
||
# Upload app APK and capture response | ||
APP_UPLOAD_RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | ||
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/app" \ | ||
-F "file=@$APP_APK_PATH") | ||
|
||
echo "App upload response: $APP_UPLOAD_RESPONSE" | ||
|
||
APP_URL=$(echo $APP_UPLOAD_RESPONSE | jq -r '.app_url') | ||
|
||
if [[ -z "$APP_URL" ]]; then | ||
echo "Error: App URL not found in response." | ||
exit 1 | ||
fi | ||
|
||
# Upload test suite APK and capture response | ||
TEST_SUITE_UPLOAD_RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | ||
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/test-suite" \ | ||
-F "file=@$TEST_APK_PATH") | ||
|
||
echo "Test suite upload response: $TEST_SUITE_UPLOAD_RESPONSE" | ||
|
||
TEST_SUITE_URL=$(echo $TEST_SUITE_UPLOAD_RESPONSE | jq -r '.test_suite_url') | ||
|
||
if [[ -z "$TEST_SUITE_URL" ]]; then | ||
echo "Error: Test suite URL not found in response." | ||
exit 1 | ||
fi | ||
|
||
# Use the app_url and test_suite_url in another cURL request | ||
FINAL_RESPONSE=$(curl -s -u "$BROWSERSTACK_USERNAME:$BROWSERSTACK_ACCESS_KEY" \ | ||
-X POST "https://api-cloud.browserstack.com/app-automate/espresso/v2/build" \ | ||
-d "{\"app\": \"$APP_URL\", \"testSuite\": \"$TEST_SUITE_URL\", \"devices\": [\"Samsung Galaxy S23-13.0\"], \"project\": \"Paypal_Messages_Android\"}" \ | ||
-H "Content-Type: application/json") | ||
|
||
echo "Final response: $FINAL_RESPONSE" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
To fix the issue, we will add a permissions
block at the root level of the workflow. This block will specify the least privileges required for the workflow to function. Since the workflow does not interact with the repository (e.g., no code pushes or pull request updates), we will set contents: read
to limit the GITHUB_TOKEN
to read-only access. This ensures the workflow adheres to the principle of least privilege.
-
Copy modified lines R11-R13
@@ -10,2 +10,5 @@ | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: |
package com.paypal.messagesdemo | ||
|
||
// @RunWith(AndroidJUnit4ClassRunner::class) | ||
// public class JetPackTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @grablack, I noticed that all of the code in JetPackTest.kt
is currently commented out.
Is this intentional? If it's meant for future work, it might be cleaner to:
- Push an empty test class with a
@Test
method marked@Ignore
and aTODO
note explaining what will be added in the next PR, or - Remove this file for now and add it back once it's ready.
This keeps the repo clean and avoids confusion for others pulling the branch 🙂
Let me know if I can help clarify!
… Central Portal directly
Description
Check messages for inline XML, programmatic XML, and Jetpack against testing plan.
Screenshots
Testing instructions