mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/mp/TestAddMissionAppSetup.java
@Test
    public void testFinishTab() throws InterruptedException
    {
        //Retrieve the test mission.
        WebElement testMission = MissionSetupHelper.retrieveMissionByName(m_Driver, "test-mission");
        //Select and click the select mission button to proceed to the parameters tab.
        WebElement selectMissionButton = testMission.findElement(
                By.cssSelector("div[class='ui-panel-content ui-widget-content']")).findElement(By.tagName("button"));
        assertThat(selectMissionButton, is(notNullValue()));
        selectMissionButton.click();
        
        //setup params
        MissionSetupHelper.setupMissionParameters(TEST_INT, TEST_DOUBLE, TEST_STRING, m_Driver);
        
        //set schedule
        MissionSetupHelper.setupTimedMission(m_Driver, System.currentTimeMillis() + 30 * 1000,
                System.currentTimeMillis() + 60 * 1000); 
        
        //Wait needed to assure that the elements for the tab has loaded.
        WebDriverWait wait = new WebDriverWait(m_Driver, 10);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//button[contains(@id, 'clearMission')]")));
        
        //Selects the table which displays the parameters for the mission and then creates a list of the rows within
        //the table.
        WebElement parametersTable = m_Driver.findElement(By.cssSelector("div[class='ui-datatable-scrollable-body']"));
        List<WebElement> tableRows = parametersTable.findElements(By.tagName("tr"));
        assertThat(tableRows.size(), is(4));
        
        //Loops through the rows of the table that displays the parameters and verifies the name and value of each
        //parameter.
        for (int i = 0; i < 4; i++)
        {
            WebElement parameterName = tableRows.get(i).findElements(By.tagName("td")).get(0);
            WebElement parameterValue = tableRows.get(i).findElements(By.tagName("td")).get(1);
            
            //Verifies the name and value depending on which row is being checked.
            switch(i)
            {
                case 0:
                    assertThat(parameterName.getText(), is("testInt"));
                    assertThat(parameterValue.getText(), is(TEST_INT.toString()));
                    break;
                case 1:
                    assertThat(parameterName.getText(), is("testDouble"));
                    assertThat(parameterValue.getText(), is(TEST_DOUBLE.toString()));
                    break;
                case 2:
                    assertThat(parameterName.getText(), is("testString"));
                    assertThat(parameterValue.getText(), is(TEST_STRING.toString()));
                    break;
                case 3:
                    assertThat(parameterName.getText(), is("testDropDown"));
                    assertThat(parameterValue.getText(), is("Option 2"));
                    break;
                default:
                    break;
            }
        }
        
        //Verify that the appropriate mission schedule is displayed
        WebElement schedule = m_Driver.findElement(By.cssSelector("div[class='ui-fieldset-content']")).findElement(
                By.tagName("tr")).findElements(By.tagName("td")).get(1).findElement(By.tagName("span"));
        assertThat(schedule.getText(), is("Timed"));
        
        //Select and click the clear mission button to make the clear mission dialog appear.
        WebElement clearMissionButton = m_Driver.findElement(By.xpath("//button[contains(@id, 'clearMission')]"));
        assertThat(clearMissionButton, is(notNullValue()));
        clearMissionButton.click();
        
        //Select and click the proceed button on the clear mission dialog window to clear the mission.
        WebElement proceedWithClear = m_Driver.findElement(By.xpath("//button[contains(@id, 'proceedClear')]"));
        assertThat(proceedWithClear, is(notNullValue()));
        proceedWithClear.click();
    }
/**
     * Tests the finish tab of the mission setup page. 
     * Verify that the values set for the variables and schedule appear appropriately and finally test the clear mission
     * button.
     */
Tests the finish tab of the mission setup page.
Verify that the values set for the variables and schedule appear appropriately and finally test the clear mission
button.
Tests the finish tab of the mission setup page . Verify that the values set for the variables and schedule appear appropriately and finally test the clear mission button .
@Test
    public void testFinishTab() throws InterruptedException
    {
        WebElement testMission = MissionSetupHelper.retrieveMissionByName(m_Driver, "test-mission");
        WebElement selectMissionButton = testMission.findElement(
                By.cssSelector("div[class='ui-panel-content ui-widget-content']")).findElement(By.tagName("button"));
        assertThat(selectMissionButton, is(notNullValue()));
        selectMissionButton.click();
        MissionSetupHelper.setupMissionParameters(TEST_INT, TEST_DOUBLE, TEST_STRING, m_Driver);
        MissionSetupHelper.setupTimedMission(m_Driver, System.currentTimeMillis() + 30 * 1000,
                System.currentTimeMillis() + 60 * 1000); 
        WebDriverWait wait = new WebDriverWait(m_Driver, 10);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//button[contains(@id, 'clearMission')]")));
        WebElement parametersTable = m_Driver.findElement(By.cssSelector("div[class='ui-datatable-scrollable-body']"));
        List<WebElement> tableRows = parametersTable.findElements(By.tagName("tr"));
        assertThat(tableRows.size(), is(4));
        for (int i = 0; i < 4; i++)
        {
            WebElement parameterName = tableRows.get(i).findElements(By.tagName("td")).get(0);
            WebElement parameterValue = tableRows.get(i).findElements(By.tagName("td")).get(1);
            switch(i)
            {
                case 0:
                    assertThat(parameterName.getText(), is("testInt"));
                    assertThat(parameterValue.getText(), is(TEST_INT.toString()));
                    break;
                case 1:
                    assertThat(parameterName.getText(), is("testDouble"));
                    assertThat(parameterValue.getText(), is(TEST_DOUBLE.toString()));
                    break;
                case 2:
                    assertThat(parameterName.getText(), is("testString"));
                    assertThat(parameterValue.getText(), is(TEST_STRING.toString()));
                    break;
                case 3:
                    assertThat(parameterName.getText(), is("testDropDown"));
                    assertThat(parameterValue.getText(), is("Option 2"));
                    break;
                default:
                    break;
            }
        }
        WebElement schedule = m_Driver.findElement(By.cssSelector("div[class='ui-fieldset-content']")).findElement(
                By.tagName("tr")).findElements(By.tagName("td")).get(1).findElement(By.tagName("span"));
        assertThat(schedule.getText(), is("Timed"));
        WebElement clearMissionButton = m_Driver.findElement(By.xpath("//button[contains(@id, 'clearMission')]"));
        assertThat(clearMissionButton, is(notNullValue()));
        clearMissionButton.click();
        WebElement proceedWithClear = m_Driver.findElement(By.xpath("//button[contains(@id, 'proceedClear')]"));
        assertThat(proceedWithClear, is(notNullValue()));
        proceedWithClear.click();
    }
