mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/CommsGeneralHelper.java
public static void createStack(final WebDriver driver, final String physicalName, final String linkName, 
        final String linkType, final String transName, final String transType) 
        throws InterruptedException
    {            
        //Initial page check
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        
        //this needs to be 2 seconds
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);

        fwait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[id*='addCommsButton']")));
        
        //Bring up the add comms dialog
        WebElement addCommsButton = driver.findElement(By.cssSelector("button[id*='addCommsButton']"));
        addCommsButton.click();
        
        //Instantiate web driver wait and fluent wait.
        WebDriverWait wait = new WebDriverWait(driver, 5);

        //Wait till the add comms dialog is visible.
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id*='addAccordion']")));

        /**
         * Select a link layer type and pass the given link name to the input field 
         */
        CommsAddDialogHelper.layerSelectHelper(driver, "Link Layer", linkType).click();
        
        //Wait until the dialog reflects that the link type has been selected       
        wait.until(ExpectedConditions.textToBePresentInElementValue(By.
                cssSelector("input[name$='linkData_selection']"), linkType));
        
        //enter the layer name
        WebElement input = driver.findElement(By.cssSelector("input[id$='linkName']"));
        GeneralHelper.retrySendKeys(driver, input, linkName, 5);
        
        /**
         * Select a physical layer 
         */
        CommsAddDialogHelper.layerSelectHelper(driver, "Physical Link", physicalName).click();
        
        //Wait until the dialog reflects that the physical link has been selected     
        wait.until(ExpectedConditions.textToBePresentInElementValue(By.
                cssSelector("input[name$='physicalData_selection']"), physicalName));
        
        /**
         * Select a transport layer and pass the name values, if applicable 
         */
        if (transType != null)
        {
            // Check to see if DirectTransport is visable
            WebElement layer = CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type",
                    transType);
            // If there are more then 3 in the list, select next page, then check again
            if (layer == null)
            {
                CommsAddDialogHelper.selectNextCommsLayerPage(driver);
                layer = CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type",
                        transType);
                if (layer == null)
                {
                    CommsAddDialogHelper.selectBackCommsLayerPage(driver);
                    layer = CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type", transType);
                }

            }

            CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type", transType).click();
            
            //Wait till the dialog reflects that the link type has been selected        
            wait.until(ExpectedConditions.textToBePresentInElementValue(By.
                    cssSelector("input[name$='transportData_selection']"), transType));
            
            //Sleep needed  to allow AJAX update to finish after a layer is selected.
            Thread.sleep(2000);
            
            //enter trans name
            input = driver.findElement(By.cssSelector("input[id$='transName']"));
            GeneralHelper.retrySendKeys(driver, input, transName, 5);
        }
        
        //click confirm stack to create new stack
        WebElement confirmStackButton = driver.findElement(By.cssSelector("button[id$='confirmStackButton']"));
        confirmStackButton.click();
        
        //wait until the confirm stack table is shown
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("span[id$='confirmStack']")));
        
        //create list of entered values for created stack
        List<String> givenParams = new ArrayList<String>();
        givenParams.add(physicalName);
        givenParams.add(linkName);
        givenParams.add(linkType);
        if (transType != null)
        {
            //add transport layer params
            givenParams.add(transName);
            givenParams.add(transType);
        }
        
        //all entered values should appear in confirm dialog
        List<WebElement> confirmData = driver.findElements(By.cssSelector("tr[class='ui-widget-content']>td")); 

        assertThat(givenParams.size(), is(confirmData.size() - 2));
        
        //submit the form
        WebElement submitButton = driver.findElement(By.cssSelector("button[id$='confirmSubmitButton']"));
        submitButton.click();
        
        //Wait for the created stack to appear in the stacks list.
        Boolean result = fwait.until(new ExpectedCondition<Boolean>()
        { 
            @Override
            public Boolean apply(WebDriver driver)
            {
                //pass in either the trans name or link depending on which one is topmost
                return CommsGeneralHelper.retrieveStack(driver, transName == null ? linkName : transName) != null;
            }
        });
        assertThat(result, is(true));
        
        //Thread sleep needed. This is due to the fact that the stack may have been created and appear in the list
        //but the list may not be done rendering. This means that any attempt to use the stack directly after this 
        //method may encounter a stale element since rendering is not complete.
        Thread.sleep(7000);
    }
