mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/asset/TestAssetLocation.java
@Test
    public void testGetPositionCapabilsConfigHandlePositionTrue() throws InterruptedException
    {
        AssetHelper.createAsset(m_Driver, "ExampleAsset", "testExampleAsset");
        
        WebElement syncButton = m_Driver.findElement(By.cssSelector("button[id$='" + SYNC_LOC_BUT_ID + "']"));
        assertThat(syncButton.isEnabled(), is(true));
        
        //used to check if the edit location button is visible and clickable, and to make sure that inputs
        //for the location fields are editable
        Wait<WebDriver> locationEditWait = new FluentWait<WebDriver>(m_Driver).withTimeout(30, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(NoSuchElementException.class, 
                        StaleElementReferenceException.class);
        
        //wait until the edit location button shows up
        locationEditWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebDriverWait applyWait = new WebDriverWait(driver, 10);
                applyWait.until(ExpectedConditions.visibilityOfElementLocated(
                        By.cssSelector("button[id$='" + EDIT_LOC_BUT_ID + "']")));
                
                return true;
            }
        });
        
        //there is an update to the button right after it is visible, this just makes sure that
        //that staleness is accounted for and avoided..
        locationEditWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebElement editLocation = m_Driver.findElement(By.cssSelector("button[id$='" + EDIT_LOC_BUT_ID + "']"));
                editLocation.click();
                
                return true;
            }
        });
        
        //wait until the inputs are editable
        boolean result = locationEditWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebElement latitude = driver.findElement(By.cssSelector("input[id$='" + LAT_INPUT_ID + "']"));
                
                return latitude.isEnabled();
            }
        });
        
        assertThat(result, is(true));
        
        //Thread sleep needed to ensure that the location panel is done updating otherwise a stale element might occur.
        Thread.sleep(5000);
        
        WebElement latitude = m_Driver.findElement(By.cssSelector("input[id$='" + LAT_INPUT_ID +"']"));
        WebElement longitude = m_Driver.findElement(By.cssSelector("input[id$='" + LON_INPUT_ID + "']"));
        WebElement altitude = m_Driver.findElement(By.cssSelector("input[id$='" + ALT_INPUT_ID + "']"));
        WebElement bank = m_Driver.findElement(By.cssSelector("input[id$='" + BANK_INPUT_ID + "']"));
        WebElement heading = m_Driver.findElement(By.cssSelector("input[id$='" + HEAD_INPUT_ID + "']"));
        WebElement elevation = m_Driver.findElement(By.cssSelector("input[id$='" + ELV_INPUT_ID + "']"));
        
        //verify all inputs are now enabled
        assertThat(latitude.isEnabled(), is(true));
        assertThat(longitude.isEnabled(), is(true));
        assertThat(altitude.isEnabled(), is(true));
        assertThat(bank.isEnabled(), is(true));
        assertThat(heading.isEnabled(), is(true));
        assertThat(elevation.isEnabled(), is(true)); 
        
        latitude.clear();
        latitude.sendKeys("1");
        
        longitude.clear();
        longitude.sendKeys("2");
        
        altitude.clear();
        altitude.sendKeys("3");
        
        bank.clear();
        bank.sendKeys("4");
        
        elevation.clear();
        elevation.sendKeys("5");
        
        heading.clear();
        heading.sendKeys("6");
        
        //Update the location.
        m_Driver.findElement(By.cssSelector("button[id$='" + UPDATE_LOC_BUT_ID + "']")).click();
        
        WebDriverWait wait = new WebDriverWait(m_Driver, 10);
        
        wait.until(ExpectedConditions.stalenessOf(latitude));
        wait.until(ExpectedConditions.stalenessOf(longitude));
        wait.until(ExpectedConditions.stalenessOf(altitude));
        wait.until(ExpectedConditions.stalenessOf(bank));
        wait.until(ExpectedConditions.stalenessOf(heading));
        wait.until(ExpectedConditions.stalenessOf(elevation));
        
        latitude = m_Driver.findElement(By.cssSelector("input[id$='" + LAT_INPUT_ID +"']"));
        longitude = m_Driver.findElement(By.cssSelector("input[id$='" + LON_INPUT_ID + "']"));
        altitude = m_Driver.findElement(By.cssSelector("input[id$='" + ALT_INPUT_ID + "']"));
        bank = m_Driver.findElement(By.cssSelector("input[id$='" + BANK_INPUT_ID + "']"));
        heading = m_Driver.findElement(By.cssSelector("input[id$='" + HEAD_INPUT_ID + "']"));
        elevation = m_Driver.findElement(By.cssSelector("input[id$='" + ELV_INPUT_ID + "']"));
         
        //verify all inputs are now not enabled
        assertThat(latitude.isEnabled(), is(false));
        assertThat(longitude.isEnabled(), is(false));
        assertThat(altitude.isEnabled(), is(false));
        assertThat(bank.isEnabled(), is(false));
        assertThat(heading.isEnabled(), is(false));
        assertThat(elevation.isEnabled(), is(false));
        
        assertThat(latitude.getAttribute("value"), is("1.000000"));
        assertThat(longitude.getAttribute("value"), is("2.000000"));
        assertThat(altitude.getAttribute("value"), is("3.000000"));
        assertThat(bank.getAttribute("value"), is("4.00"));
        assertThat(elevation.getAttribute("value"), is("5.00"));
        assertThat(heading.getAttribute("value"), is("6.00"));
        
        AssetHelper.removeAsset(m_Driver, "testExampleAsset");
    }
