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';
import 'package:ozzie/ozzie.dart'; // Ozzie dependency
void main() {
group('Veggie app', () {
FlutterDriver driver;
Ozzie ozzie; //Ozzie object
setUp(() async {
await driver.tap(find.text("Home"));
});
setUpAll(() async {
driver = await FlutterDriver.connect();
ozzie = Ozzie.initWith(driver, groupName: 'Veggie'); // Initialize the Ozzie instance
});
tearDownAll(() async {
if (driver != null) {
driver.close();
ozzie.generateHtmlReport(); //Finally generate html report
}
});
test('Apples are displayed', () async {
final cardTitle = find.byValueKey("cardTitleApples");
await ozzie.takeScreenshot("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");
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.