mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/base/TestControllerSideBar.java
@Test
    public void testActiveController() throws InterruptedException, NumberFormatException, ExecutionException, 
        TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(m_Driver, 10);
               
        wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(
            By.xpath("//div[contains(@id, 'controllerList')]")));

        ControllerHelper.ensureTwoControllers(m_Driver);
        
        //verify the active controller information
        String nameOfActiveCont = ControllerHelper.getNameOfActiveContoller(m_Driver);
        WebElement controllerId = m_Driver.findElement(By.xpath("//span[contains(@id, 'controllerId')]"));
        if (nameOfActiveCont.equals(ControllerHelper.DEFAULT_GUI_NAME))
        {
            //verify the active controller information
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_GUI_ID));
        }
        else
        {
            assertThat(nameOfActiveCont, is(ControllerHelper.DEFAULT_CONTROLLER_NAME));
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_CONTROLLER_ID));
        }

        //---Make the other controller the active controller---
        WebElement inactiveButton = m_Driver.findElements(By.cssSelector("button[class*='inactiveButton']")).get(0);
        
        //---Make the other controller the active controller. should be only inactive controller now---
        inactiveButton = m_Driver.findElement(By.cssSelector("button[class*='inactiveButton']"));
        //grab index of inactive controller
        String buttonIndex = GeneralHelper.getElementIndex(inactiveButton.getAttribute("id")); 
        inactiveButton.click();
        
        //wait until inactive controller becomes active controller 
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='" + buttonIndex 
                + ":active']")));
        
        //get the name of the active controller
        String nameOfOtherActiveCont = ControllerHelper.getNameOfActiveContoller(m_Driver);
        //verify the same controller isn't still active
        assertThat(nameOfActiveCont, is(not(nameOfOtherActiveCont)));
        
        //verify the active controller information
        controllerId = m_Driver.findElement(By.xpath("//span[contains(@id, 'controllerId')]"));
        if (nameOfOtherActiveCont.equals(ControllerHelper.DEFAULT_GUI_NAME))
        {
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_GUI_ID));
        }
        else if (nameOfOtherActiveCont.equals(ControllerHelper.DEFAULT_CONTROLLER_NAME))
        {
            //verify the active controller information
            assertThat(nameOfActiveCont, is(ControllerHelper.DEFAULT_CONTROLLER_NAME));
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_CONTROLLER_ID));
        }
    }
/**
     * Verify that if any controller that is added that can be chosen to be the active controller and that
     * the other controller will be made inactive.
     */
Verify that if any controller that is added that can be chosen to be the active controller and that
the other controller will be made inactive.
Verify that if any controller that is added that can be chosen to be the active controller and that the other controller will be made inactive .
@Test
    public void testActiveController() throws InterruptedException, NumberFormatException, ExecutionException, 
        TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(m_Driver, 10);
        wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(
            By.xpath("//div[contains(@id, 'controllerList')]")));
        ControllerHelper.ensureTwoControllers(m_Driver);
        String nameOfActiveCont = ControllerHelper.getNameOfActiveContoller(m_Driver);
        WebElement controllerId = m_Driver.findElement(By.xpath("//span[contains(@id, 'controllerId')]"));
        if (nameOfActiveCont.equals(ControllerHelper.DEFAULT_GUI_NAME))
        {
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_GUI_ID));
        }
        else
        {
            assertThat(nameOfActiveCont, is(ControllerHelper.DEFAULT_CONTROLLER_NAME));
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_CONTROLLER_ID));
        }
        WebElement inactiveButton = m_Driver.findElements(By.cssSelector("button[class*='inactiveButton']")).get(0);
        inactiveButton = m_Driver.findElement(By.cssSelector("button[class*='inactiveButton']"));
        String buttonIndex = GeneralHelper.getElementIndex(inactiveButton.getAttribute("id")); 
        inactiveButton.click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='" + buttonIndex 
                + ":active']")));
        String nameOfOtherActiveCont = ControllerHelper.getNameOfActiveContoller(m_Driver);
        assertThat(nameOfActiveCont, is(not(nameOfOtherActiveCont)));
        controllerId = m_Driver.findElement(By.xpath("//span[contains(@id, 'controllerId')]"));
        if (nameOfOtherActiveCont.equals(ControllerHelper.DEFAULT_GUI_NAME))
        {
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_GUI_ID));
        }
        else if (nameOfOtherActiveCont.equals(ControllerHelper.DEFAULT_CONTROLLER_NAME))
        {
            assertThat(nameOfActiveCont, is(ControllerHelper.DEFAULT_CONTROLLER_NAME));
            assertThat(controllerId.getText(), containsString(ControllerHelper.DEFAULT_CONTROLLER_ID));
        }
    }
