mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/comms/TestAddCommsDlg.java
@Test
    public void testCreateStackDialog() throws InterruptedException
    {
        NavigationHelper.pageAndTabCheck(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);

        // Bring up the add comms dialog
        WebElement addCommsButton = m_Driver.findElement(By.cssSelector("button[id*='addCommsButton']"));
        addCommsButton.click();

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

        // Test ExampleLinkLayer
        WebElement layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Link Layer",
                "example.ccomms.ExampleLinkLayer");
        assertThat(layer, is(notNullValue()));

        WebElement layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver,
                "example.ccomms.ExampleLinkLayer");
        assertThat(layerIcon, notNullValue());

        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_line_of_sight.png", ".png");

        // Assert Link Layer Description, Specs, Images
        layer.click();

        // wait for text to change
        wait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(
                By.cssSelector("div[id*='llDescription']"), "Select a Layer to see Description.")));
        WebElement desc = m_Driver.findElement(By.cssSelector("div[id*='llDescription']"));
        assertThat(desc.getText(), containsString("Example Link Layer"));
        assertSpecsButton("example.ccomms.ExampleLinkLayer", "ExampleLinkLayer");

        // Test DirectTransport
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type", "example.ccomms.DirectTransport");
        if (layer == null)
        {
            CommsAddDialogHelper.selectNextCommsLayerPage(m_Driver);
            layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type",
                    "example.ccomms.DirectTransport");
        }
        assertThat(layer, is(notNullValue()));

        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver, "example.ccomms.DirectTransport");
        assertThat(layerIcon, notNullValue());

        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_generic.png", ".png");

        // Assert Description, Specs, Images
        layer.click();

        // wait for text to change
        wait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(
                By.cssSelector("div[id*='transDesc']"), "Select a Layer to see Description.")));
        desc = m_Driver.findElement(By.cssSelector("div[id*='transDesc']"));
        assertThat(desc.getText(),
                containsString("An example transport layer that sends messages to another Direct transport layer"));
        assertSpecsButton("example.ccomms.DirectTransport", "Direct Transport");

        // Test EchoTransport
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type", "example.ccomms.EchoTransport");

        // If there are more then 3 in the list, select next page, then check again
        if (layer == null)
        {
            CommsAddDialogHelper.selectNextCommsLayerPage(m_Driver);
            layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type", "example.ccomms.EchoTransport");
            if (layer == null)
            {
                CommsAddDialogHelper.selectBackCommsLayerPage(m_Driver);
                layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type",
                        "example.ccomms.EchoTransport");
            }
        }
        assertThat(layer, is(notNullValue()));

        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver, "example.ccomms.EchoTransport");
        assertThat(layerIcon, notNullValue());

        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_generic.png", ".png");

        // Assert Description, Specs, Images
        layer.click();

        // wait for text to change
        wait.until(ExpectedConditions.not(
                ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("div[id*='transDesc']"),
                        "An example transport layer that sends messages to another Direct transport layer")));
        desc = m_Driver.findElement(By.cssSelector("div[id*='transDesc']"));
        assertThat(desc.getText(), containsString(
                "An example transport layer that echoes messages back through the same transport layer"));
        assertSpecsButton("example.ccomms.EchoTransport", "Echo Transport");

        // TODO: TH-1150 - Need to add tests for description and specs button, once those capabilities is working.

        // open the force add physical link dialog.
        CommsAddDialogHelper.putInForceAddPhysicalLinkMode(m_Driver);

        // ensure that link tab is open
        CommsAddDialogHelper.layerSelectHelper(m_Driver, "Physical Link", null);

        // wait until list of physical types is visible
        wait.until(
                ExpectedConditions.visibilityOf(m_Driver.findElement(By.cssSelector("div[id$='physicalTypesData']"))));

        // assert that known physical types exist and that specs contain proper info
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Physical Link",
                PhysicalLinkTypeEnum.I_2_C.toString());
        assertThat(layer, is(notNullValue()));
        assertSpecsButton(PhysicalLinkTypeEnum.I_2_C.toString(), "ExamplePhysicalLink");

        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver,
                PhysicalLinkTypeEnum.I_2_C.toString());
        assertThat(layerIcon, notNullValue());

        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_serial.png", ".png");

        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Physical Link",
                PhysicalLinkTypeEnum.SERIAL_PORT.toString());
        assertThat(layer, is(notNullValue()));
        assertSpecsButton(PhysicalLinkTypeEnum.SERIAL_PORT.toString(), "Example Serial Port");

        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver,
                PhysicalLinkTypeEnum.SERIAL_PORT.toString());
        assertThat(layerIcon, notNullValue());

        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_serial.png", ".png");

        // go back to original add comms panel
        WebElement forceAddCheckBox = m_Driver.findElement(
                By.cssSelector("input[id$='addAccordion:forceAddCheckBox_input']"));
        wait.until(ExpectedConditions.visibilityOf(forceAddCheckBox));
        forceAddCheckBox.click();

        // Wait till the link tab available. This means that force add physical link dialog is no longer displayed.
        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("addCommsForm:addAccordion:linkTab")));

        // ---close the dialog---
        WebElement closeButton = m_Driver.findElement(By.cssSelector("button[id*='cancelStackButton']"));
        closeButton.click();

        wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div[id$='addCommsDialog']")));
    }
