Search in sources :

Example 1 with LocationDialog

use of org.activityinfo.test.pageobject.web.entry.LocationDialog 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

GxtFormPanel (org.activityinfo.test.pageobject.gxt.GxtFormPanel)1 ApplicationPage (org.activityinfo.test.pageobject.web.ApplicationPage)1 DataEntryTab (org.activityinfo.test.pageobject.web.entry.DataEntryTab)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