diff --git a/ttool/src/test/java/ui/bot/ModelCreationTests.java b/ttool/src/test/java/ui/bot/ModelCreationTests.java index f9875e4806992d7e2c6cdec9de4178441b62005e..a8038143d494c46c80e7aa506ca3d78f10fc4cc3 100644 --- a/ttool/src/test/java/ui/bot/ModelCreationTests.java +++ b/ttool/src/test/java/ui/bot/ModelCreationTests.java @@ -8,7 +8,9 @@ package ui.bot; import org.assertj.swing.edt.GuiActionRunner; +import org.assertj.swing.finder.JFileChooserFinder; import org.assertj.swing.fixture.FrameFixture; +import org.assertj.swing.fixture.JFileChooserFixture; import org.assertj.swing.fixture.JMenuItemFixture; import org.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase; import org.junit.Test; @@ -35,13 +37,61 @@ public class ModelCreationTests extends AssertJSwingJUnitTestCase { * the tab New. Then save it. */ TraceManager.addDev("==============" + System.lineSeparator() + - "MainFrameTest: createANewFile: Started"); + "ModelCreationTests: creationOfAFile: Started"); JMenuItemFixture jmf = window.menuItem("File New"); - TraceManager.addDev("MainFrameTest: createANewFile: Creating a new file by clicking on New"); + TraceManager.addDev("ModelCreationTests: creationOfAFile: Creating a new file by clicking on New"); jmf.click(); if (debug) - ut.debugThread(3600, "MainFrameTest: createANewFile: "); - TraceManager.addDev("MainFrameTest: createANewFile: File created"); + ut.debugThread(3600, "ModelCreationTests: ccreationOfAFile: "); + TraceManager.addDev("ModelCreationTests: creationOfAFile: File created"); + + jmf = window.menuItem("File Save As Model"); + TraceManager.addDev("ModelCreationTests: creationOfAFile: Saving the new model by clicking on Save As Model"); + jmf.click(); + if (debug) + ut.debugThread(3600, "ModelCreationTests: creationOfAFile: "); + JFileChooserFixture jfc = JFileChooserFinder.findFileChooser().using(robot()); + TraceManager.addDev("ModelCreationTests: creationOfAFile: Writting the path "); + jfc.fileNameTextBox().pressAndReleaseKeys(ut.stringToKeyEvent("git/TTool/modeling/test")); + TraceManager.addDev("ModelCreationTests: creationOfAFile: End writting"); + TraceManager.addDev("ModelCreationTests: creationOfAFile: Clicking on the Approval Button"); + jfc.approveButton().click(); + TraceManager.addDev("ModelCreationTests: creationOfAFile: Approve"); + + TraceManager.addDev("ModelCreationTests: creationOfAFile: File saved"); + TraceManager.addDev("ModelCreationTests: creationOfAFile: Finished" + + System.lineSeparator() + "=============="); + } + + @Test + public void openAFile() { + /* + * Description : Open the file that had been created. + */ + TraceManager.addDev("==============" + System.lineSeparator() + + "ModelCreationTests: openAFile: Started"); + + JMenuItemFixture jmf = window.menuItem("File Model Project"); + TraceManager.addDev("ModelCreationTests: openAFile: Clicking on Open Model, in order to open test.xml"); + jmf.click(); + if (debug) + ut.debugThread(3600, "ModelCreationTests: openAFile: "); + TraceManager.addDev("ModelCreationTests: openAFile: End Clicking"); + + TraceManager.addDev("ModelCreationTests: openAFile: Try to open the file test.xml"); + JFileChooserFixture jfc = JFileChooserFinder.findFileChooser().using(robot()); + TraceManager.addDev("ModelCreationTests: openAFile: Writting the path "); + jfc.fileNameTextBox().pressAndReleaseKeys(ut.stringToKeyEvent("git/TTool/modeling/test.xml")); + TraceManager.addDev("ModelCreationTests: openAFile: End writting"); + TraceManager.addDev("ModelCreationTests: openAFile: Clicking on the Approval Button"); + jfc.approveButton().click(); + if (debug) + ut.debugThread(3600, "ModelCreationTests: openAFile: "); + TraceManager.addDev("ModelCreationTests: openAFile: Approve"); + TraceManager.addDev("ModelCreationTests: openAFile: End loading the file"); + + TraceManager.addDev("ModelCreationTests: openAFile: Finished" + + System.lineSeparator() + "=============="); } @Override