Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b6eed39
In progress
redbrogdon Jan 28, 2020
303b055
In progress
redbrogdon Feb 3, 2020
baed761
Working tests in android_fullscreen.
redbrogdon Feb 10, 2020
91b20a0
Formatting/lints.
redbrogdon Feb 10, 2020
58c4611
Added travis script changes
redbrogdon Feb 11, 2020
e262c9f
Newlines
redbrogdon Feb 11, 2020
a824d62
Altering API level
redbrogdon Feb 12, 2020
af8f8b2
Reworking travis config
redbrogdon Feb 12, 2020
8553851
Rerunning travis config
redbrogdon Feb 19, 2020
05a10eb
More travis-ing.
redbrogdon Mar 4, 2020
88b0bae
travis again.
redbrogdon Mar 4, 2020
57f2fa6
travis again.
redbrogdon Mar 4, 2020
45e66b4
Catting results
redbrogdon Mar 4, 2020
15004ab
Catting results
redbrogdon Mar 4, 2020
3d3d206
Adding gradle debug flags
redbrogdon Mar 4, 2020
619cd89
Logcat
redbrogdon Mar 5, 2020
a093123
Everything but the keyfile
redbrogdon Mar 11, 2020
76179d8
Adding travis var setup
redbrogdon Mar 11, 2020
11c67d8
Removing emulator setup
redbrogdon Mar 11, 2020
5f01303
Updating gcloud setup
redbrogdon Mar 11, 2020
ff7eccf
Re-enabling android builds
redbrogdon Mar 11, 2020
fb138de
Changing creds for flutter repo
redbrogdon Mar 11, 2020
96c4b80
Escape hatch
redbrogdon Mar 11, 2020
8267d91
Removing specific component update
redbrogdon Mar 11, 2020
7293c08
Checking on json file
redbrogdon Mar 11, 2020
eb09840
Fixing multidex
redbrogdon Mar 11, 2020
e2b41eb
Redoing multidex
redbrogdon Mar 12, 2020
60c4b73
Cleaning up travis.yml
redbrogdon Mar 12, 2020
92c5d39
Fixing multidex for prebuilt sample
redbrogdon Mar 12, 2020
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
# Web related
**/web/**/lib/generated_plugin_registrant.dart

# Service account files
svc-keyfile.json
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so we don't accidentally commit the credentials file to the repo.


# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
Expand Down
129 changes: 75 additions & 54 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,95 @@ git:

jobs:
include:
- name: "iOS tests, stable channel"
os: osx
osx_image: xcode11.2
language: objective-c
script: ./tool/travis_ios_script.sh
env: FLUTTER_VERSION=stable
- name: iOS tests, stable channel
os: osx
osx_image: xcode11.2
language: objective-c
script: "./tool/travis_ios_script.sh"
env: FLUTTER_VERSION=stable

- name: "Android tests, stable channel"
os: linux
dist: trusty
language: android
android:
components:
- build-tools-28.0.3
- android-28
script: ./tool/travis_android_script.sh
env: FLUTTER_VERSION=stable
- name: Android tests, stable channel
os: linux
dist: trusty
language: android
android:
components:
- build-tools-28.0.3
- android-28
script: "./tool/travis_android_script.sh"
env: FLUTTER_VERSION=stable

- name: "Flutter tests, stable channel"
os: linux
dist: trusty
language: ruby
script: ./tool/travis_flutter_script.sh
env: FLUTTER_VERSION=stable
- name: Flutter tests, stable channel
os: linux
dist: trusty
language: ruby
script: "./tool/travis_flutter_script.sh"
env: FLUTTER_VERSION=stable

- name: "iOS tests, beta channel"
os: osx
osx_image: xcode11.2
language: objective-c
script: ./tool/travis_ios_script.sh
env: FLUTTER_VERSION=beta
- name: iOS tests, beta channel
os: osx
osx_image: xcode11.2
language: objective-c
script: "./tool/travis_ios_script.sh"
env: FLUTTER_VERSION=beta

- name: "Android tests, beta channel"
os: linux
dist: trusty
language: android
android:
components:
- build-tools-28.0.3
- android-28
script: ./tool/travis_android_script.sh
env: FLUTTER_VERSION=beta
- name: Android tests, beta channel
os: linux
dist: trusty
language: android
android:
components:
- build-tools-28.0.3
- android-28
script: "./tool/travis_android_script.sh"
env: FLUTTER_VERSION=beta

- name: "Flutter tests, beta channel"
os: linux
dist: trusty
language: ruby
script: ./tool/travis_flutter_script.sh
env: FLUTTER_VERSION=beta
- name: Flutter tests, beta channel
os: linux
dist: trusty
language: ruby
script: "./tool/travis_flutter_script.sh"
env: FLUTTER_VERSION=beta

allow_failures:
- env: FLUTTER_VERSION=beta
- env: FLUTTER_VERSION=beta

env:
global:
# Disabling this makes it easier to install our own copy of gcloud
- CLOUDSDK_CORE_DISABLE_PROMPTS=1

before_script:
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION
- ./flutter/bin/flutter doctor
- chmod +x tool/travis_*_script.sh
- git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION
- "./flutter/bin/flutter doctor"
- chmod +x tool/travis_*_script.sh

cache:
cocoapods: true
directories:
- $HOME/shared/.pub-cache
- "$HOME/shared/.pub-cache"
- "$HOME/google-cloud-sdk"

