Search in sources :

Example 6 with BsModal

use of org.activityinfo.test.pageobject.bootstrap.BsModal in project activityinfo by bedatadriven.

the class UiApplicationDriver method assertVisible.

@Override
public void assertVisible(ObjectType objectType, boolean exists, TestObject testObject) {
    ensureLoggedIn();
    String name = testObject.getAlias("name");
    DesignTab designTab = applicationPage.navigateToDesignTab();
    designTab.selectDatabase(testObject.getAlias("database"));
    if (objectType == ObjectType.LOCATION_TYPE || objectType == ObjectType.FORM) {
        Optional<GxtTree.GxtNode> node = designTab.design().getDesignTree().search(name);
        if (exists) {
            assertTrue(objectType.name() + " with name '" + name + "' is not present.", node.isPresent());
        } else {
            assertTrue(objectType.name() + " with name '" + name + "' is present.", !node.isPresent());
        }
    } else if (objectType == ObjectType.PARTNER) {
        GxtGrid grid = designTab.partners().grid();
        String partnerName = testObject.getString("name");
        if (!"Default".equals(partnerName)) {
            partnerName = testObject.getAlias("name");
        }
        grid.findCell(partnerName);
    } else if (objectType == ObjectType.FORM_FIELD) {
        DesignPage designPage = designTab.design();
        designPage.getDesignTree().search(name).get().select();
        designPage.getToolbarMenu().clickButton("Open Table");
        designTab.formInstanceTable().buttonClick("New");
        BsModal dialog = designTab.formInstance();
        BsFormPanel.BsField bsField = (BsFormPanel.BsField) dialog.form().findFieldByLabel(testObject.getString("formFieldName"));
        List<String> items = testObject.getAliasList(testObject.getStringList("items"));
        if (!bsField.itemLabels().containsAll(items)) {
            throw new AssertionError("Not all elements formfield elements are present, expected: " + Joiner.on(",").join(items) + ", actual: " + Joiner.on(",").join(bsField.itemLabels()));
        }
    }
}
Also used : BsModal(org.activityinfo.test.pageobject.bootstrap.BsModal) BsFormPanel(org.activityinfo.test.pageobject.bootstrap.BsFormPanel) GxtGrid(org.activityinfo.test.pageobject.gxt.GxtGrid)

Example 7 with BsModal

use of org.activityinfo.test.pageobject.bootstrap.BsModal in project activityinfo by bedatadriven.

the class DatabaseSetupSteps method new_entry_with_end_date_cannot_be_submitted_in_database.

@Then("^new entry cannot be submitted in \"([^\"]*)\" form$")
public void new_entry_with_end_date_cannot_be_submitted_in_database(String formName, DataTable dataTable) throws Throwable {
    // old form
    driver.assertSubmissionIsNotAllowedBecauseOfLock(formName, TableDataParser.getFirstColumnValue(dataTable, "End Date"));
    // new form
    BsModal modal = driver.openFormTable(alias(currentDatabase), alias(formName)).table().newSubmission();
    modal.fill(dataTable, driver.getAliasTable());
    modal.click(I18N.CONSTANTS.save()).waitUntilNotClosed(5);
}
Also used : BsModal(org.activityinfo.test.pageobject.bootstrap.BsModal) Then(cucumber.api.java.en.Then)

Aggregations

BsModal (org.activityinfo.test.pageobject.bootstrap.BsModal)7 BsFormPanel (org.activityinfo.test.pageobject.bootstrap.BsFormPanel)3 Then (cucumber.api.java.en.Then)1 GxtGrid (org.activityinfo.test.pageobject.gxt.GxtGrid)1