use throwsA (#82238)

This commit is contained in:
Alexandre Ardhuin
2021-05-11 19:19:01 +02:00
committed by GitHub
parent 7b9a175557
commit df3662b15e
22 changed files with 311 additions and 297 deletions

View File

@@ -531,13 +531,14 @@ void main() {
fakeClient.responses['waitFor'] = makeFakeResponse(<String, dynamic>{
'message': 'This is a failure',
}, isError: true);
try {
await driver.waitFor(find.byTooltip('foo'));
fail('expected an exception');
} catch (error) {
expect(error, isA<DriverError>());
expect((error as DriverError).message, 'Error in Flutter application: {message: This is a failure}');
}
await expectLater(
() => driver.waitFor(find.byTooltip('foo')),
throwsA(isA<DriverError>().having(
(DriverError error) => error.message,
'message',
'Error in Flutter application: {message: This is a failure}',
)),
);
});
test('uncaught remote error', () async {