/**
     * Assuming default controller is the active controller, assuming example platform and example good plugin bundles
     * are in the controller. Verify the example physical link, example link layer, echo transport, and direct transport
     * layers show up in the layer type lists.
     */
Assuming default controller is the active controller, assuming example platform and example good plugin bundles
are in the controller. Verify the example physical link, example link layer, echo transport, and direct transport
layers show up in the layer type lists.
Assuming default controller is the active controller assuming example platform and example good plugin bundles are in the controller . Verify the example physical link example link layer echo transport and direct transport layers show up in the layer type lists .
@Test
    public void testCreateStackDialog() throws InterruptedException
    {
        NavigationHelper.pageAndTabCheck(m_Driver, NavigationButtonNameConstants.NAVBUT_PROP_COMMS, null);
        WebElement addCommsButton = m_Driver.findElement(By.cssSelector("button[id*='addCommsButton']"));
        addCommsButton.click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id$='addAccordion']")));
        WebElement layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Link Layer",
                "example.ccomms.ExampleLinkLayer");
        assertThat(layer, is(notNullValue()));
        WebElement layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver,
                "example.ccomms.ExampleLinkLayer");
        assertThat(layerIcon, notNullValue());
        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_line_of_sight.png", ".png");
        layer.click();
        wait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(
                By.cssSelector("div[id*='llDescription']"), "Select a Layer to see Description.")));
        WebElement desc = m_Driver.findElement(By.cssSelector("div[id*='llDescription']"));
        assertThat(desc.getText(), containsString("Example Link Layer"));
        assertSpecsButton("example.ccomms.ExampleLinkLayer", "ExampleLinkLayer");
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type", "example.ccomms.DirectTransport");
        if (layer == null)
        {
            CommsAddDialogHelper.selectNextCommsLayerPage(m_Driver);
            layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type",
                    "example.ccomms.DirectTransport");
        }
        assertThat(layer, is(notNullValue()));
        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver, "example.ccomms.DirectTransport");
        assertThat(layerIcon, notNullValue());
        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_generic.png", ".png");
        layer.click();
        wait.until(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(
                By.cssSelector("div[id*='transDesc']"), "Select a Layer to see Description.")));
        desc = m_Driver.findElement(By.cssSelector("div[id*='transDesc']"));
        assertThat(desc.getText(),
                containsString("An example transport layer that sends messages to another Direct transport layer"));
        assertSpecsButton("example.ccomms.DirectTransport", "Direct Transport");
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type", "example.ccomms.EchoTransport");
        if (layer == null)
        {
            CommsAddDialogHelper.selectNextCommsLayerPage(m_Driver);
            layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type", "example.ccomms.EchoTransport");
            if (layer == null)
            {
                CommsAddDialogHelper.selectBackCommsLayerPage(m_Driver);
                layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Transport Type",
                        "example.ccomms.EchoTransport");
            }
        }
        assertThat(layer, is(notNullValue()));
        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver, "example.ccomms.EchoTransport");
        assertThat(layerIcon, notNullValue());
        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_generic.png", ".png");
        layer.click();
        wait.until(ExpectedConditions.not(
                ExpectedConditions.textToBePresentInElementLocated(By.cssSelector("div[id*='transDesc']"),
                        "An example transport layer that sends messages to another Direct transport layer")));
        desc = m_Driver.findElement(By.cssSelector("div[id*='transDesc']"));
        assertThat(desc.getText(), containsString(
                "An example transport layer that echoes messages back through the same transport layer"));
        assertSpecsButton("example.ccomms.EchoTransport", "Echo Transport");
        CommsAddDialogHelper.putInForceAddPhysicalLinkMode(m_Driver);
        CommsAddDialogHelper.layerSelectHelper(m_Driver, "Physical Link", null);
        wait.until(
                ExpectedConditions.visibilityOf(m_Driver.findElement(By.cssSelector("div[id$='physicalTypesData']"))));
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Physical Link",
                PhysicalLinkTypeEnum.I_2_C.toString());
        assertThat(layer, is(notNullValue()));
        assertSpecsButton(PhysicalLinkTypeEnum.I_2_C.toString(), "ExamplePhysicalLink");
        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver,
                PhysicalLinkTypeEnum.I_2_C.toString());
        assertThat(layerIcon, notNullValue());
        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_serial.png", ".png");
        layer = CommsAddDialogHelper.layerSelectHelper(m_Driver, "Physical Link",
                PhysicalLinkTypeEnum.SERIAL_PORT.toString());
        assertThat(layer, is(notNullValue()));
        assertSpecsButton(PhysicalLinkTypeEnum.SERIAL_PORT.toString(), "Example Serial Port");
        layerIcon = CommsAddDialogHelper.retrieveCommsImageForLayerType(m_Driver,
                PhysicalLinkTypeEnum.SERIAL_PORT.toString());
        assertThat(layerIcon, notNullValue());
        ImageHelper.getPictureOrIconNameAndVerify(layerIcon, "comms_serial.png", ".png");
        WebElement forceAddCheckBox = m_Driver.findElement(
                By.cssSelector("input[id$='addAccordion:forceAddCheckBox_input']"));
        wait.until(ExpectedConditions.visibilityOf(forceAddCheckBox));
        forceAddCheckBox.click();
        wait.until(ExpectedConditions.presenceOfElementLocated(By.id("addCommsForm:addAccordion:linkTab")));
        WebElement closeButton = m_Driver.findElement(By.cssSelector("button[id*='cancelStackButton']"));
        closeButton.click();
        wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div[id$='addCommsDialog']")));
    }
