use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class DateClassFieldTest method testDateFormat.
/**
* Tests that the date picker can parse dates using the specified date format and that the selected date is
* serialized using the specified date format.
*/
@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 testDateFormat() {
// Add a date field and change the date format.
DateClassFieldEditPane dateField = new DateClassFieldEditPane(editor.addField("Date").getName());
dateField.openConfigPanel();
String dateFormat = "yyyy.MM.dd";
dateField.setDateFormat(dateFormat);
// Close the configuration panel to refresh the date field preview.
dateField.closeConfigPanel();
// Select a date using the date picker.
DatePicker datePicker = dateField.openDatePicker();
// The current date format doesn't include time information.
Assert.assertFalse(datePicker.hasHourSelector());
datePicker.setDay("22");
Calendar now = Calendar.getInstance();
now.set(Calendar.DAY_OF_MONTH, 22);
Assert.assertEquals(new SimpleDateFormat(dateFormat).format(now.getTime()), dateField.getDefaultValue());
// Test if the date picker knows how to parse dates with a custom date format.
// Set the value of the date input and assert the date selected by the picker.
dateField.setDefaultValue("2012.11.10");
// Currently the date picker doesn't know how to parse a date with a specified format. The workaround is to pass
// the date time stamp when generating the date input, but for this the page needs to be saved and reloaded.
editor.clickSaveAndView().edit();
datePicker = new DateClassFieldEditPane("date1").openDatePicker();
Assert.assertEquals("2012", datePicker.getYear());
Assert.assertEquals("November", datePicker.getMonth());
Assert.assertEquals("10", datePicker.getDay());
Assert.assertFalse(datePicker.hasHourSelector());
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class LiveTableEditorTest method testManageColumns.
/**
* Adds, removes and reorders live table columns.
*/
@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 testManageColumns() {
editPage.addLiveTableColumn("First Name");
Assert.assertTrue(editPage.hasLiveTableColumn("First Name"));
editPage.moveLiveTableColumnBefore("First Name", "Location");
editPage.removeLiveTableColumn("Page Title");
Assert.assertFalse(editPage.hasLiveTableColumn("Page Title"));
LiveTableElement liveTable = ((ApplicationHomePage) editPage.clickSaveAndView()).getEntriesLiveTable();
liveTable.waitUntilReady();
// The column headers aren't translated because we haven't generated the document translation bundle.
Assert.assertFalse(liveTable.hasColumn("xwikiusers.livetable.doc.title"));
Assert.assertEquals(0, liveTable.getColumnIndex("xwikiusers.livetable.first_name"));
Assert.assertEquals(1, liveTable.getColumnIndex("xwikiusers.livetable.doc.location"));
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class WizardTest method testGoBackToFirstStep.
/**
* @see XWIKI-7380: Cannot go back from step 2 to step 1
*/
@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 testGoBackToFirstStep() {
// Step 1
String appName = "Empty App âé";
appCreatePage.setApplicationName(appName);
appCreatePage.waitForApplicationNamePreview();
// Step 2
ApplicationClassEditPage classEditPage = appCreatePage.clickNextStep();
classEditPage.addField("Short Text");
// Back to Step 1
appCreatePage = classEditPage.clickPreviousStep();
appCreatePage.setApplicationName(appName);
appCreatePage.waitForApplicationNamePreview();
// Test that the application wasn't created.
Assert.assertFalse(appCreatePage.getContent().contains(ApplicationNameTest.APP_NAME_USED_WARNING_MESSAGE));
// Step 2 again
classEditPage = appCreatePage.clickNextStep();
Assert.assertTrue(classEditPage.getContent().contains(ClassEditorTest.EMPTY_CANVAS_HINT));
classEditPage.addField("Number");
// Step 3 and back to Step 2
classEditPage = classEditPage.clickNextStep().clickPreviousStep();
Assert.assertFalse(classEditPage.getContent().contains(ClassEditorTest.EMPTY_CANVAS_HINT));
Assert.assertFalse(classEditPage.hasPreviousStep());
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class InvitationTest method testAcceptInvitation.
/**
* This test proves that:
* 1. The accept invitation link sent in the email will work.
* 2. A user can accept an invitation and be directed to the registration form and can register and login.
* 3. An invitation once accepted cannot be accepted again nor declined.
* 4. An invitation once accepted can still be reported as spam.
*/
@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 testAcceptInvitation() throws Exception {
TestUtils.Session admin = getUtil().getSession();
try {
startGreenMail();
getSenderPage().send();
getGreenMail().waitForIncomingEmail(10000, 1);
MimeMessage[] messages = getGreenMail().getReceivedMessages();
String htmlMessage = getMessageContent(messages[0]).get("htmlPart");
Assert.assertTrue("New invitation is not listed as pending in the footer.", getSenderPage().getFooter().myPendingInvitations() == 1);
// Now switch to guest.
getUtil().forceGuestUser();
InvitationGuestActionsPage guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.ACCEPT);
Assert.assertTrue("There was an error message when accepting the invitation message:\n" + guestPage.getMessage(), guestPage.getMessage().equals(""));
// Register a new user.
RegistrationPage rp = new RegistrationPage();
rp.fillRegisterForm(null, null, "InvitedMember", "WeakPassword", "WeakPassword", null);
rp.clickRegister();
Assert.assertTrue("There were failure messages when registering.", rp.getValidationFailureMessages().isEmpty());
getDriver().get(getUtil().getURLToLoginAs("InvitedMember", "WeakPassword"));
Assert.assertTrue("Failed to log user in after registering from invitation.", rp.isAuthenticated());
// Now switch to guest again and try to accept the invitation again.
getUtil().forceGuestUser();
guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.ACCEPT);
Assert.assertTrue("After the invitation was accepted a user was allowed to accept it again.", guestPage.getMessage().equals("This invitation has already been accepted and the " + "offer is no longer valid."));
// Try to decline the invitation.
guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.DECLINE);
Assert.assertTrue("After the invitation was accepted a user was allowed to decline it.", guestPage.getMessage().equals("This invitation has already been accepted and " + "now cannot be declined."));
// Prove that the message can still be reported as spam
guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.REPORT);
Assert.assertTrue("After the invitation was accepted it now cannot be reported as spam.", guestPage.getMessage().equals(""));
} finally {
stopGreenMail();
getUtil().setSession(admin);
}
}
use of org.xwiki.test.ui.browser.IgnoreBrowsers in project xwiki-platform by xwiki.
the class InvitationTest method testDeclineInvitation.
/**
* This test proves that:
* 1. A guest can decline an invitation.
* 2. The message status changes and the footer reflects this.
* 3. The sender can see the info box seeing the guest's reason for declining.
* 4. The message history table shows the decline properly.
* 5. A guest cannot accept a message which has already been declined.
*/
@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 testDeclineInvitation() throws Exception {
TestUtils.Session admin = getUtil().getSession();
try {
startGreenMail();
getSenderPage().send();
getGreenMail().waitForIncomingEmail(10000, 1);
MimeMessage[] messages = getGreenMail().getReceivedMessages();
String htmlMessage = getMessageContent(messages[0]).get("htmlPart");
Assert.assertTrue("New invitation is not listed as pending in the footer.", getSenderPage().getFooter().myPendingInvitations() == 1);
// Now switch to guest.
getUtil().forceGuestUser();
InvitationGuestActionsPage guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.DECLINE);
guestPage.setMemo("I'm not interested thank you.");
guestPage.confirm();
Assert.assertTrue("Failed to decline invitation", getDriver().getPageSource().contains("This invitation has successfully been declined."));
// Switch to admin
getUtil().setSession(admin);
// Go to invitation sender.
setSenderPage(InvitationSenderPage.gotoPage());
Assert.assertTrue("Declined invitation is still listed as pending in the footer.", getSenderPage().getFooter().spamReports() == 0);
// View declined invitation.
InspectInvitationsPage inspectPage = getSenderPage().getFooter().inspectMyInvitations();
InspectInvitationsPage.OneMessage inspect = inspectPage.getMessageWhere("Status", "Declined");
Assert.assertTrue("Not showing message box to say the invitation has been declined", inspect.getStatusAndMemo().equals("Declined with message: I'm not interested thank you."));
// Insure the message history table is correct.
TableElement messageHistoryTable = inspect.clickMessageHistory();
List<WebElement> row2 = messageHistoryTable.getRow(2);
Assert.assertTrue("Message history table not showing correctly.", row2.get(0).getText().equals("Declined"));
Assert.assertTrue("Message history table not showing correctly.", row2.get(2).getText().equals("I'm not interested thank you."));
// Make sure a guest can't accept the invitation now.
getUtil().forceGuestUser();
guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.ACCEPT);
Assert.assertTrue("After a message is declined a user can still accept it!", guestPage.getMessage().equals("This invitation has been declined and cannot be accepted now."));
// Try to decline the invitation.
guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.DECLINE);
Assert.assertTrue("User was allowed to decline an invitation twice.", guestPage.getMessage().equals("This invitation has already been declined and " + "cannot be declined again."));
// Prove that the message can still be reported as spam
guestPage = InvitationGuestActionsPage.gotoPage(htmlMessage, InvitationGuestActionsPage.Action.REPORT);
Assert.assertTrue("After the invitation was declined it now cannot be reported as spam.", guestPage.getMessage().equals(""));
} finally {
stopGreenMail();
getUtil().setSession(admin);
}
}
Aggregations