mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/observation/ObservationHelper.java
public static void verifyRelatedObsPanel(WebElement panel, ExpectedObservation observation)
    {
        //get the panel grid that holds the related observations
        WebElement relatedPanel = grabRelatedObsPanel(panel);
        
        //verify the header and image are what is expected
        WebElement relationHeader = relatedPanel.findElement(By.cssSelector("span[id$='relatedHeader']"));
        assertThat(relationHeader, notNullValue());
        
        WebElement linkPanelImage = relatedPanel.findElement(By.cssSelector("img[id$='linkObsImg']"));
        String linkSource = linkPanelImage.getAttribute("src");
        String linkPic = ImageHelper.getPictureOrIconName(linkSource, ".png");
        assertThat(linkPic, is(ObservationConstants.IMG_LINK));
        
        List<WebElement> relatedPanels = grabRelatedObservationSectionPanels(relatedPanel);
        assertThat(relatedPanels.size(), is(observation.getRelatedObservation().getNumberOfSections()));
        
        int foundPanelCount = 0;
        //loop through and verify that they are correct
        for (WebElement indivPanel : relatedPanels)
        {
            WebElement panelHeader = indivPanel.findElement(By.cssSelector("span[id$='relationHeader']"));
            assertThat(panelHeader, notNullValue());
            
            if (panelHeader.getText().equals("PARENT"))
            {
                verifyRelatedObsIndividualPanel(indivPanel, observation, RelationshipTypeEnum.PARENT);
                foundPanelCount++;
            }
            else if (panelHeader.getText().equals("CHILD"))
            {
                verifyRelatedObsIndividualPanel(indivPanel, observation, RelationshipTypeEnum.CHILD);
                foundPanelCount++;
            }
            else if (panelHeader.getText().equals("PEER"))
            {
                verifyRelatedObsIndividualPanel(indivPanel, observation, RelationshipTypeEnum.PEER);
                foundPanelCount++;
            }
            else
            {
                fail(String.format("Found an individual observation heading %s " 
                        + "that does not match any of the expected headings (Peer, Child, Parent).",
                        panelHeader.getText()));
            }
        }
        
        assertThat(foundPanelCount, is(observation.getRelatedObservation().getNumberOfSections()));
    }
/**
     * Verifies a related observation panel. (A related observation panel is defined as the panel 
     * which possibly contains all three relationship types, parent, child, and peer).
     * @param panel
     *  the web element which has the related obs panel within it
     * @param observation
     *  the observation which has the expected relationships
     */
Verifies a related observation panel. (A related observation panel is defined as the panel
which possibly contains all three relationship types, parent, child, and peer).
@param panel
the web element which has the related obs panel within it
@param observation
the observation which has the expected relationships
Verifies a related observation panel . ( A related observation panel is defined as the panel which possibly contains all three relationship types parent child and peer ) . @param panel the web element which has the related obs panel within it @param observation the observation which has the expected relationships
public static void verifyRelatedObsPanel(WebElement panel, ExpectedObservation observation)
    {
        WebElement relatedPanel = grabRelatedObsPanel(panel);
        WebElement relationHeader = relatedPanel.findElement(By.cssSelector("span[id$='relatedHeader']"));
        assertThat(relationHeader, notNullValue());
        WebElement linkPanelImage = relatedPanel.findElement(By.cssSelector("img[id$='linkObsImg']"));
        String linkSource = linkPanelImage.getAttribute("src");
        String linkPic = ImageHelper.getPictureOrIconName(linkSource, ".png");
        assertThat(linkPic, is(ObservationConstants.IMG_LINK));
        List<WebElement> relatedPanels = grabRelatedObservationSectionPanels(relatedPanel);
        assertThat(relatedPanels.size(), is(observation.getRelatedObservation().getNumberOfSections()));
        int foundPanelCount = 0;
        for (WebElement indivPanel : relatedPanels)
        {
            WebElement panelHeader = indivPanel.findElement(By.cssSelector("span[id$='relationHeader']"));
            assertThat(panelHeader, notNullValue());
            if (panelHeader.getText().equals("PARENT"))
            {
                verifyRelatedObsIndividualPanel(indivPanel, observation, RelationshipTypeEnum.PARENT);
                foundPanelCount++;
            }
            else if (panelHeader.getText().equals("CHILD"))
            {
                verifyRelatedObsIndividualPanel(indivPanel, observation, RelationshipTypeEnum.CHILD);
                foundPanelCount++;
            }
            else if (panelHeader.getText().equals("PEER"))
            {
                verifyRelatedObsIndividualPanel(indivPanel, observation, RelationshipTypeEnum.PEER);
                foundPanelCount++;
            }
            else
            {
                fail(String.format("Found an individual observation heading %s " 
                        + "that does not match any of the expected headings (Peer, Child, Parent).",
                        panelHeader.getText()));
            }
        }
        assertThat(foundPanelCount, is(observation.getRelatedObservation().getNumberOfSections()));
    }
public static void verifyRelatedObsPanel ( WebElement panel , ExpectedObservation observation ) { WebElement relatedPanel = grabRelatedObsPanel ( panel ) ; WebElement relationHeader = relatedPanel . findElement ( By . cssSelector ( "span[id$='relatedHeader']" ) ) ; assertThat ( relationHeader , notNullValue ( ) ) ; WebElement linkPanelImage = relatedPanel . findElement ( By . cssSelector ( "img[id$='linkObsImg']" ) ) ; String linkSource = linkPanelImage . getAttribute ( "src" ) ; String linkPic = ImageHelper . getPictureOrIconName ( linkSource , ".png" ) ; assertThat ( linkPic , is ( ObservationConstants . IMG_LINK ) ) ; List < WebElement > relatedPanels = grabRelatedObservationSectionPanels ( relatedPanel ) ; assertThat ( relatedPanels . size ( ) , is ( observation . getRelatedObservation ( ) . getNumberOfSections ( ) ) ) ; int foundPanelCount = 0 ; for ( WebElement indivPanel : relatedPanels ) { WebElement panelHeader = indivPanel . findElement ( By . cssSelector ( "span[id$='relationHeader']" ) ) ; assertThat ( panelHeader , notNullValue ( ) ) ; if ( panelHeader . getText ( ) . equals ( "PARENT" ) ) { verifyRelatedObsIndividualPanel ( indivPanel , observation , RelationshipTypeEnum . PARENT ) ; foundPanelCount ++ ; } else if ( panelHeader . getText ( ) . equals ( "CHILD" ) ) { verifyRelatedObsIndividualPanel ( indivPanel , observation , RelationshipTypeEnum . CHILD ) ; foundPanelCount ++ ; } else if ( panelHeader . getText ( ) . equals ( "PEER" ) ) { verifyRelatedObsIndividualPanel ( indivPanel , observation , RelationshipTypeEnum . PEER ) ; foundPanelCount ++ ; } else { fail ( String . format ( "Found an individual observation heading %s " + "that does not match any of the expected headings (Peer, Child, Parent)." , panelHeader . getText ( ) ) ) ; } } assertThat ( foundPanelCount , is ( observation . getRelatedObservation ( ) . getNumberOfSections ( ) ) ) ; }
Verifies a related observation panel.
Verifies a related observation panel .
//get the panel grid that holds the related observations //verify the header and image are what is expected //loop through and verify that they are correct