mil.dod.th.ose.gui.integration/src/mil/dod/th/ose/gui/integration/webapp/asset/TestAssetAsyncCommandResponse.java
@Test
    public void testUpdateCommandResponseEvent() throws InterruptedException
    {
        //unique name for the asset created for this particular test
        final String assetName = "updateCommandResponseEventAsset";
        AssetHelper.createAsset(m_Driver, "ExampleUpdateAsset", assetName);
        
        // must go to command tab to register the response event handler
        AssetHelper.chooseAssetTab(m_Driver, AssetTabConstants.COMMAND_TAB);
        
        // now that we are listening for the event, we can activate the asset to make the plug-in post the response
        AssetHelper.activateAsset(m_Driver, assetName);
        
        //---choose the command tab ---
        AssetHelper.chooseAssetTab(m_Driver, AssetTabConstants.COMMAND_TAB);
        
        AssetCommandHelper.clickAccordionPanel(m_Driver, assetName, "Get Commands", ExpandCollapse.EXPAND);
        
        WebElement assetCommandPanel = AssetCommandHelper.getAssetCommandPanel(m_Driver, assetName);
        WebElement versionTab = assetCommandPanel.findElement(By.linkText("Version"));
        assertThat(versionTab, notNullValue());
        
        versionTab.click();
        
        WebDriverWait wait = new WebDriverWait(m_Driver, 15);
        wait.until(ExpectedConditions.visibilityOf(assetCommandPanel.findElement(
                       By.cssSelector("div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']"))));
        
        // refresh once
        m_Driver.navigate().refresh();
        Wait<WebDriver> fWait = new FluentWait<WebDriver>(m_Driver).withTimeout(30, TimeUnit.SECONDS).pollingEvery(
                    2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, NoSuchElementException.class);
        fWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebElement assetCommandPanel = AssetCommandHelper.getAssetCommandPanel(m_Driver, assetName);
                WebElement div = assetCommandPanel.findElement(
                        By.cssSelector("div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']"));

                WebElement textArea = div.findElement(
                        By.cssSelector("textarea[id$='responseData'][aria-disabled='false']"));
                return textArea.getText().contains("currentVersion=V activate-version");
            }
        });
        assetCommandPanel = AssetCommandHelper.getAssetCommandPanel(m_Driver, assetName);
        WebElement tabDiv  = assetCommandPanel.findElement(By.cssSelector(
                "div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']"));
        
        WebElement time = tabDiv.findElement(By.cssSelector("span[id$='timeData']"));
        assertThat(time, notNullValue());
        
        assertThat(time.getText(), not(equalTo("Time Received: N/A")));
        AssetHelper.deactivateAsset(m_Driver, assetName);
    }
/**
     * Verify that the get command tab is update for update response events.
     */
Verify that the get command tab is update for update response events.
Verify that the get command tab is update for update response events .
@Test
    public void testUpdateCommandResponseEvent() throws InterruptedException
    {
        final String assetName = "updateCommandResponseEventAsset";
        AssetHelper.createAsset(m_Driver, "ExampleUpdateAsset", assetName);
        AssetHelper.chooseAssetTab(m_Driver, AssetTabConstants.COMMAND_TAB);
        AssetHelper.activateAsset(m_Driver, assetName);
        AssetHelper.chooseAssetTab(m_Driver, AssetTabConstants.COMMAND_TAB);
        AssetCommandHelper.clickAccordionPanel(m_Driver, assetName, "Get Commands", ExpandCollapse.EXPAND);
        WebElement assetCommandPanel = AssetCommandHelper.getAssetCommandPanel(m_Driver, assetName);
        WebElement versionTab = assetCommandPanel.findElement(By.linkText("Version"));
        assertThat(versionTab, notNullValue());
        versionTab.click();
        WebDriverWait wait = new WebDriverWait(m_Driver, 15);
        wait.until(ExpectedConditions.visibilityOf(assetCommandPanel.findElement(
                       By.cssSelector("div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']"))));
        m_Driver.navigate().refresh();
        Wait<WebDriver> fWait = new FluentWait<WebDriver>(m_Driver).withTimeout(30, TimeUnit.SECONDS).pollingEvery(
                    2, TimeUnit.SECONDS).ignoring(StaleElementReferenceException.class, NoSuchElementException.class);
        fWait.until(new ExpectedCondition<Boolean>()
        {
            @Override
            public Boolean apply(WebDriver driver)
            {
                WebElement assetCommandPanel = AssetCommandHelper.getAssetCommandPanel(m_Driver, assetName);
                WebElement div = assetCommandPanel.findElement(
                        By.cssSelector("div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']"));
                WebElement textArea = div.findElement(
                        By.cssSelector("textarea[id$='responseData'][aria-disabled='false']"));
                return textArea.getText().contains("currentVersion=V activate-version");
            }
        });
        assetCommandPanel = AssetCommandHelper.getAssetCommandPanel(m_Driver, assetName);
        WebElement tabDiv  = assetCommandPanel.findElement(By.cssSelector(
                "div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']"));
        WebElement time = tabDiv.findElement(By.cssSelector("span[id$='timeData']"));
        assertThat(time, notNullValue());
        assertThat(time.getText(), not(equalTo("Time Received: N/A")));
        AssetHelper.deactivateAsset(m_Driver, assetName);
    }
