Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Imports the Flutter Driver API
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';
void main() {
group('Veggie app', () {
FlutterDriver driver;
setUp(() async {
// in order to make app starting from the home screen each time
await driver.tap(find.text("Home"));
});
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
if (driver != null) {
driver.close();
}
});
test('Apples are displayed', () async {
final cardTitle = find.byValueKey("cardTitleApples");
await ozzie.takeScreenshot("Apples");
await diff("Apples");
expect(await driver.getText(cardTitle),"Apples");
});
test('Plums are displayed', () async {
final cardTitle = find.byValueKey("cardTitlePlums");
await driver.scrollUntilVisible(find.byValueKey("list"), cardTitle, dyScroll: -500);
await ozzie.takeScreenshot("Plums");
await diff("Plums");
expect(await driver.getText(cardTitle),"Plums");
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.