Search in sources :

Example 11 with VerificationException

use of com.axway.ats.uiengine.exceptions.VerificationException in project ats-framework by Axway.

the class SwingTable method selectCells.

/**
 * Select table cells
 *
 * @param cells the cells coordinates (eg. new int[][]{ { 1, 1 }, { 1, 2 }, { 2, 2 } )
 * @throws VerificationException if the element doesn't exist
 */
@PublicAtsApi
public void selectCells(int[][] cells) {
    new SwingElementState(this).waitToBecomeExisting();
    JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
    try {
        TableCell[] cellsToSelect = new TableCell[cells.length];
        for (int i = 0; i < cells.length; i++) {
            int row = cells[i][0];
            int column = cells[i][1];
            cellsToSelect[i] = new TableCell(row, column) {
            };
        }
        tableFixture.selectCells(cellsToSelect);
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerifyNotEqualityException(com.axway.ats.uiengine.exceptions.VerifyNotEqualityException) VerifyEqualityException(com.axway.ats.uiengine.exceptions.VerifyEqualityException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) NotSupportedOperationException(com.axway.ats.uiengine.exceptions.NotSupportedOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 12 with VerificationException

use of com.axway.ats.uiengine.exceptions.VerificationException in project ats-framework by Axway.

the class SwingTable method rightClickCell.

/**
 * Right click on table cell
 *
 * @param row the row number
 * @param column the column number
 * @throws VerificationException if the table element doesn't exist
 */
@PublicAtsApi
public void rightClickCell(int row, int column) {
    new SwingElementState(this).waitToBecomeExisting();
    JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
    try {
        tableFixture.cell(new TableCell(row, column) {
        }).rightClick();
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerifyNotEqualityException(com.axway.ats.uiengine.exceptions.VerifyNotEqualityException) VerifyEqualityException(com.axway.ats.uiengine.exceptions.VerifyEqualityException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) NotSupportedOperationException(com.axway.ats.uiengine.exceptions.NotSupportedOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 13 with VerificationException

use of com.axway.ats.uiengine.exceptions.VerificationException in project ats-framework by Axway.

the class SwingTable method selectCell.

/**
 * Select table cell
 *
 * @param row the row number
 * @param column the column number
 * @throws VerificationException if the table element doesn't exist
 */
@PublicAtsApi
public void selectCell(int row, int column) {
    new SwingElementState(this).waitToBecomeExisting();
    JTableFixture tableFixture = (JTableFixture) SwingElementLocator.findFixture(this);
    try {
        tableFixture.selectCell(new TableCell(row, column) {
        });
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : JTableFixture(org.fest.swing.fixture.JTableFixture) TableCell(org.fest.swing.data.TableCell) SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerifyNotEqualityException(com.axway.ats.uiengine.exceptions.VerifyNotEqualityException) VerifyEqualityException(com.axway.ats.uiengine.exceptions.VerifyEqualityException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) NotSupportedOperationException(com.axway.ats.uiengine.exceptions.NotSupportedOperationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 14 with VerificationException

use of com.axway.ats.uiengine.exceptions.VerificationException in project ats-framework by Axway.

the class SwingTabbedPane method selectTabUsingSubElement.

/**
 * Select tab by title using SubElement described in the map file. The required property is 'title'
 *
 * @param mapId the sub-element mapID. This element must have property 'title'
 * @throws VerificationException if the table element doesn't exist
 */
@PublicAtsApi
public void selectTabUsingSubElement(String mapId) {
    new SwingElementState(this).waitToBecomeExisting();
    try {
        String elementMapId = properties.getInternalProperty(UiElementProperties.MAP_ID_INTERNAL_PARAM);
        if (elementMapId == null) {
            throw new UiElementException("The element must be in the MAP file", this);
        }
        UiElementProperties elProperties = ElementsMap.getInstance().getSubElementProperties(elementMapId, mapId);
        String tabTitle = elProperties.getProperty("title");
        if (tabTitle == null) {
            throw new UiElementException("The Sub-Element doesn't have 'title' attribute, " + "which is required for tab selection.", this);
        }
        ((JTabbedPaneFixture) SwingElementLocator.findFixture(this)).selectTab(tabTitle);
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementProperties(com.axway.ats.uiengine.elements.UiElementProperties) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 15 with VerificationException

use of com.axway.ats.uiengine.exceptions.VerificationException in project ats-framework by Axway.

the class SwingTabbedPane method selectTabUsingSubElement.

/**
 * Select tab by title using sub-element properties. The required property is 'title'
 *
 * @param elementProperties the sub-element {@link UiElementProperties} which contains property 'title'
 * @throws VerificationException if the table element doesn't exist
 */
@PublicAtsApi
public void selectTabUsingSubElement(UiElementProperties elementProperties) {
    new SwingElementState(this).waitToBecomeExisting();
    try {
        String tabTitle = elementProperties.getProperty("title");
        if (tabTitle == null) {
            throw new UiElementException("The Sub-Element doesn't have 'title' attribute, " + "which is required for tab selection.", this);
        }
        ((JTabbedPaneFixture) SwingElementLocator.findFixture(this)).selectTab(tabTitle);
    } catch (Exception e) {
        throw new UiElementException(e.getMessage(), this);
    }
}
Also used : SwingElementState(com.axway.ats.uiengine.utilities.swing.SwingElementState) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) JTabbedPaneFixture(org.fest.swing.fixture.JTabbedPaneFixture) UiElementException(com.axway.ats.uiengine.exceptions.UiElementException) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)18 PublicAtsApi (com.axway.ats.common.PublicAtsApi)17 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)12 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)12 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)10 VerifyEqualityException (com.axway.ats.uiengine.exceptions.VerifyEqualityException)10 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)10 JTableFixture (org.fest.swing.fixture.JTableFixture)10 TableCell (org.fest.swing.data.TableCell)6 Page (com.gargoylesoftware.htmlunit.Page)4 ConfirmHandler (com.gargoylesoftware.htmlunit.ConfirmHandler)2 JTabbedPaneFixture (org.fest.swing.fixture.JTabbedPaneFixture)2 JTableHeaderFixture (org.fest.swing.fixture.JTableHeaderFixture)2 UiElementProperties (com.axway.ats.uiengine.elements.UiElementProperties)1 RealHtmlAlert (com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlAlert)1 RealHtmlConfirm (com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlConfirm)1 RealHtmlPrompt (com.axway.ats.uiengine.elements.html.realbrowser.RealHtmlPrompt)1 MobileOperationException (com.axway.ats.uiengine.exceptions.MobileOperationException)1 ExpectedAlert (com.axway.ats.uiengine.internal.realbrowser.ExpectedAlert)1 ExpectedConfirm (com.axway.ats.uiengine.internal.realbrowser.ExpectedConfirm)1