@ Test public void testUpdateCommandResponseEvent ( ) throws InterruptedException { final String assetName = "updateCommandResponseEventAsset" ; AssetHelper . createAsset ( m_Driver , "ExampleUpdateAsset" , assetName ) ; AssetHelper . chooseAssetTab ( m_Driver , AssetTabConstants . COMMAND_TAB ) ; AssetHelper . activateAsset ( m_Driver , assetName ) ; AssetHelper . chooseAssetTab ( m_Driver , AssetTabConstants . COMMAND_TAB ) ; AssetCommandHelper . clickAccordionPanel ( m_Driver , assetName , "Get Commands" , ExpandCollapse . EXPAND ) ; WebElement assetCommandPanel = AssetCommandHelper . getAssetCommandPanel ( m_Driver , assetName ) ; WebElement versionTab = assetCommandPanel . findElement ( By . linkText ( "Version" ) ) ; assertThat ( versionTab , notNullValue ( ) ) ; versionTab . click ( ) ; WebDriverWait wait = new WebDriverWait ( m_Driver , 15 ) ; wait . until ( ExpectedConditions . visibilityOf ( assetCommandPanel . findElement ( By . cssSelector ( "div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']" ) ) ) ) ; m_Driver . navigate ( ) . refresh ( ) ; Wait < WebDriver > fWait = new FluentWait < WebDriver > ( m_Driver ) . withTimeout ( 30 , TimeUnit . SECONDS ) . pollingEvery ( 2 , TimeUnit . SECONDS ) . ignoring ( StaleElementReferenceException . class , NoSuchElementException . class ) ; fWait . until ( new ExpectedCondition < Boolean > ( ) { @ Override public Boolean apply ( WebDriver driver ) { WebElement assetCommandPanel = AssetCommandHelper . getAssetCommandPanel ( m_Driver , assetName ) ; WebElement div = assetCommandPanel . findElement ( By . cssSelector ( "div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']" ) ) ; WebElement textArea = div . findElement ( By . cssSelector ( "textarea[id$='responseData'][aria-disabled='false']" ) ) ; return textArea . getText ( ) . contains ( "currentVersion=V activate-version" ) ; } } ) ; assetCommandPanel = AssetCommandHelper . getAssetCommandPanel ( m_Driver , assetName ) ; WebElement tabDiv = assetCommandPanel . findElement ( By . cssSelector ( "div[id*='getCommandTab'][role='tabpanel'][aria-hidden='false']" ) ) ; WebElement time = tabDiv . findElement ( By . cssSelector ( "span[id$='timeData']" ) ) ; assertThat ( time , notNullValue ( ) ) ; assertThat ( time . getText ( ) , not ( equalTo ( "Time Received: N/A" ) ) ) ; AssetHelper . deactivateAsset ( m_Driver , assetName ) ; }
Verify that the get command tab is update for update response events.
Verify that the get command tab is update for update response events .
//unique name for the asset created for this particular test // must go to command tab to register the response event handler // now that we are listening for the event, we can activate the asset to make the plug-in post the response //---choose the command tab --- // refresh once