mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/ChannelsHelper.java
public static void createTransportChannel(final WebDriver driver, final String transportName, 
        final String controllerId, final String localAddress, final String remoteAddress) 
        throws InterruptedException
    {
        //navigate to the channels page if not already there.
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_CHANNELS, null);
        
        //collapse sidebars
        NavigationHelper.collapseSideBars(driver);
        
        // click on add channel button
        final WebDriverWait wait = new WebDriverWait(driver, 5);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("button[id*='addChannel']")));
        final WebElement addChannel = driver.findElement(By.cssSelector("button[id*='addChannel']"));
        assertThat(addChannel, is(notNullValue()));
        addChannel.click();
        
        // wait for dialog to show
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("propsDlg")));
        
        // need to change channel type
        final WebElement changeChannelType = driver.findElement(By.cssSelector("button[id*='changeChannelType']"));
        changeChannelType.click();
        
        wait.until(ExpectedConditions.visibilityOfElementLocated(
                By.cssSelector("div[id*='chooseChannelTable']")));
        final WebElement newChannelTable = driver.findElement(By.cssSelector("tbody[id$='chooseChannelTable_data']"));
        
        List<WebElement> channelTypeRows = newChannelTable.findElements(By.tagName("tr"));
        for (WebElement channelTypeRow : channelTypeRows)
        {
            List<WebElement> channelTypeCells = channelTypeRow.findElements(By.tagName("td"));
            if (channelTypeCells.get(1).findElement(By.tagName("div")).getText().equals(transportName))
            {
                // found channel type
                final WebElement selectButton = 
                        channelTypeRow.findElement(By.cssSelector("button[id*='selectChannelType']"));
                selectButton.click();
                break;
            }
        }
        
        //Wait till the new transport channel properties dialog is visible.
        final WebElement propertiesDialog = driver.findElement(By.cssSelector("div[id='propsDlg']"));
        wait.until(ExpectedConditions.visibilityOf(propertiesDialog));
        
        //Set the ID of the controller the transport channel will connect to.
        final WebElement controllerIdInput = propertiesDialog.findElement(
                By.cssSelector("div[id$='cIds']")).findElement(By.tagName("input"));
        controllerIdInput.clear();
        controllerIdInput.sendKeys(controllerId);
        
        //Set the local address for the transport channel.
        final WebElement localAddressInput = propertiesDialog.findElement(
                By.cssSelector("div[id$='localAddress']")).findElement(By.tagName("input"));
        localAddressInput.clear();
        localAddressInput.sendKeys(localAddress);
        
        //Set the remote address for the transport channel.
        final WebElement remoteAddressInput = propertiesDialog.findElement(
                By.cssSelector("div[id$='remoteAddress']")).findElement(By.tagName("input"));
        remoteAddressInput.clear();
        remoteAddressInput.sendKeys(remoteAddress);
        
        //Create the transport channel.
        final WebElement createChannelButton = propertiesDialog.findElement(
                By.cssSelector("button[id$='createChanButton']"));
        createChannelButton.click();
        
        //return to initial state
        NavigationHelper.expandLeftSideBarOnly(driver);
    }
/**
     * Method that creates a transport channel that connects the gui to the specified controller.
     * 
     * @param driver
     *  the web driver performing the test
     * @param transportName
     *  name the type of transport channel to create
     * @param controllerId
     *  id of the controller the transport channel is to connect to
     * @param localAddress
     *  local address for the transport channel
     * @param remoteAddress
     *  remote address for the transport channel
     */
Method that creates a transport channel that connects the gui to the specified controller.


