Last active
September 19, 2019 12:36
-
-
Save adam-stasiak/9c1cf0cb0c87c58d6fc34553ba10cae6 to your computer and use it in GitHub Desktop.
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
// 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