Search in sources :

Example 1 with ApplicationPage

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

the class SyncSmokeTest method initialSync.

@Test
public void initialSync() {
    ApplicationPage applicationPage = context.login();
    applicationPage.openSettingsMenu().enableOfflineMode();
    applicationPage.assertOfflineModeLoads(15, TimeUnit.MINUTES);
}
Also used : ApplicationPage(org.activityinfo.test.pageobject.web.ApplicationPage) Test(org.junit.Test)

Example 2 with ApplicationPage

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

the class TargetsUiTest method statefulTree.

@Test
public void statefulTree() throws Exception {
    background();
    ApplicationPage app = driver.getApplicationPage();
    TargetsPage targets = app.navigateToDesignTab().selectDatabase(driver.alias(DATABASE)).targets();
    targets.select("Target1");
    // expand tree only one time for Target1, then it should be stateful and keep it expanded
    targets.expandTree("nb. kits");
    targets.valueGrid().findCell("1000");
    targets.select("Target2");
    targets.valueGrid().findCell("2000");
    // back to Target1 without expand, tree must be already expanded
    targets.select("Target1");
    targets.valueGrid().findCell("1000");
}
Also used : TargetsPage(org.activityinfo.test.pageobject.web.design.TargetsPage) ApplicationPage(org.activityinfo.test.pageobject.web.ApplicationPage) Test(org.junit.Test)

Example 3 with ApplicationPage

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

the class UserSortingUiTest method test.

@Test
public void test() throws Exception {
    String database = "My db";
    driver.login();
    driver.setup().createDatabase(property("name", database));
    String[] partners = new String[] { "ARC", "NRC", "RI" };
    for (String partner : partners) {
        driver.setup().addPartner(partner, database);
    }
    for (int i = 0; i < 300; ++i) {
        String name = ('A' + (i % 26)) + " Jones";
        String user = String.format("user%d@example.com", i);
        driver.setup().grantPermission(property("name", name), property("partner", partners[i % partners.length]), property("database", database), property("user", user), property("permissions", "View"));
    }
    ApplicationPage app = driver.getApplicationPage();
    GxtGrid userGrid = app.navigateToDesignTab().selectDatabase(driver.alias(database)).users().grid();
    userGrid.waitUntilAtLeastOneRowIsLoaded();
    // Verify that partners are sorted over the three several pages
    // and not just within the current page
    userGrid.sortBy("partner");
    assertThat(userGrid.columnValues("partner"), everyItem(equalTo(driver.alias("ARC"))));
}
Also used : ApplicationPage(org.activityinfo.test.pageobject.web.ApplicationPage) GxtGrid(org.activityinfo.test.pageobject.gxt.GxtGrid) Test(org.junit.Test)

Example 4 with ApplicationPage

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

the class FormDesignUiTest method addingFields.

@Test
public void addingFields() throws Exception {
    driver.login();
    driver.setup().createDatabase(name(DATABASE));
    driver.setup().createForm(name("Form"), property("database", DATABASE), property("classicView", false));
    ApplicationPage applicationPage = driver.getApplicationPage();
    FormDesignerPage designer = applicationPage.navigateToFormDesigner(aliasTable.getAlias(DATABASE), aliasTable.getAlias("Form"));
    List<String> types = designer.fields().getFieldTypes();
    if (types.isEmpty()) {
        throw new AssertionError("Could not find any field types");
    }
    for (String type : types) {
        designer.fields().dropNewField(type);
        designer.save();
    }
    designer.fields().dropNewField(I18N.CONSTANTS.fieldTypeCalculated());
}
Also used : ApplicationPage(org.activityinfo.test.pageobject.web.ApplicationPage) FormDesignerPage(org.activityinfo.test.pageobject.web.design.designer.FormDesignerPage) Test(org.junit.Test)

Example 5 with ApplicationPage

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

ApplicationPage (org.activityinfo.test.pageobject.web.ApplicationPage)5 Test (org.junit.Test)5 GxtFormPanel (org.activityinfo.test.pageobject.gxt.GxtFormPanel)1 GxtGrid (org.activityinfo.test.pageobject.gxt.GxtGrid)1 TargetsPage (org.activityinfo.test.pageobject.web.design.TargetsPage)1 FormDesignerPage (org.activityinfo.test.pageobject.web.design.designer.FormDesignerPage)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 TimeoutException (org.openqa.selenium.TimeoutException)1