fixed Selenium tests after modifying where error dialog shows which part of the messages

This commit is contained in:
Axel Uhl
2022-02-21 12:28:08 +01:00
parent 2fed9c0a6b
commit 0a9dec7bae
4 changed files with 20 additions and 3 deletions
@@ -40,7 +40,7 @@
-->
<system-property>
<name>webdriver.chrome.driver</name>
<value>C:\apps\ChromeSeleniumDriver\chromedriver.exe</value>
<value>/usr/bin/chromedriver</value>
<!-- value>~/Documents/chromedriver/chromedriver</value-->
</system-property>
<!--
@@ -12,6 +12,9 @@ public class ErrorDialogPO extends PageArea {
@FindBy(how = BySeleniumId.class, using = "ErrorDialogTitle")
private WebElement title;
@FindBy(how = BySeleniumId.class, using = "ErrorDialogServerResponse")
private WebElement serverResponse;
@FindBy(how = BySeleniumId.class, using = "ErrorDialogCloseButton")
private WebElement close;
@@ -22,14 +25,27 @@ public class ErrorDialogPO extends PageArea {
public String getTitle() {
return title.getText();
}
public String getServerResponse() {
return serverResponse.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 '"
throw new RuntimeException("The expected title '" + titlePart + "' does not match the actual title '"
+ titleText + "' in the error box.");
}
close.click();
}
public void assertServerResponseContainsTextAndClose(String serverResponsePart) {
final String serverResponseText = getServerResponse();
if (!serverResponseText.contains(serverResponsePart)) {
throw new RuntimeException("The expected server response '" + serverResponsePart + "' does not match the actual server response '"
+ serverResponseText + "' in the error box.");
}
close.click();
}
}
@@ -45,6 +45,6 @@ public class RoleDefinitionCreationAndUpdateDialogPO extends DataEntryDialogPO {
public void clickOkButtonAndExpectPermissionError() {
clickOkButtonOrThrow();
waitForPO(ErrorDialogPO::new, "ErrorDialog", 10).assertTitleContainsTextAndClose("Not permitted");
waitForPO(ErrorDialogPO::new, "ErrorDialog", 10).assertServerResponseContainsTextAndClose("Not permitted");
}
}
@@ -87,6 +87,7 @@ public class DefaultErrorReporter<S extends StringMessages> implements ErrorRepo
dialogCloseButton.getElement().setAttribute(DebugConstants.DEBUG_ID_ATTRIBUTE, "ErrorDialogCloseButton"); //$NON-NLS-1$
final Label textToServerLabel = new Label();
serverResponseLabel = new HTML();
serverResponseLabel.getElement().setAttribute(DebugConstants.DEBUG_ID_ATTRIBUTE, "ErrorDialogServerResponse");
VerticalPanel dialogVPanel = new VerticalPanel();
if (showCommunicationErrorText) {
dialogVPanel.add(new HTML("<b>" + stringMessages.errorCommunicatingWithServer() + "</b>")); //$NON-NLS-1$