notifications:
email:
brogdon+github@gmail.com
email: brogdon+github@gmail.com

# Building master alone means that we don't run two builds for
# each pull request.
branches:
only: [master]
only:
- master

before_install:
# Decrypt credentials for Firebase Test Lab service account. This key will only
# decrypt properly when run from within the flutter/samples repo (not a PR from
# a fork, for example), so failure is expected in some cases. The Android test
# script is the only one that uses this value, and will account for a lack of
# credentials.
- openssl aes-256-cbc -K $encrypted_ccb0f43ba178_key -iv $encrypted_ccb0f43ba178_iv
-in svc-keyfile.json.enc -out svc-keyfile.json -d || rm svc-keyfile.json || true
- ls -la
# Install our own copy of gcloud. This is necessary because the default copy is
# so old it doesn't offer a firebase component.
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf "$HOME/google-cloud-sdk";
curl https://sdk.cloud.google.com | bash > /dev/null; fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud components update
- gcloud version
10 changes: 7 additions & 3 deletions add_to_app/android_fullscreen/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
Expand All @@ -26,13 +27,16 @@ android {
}

dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation project(':flutter')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation project(':espresso')
androidTestImplementation "com.google.truth:truth:0.42"
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
api 'androidx.test:core:1.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,68 @@

package dev.flutter.example.androidfullscreen

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.flutter.EspressoFlutter.onFlutterWidget
import androidx.test.espresso.flutter.action.FlutterActions.click
import androidx.test.espresso.flutter.assertion.FlutterAssertions.matches
import androidx.test.espresso.flutter.matcher.FlutterMatchers
import androidx.test.espresso.flutter.matcher.FlutterMatchers.withText
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
class MainActivityTest {
@Before
fun setUp() {
ActivityScenario.launch(MainActivity::class.java)
}

@Test
fun flutterTextUpdatesOnClick() {
// Launch Flutter module.
onView(withId(R.id.launch_button)).perform(androidx.test.espresso.action.ViewActions.click())

// Verify state is inited correctly.
onFlutterWidget(withText("Taps: 0"))
.check(matches(FlutterMatchers.isExisting()))

// Verify the increment button works.
onFlutterWidget(withText("Tap me!")).perform(click())
onFlutterWidget(withText("Taps: 1"))
.check(matches(FlutterMatchers.isExisting()))
}

@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("dev.flutter.example.androidfullscreen", appContext.packageName)
fun nativeTextViewUpdatesOnClick() {
// Verify Android TextView is inited correctly.
onView(withId(R.id.counter_label)).check(
androidx.test.espresso.assertion.ViewAssertions.matches(
// TODO(redbrogdon): This should be a check for 0 rather than 1. Because our state
// management is hardcoded into the Application object, though, and that object is
// reused across tests, this test begins with a counter already incremented by the
// previous one. This situation can be corrected via DI or a number of other
// approaches.
androidx.test.espresso.matcher.ViewMatchers.withText("Current count: 1")
)
)

// Launch Flutter module.
onView(withId(R.id.launch_button)).perform(androidx.test.espresso.action.ViewActions.click())

// Increment count.
onFlutterWidget(withText("Tap me!")).perform(click())

// Exit Flutter module and verify that the Android TextView is updated correctly.
onFlutterWidget(withText("Exit this screen")).perform(click())
onView(withId(R.id.counter_label)).check(
androidx.test.espresso.assertion.ViewAssertions.matches(
// TODO(redbrogdon): s/2/1
androidx.test.espresso.matcher.ViewMatchers.withText("Current count: 2")
)
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="dev.flutter.example.androidfullscreen">

<!-- Include Cleartext traffic for the espresso package -->

<application android:usesCleartextTraffic="true" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,15 @@
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true"
/>
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize" />
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

package dev.flutter.example.androidfullscreen

import android.app.Application
import androidx.multidex.MultiDexApplication
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.FlutterEngineCache
import io.flutter.embedding.engine.dart.DartExecutor
import io.flutter.plugin.common.MethodChannel

const val ENGINE_ID = "1"

class MyApplication : Application() {
class MyApplication : MultiDexApplication() {
var count = 0

private lateinit var channel: MethodChannel
Expand Down
2 changes: 1 addition & 1 deletion add_to_app/android_fullscreen/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Sep 17 09:33:13 PDT 2019
#Wed Mar 11 09:25:37 PDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
1 change: 0 additions & 1 deletion add_to_app/android_using_plugin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ android {

dependencies {
implementation project(':flutter')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
Expand Down
9 changes: 6 additions & 3 deletions add_to_app/android_using_prebuilt_module/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
Expand Down Expand Up @@ -46,12 +47,14 @@ dependencies {
transitive = true
}

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.multidex:multidex:2.0.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation "com.google.truth:truth:0.42"
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
api 'androidx.test:core:1.2.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

package dev.flutter.example.androidusingprebuiltmodule

import android.app.Application
import androidx.multidex.MultiDexApplication
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.engine.FlutterEngineCache
import io.flutter.embedding.engine.dart.DartExecutor
import io.flutter.plugin.common.MethodChannel

const val ENGINE_ID = "1"

class MyApplication : Application() {
class MyApplication : MultiDexApplication() {
var count = 0

private lateinit var channel: MethodChannel
Expand Down
Loading