Search in sources :

Example 71 with IgnoreBrowsers

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

the class ClassEditorTest method testEmptyCanvasHint.

/**
 * Tests that the hint is displayed only when the canvas is empty.
 */
@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 testEmptyCanvasHint() {
    Assert.assertTrue(editor.getContent().contains(EMPTY_CANVAS_HINT));
    ClassFieldEditPane field = editor.addField("Short Text");
    Assert.assertFalse(editor.getContent().contains(EMPTY_CANVAS_HINT));
    field.delete().clickYes();
    Assert.assertTrue(editor.getContent().contains(EMPTY_CANVAS_HINT));
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 72 with IgnoreBrowsers

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

the class ClassEditorTest method testSaveAndContinue.

/**
 * Tests the Save & Continue button.
 */
@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 testSaveAndContinue() {
    editor.addField("Date");
    editor.clickSaveAndContinue();
    // Check if the field was added.
    ViewPage viewer = editor.clickCancel();
    Assert.assertTrue(viewer.getContent().contains("Date (date1: Date)"));
    // Edit again. This time check the error message.
    viewer.edit();
    editor = new ApplicationClassEditPage();
    // Try to set the field name to an invalid value.
    ClassFieldEditPane field = new ClassFieldEditPane("date1");
    field.openConfigPanel();
    field.setName("-delta");
    editor.clickSaveAndContinue(false);
    editor.waitForNotificationErrorMessage("Failed to save the page.");
    // Double check that the field wasn't renamed.
    Assert.assertTrue(editor.clickCancel().getContent().contains("Date (date1: Date)"));
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) ViewPage(org.xwiki.test.ui.po.ViewPage) ApplicationClassEditPage(org.xwiki.appwithinminutes.test.po.ApplicationClassEditPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test)

Example 73 with IgnoreBrowsers

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

the class ClassEditorTest method testSwapFieldNames.

/**
 * Tests that swapping field names is 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 testSwapFieldNames() {
    ClassFieldEditPane field = editor.addField("Short Text");
    field.openConfigPanel();
    field.setName("alice");
    field = editor.addField("Number");
    field.openConfigPanel();
    field.setName("bob");
    editor.clickSaveAndView().edit();
    editor = new ApplicationClassEditPage();
    field = new ClassFieldEditPane("alice");
    field.openConfigPanel();
    field.setName("bob");
    field = new ClassFieldEditPane("bob");
    field.openConfigPanel();
    field.setName("alice");
    // Save the page and expect the error.
    editor.getSaveAndViewButton().click();
    waitForPageSourceContains("The class has two fields with the same name: alice");
}
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)

Example 74 with IgnoreBrowsers

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

the class ClassEditorTest method testUpdateSheetAndTemplate.

/**
 * Tests the options to update the class sheet and the class template.
 */
@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 testUpdateSheetAndTemplate() {
    // The options panel is not displayed if the class template and sheet don't exists.
    Assert.assertFalse(editor.getContent().contains("Update class template"));
    // Add a class field.
    editor.addField("Number");
    // Save and edit again.
    editor.clickSaveAndView().edit();
    editor = new ApplicationClassEditPage();
    // Set default value for the previously added field.
    new ClassFieldEditPane("number1").setDefaultValue("9");
    // Add a new field
    editor.addField("Database List");
    // The options panel should be displayed now.
    editor.setUpdateClassSheet(false);
    // Save and edit the template.
    editor.clickSaveAndView();
    new ClassSheetPage().clickTemplateLink().edit();
    // The sheet should display only the first field.
    EntryEditPage inlineEditor = new EntryEditPage();
    List<String> fieldNames = inlineEditor.getFieldNames();
    Assert.assertEquals(1, fieldNames.size());
    Assert.assertEquals("number1", fieldNames.get(0));
    // Assert the value of the first field. The class template should have been updated.
    Assert.assertEquals("9", inlineEditor.getValue("number1"));
}
Also used : EntryEditPage(org.xwiki.appwithinminutes.test.po.EntryEditPage) LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) 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 75 with IgnoreBrowsers

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

the class ClassEditorTest method testRenameWithSaveAndContinue.

/**
 * Test that Save And Continue supports field renames.
 */
@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 testRenameWithSaveAndContinue() {
    ClassFieldEditPane field = editor.addField("Short Text");
    editor.clickSaveAndContinue();
    // Rename the field.
    field.openConfigPanel();
    field.setName("title");
    editor.clickSaveAndContinue();
    // Rename the field for a second time.
    // NOTE: The IDs have been changed so we must recreate the class field edit pane.
    new ClassFieldEditPane("title").setName("city");
    // Save and assert the field was added with the right name.
    Assert.assertTrue(editor.clickSaveAndView().getContent().contains("Short Text (city: String)"));
}
Also used : LongTextClassFieldEditPane(org.xwiki.appwithinminutes.test.po.LongTextClassFieldEditPane) ClassFieldEditPane(org.xwiki.appwithinminutes.test.po.ClassFieldEditPane) 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