Method that creates a transport channel that connects the gui to the specified controller .
public static void createTransportChannel(final WebDriver driver, final String transportName, 
        final String controllerId, final String localAddress, final String remoteAddress) 
        throws InterruptedException
    {
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_CHANNELS, null);
        NavigationHelper.collapseSideBars(driver);
        final WebDriverWait wait = new WebDriverWait(driver, 5);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("button[id*='addChannel']")));
        final WebElement addChannel = driver.findElement(By.cssSelector("button[id*='addChannel']"));
        assertThat(addChannel, is(notNullValue()));
        addChannel.click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("propsDlg")));
        final WebElement changeChannelType = driver.findElement(By.cssSelector("button[id*='changeChannelType']"));
        changeChannelType.click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(
                By.cssSelector("div[id*='chooseChannelTable']")));
        final WebElement newChannelTable = driver.findElement(By.cssSelector("tbody[id$='chooseChannelTable_data']"));
        List<WebElement> channelTypeRows = newChannelTable.findElements(By.tagName("tr"));
        for (WebElement channelTypeRow : channelTypeRows)
        {
            List<WebElement> channelTypeCells = channelTypeRow.findElements(By.tagName("td"));
            if (channelTypeCells.get(1).findElement(By.tagName("div")).getText().equals(transportName))
            {
                final WebElement selectButton = 
                        channelTypeRow.findElement(By.cssSelector("button[id*='selectChannelType']"));
                selectButton.click();
                break;
            }
        }
        final WebElement propertiesDialog = driver.findElement(By.cssSelector("div[id='propsDlg']"));
        wait.until(ExpectedConditions.visibilityOf(propertiesDialog));
        final WebElement controllerIdInput = propertiesDialog.findElement(
                By.cssSelector("div[id$='cIds']")).findElement(By.tagName("input"));
        controllerIdInput.clear();
        controllerIdInput.sendKeys(controllerId);
        final WebElement localAddressInput = propertiesDialog.findElement(
                By.cssSelector("div[id$='localAddress']")).findElement(By.tagName("input"));
        localAddressInput.clear();
        localAddressInput.sendKeys(localAddress);
        final WebElement remoteAddressInput = propertiesDialog.findElement(
                By.cssSelector("div[id$='remoteAddress']")).findElement(By.tagName("input"));
        remoteAddressInput.clear();
        remoteAddressInput.sendKeys(remoteAddress);
        final WebElement createChannelButton = propertiesDialog.findElement(
                By.cssSelector("button[id$='createChanButton']"));
        createChannelButton.click();
        NavigationHelper.expandLeftSideBarOnly(driver);
    }
public static void createTransportChannel ( final WebDriver driver , final String transportName , final String controllerId , final String localAddress , final String remoteAddress ) throws InterruptedException { NavigationHelper . pageAndTabCheck ( driver , NavigationButtonNameConstants . NAVBUT_PROP_CHANNELS , null ) ; NavigationHelper . collapseSideBars ( driver ) ; final WebDriverWait wait = new WebDriverWait ( driver , 5 ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "button[id*='addChannel']" ) ) ) ; final WebElement addChannel = driver . findElement ( By . cssSelector ( "button[id*='addChannel']" ) ) ; assertThat ( addChannel , is ( notNullValue ( ) ) ) ; addChannel . click ( ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . id ( "propsDlg" ) ) ) ; final WebElement changeChannelType = driver . findElement ( By . cssSelector ( "button[id*='changeChannelType']" ) ) ; changeChannelType . click ( ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "div[id*='chooseChannelTable']" ) ) ) ; final WebElement newChannelTable = driver . findElement ( By . cssSelector ( "tbody[id$='chooseChannelTable_data']" ) ) ; List < WebElement > channelTypeRows = newChannelTable . findElements ( By . tagName ( "tr" ) ) ; for ( WebElement channelTypeRow : channelTypeRows ) { List < WebElement > channelTypeCells = channelTypeRow . findElements ( By . tagName ( "td" ) ) ; if ( channelTypeCells . get ( 1 ) . findElement ( By . tagName ( "div" ) ) . getText ( ) . equals ( transportName ) ) { final WebElement selectButton = channelTypeRow . findElement ( By . cssSelector ( "button[id*='selectChannelType']" ) ) ; selectButton . click ( ) ; break ; } } final WebElement propertiesDialog = driver . findElement ( By . cssSelector ( "div[id='propsDlg']" ) ) ; wait . until ( ExpectedConditions . visibilityOf ( propertiesDialog ) ) ; final WebElement controllerIdInput = propertiesDialog . findElement ( By . cssSelector ( "div[id$='cIds']" ) ) . findElement ( By . tagName ( "input" ) ) ; controllerIdInput . clear ( ) ; controllerIdInput . sendKeys ( controllerId ) ; final WebElement localAddressInput = propertiesDialog . findElement ( By . cssSelector ( "div[id$='localAddress']" ) ) . findElement ( By . tagName ( "input" ) ) ; localAddressInput . clear ( ) ; localAddressInput . sendKeys ( localAddress ) ; final WebElement remoteAddressInput = propertiesDialog . findElement ( By . cssSelector ( "div[id$='remoteAddress']" ) ) . findElement ( By . tagName ( "input" ) ) ; remoteAddressInput . clear ( ) ; remoteAddressInput . sendKeys ( remoteAddress ) ; final WebElement createChannelButton = propertiesDialog . findElement ( By . cssSelector ( "button[id$='createChanButton']" ) ) ; createChannelButton . click ( ) ; NavigationHelper . expandLeftSideBarOnly ( driver ) ; }
Method that creates a transport channel that connects the gui to the specified controller.
Method that creates a transport channel that connects the gui to the specified controller .
//navigate to the channels page if not already there. //collapse sidebars // click on add channel button // wait for dialog to show // need to change channel type // found channel type //Wait till the new transport channel properties dialog is visible. //Set the ID of the controller the transport channel will connect to. //Set the local address for the transport channel. //Set the remote address for the transport channel. //Create the transport channel. //return to initial state