Skip to content

Commit

Permalink
ci: added two functional(save_and_quit) tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiFilippov committed Oct 5, 2024
1 parent 5702bcb commit d48e8b0
Showing 1 changed file with 57 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void afterEachTest()
public void givenNewProjectCreatedNotBuiltWhenOpenPartitionTableEditorThenInformationPopUpMessage() throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditorFirstTest");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditor1Test");
Fixture.whenNewProjectIsSelected();
Fixture.whenOpenPartitionTableEditor();
Fixture.ThenInformationMessagePopUp();
Expand All @@ -60,7 +60,7 @@ public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorThenBuiltInPa
throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditorSecondTest");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditor2Test");
Fixture.whenNewProjectIsSelected();
Fixture.whenProjectIsBuiltUsingContextMenu();
Fixture.whenOpenPartitionTableEditor();
Expand All @@ -71,7 +71,7 @@ public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorThenBuiltInPa
public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenAddRowThenCheckRowAdded() throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditorThirdTest");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditor3Test");
Fixture.whenNewProjectIsSelected();
Fixture.whenProjectIsBuiltUsingContextMenu();
Fixture.whenOpenPartitionTableEditor();
Expand All @@ -84,14 +84,45 @@ public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenDeleteSel
throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditorThirdTest");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditor4Test");
Fixture.whenNewProjectIsSelected();
Fixture.whenProjectIsBuiltUsingContextMenu();
Fixture.whenOpenPartitionTableEditor();
Fixture.whenDeleteRowFromPartitionTable();
Fixture.ThenCheckRowDeleted();
}

@Test
public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenDeleteSelectedRowWhenSaveAndQuitwhenReopenPartitionTableThenCheckChangesSaved()
throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditor5Test");
Fixture.whenNewProjectIsSelected();
Fixture.whenProjectIsBuiltUsingContextMenu();
Fixture.whenOpenPartitionTableEditor();
Fixture.whenDeleteRowFromPartitionTable();
Fixture.whenSaveAndQuit();
Fixture.whenOpenPartitionTableEditor();
Fixture.thenCheckChangesSaved();
}

@Test
public void givenNewProjectCreatedBuiltWhenOpenPartitionTableEditorWhenDeleteSelectedRowWhenSaveAndCancelwhenReopenPartitionTableThenCheckChangesSaved()
throws Exception
{
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
Fixture.givenProjectNameIs("NewProjectPartitionTableEditor6Test");
Fixture.whenNewProjectIsSelected();
Fixture.whenProjectIsBuiltUsingContextMenu();
Fixture.whenOpenPartitionTableEditor();
Fixture.whenDeleteRowFromPartitionTable();
Fixture.whenSavePartitionTable();
Fixture.whenCancel();
Fixture.whenOpenPartitionTableEditor();
Fixture.thenCheckChangesSaved();
}

private static class Fixture
{
private static SWTWorkbenchBot bot;
Expand Down Expand Up @@ -165,6 +196,28 @@ private static void ThenCheckRowDeleted() throws IOException
assertTrue(ProjectTestOperations.comparePartitionTableRows(bot, -1));
}

private static void whenSaveAndQuit() throws IOException
{
bot.button("Save and Quit").click();
bot.button("OK").click();
}

private static void whenSavePartitionTable() throws IOException
{
bot.toolbarButton("Save").click();
bot.button("OK").click();
}

private static void whenCancel() throws IOException
{
bot.button("Cancel").click();
}

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

private static void cleanTestEnv()
{
TestWidgetWaitUtility.waitForOperationsInProgressToFinishAsync(bot);
Expand Down

0 comments on commit d48e8b0

Please sign in to comment.