mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/observation/TestObsViewer.java
@Test
    public void testViewingObs() throws InterruptedException, ExecutionException, TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(m_Driver, 60);
        
        //Name of the asset to be created.
        String assetName = "testAsset";
        
        //Create asset.
        AssetHelper.createAsset(m_Driver, "ExampleObservationsAsset", assetName);      
        
        //Activate asset.
        AssetHelper.activateAsset(m_Driver, assetName);
        
        //Refresh needs since there is not push updates for the observation tab.
        m_Driver.navigate().refresh();

        //Navigate to the observation tab.
        WebElement obsTabButton = m_Driver.findElement(By.cssSelector("a[href*='assetObsTab']"));
        assertThat(obsTabButton, is(notNullValue()));
        obsTabButton.click();
        
        //Wait till the form on the observation tab is displayed.
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("form[id*='obsForm']")));
        
        //Filter to only display image, audio, and video observations.
        ObservationFilterHelper.clickFilterByExpressionAndEnterExpression(m_Driver, 
                "imageMetadata != null || audioMetadata != null || videoMetadata != null");
        
        //Retrieve the table that contains observations.
        WebElement obsTable = m_Driver.findElement(By.cssSelector("tbody[id*='obsTable_data']"));
        assertThat(obsTable, is(notNullValue()));
        
        //Verify the number of observations.
        List<WebElement> obsList = obsTable.findElements(By.cssSelector("div[id$='observationPanel']"));
        assertThat(obsList.size(), is(4));
        
        int foundVideo = 0; 
        int foundAudio = 0;
        int foundImage = 0;
        List<WebElement> imageLinks = new ArrayList<WebElement>();
        for (WebElement obsPanel : obsList)
        {
            List<WebElement> videoLink = obsPanel.findElements(By.cssSelector("a[id*='dlVideo']"));
            List<WebElement> audioLink = obsPanel.findElements(By.cssSelector("a[id*='dlAudio']"));
            List<WebElement> imageLink = obsPanel.findElements(By.cssSelector("a[id*='viewImageObs']"));
            
            if (videoLink.size() != 0)
            {
                foundVideo++;
                assertThat(videoLink.size(), is(1));
                assertThat(videoLink.get(0).isDisplayed(), is(true));
            }
            else if (audioLink.size() != 0)
            {
                foundAudio++;
                assertThat(audioLink.size(), is(1));
                assertThat(audioLink.get(0).isDisplayed(), is(true));
            }
            else if (imageLink.size() != 0)
            {
                foundImage++;
                assertThat(imageLink.size(), is(1));
                assertThat(imageLink.get(0).isDisplayed(), is(true));
                imageLinks.add(imageLink.get(0));
            }
        }
        
        assertThat(imageLinks.size(), is(2));
        
        //Image with resolution metadata already set.
        imageLinks.get(0).click();
        ObservationImageHelper.verifyImageIsDisplayed(m_Driver);
        
        //Image without resolution metadata. ImageIO then gives the image resolution metadata.
        imageLinks.get(1).click();
        ObservationImageHelper.verifyImageIsDisplayed(m_Driver);
        
        assertThat(foundVideo, is(1));
        assertThat(foundAudio, is(1));
        assertThat(foundImage, is(2));
        
        //Clear and remove the filter.
        ObservationFilterHelper.clearFilterByExpression(m_Driver);
    }
/**
     * Method that tests to make sure the download button is shown for observations that contain audio, video, and 
     * image. Also checks to make sure that image observation can be viewed directly in the browser.
     */
Method that tests to make sure the download button is shown for observations that contain audio, video, and
image. Also checks to make sure that image observation can be viewed directly in the browser.
Method that tests to make sure the download button is shown for observations that contain audio video and image . Also checks to make sure that image observation can be viewed directly in the browser .
@Test
    public void testViewingObs() throws InterruptedException, ExecutionException, TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(m_Driver, 60);
        String assetName = "testAsset";
        AssetHelper.createAsset(m_Driver, "ExampleObservationsAsset", assetName);      
        AssetHelper.activateAsset(m_Driver, assetName);
        m_Driver.navigate().refresh();
        WebElement obsTabButton = m_Driver.findElement(By.cssSelector("a[href*='assetObsTab']"));
        assertThat(obsTabButton, is(notNullValue()));
        obsTabButton.click();
        wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("form[id*='obsForm']")));
        ObservationFilterHelper.clickFilterByExpressionAndEnterExpression(m_Driver, 
                "imageMetadata != null || audioMetadata != null || videoMetadata != null");
        WebElement obsTable = m_Driver.findElement(By.cssSelector("tbody[id*='obsTable_data']"));
        assertThat(obsTable, is(notNullValue()));
        List<WebElement> obsList = obsTable.findElements(By.cssSelector("div[id$='observationPanel']"));
        assertThat(obsList.size(), is(4));
        int foundVideo = 0; 
        int foundAudio = 0;
        int foundImage = 0;
        List<WebElement> imageLinks = new ArrayList<WebElement>();
        for (WebElement obsPanel : obsList)
        {
            List<WebElement> videoLink = obsPanel.findElements(By.cssSelector("a[id*='dlVideo']"));
            List<WebElement> audioLink = obsPanel.findElements(By.cssSelector("a[id*='dlAudio']"));
            List<WebElement> imageLink = obsPanel.findElements(By.cssSelector("a[id*='viewImageObs']"));
            if (videoLink.size() != 0)
            {
                foundVideo++;
                assertThat(videoLink.size(), is(1));
                assertThat(videoLink.get(0).isDisplayed(), is(true));
            }
            else if (audioLink.size() != 0)
            {
                foundAudio++;
                assertThat(audioLink.size(), is(1));
                assertThat(audioLink.get(0).isDisplayed(), is(true));
            }
            else if (imageLink.size() != 0)
            {
                foundImage++;
                assertThat(imageLink.size(), is(1));
                assertThat(imageLink.get(0).isDisplayed(), is(true));
                imageLinks.add(imageLink.get(0));
            }
        }
        assertThat(imageLinks.size(), is(2));
        imageLinks.get(0).click();
        ObservationImageHelper.verifyImageIsDisplayed(m_Driver);
        imageLinks.get(1).click();
        ObservationImageHelper.verifyImageIsDisplayed(m_Driver);
        assertThat(foundVideo, is(1));
        assertThat(foundAudio, is(1));
        assertThat(foundImage, is(2));
        ObservationFilterHelper.clearFilterByExpression(m_Driver);
    }