/**
     * ExampleAsset: has getPosition capability, does not have setPosition capability
     * Asset position handling config property: defaults to true
     * Bring up the configuration dialog so the default Asset position handling configuration property of true, updates
     * the flag. Verify that the edit button shows up and we can successfully edit and sync the asset location.
     */
has getPosition capability, does not have setPosition capability
Asset position handling config property: defaults to true
Bring up the configuration dialog so the default Asset position handling configuration property of true, updates
the flag. Verify that the edit button shows up and we can successfully edit and sync the asset location.
has getPosition capability does not have setPosition capability Asset position handling config property : defaults to true Bring up the configuration dialog so the default Asset position handling configuration property of true updates the flag . Verify that the edit button shows up and we can successfully edit and sync the asset location .
@Test
    public void testGetPositionCapabilsConfigHandlePositionTrue() throws InterruptedException
    {
        AssetHelper.createAsset(m_Driver, "ExampleAsset", "testExampleAsset");
        WebElement syncButton = m_Driver.findElement(By.cssSelector("button[id$='" + SYNC_LOC_BUT_ID + "']"));
        assertThat(syncButton.isEnabled(), is(true));
        Wait<WebDriver> locationEditWait = new FluentWait<WebDriver>(m_Driver).withTimeout(30, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(NoSuchElementException.class, 
                        StaleElementReferenceException.class);
        locationEditWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebDriverWait applyWait = new WebDriverWait(driver, 10);
                applyWait.until(ExpectedConditions.visibilityOfElementLocated(
                        By.cssSelector("button[id$='" + EDIT_LOC_BUT_ID + "']")));
                return true;
            }
        });
        locationEditWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebElement editLocation = m_Driver.findElement(By.cssSelector("button[id$='" + EDIT_LOC_BUT_ID + "']"));
                editLocation.click();
                return true;
            }
        });
        boolean result = locationEditWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebElement latitude = driver.findElement(By.cssSelector("input[id$='" + LAT_INPUT_ID + "']"));
                return latitude.isEnabled();
            }
        });
        assertThat(result, is(true));
        Thread.sleep(5000);
        WebElement latitude = m_Driver.findElement(By.cssSelector("input[id$='" + LAT_INPUT_ID +"']"));
        WebElement longitude = m_Driver.findElement(By.cssSelector("input[id$='" + LON_INPUT_ID + "']"));
        WebElement altitude = m_Driver.findElement(By.cssSelector("input[id$='" + ALT_INPUT_ID + "']"));
        WebElement bank = m_Driver.findElement(By.cssSelector("input[id$='" + BANK_INPUT_ID + "']"));
        WebElement heading = m_Driver.findElement(By.cssSelector("input[id$='" + HEAD_INPUT_ID + "']"));
        WebElement elevation = m_Driver.findElement(By.cssSelector("input[id$='" + ELV_INPUT_ID + "']"));
        assertThat(latitude.isEnabled(), is(true));
        assertThat(longitude.isEnabled(), is(true));
        assertThat(altitude.isEnabled(), is(true));
        assertThat(bank.isEnabled(), is(true));
        assertThat(heading.isEnabled(), is(true));
        assertThat(elevation.isEnabled(), is(true)); 
        latitude.clear();
        latitude.sendKeys("1");
        longitude.clear();
        longitude.sendKeys("2");
        altitude.clear();
        altitude.sendKeys("3");
        bank.clear();
        bank.sendKeys("4");
        elevation.clear();
        elevation.sendKeys("5");
        heading.clear();
        heading.sendKeys("6");
        m_Driver.findElement(By.cssSelector("button[id$='" + UPDATE_LOC_BUT_ID + "']")).click();
        WebDriverWait wait = new WebDriverWait(m_Driver, 10);
        wait.until(ExpectedConditions.stalenessOf(latitude));
        wait.until(ExpectedConditions.stalenessOf(longitude));
        wait.until(ExpectedConditions.stalenessOf(altitude));
        wait.until(ExpectedConditions.stalenessOf(bank));
        wait.until(ExpectedConditions.stalenessOf(heading));
        wait.until(ExpectedConditions.stalenessOf(elevation));
        latitude = m_Driver.findElement(By.cssSelector("input[id$='" + LAT_INPUT_ID +"']"));
        longitude = m_Driver.findElement(By.cssSelector("input[id$='" + LON_INPUT_ID + "']"));
        altitude = m_Driver.findElement(By.cssSelector("input[id$='" + ALT_INPUT_ID + "']"));
        bank = m_Driver.findElement(By.cssSelector("input[id$='" + BANK_INPUT_ID + "']"));
        heading = m_Driver.findElement(By.cssSelector("input[id$='" + HEAD_INPUT_ID + "']"));
        elevation = m_Driver.findElement(By.cssSelector("input[id$='" + ELV_INPUT_ID + "']"));
        assertThat(latitude.isEnabled(), is(false));
        assertThat(longitude.isEnabled(), is(false));
        assertThat(altitude.isEnabled(), is(false));
        assertThat(bank.isEnabled(), is(false));
        assertThat(heading.isEnabled(), is(false));
        assertThat(elevation.isEnabled(), is(false));
        assertThat(latitude.getAttribute("value"), is("1.000000"));
        assertThat(longitude.getAttribute("value"), is("2.000000"));
        assertThat(altitude.getAttribute("value"), is("3.000000"));
        assertThat(bank.getAttribute("value"), is("4.00"));
        assertThat(elevation.getAttribute("value"), is("5.00"));
        assertThat(heading.getAttribute("value"), is("6.00"));
        AssetHelper.removeAsset(m_Driver, "testExampleAsset");
    }
