View Javadoc
1   /*
2    * #%L
3    * IsisFish
4    * 
5    * $Id: SimulatorIT.java 4284 2015-06-23 14:46:29Z echatellier $
6    * $HeadURL: https://svn.codelutin.com/isis-fish/tags/isis-fish-4.4.0.2/src/test/java/fr/ifremer/isisfish/ui/simulator/SimulatorIT.java $
7    * %%
8    * Copyright (C) 2015 Ifremer, Code Lutin, Chatellier Eric
9    * %%
10   * This program is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as
12   * published by the Free Software Foundation, either version 3 of the 
13   * License, or (at your option) any later version.
14   * 
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Public 
21   * License along with this program.  If not, see
22   * <http://www.gnu.org/licenses/gpl-3.0.html>.
23   * #L%
24   */
25  package fr.ifremer.isisfish.ui.simulator;
26  
27  import org.junit.Before;
28  import org.junit.Test;
29  
30  import fr.ifremer.isisfish.ui.AbstractAssertjIT;
31  
32  /**
33   * UI fest tests related to simulation params and launch.
34   * 
35   * @author Eric Chatellier
36   */
37  public class SimulatorIT extends AbstractAssertjIT {
38  
39      @Before
40      @Override
41      public void setUp() {
42          super.setUp();
43          mainWindow.tabbedPane("simulTabs").selectTab(1);
44      }
45  
46      /**
47       * Param and launch a simple simulation.
48       * 
49       * @throws InterruptedException
50       */
51      @Test
52      public void testSimulationAndViewResults() throws InterruptedException {
53          // first tab
54          mainWindow.tabbedPane("bodyTabbedPane").selectTab(0);
55          mainWindow.comboBox("fieldSimulParamsRegion").selectItem("DemoRegion");
56          mainWindow.textBox("fieldSimulParamsName").setText("test");
57          mainWindow.textBox("fieldSimulParamsDesc").setText("Ho la description de ouf :D");
58          mainWindow.list("listSimulParamsStrategies").selectItem("stratest");
59          mainWindow.list("listSimulParamsPopulations").selectItem("popage");
60          
61          // second tab
62          mainWindow.tabbedPane("bodyTabbedPane").selectTab(4);
63          mainWindow.tabbedPane("bodyTabbedPane").selectTab(5);
64          mainWindow.tabbedPane("bodyTabbedPane").selectTab(6);
65          
66          // back to first tab
67          mainWindow.tabbedPane("bodyTabbedPane").selectTab(0);
68          mainWindow.comboBox("comboSelLauncher").selectItem(2);
69          mainWindow.button("buttonSimulParamsSimulate").click();
70          
71          // may be on tab (Queue)
72          int count = 0;
73          boolean done = false;
74          while (count < 10 && !done) {
75              done = mainWindow.table("queueTableDone").rowCount() == 1;
76              Thread.sleep(1000);
77              count++;
78          }
79          
80          // tab (result)
81          mainWindow.tabbedPane("simulTabs").selectTab(3);
82          mainWindow.textBox("filterText").setText("test");
83          mainWindow.comboBox("filterBox").selectItem(0);
84          mainWindow.button("openButton").click();
85      }
86  
87  }