Skip to content

Commit

Permalink
#54: Fix uitests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Dec 5, 2020
1 parent 5223006 commit 378ad46
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ void toggleRemainderDurationUpdatedAtMinuteTick()
}

@Test
void addActivitySelectRemainder()
void addActivityDeselectRemainder()
{
addActivity();

final JavaFxTable<ActivityPropertyAdapter> activitiesTable = app().activitiesTable().table();
robot.clickOn(activitiesTable.getTableCell(0, "remainder"));
activitiesTable.assertRowContent(0, ActivitiesTableExpectedRow.defaultRow().withRemainder(true).build());
activitiesTable.assertRowContent(0, ActivitiesTableExpectedRow.defaultRow().withRemainder(false).build());
}

@Test
Expand All @@ -249,7 +249,8 @@ void addActivitySelectProject()
final Node projectCell = activitiesTable.getTableCell(0, "project");

robot.doubleClickOn(projectCell).clickOn(projectCell).type(KeyCode.ENTER);
activitiesTable.assertRowContent(0, ActivitiesTableExpectedRow.defaultRow().withProject(PROJECT1).build());
activitiesTable.assertRowContent(0,
ActivitiesTableExpectedRow.defaultRow().withRemainder(true).withProject(PROJECT1).build());
}

@Test
Expand Down Expand Up @@ -321,12 +322,14 @@ private void addActivity()
time().tickMinute();
final ActivitiesTable activities = app().activitiesTable();

final JavaFxTable<ActivityPropertyAdapter> table = activities.table();
final boolean isFirstActivity = table.getRowCount() == 0;
activities.addActivity();

final Builder expectedRowContent = ActivitiesTableExpectedRow.defaultRow();
final Builder expectedRowContent = ActivitiesTableExpectedRow.defaultRow().withRemainder(isFirstActivity);

assertAll(() -> activities.table().assertRowCount(1),
() -> activities.table().assertRowContent(0, expectedRowContent.build()));
assertAll(() -> table.assertRowCount(1),
() -> table.assertRowContent(0, expectedRowContent.build()));
}

private void selectCurrentDay()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public void addRemainderActivity(Project project, String comment)
final Node projectCell = table.getTableCell(rowIndex, "project");
robot.doubleClickOn(projectCell).clickOn(projectCell).clickOn(project.getLabel());
}
robot.clickOn(table.getTableCell(rowIndex, "remainder"));
final TableCell<?, ?> remainderCell = table.getTableCell(rowIndex, "remainder");
if (!(Boolean) remainderCell.getItem())
{
robot.clickOn(remainderCell);
}
robot.doubleClickOn(table.getTableCell(rowIndex, "comment")).write(comment).type(KeyCode.ENTER);
}

Expand All @@ -54,6 +58,12 @@ public void addActivity(Project project, Duration duration, String comment)
{
final int rowIndex = addActivity();

final TableCell<?, ?> remainderCell = table.getTableCell(rowIndex, "remainder");
if ((Boolean) remainderCell.getItem())
{
robot.clickOn(remainderCell);
}

if (project != null)
{
final Node projectCell = table.getTableCell(rowIndex, "project");
Expand Down

0 comments on commit 378ad46

Please sign in to comment.