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

Switch to integration tests #1461

Merged
merged 23 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
70559cc
Allow tests to be run as integration tests
nielsenko Jan 17, 2024
1f01226
Adapt flutter driver tests to new structure
nielsenko Jan 17, 2024
13880dd
Drop flavor_helpers.dart
nielsenko Jan 17, 2024
a82dee7
Drop lib symlinks in tests
nielsenko Jan 18, 2024
a3f9d34
Use a group per test file
nielsenko Jan 18, 2024
3d968f3
Remove test symlink as well
nielsenko Jan 18, 2024
4bb30fe
Check both dart defined and shell defined env
nielsenko Jan 18, 2024
219d088
Fix CI
nielsenko Jan 18, 2024
4f14620
Simplify dartdoc_options.yaml a bit
nielsenko Jan 23, 2024
11dd617
Switch to integration_test
nielsenko Jan 23, 2024
5f12f1a
bump compileSdkVersion to 33 for android integration tests
nielsenko Jan 24, 2024
563e848
Disable realm_map_test on Android integration tests (TEST)
nielsenko Jan 24, 2024
2d93a4f
Run android flutter tests on ubuntu-latest - faster, cheaper, and mor…
nielsenko Jan 24, 2024
a217c23
Enable gradle caching
nielsenko Jan 24, 2024
108dc0e
Only drop Decimal128 tests on Android (TEMPORARY)
nielsenko Jan 24, 2024
1fffe38
Re-create platforms
nielsenko Jan 24, 2024
69d60b1
Allow network again for macos
nielsenko Jan 24, 2024
20f0c80
Publish Test Report from flutter integration test
nielsenko Jan 24, 2024
6abf65d
Remember to set org to io.realm when creating platforms projects
nielsenko Jan 25, 2024
c9ea03c
Move copyFile
nielsenko Jan 25, 2024
58d8617
Fix line-length in app_test.dart
nielsenko Jan 25, 2024
1d89e66
default differentiator to 'local'
nielsenko Jan 25, 2024
ca7b0b3
Add full directories as assets
nielsenko Jan 26, 2024
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
39 changes: 36 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,23 @@ jobs:

- name: Run tests on iOS Simulator
run: |
flutter drive --target=test_driver/app.dart --dart-define=testName="" --suppress-analytics --debug
flutter test integration_test/all_tests.dart \
--dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY \
--dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR \
--file-reporter=json:test-results.json \
--suppress-analytics
working-directory: ./flutter/realm_flutter/tests

- name: Publish Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter iOS
path: test-results.json
reporter: dart-json
only-summary: true
working-directory: ./flutter/realm_flutter/tests

cleanup-cluster-flutter-ios:
name: Cleanup Cluster for Flutter iOS
uses: ./.github/workflows/terminate-baas.yml
Expand All @@ -342,7 +356,7 @@ jobs:
differentiator: fa${{ github.run_id }}${{ github.run_attempt }}

flutter-tests-android:
runs-on: macos-latest
runs-on: ubuntu-latest
name: Flutter Tests Android
timeout-minutes: 45
needs:
Expand All @@ -358,6 +372,15 @@ jobs:
with:
submodules: 'recursive'

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle cache
uses: gradle/gradle-build-action@v2

- name: Set up Java
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -411,7 +434,17 @@ jobs:
ndk: 21.0.6113669
arch: x86
cmake: 3.10.2.4988404
script: flutter build apk --debug --target=test_driver/app.dart && flutter install --debug && flutter drive --target=test_driver/app.dart --dart-define=testName="" --suppress-analytics --debug
script: flutter test integration_test/all_tests.dart --dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY --dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR --file-reporter=json:test-results.json --suppress-analytics
working-directory: ./flutter/realm_flutter/tests

- name: Publish Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter Android
path: test-results.json
reporter: dart-json
only-summary: true
working-directory: ./flutter/realm_flutter/tests

cleanup-cluster-flutter-android:
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/flutter-desktop-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,23 @@ jobs:
if: ${{ contains(inputs.os, 'macos') }}

- name: Run tests
run: ${{ inputs.os == 'linux' && 'xvfb-run' || '' }} flutter drive -d ${{ inputs.os }} --target=test_driver/app.dart --suppress-analytics --dart-entrypoint-args="" --debug # -a="Some test name"
run: |
${{ inputs.os == 'linux' && 'xvfb-run' || '' }} \
flutter test integration_test/all_tests.dart \
--dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY \
--dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR \
--device-id=${{ inputs.os }} \
--file-reporter=json:test-results.json \
--suppress-analytics
shell: bash
working-directory: ./flutter/realm_flutter/tests

- name: Publish Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter ${{ inputs.os }} ${{ inputs.architecture }}
path: test-results.json
reporter: dart-json
only-summary: true
working-directory: ./flutter/realm_flutter/tests
1 change: 0 additions & 1 deletion common/topic.md

This file was deleted.

10 changes: 0 additions & 10 deletions dartdoc_options.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
dartdoc:
categories:
"Configuration":
markdown: topic.md
name: Configuration
"Annotations":
markdown: topic.md
name: Annotations
"Realm":
markdown: topic.md
name: Realm
"Application":
markdown: topic.md
name: Application
"Sync":
markdown: topic.md
name: Sync
categoryOrder: ["Realm", "Configuration", "Annotations", "Application", "Sync"]
examplePathPrefix: 'example'
# nodoc: ['generator/flutter/ffigen/scripts/src/test/*.g.dart']
Expand Down
6 changes: 0 additions & 6 deletions flavor_helpers.dart

This file was deleted.

1 change: 0 additions & 1 deletion flutter/realm_flutter/data

This file was deleted.

19 changes: 0 additions & 19 deletions flutter/realm_flutter/realm_flutter.iml

This file was deleted.

36 changes: 34 additions & 2 deletions flutter/realm_flutter/tests/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,39 @@
# This file should be version controlled and should not be manually edited.

version:
revision: f18b9281c2280c2646aa3d4348715ed5bb9446c8
channel: beta
revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: android
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: ios
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: linux
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: macos
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: windows
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
35 changes: 24 additions & 11 deletions flutter/realm_flutter/tests/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,21 +22,31 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
namespace "io.realm.tests"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.realm.tests"
minSdkVersion 16
targetSdkVersion 30
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -52,3 +63,5 @@ android {
flutter {
source '../..'
}

dependencies {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.tests">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.tests">
<application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="tests"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand All @@ -18,15 +19,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.realm.tests

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.

This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.tests">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
11 changes: 4 additions & 7 deletions flutter/realm_flutter/tests/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand All @@ -14,17 +15,13 @@ allprojects {
google()
mavenCentral()
}

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

Expand Down
3 changes: 1 addition & 2 deletions flutter/realm_flutter/tests/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4G
android.useAndroidX=true
android.enableJetifier=true
android.native.buildOutput=verbose
Loading
Loading