Skip to content

Commit aff9ccc

Browse files
authored
[rfw] Run tests for package:rfw on stable as well. (#888)
1 parent bba6cb8 commit aff9ccc

File tree

5 files changed

+35
-51
lines changed

5 files changed

+35
-51
lines changed

.cirrus.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,8 @@ task:
103103
CHANNEL: "master"
104104
CHANNEL: "stable"
105105
script:
106-
# Exclude:
107-
# - flutter_image; its tests need a test server, so are run via
108-
# local_tests.sh.
109-
# - rfw on stable; it includes golden tests whose results differ
110-
# between branch
111-
- if [[ "$CHANNEL" == "master" ]]; then
112-
- ./script/tool_runner.sh test --exclude=flutter_image
113-
- else
114-
- ./script/tool_runner.sh test --exclude=flutter_image,rfw
115-
- fi
106+
# We exclude flutter_image because its tests need a test server, so are run via local_tests.sh.
107+
- ./script/tool_runner.sh test --exclude=flutter_image
116108
depends_on:
117109
- format+analyze
118110
- name: android-build+platform-tests
@@ -123,18 +115,8 @@ task:
123115
script:
124116
# extension_google_sign_in_as_googleapis_auth is currently not building, see
125117
# https://github.com/flutter/flutter/issues/89301
126-
# rfw is excluded until the next Flutter stable release because it depends
127-
# on features that have never shipped to stable. (The rfw package has
128-
# never worked on stable so this is not going to break anyone.)
129-
# When updating this, also look at the ios tests below.
130-
# When updating this, also update the `rfw/run_tests.sh` file.
131-
- if [[ "$CHANNEL" == "master" ]]; then
132-
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth
133-
- ./script/tool_runner.sh native-test --android --no-integration
134-
- else
135-
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth,rfw
136-
- ./script/tool_runner.sh native-test --android --no-integration --exclude=rfw
137-
- fi
118+
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth
119+
- ./script/tool_runner.sh native-test --android --no-integration
138120
depends_on:
139121
- format+analyze
140122
- name: web_benchmarks_test
@@ -164,16 +146,7 @@ task:
164146
CHANNEL: "master"
165147
CHANNEL: "stable"
166148
build_script:
167-
# Exclude rfw until the next Flutter stable release because it depends
168-
# on features that have never shipped to stable. (The rfw package has
169-
# never worked on stable so this is not going to break anyone.)
170-
# When updating this, also look at the android tests above.
171-
# When updating this, also update the `rfw/run_tests.sh` file.
172-
- if [[ "$CHANNEL" == "master" ]]; then
173-
- ./script/tool_runner.sh build-examples --ios
174-
- else
175-
- ./script/tool_runner.sh build-examples --ios --exclude=rfw
176-
- fi
149+
- ./script/tool_runner.sh build-examples --ios
177150
- name: local_tests
178151
env:
179152
PATH: $PATH:/usr/local/bin

packages/rfw/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,7 @@ When contributing code, ensure that `flutter test --coverage; lcov
266266
update `test_coverage/bin/test_coverage.dart` with the appropriate
267267
expectations to prevent future coverage regressions. (That program is
268268
run by `run_tests.sh`.)
269+
270+
Golden tests are only run against the Flutter master channel and only
271+
run on Linux, since minor rendering differences are expected on
272+
different platforms and on different versions of Flutter.

packages/rfw/test/argument_decoders_test.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44

55
// This file is hand-formatted.
66

7+
import 'dart:io' show Platform;
8+
79
import 'package:flutter/material.dart';
810
import 'package:flutter_test/flutter_test.dart';
911
import 'package:rfw/formats.dart' show parseLibraryFile;
1012
import 'package:rfw/rfw.dart';
1113

14+
// See Contributing section of README.md file.
15+
final bool runGoldens = Platform.isLinux &&
16+
(!Platform.environment.containsKey('CHANNEL') ||
17+
Platform.environment['CHANNEL'] == 'master');
18+
1219
void main() {
1320
testWidgets('String example', (WidgetTester tester) async {
1421
Duration? duration;
@@ -494,5 +501,5 @@ void main() {
494501
find.byType(RemoteWidget),
495502
matchesGoldenFile('goldens/argument_decoders_test.gridview.custom.png'),
496503
);
497-
});
504+
}, skip: !runGoldens);
498505
}

packages/rfw/test/material_widgets_test.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'dart:io' show Platform;
6+
57
import 'package:flutter/material.dart';
68
import 'package:flutter_test/flutter_test.dart';
79
import 'package:rfw/formats.dart' show parseLibraryFile;
810
import 'package:rfw/rfw.dart';
911

12+
// See Contributing section of README.md file.
13+
final bool runGoldens = Platform.isLinux &&
14+
(!Platform.environment.containsKey('CHANNEL') ||
15+
Platform.environment['CHANNEL'] == 'master');
16+
1017
void main() {
1118
testWidgets('Material widgets', (WidgetTester tester) async {
1219
final Runtime runtime = Runtime()
@@ -140,5 +147,5 @@ void main() {
140147
find.byType(RemoteWidget),
141148
matchesGoldenFile('goldens/material_test.drawer.png'),
142149
);
143-
});
150+
}, skip: !runGoldens);
144151
}

packages/rfw/test_coverage/bin/test_coverage.dart

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,32 @@ const String lastUpdate = '2021-08-30';
1515
Future<void> main(List<String> arguments) async {
1616
// This script is mentioned in the README.md file.
1717

18-
if (Platform.environment['CHANNEL'] == 'stable') {
19-
// For now these are disabled because this package has never been supported
20-
// on the stable channel and requires newer language features that have not
21-
// yet shipped to a stable build. It will be possible to test this with the
22-
// first stable to ship after October 2021.
23-
print(
24-
'Skipping tests on stable channel.\n'
25-
'These tests can be unskipped once we ship a stable after October 2021.',
26-
);
27-
exit(0);
28-
}
29-
3018
final Directory coverageDirectory = Directory('coverage');
3119

3220
if (coverageDirectory.existsSync()) {
3321
coverageDirectory.deleteSync(recursive: true);
3422
}
3523

36-
// We run with --update-goldens because the goal here is not to verify the tests
37-
// pass but to verify the coverage, and the goldens are not always going to pass
38-
// when run on different platforms (e.g. on Cirrus we run this on a mac but the
39-
// goldens expect a linux box).
4024
final ProcessResult result = Process.runSync(
4125
'flutter',
42-
<String>['test', '--coverage', '--update-goldens'],
26+
<String>['test', '--coverage'],
4327
);
4428
if (result.exitCode != 0) {
4529
print(result.stdout);
4630
print(result.stderr);
4731
print('Tests failed.');
32+
// leave coverage directory around to aid debugging
4833
exit(1);
4934
}
5035

36+
if (Platform.environment['CHANNEL'] != 'master') {
37+
print(
38+
'Tests passed. (Coverage verification skipped; not on master channel.)',
39+
);
40+
coverageDirectory.deleteSync(recursive: true);
41+
exit(0);
42+
}
43+
5144
final List<lcov.Record> records = await lcov.Parser.parse(
5245
'coverage/lcov.info',
5346
);

0 commit comments

Comments
 (0)