mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/asset/TestAssetPage.java
@Test
    public void testAssetLocation() throws InterruptedException, ExecutionException, 
        java.util.concurrent.TimeoutException
    {
        AssetHelper.createAsset(m_Driver, "ExampleAsset", "locationAsset");
        
        //---verify asset has been created ---
        WebElement assetElement = AssetHelper.retrieveAsset(m_Driver, "locationAsset");
        assertThat(assetElement, is(notNullValue()));
        
        //---click the edit location button---
        WebElement locationEdit = m_Driver.findElement(By.cssSelector("button[id*='editLocationButton']"));
        locationEdit.click();
        
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[id*='updateLocationButton']")));
        
        //update the values
        WebElement lat = m_Driver.findElement(By.cssSelector("input[id$='assetLatLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, lat, "4", 10);
        WebElement longitude = m_Driver.findElement(By.cssSelector("input[id$='assetLongLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, longitude, "3.5", 10);
        WebElement alt = m_Driver.findElement(By.cssSelector("input[id$='assetAltitudeLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, alt, "3.9", 10);
        WebElement head = m_Driver.findElement(By.cssSelector("input[id$='assetHeadingLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, head, "6", 10);
        WebElement ele = m_Driver.findElement(By.cssSelector("input[id$='assetElevationLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, ele, "9.9", 10);
        WebElement bank = m_Driver.findElement(By.cssSelector("input[id$='assetBankLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, bank, "0.8", 10);

        WebElement updateLocation = m_Driver.findElement(By.cssSelector("button[id*='updateLocationButton']"));
        updateLocation.click();
        
        wait.until(ExpectedConditions.textToBePresentInElementLocated(
                By.cssSelector("button[id*='editLocationButton']"), "Edit Location"));

        //now disconnect from the controller so we can be sure the values can be requested
        ChannelsHelper.removeSocketChannel(m_Driver, "localhost", "4000", true);
        //..reconnect
        ControllerHelper.createController(m_Driver);
        
        //Navigate to asset page.
        NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS);
        
        //grab the asset
        assetElement = AssetHelper.retrieveAsset(m_Driver, "locationAsset");
        assertThat(assetElement, is(notNullValue()));
        
        //request the previously set values to be synced
        WebElement syncPosition = m_Driver.findElement(By.cssSelector("button[id*='syncLocationButton']"));
        syncPosition.click();
        
        //can't wait for text to appear because of the boxes being disabled
        GeneralHelper.sleepWithText(5, "Waiting for command to execute and update values.");
        
        //verify values, need to get attribute because boxes are disabled
        WebElement syncedLat = m_Driver.findElement(By.cssSelector("input[id$='assetLatLocation']"));
        assertThat(syncedLat.getAttribute("value"), is("4.000000"));
        WebElement syncedLong = m_Driver.findElement(By.cssSelector("input[id$='assetLongLocation']"));
        assertThat(syncedLong.getAttribute("value"), is("3.500000"));
        WebElement syncedAlt = m_Driver.findElement(By.cssSelector("input[id$='assetAltitudeLocation']"));
        assertThat(syncedAlt.getAttribute("value"), is("3.900000"));
        WebElement syncedHead = m_Driver.findElement(By.cssSelector("input[id$='assetHeadingLocation']"));
        assertThat(syncedHead.getAttribute("value"), is("6.00"));
        WebElement syncedEle = m_Driver.findElement(By.cssSelector("input[id$='assetElevationLocation']"));
        assertThat(syncedEle.getAttribute("value"), is("9.90"));
        WebElement syncedBank = m_Driver.findElement(By.cssSelector("input[id$='assetBankLocation']"));
        assertThat(syncedBank.getAttribute("value"), is("0.80"));
        
        AssetHelper.removeAsset(m_Driver, "locationAsset");
    }
/**
     * Verify the asset's location can be set and synced.
     */
Verify the asset's location can be set and synced.
Verify the asset ' s location can be set and synced .
@Test
    public void testAssetLocation() throws InterruptedException, ExecutionException, 
        java.util.concurrent.TimeoutException
    {
        AssetHelper.createAsset(m_Driver, "ExampleAsset", "locationAsset");
        WebElement assetElement = AssetHelper.retrieveAsset(m_Driver, "locationAsset");
        assertThat(assetElement, is(notNullValue()));
        WebElement locationEdit = m_Driver.findElement(By.cssSelector("button[id*='editLocationButton']"));
        locationEdit.click();
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[id*='updateLocationButton']")));
        WebElement lat = m_Driver.findElement(By.cssSelector("input[id$='assetLatLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, lat, "4", 10);
        WebElement longitude = m_Driver.findElement(By.cssSelector("input[id$='assetLongLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, longitude, "3.5", 10);
        WebElement alt = m_Driver.findElement(By.cssSelector("input[id$='assetAltitudeLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, alt, "3.9", 10);
        WebElement head = m_Driver.findElement(By.cssSelector("input[id$='assetHeadingLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, head, "6", 10);
        WebElement ele = m_Driver.findElement(By.cssSelector("input[id$='assetElevationLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, ele, "9.9", 10);
        WebElement bank = m_Driver.findElement(By.cssSelector("input[id$='assetBankLocation']"));
        GeneralHelper.retrySendKeys(m_Driver, bank, "0.8", 10);
        WebElement updateLocation = m_Driver.findElement(By.cssSelector("button[id*='updateLocationButton']"));
        updateLocation.click();
        wait.until(ExpectedConditions.textToBePresentInElementLocated(
                By.cssSelector("button[id*='editLocationButton']"), "Edit Location"));
        ChannelsHelper.removeSocketChannel(m_Driver, "localhost", "4000", true);
        ControllerHelper.createController(m_Driver);
        NavigationHelper.navigateToPage(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_ASSETS);
        assetElement = AssetHelper.retrieveAsset(m_Driver, "locationAsset");
        assertThat(assetElement, is(notNullValue()));
        WebElement syncPosition = m_Driver.findElement(By.cssSelector("button[id*='syncLocationButton']"));
        syncPosition.click();
        GeneralHelper.sleepWithText(5, "Waiting for command to execute and update values.");
        WebElement syncedLat = m_Driver.findElement(By.cssSelector("input[id$='assetLatLocation']"));
        assertThat(syncedLat.getAttribute("value"), is("4.000000"));
        WebElement syncedLong = m_Driver.findElement(By.cssSelector("input[id$='assetLongLocation']"));
        assertThat(syncedLong.getAttribute("value"), is("3.500000"));
        WebElement syncedAlt = m_Driver.findElement(By.cssSelector("input[id$='assetAltitudeLocation']"));
        assertThat(syncedAlt.getAttribute("value"), is("3.900000"));
        WebElement syncedHead = m_Driver.findElement(By.cssSelector("input[id$='assetHeadingLocation']"));
        assertThat(syncedHead.getAttribute("value"), is("6.00"));
        WebElement syncedEle = m_Driver.findElement(By.cssSelector("input[id$='assetElevationLocation']"));
        assertThat(syncedEle.getAttribute("value"), is("9.90"));
        WebElement syncedBank = m_Driver.findElement(By.cssSelector("input[id$='assetBankLocation']"));
        assertThat(syncedBank.getAttribute("value"), is("0.80"));
        AssetHelper.removeAsset(m_Driver, "locationAsset");
    }
@ Test public void testAssetLocation ( ) throws InterruptedException , ExecutionException , java . util . concurrent . TimeoutException { AssetHelper . createAsset ( m_Driver , "ExampleAsset" , "locationAsset" ) ; WebElement assetElement = AssetHelper . retrieveAsset ( m_Driver , "locationAsset" ) ; assertThat ( assetElement , is ( notNullValue ( ) ) ) ; WebElement locationEdit = m_Driver . findElement ( By . cssSelector ( "button[id*='editLocationButton']" ) ) ; locationEdit . click ( ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "button[id*='updateLocationButton']" ) ) ) ; WebElement lat = m_Driver . findElement ( By . cssSelector ( "input[id$='assetLatLocation']" ) ) ; GeneralHelper . retrySendKeys ( m_Driver , lat , "4" , 10 ) ; WebElement longitude = m_Driver . findElement ( By . cssSelector ( "input[id$='assetLongLocation']" ) ) ; GeneralHelper . retrySendKeys ( m_Driver , longitude , "3.5" , 10 ) ; WebElement alt = m_Driver . findElement ( By . cssSelector ( "input[id$='assetAltitudeLocation']" ) ) ; GeneralHelper . retrySendKeys ( m_Driver , alt , "3.9" , 10 ) ; WebElement head = m_Driver . findElement ( By . cssSelector ( "input[id$='assetHeadingLocation']" ) ) ; GeneralHelper . retrySendKeys ( m_Driver , head , "6" , 10 ) ; WebElement ele = m_Driver . findElement ( By . cssSelector ( "input[id$='assetElevationLocation']" ) ) ; GeneralHelper . retrySendKeys ( m_Driver , ele , "9.9" , 10 ) ; WebElement bank = m_Driver . findElement ( By . cssSelector ( "input[id$='assetBankLocation']" ) ) ; GeneralHelper . retrySendKeys ( m_Driver , bank , "0.8" , 10 ) ; WebElement updateLocation = m_Driver . findElement ( By . cssSelector ( "button[id*='updateLocationButton']" ) ) ; updateLocation . click ( ) ; wait . until ( ExpectedConditions . textToBePresentInElementLocated ( By . cssSelector ( "button[id*='editLocationButton']" ) , "Edit Location" ) ) ; ChannelsHelper . removeSocketChannel ( m_Driver , "localhost" , "4000" , true ) ; ControllerHelper . createController ( m_Driver ) ; NavigationHelper . navigateToPage ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_ASSETS ) ; assetElement = AssetHelper . retrieveAsset ( m_Driver , "locationAsset" ) ; assertThat ( assetElement , is ( notNullValue ( ) ) ) ; WebElement syncPosition = m_Driver . findElement ( By . cssSelector ( "button[id*='syncLocationButton']" ) ) ; syncPosition . click ( ) ; GeneralHelper . sleepWithText ( 5 , "Waiting for command to execute and update values." ) ; WebElement syncedLat = m_Driver . findElement ( By . cssSelector ( "input[id$='assetLatLocation']" ) ) ; assertThat ( syncedLat . getAttribute ( "value" ) , is ( "4.000000" ) ) ; WebElement syncedLong = m_Driver . findElement ( By . cssSelector ( "input[id$='assetLongLocation']" ) ) ; assertThat ( syncedLong . getAttribute ( "value" ) , is ( "3.500000" ) ) ; WebElement syncedAlt = m_Driver . findElement ( By . cssSelector ( "input[id$='assetAltitudeLocation']" ) ) ; assertThat ( syncedAlt . getAttribute ( "value" ) , is ( "3.900000" ) ) ; WebElement syncedHead = m_Driver . findElement ( By . cssSelector ( "input[id$='assetHeadingLocation']" ) ) ; assertThat ( syncedHead . getAttribute ( "value" ) , is ( "6.00" ) ) ; WebElement syncedEle = m_Driver . findElement ( By . cssSelector ( "input[id$='assetElevationLocation']" ) ) ; assertThat ( syncedEle . getAttribute ( "value" ) , is ( "9.90" ) ) ; WebElement syncedBank = m_Driver . findElement ( By . cssSelector ( "input[id$='assetBankLocation']" ) ) ; assertThat ( syncedBank . getAttribute ( "value" ) , is ( "0.80" ) ) ; AssetHelper . removeAsset ( m_Driver , "locationAsset" ) ; }
Verify the asset's location can be set and synced.
Verify the asset ' s location can be set and synced .
//---verify asset has been created --- //---click the edit location button--- //update the values //now disconnect from the controller so we can be sure the values can be requested //..reconnect //Navigate to asset page. //grab the asset //request the previously set values to be synced //can't wait for text to appear because of the boxes being disabled //verify values, need to get attribute because boxes are disabled