Skip to content

Commit

Permalink
ci: added delete_row test / update row_compare method
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiFilippov committed Oct 5, 2024
1 parent 38a6bb1 commit 5702bcb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorThenBuiltInPa
}

@Test
public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenAddRowToPartitionTableThenCheckRowAdded()
throws Exception
public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenAddRowThenCheckRowAdded() throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditorThirdTest");
Expand All @@ -80,6 +79,19 @@ public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenAddRowToP
Fixture.ThenCheckRowAdded();
}

@Test
public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenDeleteSelectedRowThenCheckRowDeleted()
throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditorThirdTest");
Fixture.whenNewProjectIsSelected();
Fixture.whenProjectIsBuiltUsingContextMenu();
Fixture.whenOpenPartitionTableEditor();
Fixture.whenDeleteRowFromPartitionTable();
Fixture.ThenCheckRowDeleted();
}

private static class Fixture
{
private static SWTWorkbenchBot bot;
Expand Down Expand Up @@ -140,7 +152,17 @@ private static void whenAddRowToPartitionTable() throws IOException

private static void ThenCheckRowAdded() throws IOException
{
assertTrue(ProjectTestOperations.compareRows(bot));
assertTrue(ProjectTestOperations.comparePartitionTableRows(bot, 1));
}

private static void whenDeleteRowFromPartitionTable() throws IOException
{
ProjectTestOperations.deletePartitionTableRow(bot);
}

private static void ThenCheckRowDeleted() throws IOException
{
assertTrue(ProjectTestOperations.comparePartitionTableRows(bot, -1));
}

private static void cleanTestEnv()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,20 @@ public static boolean checkPartitionTableContent(SWTWorkbenchBot bot)
return true;
}

public static boolean compareRows(SWTWorkbenchBot bot) throws IOException
public static boolean comparePartitionTableRows(SWTWorkbenchBot bot, int expectedDifference) throws IOException
{
SWTBotTable table = bot.table();
int defaultRows = 3;
int actualRows = table.rowCount();
if (1 != (actualRows - defaultRows))
{
return false;
}
return true;
return (actualRows - defaultRows) == expectedDifference;
}

public static void deletePartitionTableRow(SWTWorkbenchBot bot) throws IOException
{
SWTBotTable table = bot.table();
table.select(1);
bot.toolbarButton("Delete Selected").click();
bot.button("OK").click();
}

public static void joinJobByName(String jobName)
Expand All @@ -645,4 +649,4 @@ public static void joinJobByName(String jobName)
}
}
}
}
}

0 comments on commit 5702bcb

Please sign in to comment.