From 00b0132938b3fe2066eda12ea7cfacaf155ef300 Mon Sep 17 00:00:00 2001 From: Arthur VUAGNIAUX <arthur.vuagniaux@telecom-paristech.fr> Date: Mon, 3 Dec 2018 12:57:27 +0100 Subject: [PATCH] Issue #71: Update tests of ModelCreationTests.java --- .../test/java/ui/bot/ModelCreationTests.java | 58 +++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/ttool/src/test/java/ui/bot/ModelCreationTests.java b/ttool/src/test/java/ui/bot/ModelCreationTests.java index f9875e4806..a8038143d4 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 -- GitLab