Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Ensure that integration tests are actually being run #3857

Merged
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
18 changes: 12 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ task:
build_script:
- flutter config --enable-linux-desktop
- ./script/tool_runner.sh build-examples --linux
test_script:
drive_script:
- xvfb-run ./script/tool_runner.sh drive-examples --linux

# Heavy-workload Linux tasks.
Expand Down Expand Up @@ -167,6 +167,8 @@ task:
### Web tasks ###
- name: build-web+drive-examples
env:
# Currently missing; see https://github.com/flutter/flutter/issues/81982
PLUGINS_TO_EXCLUDE_INTEGRATION_TESTS: "image_picker_for_web,shared_preferences_web,video_player_web"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
Expand All @@ -178,10 +180,10 @@ task:
- ./chromedriver/chromedriver --port=4444 &
build_script:
- ./script/tool_runner.sh build-examples --web
test_script:
drive_script:
# TODO(stuartmorgan): Eliminate this check once 2.1 reaches stable.
- if [[ "$CHANNEL" == "master" ]]; then
- ./script/tool_runner.sh drive-examples --web
- ./script/tool_runner.sh drive-examples --web --exclude $PLUGINS_TO_EXCLUDE_INTEGRATION_TESTS
- else
- echo "Requires null-safe integration_test; skipping."
- fi
Expand All @@ -203,6 +205,9 @@ task:
env:
PATH: $PATH:/usr/local/bin
PLUGINS_TO_SKIP_XCTESTS: "integration_test"
# in_app_purchase_ios is currently missing tests; see https://github.com/flutter/flutter/issues/81695
# sensor hangs on CI.
PLUGINS_TO_EXCLUDE_INTEGRATION_TESTS: "in_app_purchase_ios,sensors"
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
Expand All @@ -217,12 +222,13 @@ task:
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-14-3 | xargs xcrun simctl boot
build_script:
- ./script/tool_runner.sh build-examples --ipa
test_script:
xctest_script:
- ./script/tool_runner.sh xctest --skip $PLUGINS_TO_SKIP_XCTESTS --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
drive_script:
# `drive-examples` contains integration tests, which changes the UI of the application.
# This UI change sometimes affects `xctest`.
# So we run `drive-examples` after `xctest`, changing the order will result ci failure.
- ./script/tool_runner.sh drive-examples --ios
- ./script/tool_runner.sh drive-examples --ios --exclude $PLUGINS_TO_EXCLUDE_INTEGRATION_TESTS
### macOS desktop tasks ###
- name: build_all_plugins_macos
env:
Expand All @@ -241,7 +247,7 @@ task:
build_script:
- flutter config --enable-macos-desktop
- ./script/tool_runner.sh build-examples --macos --no-ipa
test_script:
drive_script:
- ./script/tool_runner.sh drive-examples --macos

task:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@

// @dart=2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:integration_test/integration_test_driver.dart';

import 'package:flutter_driver/flutter_driver.dart';

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
final String data = await driver.requestData(
null,
timeout: const Duration(minutes: 1),
);
await driver.close();
final Map<String, dynamic> result = jsonDecode(data);
exit(result['result'] == 'true' ? 0 : 1);
}
Future<void> main() => integrationDriver();
19 changes: 3 additions & 16 deletions packages/android_intent/example/test_driver/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9
// @dart=2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:integration_test/integration_test_driver.dart';

import 'package:flutter_driver/flutter_driver.dart';

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
final String data = await driver.requestData(
null,
timeout: const Duration(minutes: 1),
);
await driver.close();
final Map<String, dynamic> result = jsonDecode(data);
exit(result['result'] == 'true' ? 0 : 1);
}
Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.9
// @dart=2.9

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:battery/battery.dart';
import 'package:integration_test/integration_test.dart';
Expand All @@ -13,7 +14,18 @@ void main() {

testWidgets('Can get battery level', (WidgetTester tester) async {
final Battery battery = Battery();
final int batteryLevel = await battery.batteryLevel;
int batteryLevel;
try {
batteryLevel = await battery.batteryLevel;
} on PlatformException catch (e) {
// The "UNAVAIBLE" error just means that the system reported the battery
// level as unknown (e.g., the test is running on simulator); it still
// indicates that the plugin itself is working as expected, so consider it
// as passing.
if (e.code == 'UNAVAILABLE') {
batteryLevel = 1;
}
}
expect(batteryLevel, isNotNull);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() async => integrationDriver();
Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// TODO(cyanglaz): Remove once https://github.com/flutter/flutter/issues/59879 is fixed.
// @dart = 2.9
// @dart=2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
final String data =
await driver.requestData(null, timeout: const Duration(minutes: 1));
await driver.close();
final Map<String, dynamic> result = jsonDecode(data);
exit(result['result'] == 'true' ? 0 : 1);
}
Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:integration_test/integration_test_driver.dart';

Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
final String data =
await driver.requestData(null, timeout: const Duration(minutes: 1));
await driver.close();
final Map<String, dynamic> result = jsonDecode(data);
exit(result['result'] == 'true' ? 0 : 1);
}
Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() async => integrationDriver();
Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() async => integrationDriver();
Future<void> main() => integrationDriver();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart=2.9

import 'package:integration_test/integration_test_driver.dart';

Future<void> main() => integrationDriver();

This file was deleted.

Loading