Skip to content

Commit 2137b05

Browse files
authored
Move unit tests to example/RunnerTests (#802)
* Move unit tests to example/is/RunnerTests * Remove melos from install-tools * Upload iOS test result to github when tests fail
1 parent 5a8e475 commit 2137b05

27 files changed

+306
-313
lines changed

.github/workflows/google_mobile_ads.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ on:
2828
env:
2929
GOOGLEMOBILEADS_PLUGIN_SCOPE: "*google_mobile_ads*"
3030
GOOGLEMOBILEADS_PLUGIN_SCOPE_EXAMPLE: "*google_mobile_ads_example*"
31-
3231
jobs:
3332
android:
3433
runs-on: macos-latest
@@ -66,8 +65,15 @@ jobs:
6665
- name: "Unit Tests"
6766
run: |
6867
cd packages/google_mobile_ads/example/ios
69-
xcodebuild -configuration Debug VERBOSE_SCRIPT_LOGGING=YES -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.2' test
70-
68+
flutter clean
69+
flutter pub get
70+
pod install
71+
xcodebuild -configuration Debug -resultBundlePath TestResults VERBOSE_SCRIPT_LOGGING=YES -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.2' test
72+
- uses: actions/upload-artifact@v3
73+
if: failure()
74+
with:
75+
name: iOSTestResults
76+
path: packages/google_mobile_ads/example/ios/TestResults.xcresult
7177
flutter:
7278
runs-on: ubuntu-latest
7379
if: github.event_name == 'pull_request'

.github/workflows/scripts/install-tools.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2021 Google LLC
2+
# Copyright 2023 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
flutter pub global activate melos
1716
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH
1817
echo "$GITHUB_WORKSPACE/_flutter/.pub-cache/bin" >> $GITHUB_PATH
1918
echo "$GITHUB_WORKSPACE/_flutter/bin/cache/dart-sdk/bin" >> $GITHUB_PATH

packages/google_mobile_ads/example/ios/Podfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,18 @@ flutter_ios_podfile_setup
3030
target 'Runner' do
3131
use_frameworks!
3232
use_modular_headers!
33-
3433
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
34+
35+
target 'RunnerTests' do
36+
inherit! :search_paths
37+
38+
# Matches test_spec dependency.
39+
pod 'OCMock', '3.6'
40+
end
3541
end
3642

3743
post_install do |installer|
3844
installer.pods_project.targets.each do |target|
3945
flutter_additional_ios_build_settings(target)
4046
end
4147
end
42-
43-
# Add test dependency matching google_mobile_ads.podspec.
44-
target 'google_mobile_ads_exampleTests' do
45-
pod 'OCMock','3.6'
46-
end

packages/google_mobile_ads/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 258 additions & 284 deletions
Large diffs are not rendered by default.

packages/google_mobile_ads/example/ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,7 @@
5858
<true/>
5959
<key>CADisableMinimumFrameDurationOnPhone</key>
6060
<true/>
61+
<key>UIApplicationSupportsIndirectInputEvents</key>
62+
<true/>
6163
</dict>
6264
</plist>

packages/google_mobile_ads/ios/Tests/FLTAdRequestTest.m renamed to packages/google_mobile_ads/example/ios/RunnerTests/FLTAdRequestTest.m

File renamed without changes.

packages/google_mobile_ads/ios/Tests/FLTAdUtilTest.m renamed to packages/google_mobile_ads/example/ios/RunnerTests/FLTAdUtilTest.m

File renamed without changes.

packages/google_mobile_ads/ios/Tests/FLTAppOpenAdTest.m renamed to packages/google_mobile_ads/example/ios/RunnerTests/FLTAppOpenAdTest.m

File renamed without changes.

packages/google_mobile_ads/ios/Tests/FLTBannerAdTest.m renamed to packages/google_mobile_ads/example/ios/RunnerTests/FLTBannerAdTest.m

File renamed without changes.

packages/google_mobile_ads/ios/Tests/FLTFluidGAMBannerAdTest.m renamed to packages/google_mobile_ads/example/ios/RunnerTests/FLTFluidGAMBannerAdTest.m

File renamed without changes.

0 commit comments

Comments
 (0)