/**
     * Assuming default controller is the active controller, assuming the example platform bundle is loaded
     * on the controller. Create a new comms stack type specified by the given params.
     */
Assuming default controller is the active controller, assuming the example platform bundle is loaded
on the controller. Create a new comms stack type specified by the given params.
Assuming default controller is the active controller assuming the example platform bundle is loaded on the controller . Create a new comms stack type specified by the given params .
public static void createStack(final WebDriver driver, final String physicalName, final String linkName, 
        final String linkType, final String transName, final String transType) 
        throws InterruptedException
    {            
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                        NoSuchElementException.class);
        fwait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[id*='addCommsButton']")));
        WebElement addCommsButton = driver.findElement(By.cssSelector("button[id*='addCommsButton']"));
        addCommsButton.click();
        WebDriverWait wait = new WebDriverWait(driver, 5);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id*='addAccordion']")));
        /**
         * Select a link layer type and pass the given link name to the input field 
         */
        CommsAddDialogHelper.layerSelectHelper(driver, "Link Layer", linkType).click();
        wait.until(ExpectedConditions.textToBePresentInElementValue(By.
                cssSelector("input[name$='linkData_selection']"), linkType));
        WebElement input = driver.findElement(By.cssSelector("input[id$='linkName']"));
        GeneralHelper.retrySendKeys(driver, input, linkName, 5);
        /**
         * Select a physical layer 
         */
        CommsAddDialogHelper.layerSelectHelper(driver, "Physical Link", physicalName).click();
        wait.until(ExpectedConditions.textToBePresentInElementValue(By.
                cssSelector("input[name$='physicalData_selection']"), physicalName));
        /**
         * Select a transport layer and pass the name values, if applicable 
         */
        if (transType != null)
        {
            WebElement layer = CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type",
                    transType);
            if (layer == null)
            {
                CommsAddDialogHelper.selectNextCommsLayerPage(driver);
                layer = CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type",
                        transType);
                if (layer == null)
                {
                    CommsAddDialogHelper.selectBackCommsLayerPage(driver);
                    layer = CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type", transType);
                }
            }
            CommsAddDialogHelper.layerSelectHelper(driver, "Transport Type", transType).click();
            wait.until(ExpectedConditions.textToBePresentInElementValue(By.
                    cssSelector("input[name$='transportData_selection']"), transType));
            Thread.sleep(2000);
            input = driver.findElement(By.cssSelector("input[id$='transName']"));
            GeneralHelper.retrySendKeys(driver, input, transName, 5);
        }
        WebElement confirmStackButton = driver.findElement(By.cssSelector("button[id$='confirmStackButton']"));
        confirmStackButton.click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("span[id$='confirmStack']")));
        List<String> givenParams = new ArrayList<String>();
        givenParams.add(physicalName);
        givenParams.add(linkName);
        givenParams.add(linkType);
        if (transType != null)
        {
            givenParams.add(transName);
            givenParams.add(transType);
        }
        List<WebElement> confirmData = driver.findElements(By.cssSelector("tr[class='ui-widget-content']>td")); 
        assertThat(givenParams.size(), is(confirmData.size() - 2));
        WebElement submitButton = driver.findElement(By.cssSelector("button[id$='confirmSubmitButton']"));
        submitButton.click();
        Boolean result = fwait.until(new ExpectedCondition<Boolean>()
        { 
            @Override
            public Boolean apply(WebDriver driver)
            {
                return CommsGeneralHelper.retrieveStack(driver, transName == null ? linkName : transName) != null;
            }
        });
        assertThat(result, is(true));
        Thread.sleep(7000);
    }
