Search in sources :

Example 1 with DataEntryTab

use of org.activityinfo.test.pageobject.web.entry.DataEntryTab in project activityinfo by bedatadriven.

the class DataEntrySteps method field_contains_image.

@Then("^\"([^\"]*)\" field contains image.$")
public void field_contains_image(String imageFieldName) throws Throwable {
    DataEntryTab dataEntryTab = (DataEntryTab) driver.getCurrentPage();
    dataEntryTab.selectSubmission(0);
    BsModal modal = dataEntryTab.editBetaSubmission();
    // give it a time fetch image serving url and put it to img.src
    Sleep.sleepSeconds(35);
    assertTrue(modal.form().findFieldByLabel(driver.getAliasTable().getAlias(imageFieldName)).isBlobImageLoaded());
    modal.cancel();
}
Also used : DataEntryTab(org.activityinfo.test.pageobject.web.entry.DataEntryTab) Then(cucumber.api.java.en.Then)

Example 2 with DataEntryTab

use of org.activityinfo.test.pageobject.web.entry.DataEntryTab in project activityinfo by bedatadriven.

the class DataEntrySteps method firstDownloadableLinkOfFirstSubmission.

private String firstDownloadableLinkOfFirstSubmission(String attachmentFieldName) {
    DataEntryTab dataEntryTab = (DataEntryTab) driver.getCurrentPage();
    dataEntryTab.selectSubmission(0);
    BsModal modal = dataEntryTab.editBetaSubmission();
    String blobLink = modal.form().findFieldByLabel(driver.getAliasTable().getAlias(attachmentFieldName)).getFirstBlobLink();
    // all links must start from https
    assertTrue(blobLink.startsWith("https"));
    modal.cancel();
    return blobLink;
}
Also used : DataEntryTab(org.activityinfo.test.pageobject.web.entry.DataEntryTab)

Example 3 with DataEntryTab

use of org.activityinfo.test.pageobject.web.entry.DataEntryTab in project activityinfo by bedatadriven.

the class LocationDialogUiTest method frenchCoordinates.

@Test
public void frenchCoordinates() throws Exception {
    LocaleProxy.initialize();
    ThreadLocalLocaleProvider.pushLocale(Locale.forLanguageTag("fr"));
    accounts.setLocale("fr");
    System.out.println(I18N.CONSTANTS.newSite());
    driver.login();
    driver.setup().createDatabase(name(CLUSTER_DATABASE));
    driver.setup().createLocationType(name(VILLAGE), property("database", CLUSTER_DATABASE), property("workflowId", "open"));
    driver.setup().createForm(name(DISTRIBUTION_FORM), property("database", CLUSTER_DATABASE), property("locationType", VILLAGE));
    ApplicationPage applicationPage = driver.getApplicationPage();
    applicationPage.openLocaleMenu().selectLocale("Fran\u00e7ais");
    DataEntryTab dataEntryTab = applicationPage.navigateToDataEntryTab();
    GxtDataEntryDriver dataEntry = (GxtDataEntryDriver) dataEntryTab.navigateToForm(this.driver.getAliasTable().getAlias(DISTRIBUTION_FORM)).newSubmission();
    LocationDialog locationDialog = dataEntry.getLocationDialog();
    locationDialog.locationInput().sendKeys("Mwenu Ditu");
    try {
        locationDialog.addNew();
        locationDialog.dragMarker(5, 5);
    } catch (TimeoutException e) {
        // sometimes test fails because it can't find marker, however tried it manually and it always appears
        // retry one time
        locationDialog.addNew();
        locationDialog.dragMarker(5, 5);
    }
    GxtFormPanel.GxtField latitude = locationDialog.getFormPanel().findFieldByLabel(I18N.CONSTANTS.latitude());
    latitude.assertValid();
}
Also used : GxtDataEntryDriver(org.activityinfo.test.pageobject.web.entry.GxtDataEntryDriver) DataEntryTab(org.activityinfo.test.pageobject.web.entry.DataEntryTab) LocationDialog(org.activityinfo.test.pageobject.web.entry.LocationDialog) ApplicationPage(org.activityinfo.test.pageobject.web.ApplicationPage) GxtFormPanel(org.activityinfo.test.pageobject.gxt.GxtFormPanel) TimeoutException(org.openqa.selenium.TimeoutException) Test(org.junit.Test)

Aggregations

DataEntryTab (org.activityinfo.test.pageobject.web.entry.DataEntryTab)3 Then (cucumber.api.java.en.Then)1 GxtFormPanel (org.activityinfo.test.pageobject.gxt.GxtFormPanel)1 ApplicationPage (org.activityinfo.test.pageobject.web.ApplicationPage)1 GxtDataEntryDriver (org.activityinfo.test.pageobject.web.entry.GxtDataEntryDriver)1 LocationDialog (org.activityinfo.test.pageobject.web.entry.LocationDialog)1 Test (org.junit.Test)1 TimeoutException (org.openqa.selenium.TimeoutException)1