@ Test public void testActiveController ( ) throws InterruptedException , NumberFormatException , ExecutionException , TimeoutException { WebDriverWait wait = new WebDriverWait ( m_Driver , 10 ) ; wait . until ( ExpectedConditions . presenceOfAllElementsLocatedBy ( By . xpath ( "//div[contains(@id, 'controllerList')]" ) ) ) ; ControllerHelper . ensureTwoControllers ( m_Driver ) ; String nameOfActiveCont = ControllerHelper . getNameOfActiveContoller ( m_Driver ) ; WebElement controllerId = m_Driver . findElement ( By . xpath ( "//span[contains(@id, 'controllerId')]" ) ) ; if ( nameOfActiveCont . equals ( ControllerHelper . DEFAULT_GUI_NAME ) ) { assertThat ( controllerId . getText ( ) , containsString ( ControllerHelper . DEFAULT_GUI_ID ) ) ; } else { assertThat ( nameOfActiveCont , is ( ControllerHelper . DEFAULT_CONTROLLER_NAME ) ) ; assertThat ( controllerId . getText ( ) , containsString ( ControllerHelper . DEFAULT_CONTROLLER_ID ) ) ; } WebElement inactiveButton = m_Driver . findElements ( By . cssSelector ( "button[class*='inactiveButton']" ) ) . get ( 0 ) ; inactiveButton = m_Driver . findElement ( By . cssSelector ( "button[class*='inactiveButton']" ) ) ; String buttonIndex = GeneralHelper . getElementIndex ( inactiveButton . getAttribute ( "id" ) ) ; inactiveButton . click ( ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "div[id$='" + buttonIndex + ":active']" ) ) ) ; String nameOfOtherActiveCont = ControllerHelper . getNameOfActiveContoller ( m_Driver ) ; assertThat ( nameOfActiveCont , is ( not ( nameOfOtherActiveCont ) ) ) ; controllerId = m_Driver . findElement ( By . xpath ( "//span[contains(@id, 'controllerId')]" ) ) ; if ( nameOfOtherActiveCont . equals ( ControllerHelper . DEFAULT_GUI_NAME ) ) { assertThat ( controllerId . getText ( ) , containsString ( ControllerHelper . DEFAULT_GUI_ID ) ) ; } else if ( nameOfOtherActiveCont . equals ( ControllerHelper . DEFAULT_CONTROLLER_NAME ) ) { assertThat ( nameOfActiveCont , is ( ControllerHelper . DEFAULT_CONTROLLER_NAME ) ) ; assertThat ( controllerId . getText ( ) , containsString ( ControllerHelper . DEFAULT_CONTROLLER_ID ) ) ; } }
Verify that if any controller that is added that can be chosen to be the active controller and that
 the other controller will be made inactive.
Verify that if any controller that is added that can be chosen to be the active controller and that the other controller will be made inactive .
//verify the active controller information //verify the active controller information //---Make the other controller the active controller--- //---Make the other controller the active controller. should be only inactive controller now--- //grab index of inactive controller //wait until inactive controller becomes active controller  //get the name of the active controller //verify the same controller isn't still active //verify the active controller information //verify the active controller information