Skip to content

Instantly share code, notes, and snippets.

@adam-stasiak
Last active September 19, 2019 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adam-stasiak/9c1cf0cb0c87c58d6fc34553ba10cae6 to your computer and use it in GitHub Desktop.
Save adam-stasiak/9c1cf0cb0c87c58d6fc34553ba10cae6 to your computer and use it in GitHub Desktop.
// 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