mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/helpers/CommsGeneralHelper.java
public static void activateStack(final WebDriver driver, final String stackName) throws InterruptedException, 
        ExecutionException, TimeoutException
    {
        //Initial page/tab check.
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        
        //Retrieve the stack to be activated.
        WebElement stack = retrieveStack(driver, stackName);
        if (stack == null)
        {
            throw new IllegalArgumentException("No stack found with name: " + stackName);
        }
        
        //--activate the stack
        WebElement activateButton = stack.findElement(By.cssSelector("button[id$='activateButton']"));
        WebElement removeButton = stack.findElement(By.cssSelector("button[id$='removeButton']"));
        
        //assert that activate and remove buttons are displayed
        assertThat(activateButton.isDisplayed(), is(true));
        assertThat(removeButton.isDisplayed(), is(true));
        
        //click the activate button
        GrowlVerifier.verifyAndWaitToDisappear(20, activateButton, "Link Activated");
        
        //this needs to be 2 seconds
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(NoSuchElementException.class, 
                        StaleElementReferenceException.class);
        
        //Wait till the status of the stack is activated.
        fwait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[id$='deactivationButton']")));
        
        //ensure activate and remove buttons are invisible
        fwait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("button[id$='activateButton']")));
        fwait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("button[id$='removeButton']")));
        
        //refresh DOM instance - since buttons changed, using old stack object will cause StaleElementException
        stack = retrieveStack(driver, stackName);
        
        //find deactivate button
        WebElement deactivateButton = stack.findElement(By.cssSelector("button[id$='deactivationButton']"));

        //ensure deactivate button is displayed
        assertThat(deactivateButton.isDisplayed(), is(true));     
    }
/**
     * Assuming an stack with the given name is already created, activate the stack.
     */
Assuming an stack with the given name is already created, activate the stack.
Assuming an stack with the given name is already created activate the stack .
public static void activateStack(final WebDriver driver, final String stackName) throws InterruptedException, 
        ExecutionException, TimeoutException
    {
        NavigationHelper.pageAndTabCheck(driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        WebElement stack = retrieveStack(driver, stackName);
        if (stack == null)
        {
            throw new IllegalArgumentException("No stack found with name: " + stackName);
        }
        WebElement activateButton = stack.findElement(By.cssSelector("button[id$='activateButton']"));
        WebElement removeButton = stack.findElement(By.cssSelector("button[id$='removeButton']"));
        assertThat(activateButton.isDisplayed(), is(true));
        assertThat(removeButton.isDisplayed(), is(true));
        GrowlVerifier.verifyAndWaitToDisappear(20, activateButton, "Link Activated");
        Wait<WebDriver> fwait = new FluentWait<WebDriver>(driver).withTimeout(30, TimeUnit.SECONDS).
                pollingEvery(2, TimeUnit.SECONDS).ignoring(NoSuchElementException.class, 
                        StaleElementReferenceException.class);
        fwait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("button[id$='deactivationButton']")));
        fwait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("button[id$='activateButton']")));
        fwait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("button[id$='removeButton']")));
        stack = retrieveStack(driver, stackName);
        WebElement deactivateButton = stack.findElement(By.cssSelector("button[id$='deactivationButton']"));
        assertThat(deactivateButton.isDisplayed(), is(true));     
    }
public static void activateStack ( final WebDriver driver , final String stackName ) throws InterruptedException , ExecutionException , TimeoutException { NavigationHelper . pageAndTabCheck ( driver , NavigationButtonNameConstants . NAVBUT_PROP_COMMS , null ) ; WebElement stack = retrieveStack ( driver , stackName ) ; if ( stack == null ) { throw new IllegalArgumentException ( "No stack found with name: " + stackName ) ; } WebElement activateButton = stack . findElement ( By . cssSelector ( "button[id$='activateButton']" ) ) ; WebElement removeButton = stack . findElement ( By . cssSelector ( "button[id$='removeButton']" ) ) ; assertThat ( activateButton . isDisplayed ( ) , is ( true ) ) ; assertThat ( removeButton . isDisplayed ( ) , is ( true ) ) ; GrowlVerifier . verifyAndWaitToDisappear ( 20 , activateButton , "Link Activated" ) ; Wait < WebDriver > fwait = new FluentWait < WebDriver > ( driver ) . withTimeout ( 30 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( NoSuchElementException . class , StaleElementReferenceException . class ) ; fwait . until ( ExpectedConditions . presenceOfElementLocated ( By . cssSelector ( "button[id$='deactivationButton']" ) ) ) ; fwait . until ( ExpectedConditions . invisibilityOfElementLocated ( By . cssSelector ( "button[id$='activateButton']" ) ) ) ; fwait . until ( ExpectedConditions . invisibilityOfElementLocated ( By . cssSelector ( "button[id$='removeButton']" ) ) ) ; stack = retrieveStack ( driver , stackName ) ; WebElement deactivateButton = stack . findElement ( By . cssSelector ( "button[id$='deactivationButton']" ) ) ; assertThat ( deactivateButton . isDisplayed ( ) , is ( true ) ) ; }
Assuming an stack with the given name is already created, activate the stack.
Assuming an stack with the given name is already created activate the stack .
//Initial page/tab check. //Retrieve the stack to be activated. //--activate the stack //assert that activate and remove buttons are displayed //click the activate button //this needs to be 2 seconds //Wait till the status of the stack is activated. //ensure activate and remove buttons are invisible //refresh DOM instance - since buttons changed, using old stack object will cause StaleElementException //find deactivate button //ensure deactivate button is displayed