[web] Smoke tests for web engine (#51003)
* smoke test for web * fix comments and remove logs * addressing reviewer comments * fix analyzer issue * running the test on cirrus * cirrus yaml syntax error * pub get for web_drivers * go to the examples directory before running the flutter app * cirrus is not able to find chromedriver. add a sleep to see if timing is the issue. * run chrome driver in the background * After PR #51084, flutter drive command can build and run a web app. Clean flutter run command from cirrus.yml * enable web
This commit is contained in:
12
examples/hello_world/test_driver/smoke_web_engine.dart
Normal file
12
examples/hello_world/test_driver/smoke_web_engine.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// 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/driver_extension.dart';
|
||||
import 'package:hello_world/main.dart' as app;
|
||||
|
||||
void main() {
|
||||
enableFlutterDriverExtension();
|
||||
|
||||
app.main();
|
||||
}
|
||||
32
examples/hello_world/test_driver/smoke_web_engine_test.dart
Normal file
32
examples/hello_world/test_driver/smoke_web_engine_test.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
/// The following test is used as a simple smoke test for verfying Flutter
|
||||
/// Framework and Flutter Web Engine integration.
|
||||
void main() {
|
||||
group('Hello World App', () {
|
||||
final SerializableFinder titleFinder = find.byValueKey('title');
|
||||
|
||||
FlutterDriver driver;
|
||||
|
||||
// Connect to the Flutter driver before running any tests.
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect();
|
||||
});
|
||||
|
||||
// Close the connection to the driver after the tests have completed.
|
||||
tearDownAll(() async {
|
||||
if (driver != null) {
|
||||
driver.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('title is correct', () async {
|
||||
expect(await driver.getText(titleFinder), 'Hello, world!');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user