mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/CommsGeneralHelper.java
public static void commsTestCleanUpHelper(WebDriver driver) throws InterruptedException, ExecutionException, 
        TimeoutException
    {
        WebElement addCommsDlg = driver.findElement(By.cssSelector("div[id$='addCommsDialog']"));
        
        if (addCommsDlg.isDisplayed())
        {
            //rather than just closing dialog, refresh entire page to ensure closure of all open dialogs
            //and resetting of input fields and validation state.
            driver.navigate().refresh();            
        }
        
        List<WebElement> stacksList = driver.findElements(By.cssSelector("a[id*='dataList']"));
        //stack list should not contain more than 1 "All" stack, 2 dev physical links, 
        //and 1 physical link that was force-added
        if (stacksList.size() > 4)
        {
            for (WebElement element : driver.findElements(By.cssSelector("a[id*='dataList']")))
            {
                String topLayerName = element.getText().trim();
                if (!topLayerName.equals("All") && !topLayerName.contains("dev") 
                        && !topLayerName.matches("^[0-9]+$"))
                {
                    CommsGeneralHelper.removeStack(driver, topLayerName);
                }
            }
        }
        
        if(!bundleInstalled)
        {
            BundleManagerUtil.installBundle(driver, ResourceLocatorUtil.getExampleCustomCommPluginFile(), 
                    NavigationButtonNameConstants.NAVBUT_PROP_COMMS);
            bundleInstalled = true;
            
            //open up add comms dialog and refresh the types again so they are available for the next test
            WebElement addCommsButton = driver.findElement(By.cssSelector("button[id*='addCommsButton']"));
            
            WebDriverWait wait = new WebDriverWait(driver, 5);
            wait.until(ExpectedConditions.visibilityOf(addCommsButton));
            addCommsButton.click();
            
            WebElement refreshTypesButton = driver.findElement(By.cssSelector("button[id*='refreshCommsTypes']"));
            wait.until(ExpectedConditions.visibilityOf(refreshTypesButton));
            refreshTypesButton.click();
            
            wait.until(ExpectedConditions.refreshed(ExpectedConditions.
                    elementToBeClickable(By.cssSelector("button[id*='cancelStackButton']"))));
            
            WebElement closeButton = driver.findElement(By.cssSelector("button[id*='cancelStackButton']"));
            closeButton.click();
        }
    }
/**
     * Used to ensure that the add comms dialog is closed and that all non-physical link stacks are removed.
     */
Used to ensure that the add comms dialog is closed and that all non-physical link stacks are removed.
Used to ensure that the add comms dialog is closed and that all non - physical link stacks are removed .
public static void commsTestCleanUpHelper(WebDriver driver) throws InterruptedException, ExecutionException, 
        TimeoutException
    {
        WebElement addCommsDlg = driver.findElement(By.cssSelector("div[id$='addCommsDialog']"));
        if (addCommsDlg.isDisplayed())
        {
            driver.navigate().refresh();            
        }
        List<WebElement> stacksList = driver.findElements(By.cssSelector("a[id*='dataList']"));
        if (stacksList.size() > 4)
        {
            for (WebElement element : driver.findElements(By.cssSelector("a[id*='dataList']")))
            {
                String topLayerName = element.getText().trim();
                if (!topLayerName.equals("All") && !topLayerName.contains("dev") 
                        && !topLayerName.matches("^[0-9]+$"))
                {
                    CommsGeneralHelper.removeStack(driver, topLayerName);
                }
            }
        }
        if(!bundleInstalled)
        {
            BundleManagerUtil.installBundle(driver, ResourceLocatorUtil.getExampleCustomCommPluginFile(), 
                    NavigationButtonNameConstants.NAVBUT_PROP_COMMS);
            bundleInstalled = true;
            WebElement addCommsButton = driver.findElement(By.cssSelector("button[id*='addCommsButton']"));
            WebDriverWait wait = new WebDriverWait(driver, 5);
            wait.until(ExpectedConditions.visibilityOf(addCommsButton));
            addCommsButton.click();
            WebElement refreshTypesButton = driver.findElement(By.cssSelector("button[id*='refreshCommsTypes']"));
            wait.until(ExpectedConditions.visibilityOf(refreshTypesButton));
            refreshTypesButton.click();
            wait.until(ExpectedConditions.refreshed(ExpectedConditions.
                    elementToBeClickable(By.cssSelector("button[id*='cancelStackButton']"))));
            WebElement closeButton = driver.findElement(By.cssSelector("button[id*='cancelStackButton']"));
            closeButton.click();
        }
    }
public static void commsTestCleanUpHelper ( WebDriver driver ) throws InterruptedException , ExecutionException , TimeoutException { WebElement addCommsDlg = driver . findElement ( By . cssSelector ( "div[id$='addCommsDialog']" ) ) ; if ( addCommsDlg . isDisplayed ( ) ) { driver . navigate ( ) . refresh ( ) ; } List < WebElement > stacksList = driver . findElements ( By . cssSelector ( "a[id*='dataList']" ) ) ; if ( stacksList . size ( ) > 4 ) { for ( WebElement element : driver . findElements ( By . cssSelector ( "a[id*='dataList']" ) ) ) { String topLayerName = element . getText ( ) . trim ( ) ; if ( ! topLayerName . equals ( "All" ) && ! topLayerName . contains ( "dev" ) && ! topLayerName . matches ( "^[0-9]+$" ) ) { CommsGeneralHelper . removeStack ( driver , topLayerName ) ; } } } if ( ! bundleInstalled ) { BundleManagerUtil . installBundle ( driver , ResourceLocatorUtil . getExampleCustomCommPluginFile ( ) , NavigationButtonNameConstants . NAVBUT_PROP_COMMS ) ; bundleInstalled = true ; WebElement addCommsButton = driver . findElement ( By . cssSelector ( "button[id*='addCommsButton']" ) ) ; WebDriverWait wait = new WebDriverWait ( driver , 5 ) ; wait . until ( ExpectedConditions . visibilityOf ( addCommsButton ) ) ; addCommsButton . click ( ) ; WebElement refreshTypesButton = driver . findElement ( By . cssSelector ( "button[id*='refreshCommsTypes']" ) ) ; wait . until ( ExpectedConditions . visibilityOf ( refreshTypesButton ) ) ; refreshTypesButton . click ( ) ; wait . until ( ExpectedConditions . refreshed ( ExpectedConditions . elementToBeClickable ( By . cssSelector ( "button[id*='cancelStackButton']" ) ) ) ) ; WebElement closeButton = driver . findElement ( By . cssSelector ( "button[id*='cancelStackButton']" ) ) ; closeButton . click ( ) ; } }
Used to ensure that the add comms dialog is closed and that all non-physical link stacks are removed.
Used to ensure that the add comms dialog is closed and that all non - physical link stacks are removed .
//rather than just closing dialog, refresh entire page to ensure closure of all open dialogs //and resetting of input fields and validation state. //stack list should not contain more than 1 "All" stack, 2 dev physical links,  //and 1 physical link that was force-added //open up add comms dialog and refresh the types again so they are available for the next test