@ Test public void testGetPositionCapabilsConfigHandlePositionTrue ( ) throws InterruptedException { AssetHelper . createAsset ( m_Driver , "ExampleAsset" , "testExampleAsset" ) ; WebElement syncButton = m_Driver . findElement ( By . cssSelector ( "button[id$='" + SYNC_LOC_BUT_ID + "']" ) ) ; assertThat ( syncButton . isEnabled ( ) , is ( true ) ) ; Wait < WebDriver > locationEditWait = new FluentWait < WebDriver > ( m_Driver ) . withTimeout ( 30 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( NoSuchElementException . class , StaleElementReferenceException . class ) ; locationEditWait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { WebDriverWait applyWait = new WebDriverWait ( driver , 10 ) ; applyWait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "button[id$='" + EDIT_LOC_BUT_ID + "']" ) ) ) ; return true ; } } ) ; locationEditWait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { WebElement editLocation = m_Driver . findElement ( By . cssSelector ( "button[id$='" + EDIT_LOC_BUT_ID + "']" ) ) ; editLocation . click ( ) ; return true ; } } ) ; boolean result = locationEditWait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { WebElement latitude = driver . findElement ( By . cssSelector ( "input[id$='" + LAT_INPUT_ID + "']" ) ) ; return latitude . isEnabled ( ) ; } } ) ; assertThat ( result , is ( true ) ) ; Thread . sleep ( 5000 ) ; WebElement latitude = m_Driver . findElement ( By . cssSelector ( "input[id$='" + LAT_INPUT_ID + "']" ) ) ; WebElement longitude = m_Driver . findElement ( By . cssSelector ( "input[id$='" + LON_INPUT_ID + "']" ) ) ; WebElement altitude = m_Driver . findElement ( By . cssSelector ( "input[id$='" + ALT_INPUT_ID + "']" ) ) ; WebElement bank = m_Driver . findElement ( By . cssSelector ( "input[id$='" + BANK_INPUT_ID + "']" ) ) ; WebElement heading = m_Driver . findElement ( By . cssSelector ( "input[id$='" + HEAD_INPUT_ID + "']" ) ) ; WebElement elevation = m_Driver . findElement ( By . cssSelector ( "input[id$='" + ELV_INPUT_ID + "']" ) ) ; assertThat ( latitude . isEnabled ( ) , is ( true ) ) ; assertThat ( longitude . isEnabled ( ) , is ( true ) ) ; assertThat ( altitude . isEnabled ( ) , is ( true ) ) ; assertThat ( bank . isEnabled ( ) , is ( true ) ) ; assertThat ( heading . isEnabled ( ) , is ( true ) ) ; assertThat ( elevation . isEnabled ( ) , is ( true ) ) ; latitude . clear ( ) ; latitude . sendKeys ( "1" ) ; longitude . clear ( ) ; longitude . sendKeys ( "2" ) ; altitude . clear ( ) ; altitude . sendKeys ( "3" ) ; bank . clear ( ) ; bank . sendKeys ( "4" ) ; elevation . clear ( ) ; elevation . sendKeys ( "5" ) ; heading . clear ( ) ; heading . sendKeys ( "6" ) ; m_Driver . findElement ( By . cssSelector ( "button[id$='" + UPDATE_LOC_BUT_ID + "']" ) ) . click ( ) ; WebDriverWait wait = new WebDriverWait ( m_Driver , 10 ) ; wait . until ( ExpectedConditions . stalenessOf ( latitude ) ) ; wait . until ( ExpectedConditions . stalenessOf ( longitude ) ) ; wait . until ( ExpectedConditions . stalenessOf ( altitude ) ) ; wait . until ( ExpectedConditions . stalenessOf ( bank ) ) ; wait . until ( ExpectedConditions . stalenessOf ( heading ) ) ; wait . until ( ExpectedConditions . stalenessOf ( elevation ) ) ; latitude = m_Driver . findElement ( By . cssSelector ( "input[id$='" + LAT_INPUT_ID + "']" ) ) ; longitude = m_Driver . findElement ( By . cssSelector ( "input[id$='" + LON_INPUT_ID + "']" ) ) ; altitude = m_Driver . findElement ( By . cssSelector ( "input[id$='" + ALT_INPUT_ID + "']" ) ) ; bank = m_Driver . findElement ( By . cssSelector ( "input[id$='" + BANK_INPUT_ID + "']" ) ) ; heading = m_Driver . findElement ( By . cssSelector ( "input[id$='" + HEAD_INPUT_ID + "']" ) ) ; elevation = m_Driver . findElement ( By . cssSelector ( "input[id$='" + ELV_INPUT_ID + "']" ) ) ; assertThat ( latitude . isEnabled ( ) , is ( false ) ) ; assertThat ( longitude . isEnabled ( ) , is ( false ) ) ; assertThat ( altitude . isEnabled ( ) , is ( false ) ) ; assertThat ( bank . isEnabled ( ) , is ( false ) ) ; assertThat ( heading . isEnabled ( ) , is ( false ) ) ; assertThat ( elevation . isEnabled ( ) , is ( false ) ) ; assertThat ( latitude . getAttribute ( "value" ) , is ( "1.000000" ) ) ; assertThat ( longitude . getAttribute ( "value" ) , is ( "2.000000" ) ) ; assertThat ( altitude . getAttribute ( "value" ) , is ( "3.000000" ) ) ; assertThat ( bank . getAttribute ( "value" ) , is ( "4.00" ) ) ; assertThat ( elevation . getAttribute ( "value" ) , is ( "5.00" ) ) ; assertThat ( heading . getAttribute ( "value" ) , is ( "6.00" ) ) ; AssetHelper . removeAsset ( m_Driver , "testExampleAsset" ) ; }
ExampleAsset: has getPosition capability, does not have setPosition capability
 Asset position handling config property: defaults to true
 Bring up the configuration dialog so the default Asset position handling configuration property of true, updates
 the flag.
ExampleAsset : has getPosition capability does not have setPosition capability Asset position handling config property : defaults to true Bring up the configuration dialog so the default Asset position handling configuration property of true updates the flag .
//used to check if the edit location button is visible and clickable, and to make sure that inputs //for the location fields are editable //wait until the edit location button shows up //there is an update to the button right after it is visible, this just makes sure that //that staleness is accounted for and avoided.. //wait until the inputs are editable //Thread sleep needed to ensure that the location panel is done updating otherwise a stale element might occur. //verify all inputs are now enabled //Update the location. //verify all inputs are now not enabled