mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 06:18:12 +00:00
Bug 5239: Added PO for the generic error dialog
This commit is contained in:
1 parent
46753a3b68
commit
d6f720a5e0
2 files changed
+40
-1
No files matched your search
+35
@@ -0,0 +1,35 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.common;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class ErrorDialogPO extends PageArea {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ErrorDialogTitle")
|
||||
private WebElement title;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ErrorDialogCloseButton")
|
||||
private WebElement close;
|
||||
|
||||
public ErrorDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title.getText();
|
||||
}
|
||||
|
||||
public void assertTitleContainsTextAndClose(String titlePart) {
|
||||
final String titleText = getTitle();
|
||||
if (!titleText.contains(titlePart)) {
|
||||
throw new RuntimeException("The expected title '" + titlePart + "' does not math the actual title '"
|
||||
+ titleText + "' in the error box.");
|
||||
}
|
||||
close.click();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sse.gwt.client.Notification.NotificationType;
|
||||
import com.sap.sse.gwt.shared.DebugConstants;
|
||||
|
||||
public class DefaultErrorReporter<S extends StringMessages> implements ErrorReporter {
|
||||
private DialogBox errorDialogBox;
|
||||
@@ -21,7 +22,7 @@ public class DefaultErrorReporter<S extends StringMessages> implements ErrorRepo
|
||||
public DefaultErrorReporter(S stringMessages) {
|
||||
this.stringMessages = stringMessages;
|
||||
/* TODO: Make this more generic (e.g. make it support all kinds of messages) */
|
||||
errorDialogBox = createErrorDialog();
|
||||
errorDialogBox = createErrorDialog();
|
||||
persistentAlertLabel = new Label("");
|
||||
persistentAlertLabel.setStyleName("global-alert-message");
|
||||
}
|
||||
@@ -67,11 +68,14 @@ public class DefaultErrorReporter<S extends StringMessages> implements ErrorRepo
|
||||
private DialogBox createErrorDialog() {
|
||||
// Create the popup dialog box
|
||||
final DialogBox myErrorDialogBox = new DialogBox();
|
||||
myErrorDialogBox.getElement().setAttribute(DebugConstants.DEBUG_ID_ATTRIBUTE, "ErrorDialog");
|
||||
myErrorDialogBox.setText(stringMessages.remoteProcedureCall());
|
||||
myErrorDialogBox.getCaption().asWidget().getElement().setAttribute(DebugConstants.DEBUG_ID_ATTRIBUTE, "ErrorDialogTitle");
|
||||
myErrorDialogBox.setAnimationEnabled(true);
|
||||
dialogCloseButton = new Button(stringMessages.close());
|
||||
// We can set the id of a widget by accessing its Element
|
||||
dialogCloseButton.getElement().setId("closeButton"); //$NON-NLS-1$
|
||||
dialogCloseButton.getElement().setAttribute(DebugConstants.DEBUG_ID_ATTRIBUTE, "ErrorDialogCloseButton"); //$NON-NLS-1$
|
||||
final Label textToServerLabel = new Label();
|
||||
serverResponseLabel = new HTML();
|
||||
VerticalPanel dialogVPanel = new VerticalPanel();
|
||||
|
||||
Reference in new issue
Block a user