Search in sources :

Example 66 with IgnoreBrowsers

use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.

the class ApplicationNameTest method testExistingAppName.

/**
 * Try to input the name of an existing application.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testExistingAppName() {
    ApplicationCreatePage appCreatePage = ApplicationCreatePage.gotoPage();
    Assert.assertFalse(appCreatePage.getContent().contains(APP_NAME_USED_WARNING_MESSAGE));
    // Type the name of an existing space.
    appCreatePage.setApplicationName("Help");
    appCreatePage.waitForApplicationNamePreview();
    Assert.assertTrue(appCreatePage.getContent().contains(APP_NAME_USED_WARNING_MESSAGE));
    // Proceed to the next step.
    Assert.assertEquals("/Help/Code/Help Structure", appCreatePage.clickNextStep().getBreadcrumbContent());
}
Also used : ApplicationCreatePage(org.xwiki.appwithinminutes.test.po.ApplicationCreatePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) AbstractTest(org.xwiki.test.ui.AbstractTest) Test(org.junit.Test)

Example 67 with IgnoreBrowsers

use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.

the class AppsLiveTableTest method testDeleteApplication.

/**
 * Creates an application and deletes it using the Actions column from the applications live table.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testDeleteApplication() {
    // Create the application.
    String appName = RandomStringUtils.randomAlphabetic(6);
    createApplication(appName);
    // Check the the applications live table lists the created application.
    ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    Assert.assertTrue(appsLiveTable.hasColumn("Actions"));
    appsLiveTable.filterApplicationName(appName.substring(0, 3));
    Assert.assertTrue(appsLiveTable.isApplicationListed(appName));
    // Click the delete icon then cancel the confirmation.
    appsLiveTable.clickDeleteApplication(appName).clickNo();
    // We should be taken back to the AppWithinMinutes home page.
    homePage = new AppWithinMinutesHomePage();
    appsLiveTable = homePage.getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    // The application name filter should've been preserved.
    Assert.assertEquals(appName.substring(0, 3), appsLiveTable.getApplicationNameFilter());
    // Click the delete icon again and this confirm the action.
    appsLiveTable.clickDeleteApplication(appName).clickYes();
    // We should be taken back to the AppWithinMinutes home page.
    homePage = new AppWithinMinutesHomePage();
    appsLiveTable = homePage.getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    // The application name filter should've been preserved.
    Assert.assertEquals(appName.substring(0, 3), appsLiveTable.getApplicationNameFilter());
    // And the deleted application shouldn't be listed anymore.
    Assert.assertFalse(appsLiveTable.isApplicationListed(appName));
}
Also used : AppWithinMinutesHomePage(org.xwiki.appwithinminutes.test.po.AppWithinMinutesHomePage) ApplicationsLiveTableElement(org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 68 with IgnoreBrowsers

use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.

the class AppsLiveTableTest method testEditApplication.

/**
 * Creates an application and edits it using the Actions column from the applications live table.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testEditApplication() {
    // Create the application.
    String appName = RandomStringUtils.randomAlphabetic(6);
    createApplication(appName);
    // Edit the application.
    ApplicationsLiveTableElement appsLiveTable = homePage.getAppsLiveTable();
    appsLiveTable.waitUntilReady();
    ApplicationClassEditPage classEditor = appsLiveTable.clickEditApplication(appName);
    // Edit the existing class field.
    ClassFieldEditPane fieldEditPane = new ClassFieldEditPane("shortText1");
    fieldEditPane.setPrettyName("City Name");
    fieldEditPane.openConfigPanel();
    fieldEditPane.setName("cityName");
    // Move to the next step.
    ApplicationHomeEditPage homeEditPage = classEditor.clickNextStep().clickNextStep();
    homeEditPage.setDescription("demo");
    // Finish editing.
    ApplicationHomePage homePage = homeEditPage.clickFinish();
    Assert.assertTrue(homePage.getContent().contains("demo"));
}
Also used : ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) ApplicationHomeEditPage(org.xwiki.appwithinminutes.test.po.ApplicationHomeEditPage) ApplicationsLiveTableElement(org.xwiki.appwithinminutes.test.po.ApplicationsLiveTableElement) ApplicationHomePage(org.xwiki.appwithinminutes.test.po.ApplicationHomePage) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 69 with IgnoreBrowsers

use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.

the class ClassEditorTest method testDeleteField.

/**
 * Tests that class fields can be deleted and that documents having objects of that class are updated.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testDeleteField() {
    // Add two fields.
    editor.addField("Boolean").setPrettyName("Available");
    editor.addField("Date").setPrettyName("Day");
    // Save and assert they are present.
    ViewPage classView = editor.clickSaveAndView();
    Assert.assertTrue(classView.getContent().contains("Available (boolean1: Boolean)"));
    Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));
    // Edit again and delete one of the fields.
    classView.edit();
    new ClassFieldEditPane("boolean1").delete().clickYes();
    // Save and check if the field was removed.
    classView = new ApplicationClassEditPage().clickSaveAndView();
    Assert.assertFalse(classView.getContent().contains("Available (boolean1: Boolean)"));
    Assert.assertTrue(classView.getContent().contains("Day (date1: Date)"));
    // Edit the class template and see if the deleted field is now deprecated.
    ObjectEditPage objectEditor = new ClassSheetPage().clickTemplateLink().editObjects();
    String className = String.format("%s.%s", getTestClassName(), getTestMethodName());
    Assert.assertTrue(objectEditor.isPropertyDeprecated(className, "boolean1"));
    Assert.assertFalse(objectEditor.isPropertyDeprecated(className, "date1"));
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) ObjectEditPage(org.xwiki.test.ui.po.editor.ObjectEditPage) ViewPage(org.xwiki.test.ui.po.ViewPage) ClassSheetPage(org.xwiki.xclass.test.po.ClassSheetPage) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 70 with IgnoreBrowsers

use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.

the class ClassEditorTest method testInvalidFieldName.

/**
 * Tests that invalid field names are not allowed.
 */
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testInvalidFieldName() {
    String invalidFieldNameErrorMessage = "Property names must follow these naming rules:";
    ClassFieldEditPane field = editor.addField("Static List");
    field.openConfigPanel();
    field.setName("3times");
    // Save the page and expect the error.
    editor.getSaveAndViewButton().click();
    waitForPageSourceContains(invalidFieldNameErrorMessage);
    getDriver().navigate().back();
    editor = new ApplicationClassEditPage();
    field = editor.addField("User");
    field.openConfigPanel();
    // Unfortunately we don't allow Unicode letters because they are not fully supported in tag names.
    // See XWIKI-7306: The class editor doesn't validate properly the field names
    field.setName("\u021Bar\u0103");
    // Save the page and expect the error.
    editor.getSaveAndViewButton().click();
    waitForPageSourceContains(invalidFieldNameErrorMessage);
    getDriver().navigate().back();
    editor = new ApplicationClassEditPage();
    field = editor.addField("Group");
    field.openConfigPanel();
    field.setName("alice>bob");
    // Save the page and expect the error.
    editor.getSaveAndViewButton().click();
    waitForPageSourceContains(invalidFieldNameErrorMessage);
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Aggregations

IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)80 Test (org.junit.Test)76 AbstractTest (org.xwiki.test.ui.AbstractTest)43 ViewPage (org.xwiki.test.ui.po.ViewPage)26 ClassFieldEditPane (org.xwiki.appwithinminutes.test.po.ClassFieldEditPane)12 LongTextClassFieldEditPane (org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane)11 ApplicationClassEditPage (org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage)10 WikiEditPage (org.xwiki.test.ui.po.editor.WikiEditPage)9 MimeMessage (javax.mail.internet.MimeMessage)7 TestUtils (org.xwiki.test.ui.TestUtils)6 HistoryPane (org.xwiki.test.ui.po.HistoryPane)6 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)6 LoginPage (org.xwiki.test.ui.po.LoginPage)6 PreferencesUserProfilePage (org.xwiki.user.test.po.PreferencesUserProfilePage)6 ApplicationHomePage (org.xwiki.appwithinminutes.test.po.ApplicationHomePage)5 EntryEditPage (org.xwiki.appwithinminutes.test.po.EntryEditPage)5 InvitationGuestActionsPage (org.xwiki.invitation.test.po.InvitationGuestActionsPage)5 ChangePasswordPage (org.xwiki.user.test.po.ChangePasswordPage)5 URL (java.net.URL)4 WebElement (org.openqa.selenium.WebElement)4