-
Notifications
You must be signed in to change notification settings - Fork 6
chore: [SDK-4364] prepare .NET MAUI demo for Appium E2E tests #173
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1238617
chore(demo): add AutomationIds for Appium E2E tests
fadi-george 0647de8
chore(demo): add WithSound notification type
fadi-george 5004d15
chore(demo): remove LogView, use Debug.WriteLine
fadi-george b7a1e03
refactor(demo): replace LoadingOverlay with inline LoadingState
fadi-george fdf5d05
refactor(demo): remove OneSignalRepository layer
fadi-george 83472e2
refactor(demo): support typed JSON event props
fadi-george 46a7136
fix: allow null values in JSON props
fadi-george 762871b
fix(demo): guard codesign props from simulator builds
fadi-george 7de2a6b
fix(demo): improve iOS keyboard UX for Appium tests
fadi-george 1946e8a
chore(demo): add OneSignalWidget Xcode project
fadi-george 5802b8e
style(demo): reformat code for readability
fadi-george 10e3e59
ci(e2e): add E2E test workflow
fadi-george 439045a
fix(android): skip unmarshalable dict/list values
fadi-george File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - rel/** | ||
| workflow_dispatch: | ||
| inputs: | ||
| platform: | ||
| description: 'Platform to test' | ||
| required: true | ||
| default: 'both' | ||
| type: choice | ||
| options: | ||
| - android | ||
| - ios | ||
| - both | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-android: | ||
| if: >- | ||
| github.event_name == 'push' || | ||
| github.event.inputs.platform == 'android' || | ||
| github.event.inputs.platform == 'both' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Set up Java | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
|
|
||
| - name: Install MAUI Android workload | ||
| run: dotnet workload install maui-android | ||
|
|
||
| - name: Create demo .env | ||
| working-directory: examples/demo | ||
| run: | | ||
| echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env | ||
| echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env | ||
| echo "E2E_MODE=true" >> .env | ||
|
|
||
| # RuntimeIdentifier=android-arm64 ships native code only for arm64-v8a, | ||
| # which is what BrowserStack's modern Android device farm runs. This | ||
| # roughly halves the APK size (~30MB → ~19MB) versus the default | ||
| # multi-ABI build. | ||
| - name: Build release APK | ||
| working-directory: examples/demo | ||
| run: | | ||
| dotnet publish demo.csproj \ | ||
| -f net10.0-android \ | ||
| -c Release \ | ||
| -p:AndroidPackageFormat=apk \ | ||
| -p:RuntimeIdentifier=android-arm64 | ||
|
|
||
| - name: Locate APK | ||
| id: apk | ||
| working-directory: examples/demo | ||
| run: | | ||
| APK=$(ls bin/Release/net10.0-android/android-arm64/*-Signed.apk | head -n1) | ||
| if [ -z "$APK" ]; then | ||
| echo "::error::No signed APK produced by dotnet publish" | ||
| exit 1 | ||
| fi | ||
| cp "$APK" demo.apk | ||
| echo "path=examples/demo/demo.apk" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Upload APK | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: demo-apk | ||
| path: ${{ steps.apk.outputs.path }} | ||
| retention-days: 1 | ||
| compression-level: 0 | ||
|
|
||
| build-ios: | ||
| if: >- | ||
| github.event_name == 'push' || | ||
| github.event.inputs.platform == 'ios' || | ||
| github.event.inputs.platform == 'both' | ||
| runs-on: macos-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: '10.0.x' | ||
|
|
||
| - name: Install MAUI iOS workload | ||
| run: dotnet workload install maui-ios | ||
|
|
||
| - name: Create demo .env | ||
| working-directory: examples/demo | ||
| run: | | ||
| echo "ONESIGNAL_APP_ID=${{ vars.APPIUM_ONESIGNAL_APP_ID }}" > .env | ||
| echo "ONESIGNAL_API_KEY=${{ secrets.APPIUM_ONESIGNAL_API_KEY }}" >> .env | ||
| echo "E2E_MODE=true" >> .env | ||
|
|
||
| - name: Set up iOS codesigning | ||
| uses: OneSignal/sdk-shared/.github/actions/setup-ios-demo-codesigning@main | ||
| with: | ||
| p12-base64: ${{ secrets.APPIUM_IOS_DEV_CERT_P12_BASE64 }} | ||
| p12-password: ${{ secrets.APPIUM_IOS_DEV_CERT_PASSWORD }} | ||
| asc-key-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_KEY_ID }} | ||
| asc-issuer-id: ${{ secrets.APPIUM_APP_STORE_CONNECT_ISSUER_ID }} | ||
| asc-private-key: ${{ secrets.APPIUM_APP_STORE_CONNECT_PRIVATE_KEY }} | ||
|
|
||
| # RuntimeIdentifier=ios-arm64 is required for a real device build that | ||
| # BrowserStack can install. | ||
| # Do NOT add -p:UseInterpreter=true here. It shrinks the IPA but breaks | ||
| # the Notification Service Extension (image notifications stop working) | ||
| # because the interpreter path drops the ObjC class registration for | ||
| # the NSE binding in OneSignalSDK.DotNet.iOS. | ||
| - name: Build signed IPA | ||
| working-directory: examples/demo | ||
| run: | | ||
| dotnet publish demo.csproj \ | ||
| -f net10.0-ios \ | ||
| -c Release \ | ||
| -p:RuntimeIdentifier=ios-arm64 \ | ||
| -p:ArchiveOnBuild=true | ||
|
|
||
| - name: Locate IPA | ||
| id: ipa | ||
| working-directory: examples/demo | ||
| run: | | ||
| IPA=$(ls bin/Release/net10.0-ios/ios-arm64/publish/*.ipa | head -n1) | ||
| if [ -z "$IPA" ]; then | ||
| echo "::error::No IPA produced by dotnet publish" | ||
| exit 1 | ||
| fi | ||
| cp "$IPA" demo.ipa | ||
| echo "path=examples/demo/demo.ipa" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Verify aps-environment in IPA | ||
| working-directory: examples/demo | ||
| run: | | ||
| unzip -oq demo.ipa -d /tmp/ipa | ||
| APP=$(ls -d /tmp/ipa/Payload/*.app | head -n1) | ||
| codesign -d --entitlements - "$APP" 2>&1 | tee /tmp/entitlements.txt | ||
| if ! grep -q 'aps-environment' /tmp/entitlements.txt; then | ||
| echo "::error::Built IPA is missing aps-environment entitlement; push subscription will not work" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Upload IPA | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: demo-ipa | ||
| path: ${{ steps.ipa.outputs.path }} | ||
| retention-days: 1 | ||
| compression-level: 0 | ||
|
|
||
| e2e-android: | ||
| needs: build-android | ||
| uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main | ||
| secrets: inherit | ||
| with: | ||
| platform: android | ||
| app-artifact: demo-apk | ||
| app-filename: demo.apk | ||
| sdk-type: dotnet | ||
| build-name: dotnet-android-${{ github.ref_name }}-${{ github.run_number }} | ||
|
|
||
| e2e-ios: | ||
| needs: build-ios | ||
| uses: OneSignal/sdk-shared/.github/workflows/appium-e2e.yml@main | ||
| secrets: inherit | ||
| with: | ||
| platform: ios | ||
| app-artifact: demo-ipa | ||
| app-filename: demo.ipa | ||
| sdk-type: dotnet | ||
| build-name: dotnet-ios-${{ github.ref_name }}-${{ github.run_number }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| # Default App ID (used when ONESIGNAL_APP_ID is empty or missing): 77e32082-ea27-42e3-a898-c72e141824ef | ||
| ONESIGNAL_APP_ID=your-onesignal-app-id | ||
| ONESIGNAL_API_KEY=your_rest_api_key | ||
| E2E_MODE=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.