-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Rollouts] Add integration test app (#12239)
- Loading branch information
1 parent
7c2ac50
commit a57c4e9
Showing
12 changed files
with
1,377 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
1,053 changes: 1,053 additions & 0 deletions
1,053
...emoteConfig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp/ContentView.swift
This file contains 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,29 @@ | ||
// | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
VStack { | ||
Image(systemName: "globe") | ||
.imageScale(.large) | ||
.foregroundStyle(.tint) | ||
Text("Hello, world!") | ||
} | ||
.padding() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...g/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp/FeatureRolloutsTestApp.entitlements
This file contains 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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<key>com.apple.security.files.user-selected.read-only</key> | ||
<true/> | ||
</dict> | ||
</plist> |
25 changes: 25 additions & 0 deletions
25
...atureRolloutsTestApp/FeatureRolloutsTestApp_CrashlyticsRemoteConfig_iOS/ContentView.swift
This file contains 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,25 @@ | ||
// | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
CrashButtonView() | ||
.padding() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...fig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp_Crashlytics_iOS/ContentView.swift
This file contains 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,26 @@ | ||
// | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import FirebaseCrashlytics | ||
import Foundation | ||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
CrashButtonView() | ||
.padding() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ig/Tests/FeatureRolloutsTestApp/FeatureRolloutsTestApp_RemoteConfig_iOS/ContentView.swift
This file contains 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,30 @@ | ||
// | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
var body: some View { | ||
VStack { | ||
Image(systemName: "globe") | ||
.imageScale(.large) | ||
.foregroundStyle(.tint) | ||
Text("Hello, world!") | ||
} | ||
.padding() | ||
} | ||
} |
This file contains 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,51 @@ | ||
# Uncomment the next line to define a global platform for your project | ||
# platform :ios, '9.0' | ||
|
||
def shared_pods | ||
pod 'FirebaseCore', :path => '../../../' | ||
pod 'FirebaseInstallations', :path => '../../../' | ||
pod 'FirebaseCoreInternal', :path => '../../../' | ||
pod 'FirebaseCoreExtension', :path => '../../../' | ||
pod 'FirebaseRemoteConfigInterop', :path => '../../../' | ||
end | ||
|
||
target 'FeatureRolloutsTestApp_iOS' do | ||
platform :ios, '11.0' | ||
|
||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
shared_pods | ||
end | ||
|
||
target 'FeatureRolloutsTestApp_Crashlytics_iOS' do | ||
platform :ios, '11.0' | ||
|
||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
shared_pods | ||
pod 'FirebaseCrashlytics', :path => '../../../' | ||
end | ||
|
||
target 'FeatureRolloutsTestApp_RemoteConfig_iOS' do | ||
platform :ios, '11.0' | ||
|
||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
shared_pods | ||
pod 'FirebaseRemoteConfig', :path => '../../../' | ||
end | ||
|
||
target 'FeatureRolloutsTestApp_CrashlyticsRemoteConfig_iOS' do | ||
platform :ios, '11.0' | ||
|
||
# Comment the next line if you don't want to use dynamic frameworks | ||
use_frameworks! | ||
|
||
shared_pods | ||
pod 'FirebaseCrashlytics', :path => '../../../' | ||
pod 'FirebaseRemoteConfig', :path => '../../../' | ||
end | ||
|
62 changes: 62 additions & 0 deletions
62
FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/Shared/CrashButtonView.swift
This file contains 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,62 @@ | ||
// | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import FirebaseCrashlytics | ||
import Foundation | ||
import SwiftUI | ||
|
||
struct CrashButtonView: View { | ||
var body: some View { | ||
var counter = 0 | ||
|
||
NavigationView { | ||
VStack( | ||
alignment: .leading, | ||
spacing: 10 | ||
) { | ||
Button(action: { | ||
Crashlytics.crashlytics().setUserID("ThisIsABot") | ||
}) { | ||
Text("Set User Id") | ||
} | ||
|
||
Button(action: { | ||
assertionFailure("Throw a Crash") | ||
}) { | ||
Text("Crash") | ||
} | ||
|
||
Button(action: { | ||
Crashlytics.crashlytics().record(error: NSError( | ||
domain: "This is a test non-fatal", | ||
code: 400 | ||
)) | ||
}) { | ||
Text("Record Non-fatal event") | ||
} | ||
|
||
Button(action: { | ||
Crashlytics.crashlytics().setCustomValue(counter, forKey: "counter " + String(counter)) | ||
let i = counter | ||
counter = i + 1 | ||
}) { | ||
Text("Set custom key") | ||
} | ||
} | ||
.navigationTitle("Crashlytics Example") | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/Shared/FeatureRolloutsTestAppApp.swift
This file contains 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,31 @@ | ||
// | ||
// Copyright 2024 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import FirebaseCore | ||
import SwiftUI | ||
|
||
@main | ||
struct FeatureRolloutsTestAppApp: App { | ||
init() { | ||
FirebaseApp.configure() | ||
} | ||
|
||
var body: some Scene { | ||
WindowGroup { | ||
ContentView() | ||
} | ||
} | ||
} |
This file contains 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,58 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
readonly DIR="$( git rev-parse --show-toplevel )" | ||
|
||
# | ||
# This script attempts to copy the Google Services file from google3. If you are not a Google Employee, it will fail, so we'd recommend you create your own Firebase App and place the Google Services file in Tests/TestApp/Shared | ||
# | ||
|
||
echoColor() { | ||
COLOR='\033[0;35m' | ||
NC='\033[0m' | ||
printf "${COLOR}$1${NC}\n" | ||
} | ||
|
||
echoRed() { | ||
COLOR='\033[0;31m' | ||
NC='\033[0m' | ||
printf "${COLOR}$1${NC}\n" | ||
} | ||
|
||
echoColor "Generating Firebase Remote Config Feature Rolouts Test App" | ||
echoColor "Copying GoogleService-Info.plist from google3. Checking gcert status" | ||
if gcertstatus; then | ||
G3Path="/google/src/files/head/depot/google3/third_party/firebase/ios/Secrets/RemoteConfig/FeatureRollouts/GoogleService-Info.plist" | ||
Dest="$DIR/FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp/Shared" | ||
cp $G3Path $Dest | ||
echoColor "Copied $G3Path to $Dest" | ||
else | ||
echoRed "gcert token is not valid. If you are a Google Employee, run 'gcert', and then repeat this command. Non-Google employees will need to download a GoogleService-Info.plist and place it in $DIR/FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp" | ||
fi | ||
|
||
|
||
echoColor "Running 'pod install'" | ||
cd $DIR/FirebaseRemoteConfig/Tests/FeatureRolloutsTestApp | ||
pod install | ||
|
||
# Upon a `pod install`, Crashlytics will copy these files at the root directory | ||
# due to a funky interaction with its cocoapod. This line deletes these extra | ||
# copies of the files as they should only live in Crashlytics/ | ||
rm -f $DIR/run $DIR/upload-symbols | ||
|
||
open *.xcworkspace | ||
|
This file contains 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