This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e] Test multiple failure behavior (#2514)
* driver test for failure behavior
- Loading branch information
1 parent
70d874d
commit 4dc097d
Showing
5 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2019 The Chromium 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/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:e2e/e2e.dart'; | ||
|
||
import 'package:e2e_example/main.dart'; | ||
|
||
// Tests the failure behavior of the E2EWidgetsFlutterBinding | ||
// | ||
// This test fails intentionally! It should be run using a test runner that | ||
// expects failure. | ||
void main() { | ||
E2EWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('success', (WidgetTester tester) async { | ||
expect(1 + 1, 2); // This should pass | ||
}); | ||
|
||
testWidgets('failure 1', (WidgetTester tester) async { | ||
// Build our app and trigger a frame. | ||
await tester.pumpWidget(MyApp()); | ||
|
||
// Verify that platform version is retrieved. | ||
expect( | ||
find.byWidgetPredicate( | ||
(Widget widget) => | ||
widget is Text && widget.data.startsWith('This should fail'), | ||
), | ||
findsOneWidget, | ||
); | ||
}); | ||
|
||
testWidgets('failure 2', (WidgetTester tester) async { | ||
expect(1 + 1, 3); // This should fail | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter_driver/flutter_driver.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
Future<void> main() async { | ||
test('fails gracefully', () async { | ||
final FlutterDriver driver = await FlutterDriver.connect(); | ||
final String result = | ||
await driver.requestData(null, timeout: const Duration(minutes: 1)); | ||
await driver.close(); | ||
expect( | ||
result, | ||
'failure', | ||
skip: true, // https://github.com/flutter/flutter/issues/48601 | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters