mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/CommsGeneralHelper.java
public static void removeStack(final WebDriver driver, final String stackName, 
            final String ...growlTitles) throws InterruptedException, ExecutionException, TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(driver, 15);
        
        //Initial page/tab check.
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        
        //Retrieve the stack to be removed.
        WebElement stack = retrieveStack(driver, stackName);
        
        //---remove the stack---
        List<WebElement> removeButtonList = stack.findElements(By.cssSelector("button[id$='removeButton']"));
        
        if (removeButtonList.size() > 0)
        {
            removeButtonList.get(0).click();
        
            wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='removeStackDialog']")));
            
            //confirm we want to remove the stack
            WebElement confirmRemove = driver.findElement(By.cssSelector("button[id$='confirmDeleteButton']"));
            if (growlTitles.length > 0)
            {
                GrowlVerifier.verifyAndWaitToDisappear(30, confirmRemove, growlTitles);
            }
            else
            {
                confirmRemove.click();
            }
            
            //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);
            
            Boolean result = fwait.until(new ExpectedCondition<Boolean>()
            {
                @Override
                public Boolean apply(WebDriver driver)
                {
                    return retrieveStack(driver, stackName) == null;
                }
            });        
            assertThat(result, is(true));
            
            //Thread sleep needed. This is due to the fact that the stack may 
            //have been deleted and disappear from the list
            //but the list may not be updated. 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(2000);
        }
    }
/**
     * Assuming a stack with the given name is already created and deactivated, remove the stack.
     */
Assuming a stack with the given name is already created and deactivated, remove the stack.
Assuming a stack with the given name is already created and deactivated remove the stack .
public static void removeStack(final WebDriver driver, final String stackName, 
            final String ...growlTitles) throws InterruptedException, ExecutionException, TimeoutException
    {
        WebDriverWait wait = new WebDriverWait(driver, 15);
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        WebElement stack = retrieveStack(driver, stackName);
        List<WebElement> removeButtonList = stack.findElements(By.cssSelector("button[id$='removeButton']"));
        if (removeButtonList.size() > 0)
        {
            removeButtonList.get(0).click();
            wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='removeStackDialog']")));
            WebElement confirmRemove = driver.findElement(By.cssSelector("button[id$='confirmDeleteButton']"));
            if (growlTitles.length > 0)
            {
                GrowlVerifier.verifyAndWaitToDisappear(30, confirmRemove, growlTitles);
            }
            else
            {
                confirmRemove.click();
            }
            Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).
                    pollingEvery(2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, 
                            NoSuchElementException.class);
            Boolean result = fwait.until(new ExpectedCondition<Boolean>()
            {
                @Override
                public Boolean apply(WebDriver driver)
                {
                    return retrieveStack(driver, stackName) == null;
                }
            });        
            assertThat(result, is(true));
            Thread.sleep(2000);
        }
    }
public static void removeStack ( final WebDriver driver , final String stackName , final String ... growlTitles ) throws InterruptedException , ExecutionException , TimeoutException { WebDriverWait wait = new WebDriverWait ( driver , 15 ) ; NavigationHelper . pageAndTabCheck ( driver , NavigationButtonNameConstants . NAVBUT_PROP_COMMS , null ) ; WebElement stack = retrieveStack ( driver , stackName ) ; List < WebElement > removeButtonList = stack . findElements ( By . cssSelector ( "button[id$='removeButton']" ) ) ; if ( removeButtonList . size ( ) > 0 ) { removeButtonList . get ( 0 ) . click ( ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "div[id$='removeStackDialog']" ) ) ) ; WebElement confirmRemove = driver . findElement ( By . cssSelector ( "button[id$='confirmDeleteButton']" ) ) ; if ( growlTitles . length > 0 ) { GrowlVerifier . verifyAndWaitToDisappear ( 30 , confirmRemove , growlTitles ) ; } else { confirmRemove . click ( ) ; } Wait < WebDriver > fwait = new FluentWait < WebDriver > ( driver ) . withTimeout ( 30 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( StaleElementReferenceException . class , NoSuchElementException . class ) ; Boolean result = fwait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { return retrieveStack ( driver , stackName ) == null ; } } ) ; assertThat ( result , is ( true ) ) ; Thread . sleep ( 2000 ) ; } }
Assuming a stack with the given name is already created and deactivated, remove the stack.
Assuming a stack with the given name is already created and deactivated remove the stack .
//Initial page/tab check. //Retrieve the stack to be removed. //---remove the stack--- //confirm we want to remove the stack //this needs to be 2 seconds //Thread sleep needed. This is due to the fact that the stack may  //have been deleted and disappear from the list //but the list may not be updated. This means that any attempt to use the stack directly after this  //method may encounter a stale element since rendering is not complete.