This reverts commit ca2d7b3d3c.
This commit is contained in:
@@ -5,6 +5,7 @@ environment:
|
||||
sdk: ">=2.8.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
image: 3.0.0-nullsafety.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_driver:
|
||||
@@ -40,6 +41,7 @@ dependencies:
|
||||
package_config: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
path: 1.8.0-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
pedantic: 1.10.0-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
petitparser: 4.0.0-nullsafety.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
pool: 1.5.0-nullsafety.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
pub_semver: 1.4.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
shelf: 0.7.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
@@ -62,6 +64,7 @@ dependencies:
|
||||
web_socket_channel: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
webdriver: 3.0.0-nullsafety.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
webkit_inspection_protocol: 0.7.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
xml: 5.0.0-nullsafety.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
yaml: 2.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
|
||||
|
||||
dev_dependencies:
|
||||
@@ -75,4 +78,4 @@ dev_dependencies:
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
# PUBSPEC CHECKSUM: 410e
|
||||
# PUBSPEC CHECKSUM: 0385
|
||||
|
||||
47
dev/integration_tests/ui/test_driver/screenshot_test.dart
Normal file
47
dev/integration_tests/ui/test_driver/screenshot_test.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:image/image.dart';
|
||||
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
void main() {
|
||||
group('FlutterDriver', () {
|
||||
FlutterDriver driver;
|
||||
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect();
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
await driver.close();
|
||||
});
|
||||
|
||||
test('should take screenshot', () async {
|
||||
final SerializableFinder toggleBtn = find.byValueKey('toggle');
|
||||
// Cards use a magic background color that we look for in the screenshots.
|
||||
final Matcher cardsAreVisible = contains(getColor(0xff, 0x01, 0x02));
|
||||
await driver.waitFor(toggleBtn);
|
||||
|
||||
bool cardsShouldBeVisible = false;
|
||||
Image imageBefore = decodePng(await driver.screenshot());
|
||||
for (int i = 0; i < 10; i += 1) {
|
||||
await driver.tap(toggleBtn);
|
||||
cardsShouldBeVisible = !cardsShouldBeVisible;
|
||||
final Image imageAfter = decodePng(await driver.screenshot());
|
||||
|
||||
if (cardsShouldBeVisible) {
|
||||
expect(imageBefore.data, isNot(cardsAreVisible));
|
||||
expect(imageAfter.data, cardsAreVisible);
|
||||
} else {
|
||||
expect(imageBefore.data, cardsAreVisible);
|
||||
expect(imageAfter.data, isNot(cardsAreVisible));
|
||||
}
|
||||
|
||||
imageBefore = imageAfter;
|
||||
}
|
||||
}, timeout: const Timeout(Duration(minutes: 2)));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user