@ Test public void testCreateStackDialog ( ) throws InterruptedException { NavigationHelper . pageAndTabCheck ( m_Driver , NavigationButtonNameConstants . NAVBUT_PROP_COMMS , null ) ; WebElement addCommsButton = m_Driver . findElement ( By . cssSelector ( "button[id*='addCommsButton']" ) ) ; addCommsButton . click ( ) ; wait . until ( ExpectedConditions . visibilityOfElementLocated ( By . cssSelector ( "div[id$='addAccordion']" ) ) ) ; WebElement layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Link Layer" , "example.ccomms.ExampleLinkLayer" ) ; assertThat ( layer , is ( notNullValue ( ) ) ) ; WebElement layerIcon = CommsAddDialogHelper . retrieveCommsImageForLayerType ( m_Driver , "example.ccomms.ExampleLinkLayer" ) ; assertThat ( layerIcon , notNullValue ( ) ) ; ImageHelper . getPictureOrIconNameAndVerify ( layerIcon , "comms_line_of_sight.png" , ".png" ) ; layer . click ( ) ; wait . until ( ExpectedConditions . not ( ExpectedConditions . textToBePresentInElementLocated ( By . cssSelector ( "div[id*='llDescription']" ) , "Select a Layer to see Description." ) ) ) ; WebElement desc = m_Driver . findElement ( By . cssSelector ( "div[id*='llDescription']" ) ) ; assertThat ( desc . getText ( ) , containsString ( "Example Link Layer" ) ) ; assertSpecsButton ( "example.ccomms.ExampleLinkLayer" , "ExampleLinkLayer" ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Transport Type" , "example.ccomms.DirectTransport" ) ; if ( layer == null ) { CommsAddDialogHelper . selectNextCommsLayerPage ( m_Driver ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Transport Type" , "example.ccomms.DirectTransport" ) ; } assertThat ( layer , is ( notNullValue ( ) ) ) ; layerIcon = CommsAddDialogHelper . retrieveCommsImageForLayerType ( m_Driver , "example.ccomms.DirectTransport" ) ; assertThat ( layerIcon , notNullValue ( ) ) ; ImageHelper . getPictureOrIconNameAndVerify ( layerIcon , "comms_generic.png" , ".png" ) ; layer . click ( ) ; wait . until ( ExpectedConditions . not ( ExpectedConditions . textToBePresentInElementLocated ( By . cssSelector ( "div[id*='transDesc']" ) , "Select a Layer to see Description." ) ) ) ; desc = m_Driver . findElement ( By . cssSelector ( "div[id*='transDesc']" ) ) ; assertThat ( desc . getText ( ) , containsString ( "An example transport layer that sends messages to another Direct transport layer" ) ) ; assertSpecsButton ( "example.ccomms.DirectTransport" , "Direct Transport" ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Transport Type" , "example.ccomms.EchoTransport" ) ; if ( layer == null ) { CommsAddDialogHelper . selectNextCommsLayerPage ( m_Driver ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Transport Type" , "example.ccomms.EchoTransport" ) ; if ( layer == null ) { CommsAddDialogHelper . selectBackCommsLayerPage ( m_Driver ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Transport Type" , "example.ccomms.EchoTransport" ) ; } } assertThat ( layer , is ( notNullValue ( ) ) ) ; layerIcon = CommsAddDialogHelper . retrieveCommsImageForLayerType ( m_Driver , "example.ccomms.EchoTransport" ) ; assertThat ( layerIcon , notNullValue ( ) ) ; ImageHelper . getPictureOrIconNameAndVerify ( layerIcon , "comms_generic.png" , ".png" ) ; layer . click ( ) ; wait . until ( ExpectedConditions . not ( ExpectedConditions . textToBePresentInElementLocated ( By . cssSelector ( "div[id*='transDesc']" ) , "An example transport layer that sends messages to another Direct transport layer" ) ) ) ; desc = m_Driver . findElement ( By . cssSelector ( "div[id*='transDesc']" ) ) ; assertThat ( desc . getText ( ) , containsString ( "An example transport layer that echoes messages back through the same transport layer" ) ) ; assertSpecsButton ( "example.ccomms.EchoTransport" , "Echo Transport" ) ; CommsAddDialogHelper . putInForceAddPhysicalLinkMode ( m_Driver ) ; CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Physical Link" , null ) ; wait . until ( ExpectedConditions . visibilityOf ( m_Driver . findElement ( By . cssSelector ( "div[id$='physicalTypesData']" ) ) ) ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Physical Link" , PhysicalLinkTypeEnum . I_2_C . toString ( ) ) ; assertThat ( layer , is ( notNullValue ( ) ) ) ; assertSpecsButton ( PhysicalLinkTypeEnum . I_2_C . toString ( ) , "ExamplePhysicalLink" ) ; layerIcon = CommsAddDialogHelper . retrieveCommsImageForLayerType ( m_Driver , PhysicalLinkTypeEnum . I_2_C . toString ( ) ) ; assertThat ( layerIcon , notNullValue ( ) ) ; ImageHelper . getPictureOrIconNameAndVerify ( layerIcon , "comms_serial.png" , ".png" ) ; layer = CommsAddDialogHelper . layerSelectHelper ( m_Driver , "Physical Link" , PhysicalLinkTypeEnum . SERIAL_PORT . toString ( ) ) ; assertThat ( layer , is ( notNullValue ( ) ) ) ; assertSpecsButton ( PhysicalLinkTypeEnum . SERIAL_PORT . toString ( ) , "Example Serial Port" ) ; layerIcon = CommsAddDialogHelper . retrieveCommsImageForLayerType ( m_Driver , PhysicalLinkTypeEnum . SERIAL_PORT . toString ( ) ) ; assertThat ( layerIcon , notNullValue ( ) ) ; ImageHelper . getPictureOrIconNameAndVerify ( layerIcon , "comms_serial.png" , ".png" ) ; WebElement forceAddCheckBox = m_Driver . findElement ( By . cssSelector ( "input[id$='addAccordion:forceAddCheckBox_input']" ) ) ; wait . until ( ExpectedConditions . visibilityOf ( forceAddCheckBox ) ) ; forceAddCheckBox . click ( ) ; wait . until ( ExpectedConditions . presenceOfElementLocated ( By . id ( "addCommsForm:addAccordion:linkTab" ) ) ) ; WebElement closeButton = m_Driver . findElement ( By . cssSelector ( "button[id*='cancelStackButton']" ) ) ; closeButton . click ( ) ; wait . until ( ExpectedConditions . invisibilityOfElementLocated ( By . cssSelector ( "div[id$='addCommsDialog']" ) ) ) ; }
Assuming default controller is the active controller, assuming example platform and example good plugin bundles
 are in the controller.
Assuming default controller is the active controller assuming example platform and example good plugin bundles are in the controller .
// Bring up the add comms dialog // Wait until the add comms dialog is visible // Test ExampleLinkLayer // Assert Link Layer Description, Specs, Images // wait for text to change // Test DirectTransport // Assert Description, Specs, Images // wait for text to change // Test EchoTransport // If there are more then 3 in the list, select next page, then check again // Assert Description, Specs, Images // wait for text to change // TODO: TH-1150 - Need to add tests for description and specs button, once those capabilities is working. // open the force add physical link dialog. // ensure that link tab is open // wait until list of physical types is visible // assert that known physical types exist and that specs contain proper info // go back to original add comms panel // Wait till the link tab available. This means that force add physical link dialog is no longer displayed. // ---close the dialog---