@ Test public void testFinishTab ( ) throws InterruptedException { WebElement testMission = MissionSetupHelper . retrieveMissionByName ( m_Driver , "test-mission" ) ; WebElement selectMissionButton = testMission . findElement ( By . cssSelector ( "div[class='ui-panel-content ui-widget-content']" ) ) . findElement ( By . tagName ( "button" ) ) ; assertThat ( selectMissionButton , is ( notNullValue ( ) ) ) ; selectMissionButton . click ( ) ; MissionSetupHelper . setupMissionParameters ( TEST_INT , TEST_DOUBLE , TEST_STRING , m_Driver ) ; MissionSetupHelper . setupTimedMission ( m_Driver , System . currentTimeMillis ( ) + 30 * 1000 , System . currentTimeMillis ( ) + 60 * 1000 ) ; WebDriverWait wait = new WebDriverWait ( m_Driver , 10 ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . xpath ( "//button[contains(@id, 'clearMission')]" ) ) ) ; WebElement parametersTable = m_Driver . findElement ( By . cssSelector ( "div[class='ui-datatable-scrollable-body']" ) ) ; List < WebElement > tableRows = parametersTable . findElements ( By . tagName ( "tr" ) ) ; assertThat ( tableRows . size ( ) , is ( 4 ) ) ; for ( int i = 0 ; i < 4 ; i ++ ) { WebElement parameterName = tableRows . get ( i ) . findElements ( By . tagName ( "td" ) ) . get ( 0 ) ; WebElement parameterValue = tableRows . get ( i ) . findElements ( By . tagName ( "td" ) ) . get ( 1 ) ; switch ( i ) { case 0 : assertThat ( parameterName . getText ( ) , is ( "testInt" ) ) ; assertThat ( parameterValue . getText ( ) , is ( TEST_INT . toString ( ) ) ) ; break ; case 1 : assertThat ( parameterName . getText ( ) , is ( "testDouble" ) ) ; assertThat ( parameterValue . getText ( ) , is ( TEST_DOUBLE . toString ( ) ) ) ; break ; case 2 : assertThat ( parameterName . getText ( ) , is ( "testString" ) ) ; assertThat ( parameterValue . getText ( ) , is ( TEST_STRING . toString ( ) ) ) ; break ; case 3 : assertThat ( parameterName . getText ( ) , is ( "testDropDown" ) ) ; assertThat ( parameterValue . getText ( ) , is ( "Option 2" ) ) ; break ; default : break ; } } WebElement schedule = m_Driver . findElement ( By . cssSelector ( "div[class='ui-fieldset-content']" ) ) . findElement ( By . tagName ( "tr" ) ) . findElements ( By . tagName ( "td" ) ) . get ( 1 ) . findElement ( By . tagName ( "span" ) ) ; assertThat ( schedule . getText ( ) , is ( "Timed" ) ) ; WebElement clearMissionButton = m_Driver . findElement ( By . xpath ( "//button[contains(@id, 'clearMission')]" ) ) ; assertThat ( clearMissionButton , is ( notNullValue ( ) ) ) ; clearMissionButton . click ( ) ; WebElement proceedWithClear = m_Driver . findElement ( By . xpath ( "//button[contains(@id, 'proceedClear')]" ) ) ; assertThat ( proceedWithClear , is ( notNullValue ( ) ) ) ; proceedWithClear . click ( ) ; }
Tests the finish tab of the mission setup page.
Tests the finish tab of the mission setup page .
//Retrieve the test mission. //Select and click the select mission button to proceed to the parameters tab. //setup params //set schedule //Wait needed to assure that the elements for the tab has loaded. //Selects the table which displays the parameters for the mission and then creates a list of the rows within //the table. //Loops through the rows of the table that displays the parameters and verifies the name and value of each //parameter. //Verifies the name and value depending on which row is being checked. //Verify that the appropriate mission schedule is displayed //Select and click the clear mission button to make the clear mission dialog appear. //Select and click the proceed button on the clear mission dialog window to clear the mission.