@ Test public void testViewingObs ( ) throws InterruptedException , ExecutionException , TimeoutException { WebDriverWait wait = new WebDriverWait ( m_Driver , 60 ) ; String assetName = "testAsset" ; AssetHelper . createAsset ( m_Driver , "ExampleObservationsAsset" , assetName ) ; AssetHelper . activateAsset ( m_Driver , assetName ) ; m_Driver . navigate ( ) . refresh ( ) ; WebElement obsTabButton = m_Driver . findElement ( By . cssSelector ( "a[href*='assetObsTab']" ) ) ; assertThat ( obsTabButton , is ( notNullValue ( ) ) ) ; obsTabButton . click ( ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "form[id*='obsForm']" ) ) ) ; ObservationFilterHelper . clickFilterByExpressionAndEnterExpression ( m_Driver , "imageMetadata != null || audioMetadata != null || videoMetadata != null" ) ; WebElement obsTable = m_Driver . findElement ( By . cssSelector ( "tbody[id*='obsTable_data']" ) ) ; assertThat ( obsTable , is ( notNullValue ( ) ) ) ; List < WebElement > obsList = obsTable . findElements ( By . cssSelector ( "div[id$='observationPanel']" ) ) ; assertThat ( obsList . size ( ) , is ( 4 ) ) ; int foundVideo = 0 ; int foundAudio = 0 ; int foundImage = 0 ; List < WebElement > imageLinks = new ArrayList < WebElement > ( ) ; for ( WebElement obsPanel : obsList ) { List < WebElement > videoLink = obsPanel . findElements ( By . cssSelector ( "a[id*='dlVideo']" ) ) ; List < WebElement > audioLink = obsPanel . findElements ( By . cssSelector ( "a[id*='dlAudio']" ) ) ; List < WebElement > imageLink = obsPanel . findElements ( By . cssSelector ( "a[id*='viewImageObs']" ) ) ; if ( videoLink . size ( ) != 0 ) { foundVideo ++ ; assertThat ( videoLink . size ( ) , is ( 1 ) ) ; assertThat ( videoLink . get ( 0 ) . isDisplayed ( ) , is ( true ) ) ; } else if ( audioLink . size ( ) != 0 ) { foundAudio ++ ; assertThat ( audioLink . size ( ) , is ( 1 ) ) ; assertThat ( audioLink . get ( 0 ) . isDisplayed ( ) , is ( true ) ) ; } else if ( imageLink . size ( ) != 0 ) { foundImage ++ ; assertThat ( imageLink . size ( ) , is ( 1 ) ) ; assertThat ( imageLink . get ( 0 ) . isDisplayed ( ) , is ( true ) ) ; imageLinks . add ( imageLink . get ( 0 ) ) ; } } assertThat ( imageLinks . size ( ) , is ( 2 ) ) ; imageLinks . get ( 0 ) . click ( ) ; ObservationImageHelper . verifyImageIsDisplayed ( m_Driver ) ; imageLinks . get ( 1 ) . click ( ) ; ObservationImageHelper . verifyImageIsDisplayed ( m_Driver ) ; assertThat ( foundVideo , is ( 1 ) ) ; assertThat ( foundAudio , is ( 1 ) ) ; assertThat ( foundImage , is ( 2 ) ) ; ObservationFilterHelper . clearFilterByExpression ( m_Driver ) ; }
Method that tests to make sure the download button is shown for observations that contain audio, video, and
 image.
Method that tests to make sure the download button is shown for observations that contain audio video and image .
//Name of the asset to be created. //Create asset. //Activate asset. //Refresh needs since there is not push updates for the observation tab. //Navigate to the observation tab. //Wait till the form on the observation tab is displayed. //Filter to only display image, audio, and video observations. //Retrieve the table that contains observations. //Verify the number of observations. //Image with resolution metadata already set. //Image without resolution metadata. ImageIO then gives the image resolution metadata. //Clear and remove the filter.