Skip to content
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

Updated simulator and emulator setup used for UI tests on Android and iOS #119

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions .github/scripts/uitests_for_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@
# Launch UI tests for Android
#----------------------------------------------------------

# Set up environment variables for Mac Mini M2
export ANDROID_SDK_ROOT=/Users/administrator/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin

# Search for device name
DEVICE=$(emulator -list-avds | head -n 1)
# Get current user ('administrator' for the CI)
USER=$(whoami)

if [[ $USER == "administrator" ]]; then
# Set up environment variables for Mac Mini M2
export ANDROID_SDK_ROOT=/Users/administrator/Library/Android/sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin

# Use specific name
DEVICE="Medium_Phone_API_31"
else
# Search for device name
DEVICE=$(emulator -list-avds | head -n 1)
fi

echo "$DEVICE"
echo "Using $DEVICE"

# (re)Launch emulator
adb -s emulator-5554 emu kill
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/uitests_for_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#----------------------------------------------------------

# Search for device ID
DEVICE=$(xcrun simctl list devices | grep -m 1 'iPhone 14 Pro' | grep -E -o -i '([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})')
DEVICE=$(xcrun simctl list devices | grep -m 1 'iPhone 15 Pro' | grep -E -o -i '([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})')

# (re)Launch simulator
xcrun simctl shutdown "${DEVICE}"
Expand Down
66 changes: 27 additions & 39 deletions example/integration_test/get_current_user_status_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,21 @@ void main() {
expect(
result.purposes?.keys,
containsAll([
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
"geolocation_data",
"device_characteristics",
'measure_ad_performance',
'create_ads_profile',
'device_characteristics',
'cookies',
'geolocation_data',
'improve_products',
'market_research',
'select_basic_ads',
'select_personalized_ads',
]));

assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down Expand Up @@ -141,25 +137,21 @@ void main() {
expect(
result.purposes?.keys,
containsAll([
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
"geolocation_data",
"device_characteristics",
'measure_ad_performance',
'create_ads_profile',
'device_characteristics',
'cookies',
'geolocation_data',
'improve_products',
'market_research',
'select_basic_ads',
'select_personalized_ads',
]));

assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: true));
Expand Down Expand Up @@ -209,25 +201,21 @@ void main() {
expect(
result.purposes?.keys,
containsAll([
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
"geolocation_data",
"device_characteristics",
'measure_ad_performance',
'create_ads_profile',
'device_characteristics',
'cookies',
'geolocation_data',
'improve_products',
'market_research',
'select_basic_ads',
'select_personalized_ads',
]));

assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down
9 changes: 4 additions & 5 deletions example/integration_test/purpose_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ void main() {
const purposeNames = "$purpose1Name, Create profiles for personalised advertising, "
"Actively scan device characteristics for identification, Use precise geolocation data, "
"Develop and improve services, Understand audiences through statistics or combinations of data "
"from different sources, Measure advertising performance, Measure content performance, "
"Use limited data to select advertising, Use profiles to select personalised advertising, "
"Use limited data to select content.";
"from different sources, Measure advertising performance, "
"Use limited data to select advertising, Use profiles to select personalised advertising.";
const purposeIds = "cookies, create_ads_profile, device_characteristics, geolocation_data, improve_products, "
"market_research, measure_ad_performance, measure_content_performance, select_basic_ads, "
"select_personalized_ads, use_limited_data_to_select_content.";
"market_research, measure_ad_performance, select_basic_ads, "
"select_personalized_ads.";

final initializeBtnFinder = find.byKey(Key("initializeSmall"));
final requiredPurposeIdsBtnFinder = find.byKey(Key("getRequiredPurposeIds"));
Expand Down
24 changes: 0 additions & 24 deletions example/integration_test/set_current_user_status_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ void main() {
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
Expand All @@ -100,9 +98,7 @@ void main() {
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down Expand Up @@ -159,9 +155,7 @@ void main() {
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
Expand All @@ -172,9 +166,7 @@ void main() {
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down Expand Up @@ -231,9 +223,7 @@ void main() {
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
Expand All @@ -244,9 +234,7 @@ void main() {
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down Expand Up @@ -310,9 +298,7 @@ void main() {
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
Expand All @@ -323,9 +309,7 @@ void main() {
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down Expand Up @@ -389,9 +373,7 @@ void main() {
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
Expand All @@ -402,9 +384,7 @@ void main() {
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down Expand Up @@ -472,9 +452,7 @@ void main() {
"cookies",
"select_basic_ads",
"measure_ad_performance",
"measure_content_performance",
"improve_products",
"use_limited_data_to_select_content",
"create_ads_profile",
"select_personalized_ads",
"market_research",
Expand All @@ -485,9 +463,7 @@ void main() {
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "cookies", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_basic_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_ad_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "measure_content_performance", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "improve_products", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "use_limited_data_to_select_content", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "create_ads_profile", enabled: false));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "select_personalized_ads", enabled: true));
assertPurposeStatusMapContains(result.purposes, PurposeStatus(id: "market_research", enabled: false));
Expand Down
2 changes: 1 addition & 1 deletion example/integration_test/vendor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void main() {
await tester.pumpAndSettle();

final expected = "Native message: Vendor: 2KDirect, Inc. (dba iPromote) / ipromote."
"Purposes: 3 consent, 4 LI, 0 features, 2 special purposes, 0 special features."
"Purposes: 3 consent, 4 LI, 0 features, 3 special purposes, 0 special features."
"URL 0: en -> https://www.ipromote.com/privacy-policy/ - https://www.ipromote.com/privacy-policy/."
"IAB2 = null";
assertNativeMessage("getVendor", expected);
Expand Down