Fixes Leaderboard Display Tests

pull/505/head
Alvaro Almeida Freire Stivi 1 year ago
parent cea33687f4
commit 04d1f6d59c
No known key found for this signature in database

@ -60,5 +60,4 @@ class DefaultFirebaseOptions {
authDomain: '', authDomain: '',
storageBucket: '', storageBucket: '',
); );
} }

@ -108,6 +108,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'renders the titles', 'renders the titles',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
await game.pump(LeaderboardDisplay(entries: const [])); await game.pump(LeaderboardDisplay(entries: const []));
await game.ready(); await game.ready();
}, },
@ -124,7 +125,9 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'renders the first 5 entries', 'renders the first 5 entries',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
await game.pump(LeaderboardDisplay(entries: leaderboard)); await game.pump(LeaderboardDisplay(entries: leaderboard));
await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
for (final text in [ for (final text in [
@ -154,6 +157,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'can open the second page', 'can open the second page',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final display = LeaderboardDisplay(entries: leaderboard); final display = LeaderboardDisplay(entries: leaderboard);
await game.pump(display); await game.pump(display);
final arrow = game final arrow = game
@ -165,7 +169,7 @@ void main() {
// Tap the arrow // Tap the arrow
arrow.onTap(); arrow.onTap();
// Wait for the transition to finish // Wait for the transition to finish
display.updateTree(5); game.update(5);
await game.ready(); await game.ready();
}, },
verify: (game, _) async { verify: (game, _) async {
@ -196,6 +200,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'can open the second page and go back to the first', 'can open the second page and go back to the first',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
final display = LeaderboardDisplay(entries: leaderboard); final display = LeaderboardDisplay(entries: leaderboard);
await game.pump(display); await game.pump(display);
@ -208,10 +213,10 @@ void main() {
// Tap the arrow // Tap the arrow
arrow.onTap(); arrow.onTap();
// Wait for the transition to finish // Wait for the transition to finish
display.updateTree(5); game.update(5);
await game.ready(); await game.ready();
}, },
verify: (game, _) async { verify: (game, tester) async {
for (final text in [ for (final text in [
'FFF', 'FFF',
'GGG', 'GGG',
@ -244,9 +249,8 @@ void main() {
arrow.onTap(); arrow.onTap();
// Wait for the transition to finish // Wait for the transition to finish
final display = LeaderboardDisplay(entries: leaderboard); game.update(5);
display.updateTree(5); await tester.pump();
await game.ready();
for (final text in [ for (final text in [
'AAA', 'AAA',

@ -45,6 +45,7 @@ void main() {
flameTester.testGameWidget( flameTester.testGameWidget(
'renders correctly', 'renders correctly',
setUp: (game, _) async { setUp: (game, _) async {
await game.onLoad();
await game.pump(LeaderboardFailureDisplay()); await game.pump(LeaderboardFailureDisplay());
await game.ready(); await game.ready();
}, },

Loading…
Cancel
Save