Revert "Allow Flutter golden file tests to be flaky (#114450)" (#114902)

This reverts commit 53e6876226.
This commit is contained in:
Zachary Anderson
2022-11-08 09:26:55 -08:00
committed by GitHub
parent a1432a9c5d
commit a84e369bd2
35 changed files with 1351 additions and 2093 deletions

View File

@@ -41,13 +41,13 @@ void main() {
final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink;
final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess, logger: BufferLogger.test());
process.sendCommand(imageFile, goldenKey, false, <String, String>{'additional data' : 'data'});
process.sendCommand(imageFile, goldenKey, false);
final Map<String, dynamic> response = await process.getResponse();
final String stringToStdin = ioSink.getAndClear();
expect(response, expectedResponse);
expect(stringToStdin, '{"imageFile":"test_image_file","key":"file://golden_key/","update":false,"customProperties":{"additional data":"data"}}\n');
expect(stringToStdin, '{"imageFile":"test_image_file","key":"file://golden_key/","update":false}\n');
});
testWithoutContext('can handle multiple requests', () async {
@@ -64,21 +64,18 @@ void main() {
final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink;
final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess, logger: BufferLogger.test());
process.sendCommand(imageFile, goldenKey, false, null);
process.sendCommand(imageFile, goldenKey, false);
final Map<String, dynamic> response1 = await process.getResponse();
process.sendCommand(imageFile2, goldenKey2, true, null);
process.sendCommand(imageFile2, goldenKey2, true);
final Map<String, dynamic> response2 = await process.getResponse();
final String stringToStdin = ioSink.getAndClear();
expect(response1, expectedResponse1);
expect(response2, expectedResponse2);
expect(
stringToStdin,
'{"imageFile":"test_image_file","key":"file://golden_key/","update":false}\n'
'{"imageFile":"second_test_image_file","key":"file://second_golden_key/","update":true}\n');
expect(stringToStdin, '{"imageFile":"test_image_file","key":"file://golden_key/","update":false}\n{"imageFile":"second_test_image_file","key":"file://second_golden_key/","update":true}\n');
});
testWithoutContext('ignores anything that does not look like JSON', () async {
@@ -97,7 +94,7 @@ Other JSON data after the initial data
final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink;
final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess,logger: BufferLogger.test());
process.sendCommand(imageFile, goldenKey, false, null);
process.sendCommand(imageFile, goldenKey, false);
final Map<String, dynamic> response = await process.getResponse();
final String stringToStdin = ioSink.getAndClear();

View File

@@ -61,7 +61,7 @@ void main() {
webRenderer: WebRendererMode.html,
);
final String? result = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false, null);
final String? result = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false);
expect(result, null);
});
@@ -90,7 +90,7 @@ void main() {
webRenderer: WebRendererMode.canvaskit,
);
final String? result = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false, null);
final String? result = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false);
expect(result, 'some message');
});
@@ -123,10 +123,10 @@ void main() {
webRenderer: WebRendererMode.html,
);
final String? result1 = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false, null);
final String? result1 = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false);
expect(result1, 'some message');
final String? result2 = await comparator.compareGoldens(testUri, imageBytes, goldenKey2, false, null);
final String? result2 = await comparator.compareGoldens(testUri, imageBytes, goldenKey2, false);
expect(result2, 'some other message');
});
@@ -168,10 +168,10 @@ void main() {
webRenderer: WebRendererMode.canvaskit,
);
final String? result1 = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false, null);
final String? result1 = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false);
expect(result1, 'some message');
final String? result2 = await comparator.compareGoldens(testUri2, imageBytes, goldenKey2, false, null);
final String? result2 = await comparator.compareGoldens(testUri2, imageBytes, goldenKey2, false);
expect(result2, 'some other message');
});
@@ -203,7 +203,7 @@ void main() {
webRenderer: WebRendererMode.html,
);
final String? result = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false, null);
final String? result = await comparator.compareGoldens(testUri, imageBytes, goldenKey, false);
expect(result, null);
await comparator.close();

View File

@@ -117,7 +117,7 @@ void main() {
final List<String> allowedPaths = <String>[
fileSystem.path.join(flutterTools, 'lib', 'src', 'test', 'flutter_platform.dart'),
fileSystem.path.join(flutterTools, 'lib', 'src', 'test', 'flutter_web_platform.dart'),
fileSystem.path.join(flutterTools, 'lib', 'src', 'test', 'flutter_goldens.dart'),
fileSystem.path.join(flutterTools, 'lib', 'src', 'test', 'test_wrapper.dart'),
];
bool isNotAllowed(FileSystemEntity entity) => allowedPaths.every((String path) => path != entity.path);