public static void createStack ( final WebDriver driver , final String physicalName , final String linkName , final String linkType , final String transName , final String transType ) throws InterruptedException { NavigationHelper . pageAndTabCheck ( driver , NavigationButtonNameConstants . NAVBUT_PROP_COMMS , null ) ; Wait < WebDriver > fwait = new FluentWait < WebDriver > ( driver ) . withTimeout ( 30 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( StaleElementReferenceException . class , NoSuchElementException . class ) ; fwait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "button[id*='addCommsButton']" ) ) ) ; WebElement addCommsButton = driver . findElement ( By . cssSelector ( "button[id*='addCommsButton']" ) ) ; addCommsButton . click ( ) ; WebDriverWait wait = new WebDriverWait ( driver , 5 ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "div[id*='addAccordion']" ) ) ) ; /**
         * Select a link layer type and pass the given link name to the input field 
         */ CommsAddDialogHelper . layerSelectHelper ( driver , "Link Layer" , linkType ) . click ( ) ; wait . until ( ExpectedConditions . textToBePresentInElementValue ( By . cssSelector ( "input[name$='linkData_selection']" ) , linkType ) ) ; WebElement input = driver . findElement ( By . cssSelector ( "input[id$='linkName']" ) ) ; GeneralHelper . retrySendKeys ( driver , input , linkName , 5 ) ; /**
         * Select a physical layer 
         */ CommsAddDialogHelper . layerSelectHelper ( driver , "Physical Link" , physicalName ) . click ( ) ; wait . until ( ExpectedConditions . textToBePresentInElementValue ( By . cssSelector ( "input[name$='physicalData_selection']" ) , physicalName ) ) ; /**
         * Select a transport layer and pass the name values, if applicable 
         */ if ( transType != null ) { WebElement layer = CommsAddDialogHelper . layerSelectHelper ( driver , "Transport Type" , transType ) ; if ( layer == null ) { CommsAddDialogHelper . selectNextCommsLayerPage ( driver ) ; layer = CommsAddDialogHelper . layerSelectHelper ( driver , "Transport Type" , transType ) ; if ( layer == null ) { CommsAddDialogHelper . selectBackCommsLayerPage ( driver ) ; layer = CommsAddDialogHelper . layerSelectHelper ( driver , "Transport Type" , transType ) ; } } CommsAddDialogHelper . layerSelectHelper ( driver , "Transport Type" , transType ) . click ( ) ; wait . until ( ExpectedConditions . textToBePresentInElementValue ( By . cssSelector ( "input[name$='transportData_selection']" ) , transType ) ) ; Thread . sleep ( 2000 ) ; input = driver . findElement ( By . cssSelector ( "input[id$='transName']" ) ) ; GeneralHelper . retrySendKeys ( driver , input , transName , 5 ) ; } WebElement confirmStackButton = driver . findElement ( By . cssSelector ( "button[id$='confirmStackButton']" ) ) ; confirmStackButton . click ( ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "span[id$='confirmStack']" ) ) ) ; List < String > givenParams = new ArrayList < String > ( ) ; givenParams . add ( physicalName ) ; givenParams . add ( linkName ) ; givenParams . add ( linkType ) ; if ( transType != null ) { givenParams . add ( transName ) ; givenParams . add ( transType ) ; } List < WebElement > confirmData = driver . findElements ( By . cssSelector ( "tr[class='ui-widget-content']>td" ) ) ; assertThat ( givenParams . size ( ) , is ( confirmData . size ( ) - 2 ) ) ; WebElement submitButton = driver . findElement ( By . cssSelector ( "button[id$='confirmSubmitButton']" ) ) ; submitButton . click ( ) ; Boolean result = fwait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { return CommsGeneralHelper . retrieveStack ( driver , transName == null ? linkName : transName ) != null ; } } ) ; assertThat ( result , is ( true ) ) ; Thread . sleep ( 7000 ) ; }
Assuming default controller is the active controller, assuming the example platform bundle is loaded
 on the controller.
Assuming default controller is the active controller assuming the example platform bundle is loaded on the controller .
//Initial page check //this needs to be 2 seconds //Bring up the add comms dialog //Instantiate web driver wait and fluent wait. //Wait till the add comms dialog is visible. //Wait until the dialog reflects that the link type has been selected        //enter the layer name //Wait until the dialog reflects that the physical link has been selected      // Check to see if DirectTransport is visable // If there are more then 3 in the list, select next page, then check again //Wait till the dialog reflects that the link type has been selected         //Sleep needed  to allow AJAX update to finish after a layer is selected. //enter trans name //click confirm stack to create new stack //wait until the confirm stack table is shown //create list of entered values for created stack //add transport layer params //all entered values should appear in confirm dialog //submit the form //Wait for the created stack to appear in the stacks list. //pass in either the trans name or link depending on which one is topmost //Thread sleep needed. This is due to the fact that the stack may have been created and appear in the list //but the list may not be done rendering. This means that any attempt to use the stack directly after this  //method may encounter a stale element since rendering is not complete.