Skip to content

Commit

Permalink
fix: failed test on local
Browse files Browse the repository at this point in the history
StartOfDayの後片付けができてなかった
  • Loading branch information
zin- committed Sep 17, 2024
1 parent 7d5174b commit 645553e
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 88 deletions.
62 changes: 26 additions & 36 deletions integration_test/scenarios/settings/settings_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,43 +127,33 @@ void main() => group(
},
);

group(
"with saved",
() {
final now = DateTime.now();
setUp(() async {
await PreferenceClientRepository().receive(PreferenceEntity(
startOfDayKey,
TimeOfDay.fromDateTime(now),
));
});

testWidgets(
"show saved.",
(widgetTester) async {
await runApplication();
await widgetTester.pumpAndSettle();

await widgetTester.tap(drawerIconFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.text(l10n.settingsPageTitle));
await widgetTester.pumpAndSettle();

expect(
widgetTester
.widget<Text>(find
.descendant(
group('with saved', () {
final now = DateTime.now();
setUp(() async {
await PreferenceClientRepository().receive(PreferenceEntity(
startOfDayKey, TimeOfDay.fromDateTime(now)));
});

testWidgets('show saved.', (widgetTester) async {
await runApplication();
await widgetTester.pumpAndSettle();

await widgetTester.tap(drawerIconFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.text(l10n.settingsPageTitle));
await widgetTester.pumpAndSettle();

expect(
widgetTester
.widget<Text>(find
.descendant(
of: find.byType(SettingsTile),
matching: find.byType(Text),
)
.at(1))
.data,
timeText(now),
);
},
);
},
);
matching: find.byType(Text))
.at(1))
.data,
timeText(now));
});
});
},
);

Expand Down
97 changes: 45 additions & 52 deletions integration_test/scenarios/task_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -340,70 +340,63 @@ void testTaskScenario() => group(': $_scenarioName', () {
},
);

testWidgets(
": start is not all day, end is all day.",
(widgetTester) async {
await PreferenceClientRepository().receive(PreferenceEntity(
startOfDayKey,
const TimeOfDay(hour: 1, minute: 0),
));
testWidgets(': start is not all day, end is all day.',
(widgetTester) async {
widgetTester.ignoreMockMethodCallHandler(
MethodChannelMock.permissionHandler);

await runApplication();
await widgetTester.pumpAndSettle();
await widgetTester.tap(newMemFabFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(calendarIconFinder.at(0));
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.byIcon(Icons.chevron_right).at(0));
await widgetTester.pumpAndSettle();
const pickingDate = 1;
await widgetTester.tap(find.text("$pickingDate"));
await widgetTester.tap(okFinder);
await widgetTester.pumpAndSettle();
await PreferenceClientRepository().receive(PreferenceEntity(
startOfDayKey, const TimeOfDay(hour: 1, minute: 0)));

await widgetTester.tap(find.byType(Switch).at(0));
await widgetTester.pumpAndSettle();
await runApplication();
await widgetTester.pumpAndSettle();
await widgetTester.tap(newMemFabFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(calendarIconFinder.at(0));
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.byIcon(Icons.chevron_right).at(0));
await widgetTester.pumpAndSettle();
const pickingDate = 1;
await widgetTester.tap(find.text("$pickingDate"));
await widgetTester.tap(okFinder);
await widgetTester.pumpAndSettle();

await widgetTester.tap(okFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(find.byType(Switch).at(0));
await widgetTester.pumpAndSettle();

await widgetTester.tap(calendarIconFinder.at(1));
await widgetTester.pumpAndSettle();
await widgetTester.tap(okFinder);
await widgetTester.pumpAndSettle();

await widgetTester.tap(find.text("$pickingDate"));
await widgetTester.tap(okFinder);
await widgetTester.pumpAndSettle();
await widgetTester.tap(calendarIconFinder.at(1));
await widgetTester.pumpAndSettle();

final now = DateTime.now();
final endDate = DateTime(now.year, now.month + 1, pickingDate);
expect(
await widgetTester.tap(find.text("$pickingDate"));
await widgetTester.tap(okFinder);
await widgetTester.pumpAndSettle();

final now = DateTime.now();
final endDate = DateTime(now.year, now.month + 1, pickingDate);
expect(
(widgetTester.widget(find.byType(TextFormField).at(3))
as TextFormField)
.initialValue,
dateText(endDate),
);
dateText(endDate));

const enteringMemName =
"$_scenarioName: Save Period: start is not all day, end is all day - mem name - entering";
await widgetTester.enterText(
memNameOnDetailPageFinder,
enteringMemName,
);
await widgetTester.tap(saveMemFabFinder);
await widgetTester.pumpAndSettle();
const enteringMemName =
"$_scenarioName: Save Period: start is not all day, end is all day - mem name - entering";
await widgetTester.enterText(
memNameOnDetailPageFinder, enteringMemName);
await widgetTester.tap(saveMemFabFinder);
await widgetTester.pumpAndSettle();

final savedMems = (await dbA.select(
defTableMems,
await PreferenceClientRepository().discard(startOfDayKey);

final savedMems = (await dbA.select(defTableMems,
where: "${defColMemsName.name} = ?",
whereArgs: [enteringMemName],
));
expect(savedMems, hasLength(1));
expect(
savedMems.single[defColMemsEndOn.name],
equals(endDate),
);
},
);
whereArgs: [enteringMemName]));
expect(savedMems, hasLength(1));
expect(savedMems.single[defColMemsEndOn.name], equals(endDate));
});
},
);

Expand Down

0 comments on commit 645553e

Please sign in to comment.