Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit b03ccdeb authored by Sonali MOHANTY's avatar Sonali MOHANTY
Browse files

Pull request #1: New test added

Merge in EDELIVERY/smp from smp2022 to development

* commit '1d6b661f':
  New test added
parents 410ffab4 1d6b661f
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,9 @@ public class DomainPopup extends PageComponent {
@FindBy(css = "div.mat-form-field-infix > div.ng-star-inserted")
WebElement domainCodeValidationError;
@FindBy(css = "#MetadataTextArea")
private WebElement metadataTextArea;
@FindBy(css = "#smlClientKeyAlias_id")
WebElement smlClientAliasSelectContainer;
GenericSelect smlClientAliasSelect;
......@@ -65,6 +68,7 @@ public class DomainPopup extends PageComponent {
waitForElementToBeGone(cancelBtn);
}
public boolean isLoaded() {
log.info("checking if domain popup is properly loaded");
return isVisible(okBtn)
......@@ -143,7 +147,29 @@ public class DomainPopup extends PageComponent {
}
}
public String domainCode63CharValidationGetErrMsg() {
try {
waitForElementToBeVisible(domainCodeValidationError);
return domainCodeValidationError.getAttribute("value");
} catch (Exception e) {
}
return null;
}
public String getSmlSmpId63CharValidationMsg() {
WebElement invalidSmlSmpIdErrorMsg = driver.findElement(By.cssSelector("div.mat-form-field-infix > div.ng-star-inserted"));
try {
waitForElementToBeVisible(invalidSmlSmpIdErrorMsg);
return invalidSmlSmpIdErrorMsg.getAttribute("value");
} catch (Exception e) {
}
return null;
}
public String xmlFieldVALUE(){
log.info("value is "+metadataTextArea.getAttribute("value"));
return metadataTextArea.getAttribute("value");
}
public void clearAndFillDomainCodeInput(String domainCode) {
log.info("clear and fill domain code data");
clearAndFillInput(domainCodeInput, domainCode);
......
......@@ -28,7 +28,7 @@ public class ServiceMetadataPopup extends PageComponent {
private WebElement clearButton;
@FindBy(css = "mat-card-content > mat-toolbar > mat-toolbar-row > button:nth-child(2)")
private WebElement generateXMLButton;
@FindBy(css = "mat-card-content > mat-toolbar > mat-toolbar-row > button:nth-child(3)")
@FindBy(css = "mat-card-content > mat-toolbar > mat-toolbar-row > button:nth-child(4)")
private WebElement validateButton;
@FindBy(css = "#MetadataTextArea")
......@@ -49,6 +49,9 @@ public class ServiceMetadataPopup extends PageComponent {
@FindBy(xpath = "//span[text() ='Metadata wizard']")
private WebElement metadataWizardBtn;
@FindBy(css = "mat-card-content > div > div.ng-star-inserted:nth-child(2)")
private WebElement xmlValidationMsg;
@FindBy(css = "mat-dialog-content #domain_id")
private WebElement domainSelectContainer;
private GenericSelect domainSelect;
......@@ -73,6 +76,11 @@ public class ServiceMetadataPopup extends PageComponent {
}
public String xmlFieldVALUE(){
log.info("value is "+metadataTextArea.getAttribute("value"));
return metadataTextArea.getAttribute("value");
}
public void fillForm(String domain, String docID, String docScheme) {
waitForElementToBeVisible(documentIdentifierInput);
domainSelect.selectWithIndex(0);
......@@ -83,7 +91,26 @@ public class ServiceMetadataPopup extends PageComponent {
generateXMLButton.click();
}
public String captureTextOfMetadataTextArea(){
return metadataTextArea.getText();
}
public void clickValidateBtn(){
waitForElementToBeClickable(validateButton).click();
}
public void clickGenerateXMLBtn(){
waitForElementToBeClickable(generateXMLButton).click();
}
public void clickClearBtn(){
waitForElementToBeClickable(clearButton).click();
}
public String getXMLValidationMessage(){
return xmlValidationMsg.getText();
}
public void addTextToMetadataTextArea(String generator){
metadataTextArea.sendKeys(generator);
}
public String docIDFieldValue(){
return documentIdentifierInput.getAttribute("value");
......
......@@ -76,4 +76,15 @@ public class SMPMessages {
public static final String SMLSMPID_VALIDATION_MESSAGE = "SML SMP ID should be up to 63 characters long, should only contain alphanumeric and hyphen characters, should not start with a digit nor a hyphen and should not end with a hyphen.";
public static final String USER_EMAIL_VALIDATION_MESSAGE = "Email is invalid!";
public static final String DOMAINCODE_VALIDATION_MESSAGE = "Domain code must contain only chars and numbers and must be less than 63 chars long.";
public static final String VALID_XML_MESSAGE = "Servicemetadata is valid!";
public static final String INVALID_XML_MESSAGE1 = "SAXParseException: XML document structures must start and end within the same entity.";
public static final String INVALID_XML_MESSAGE2 = "SAXParseException: Content is not allowed in prolog.";
public static final String INVALID_XML_MESSAGE3 = "SAXParseException: Content is not allowed in trailing section.";
public static final String INVALID_XML_MESSAGE4 = "SAXParseException: cvc-complex-type.2.3: Element 'ServiceMetadata' cannot have character [children], because the type's content type is element-only.";
public static final String INVALID_XML_MESSAGE5 = "SAXParseException: The end-tag for element type \"ServiceMetadata\" must end with a '>' delimiter.";
public static final String INVALID_XML_MESSAGE6 = "SAXParseException: cvc-complex-type.2.3: Element 'Process' cannot have character [children], because the type's content type is element-only.";
public static final String EMPTY_XML_WARN_MESSAGE = "Service metadata xml must not be empty";
public static final String EMPTY_XML_MESSAGE = "Valid service metadata XML is required!";
public static final String INVALID_XML_MESSAGE7 = "SAXParseException: The markup in the document following the root element must be well-formed.";
}
This diff is collapsed.
......@@ -10,6 +10,7 @@ import pages.service_groups.ServiceGroupGrid;
import pages.service_groups.ServiceGroupRow;
import pages.service_groups.edit.*;
import utils.Generator;
import utils.enums.SMPMessages;
import utils.rest.SMPRestClient;
import java.util.List;
......@@ -166,7 +167,7 @@ public class EditPgTest extends BaseTest {
ServiceGroupPopup popup = new ServiceGroupPopup(driver);
soft.assertTrue(row0.getParticipantIdentifier().equalsIgnoreCase(popup.getParticipantIdentifierValue()), "Popup opened for appropriate service group");
soft.assertTrue(row0.getParticipantIdentifier().equalsIgnoreCase(popup.getParticipantSchemeValue()), "Popup opened for appropriate service group");
soft.assertTrue(row0.getParticipantScheme().equalsIgnoreCase(popup.getParticipantSchemeValue()), "Popup opened for appropriate service group");
soft.assertTrue(popup.isExtensionAreaEditable(), "extension area is editable");
soft.assertTrue(!popup.isParticipantIdentifierInputEnabled(), "Participant Identifier field is disabled");
......@@ -435,6 +436,74 @@ public class EditPgTest extends BaseTest {
soft.assertAll();
}
@Test(description = "EDT-140")
public void serviceMetadataXMLValidationRule(){
SoftAssert soft = new SoftAssert();
EditPage page = new EditPage(driver);
String generator = Generator.randomAlphaNumeric(10);
ServiceGroupGrid grid = page.getGrid();
Integer index = 0;
ServiceGroupRowE row0 = grid.getRowsAs(ServiceGroupRowE.class).get(index);
ServiceMetadataPopup metadataPopup= row0.clickAddMetadata();
metadataPopup.fillForm(generator,generator,generator);
metadataPopup.clickValidateBtn();
soft.assertEquals(metadataPopup.getXMLValidationMessage(), SMPMessages.VALID_XML_MESSAGE,"The message is not in list");
metadataPopup.clickClearBtn();
metadataPopup.clickValidateBtn();
soft.assertEquals(metadataPopup.getXMLValidationMessage(),SMPMessages.EMPTY_XML_WARN_MESSAGE,"The message is not in list");
metadataPopup.clickGenerateXMLBtn();
String xml1 = metadataPopup.captureTextOfMetadataTextArea();
String invalidxml1 = xml1+"xcvjdvxv";
metadataPopup.addTextToMetadataTextArea(invalidxml1);
metadataPopup.clickValidateBtn();
soft.assertEquals(metadataPopup.getXMLValidationMessage(),SMPMessages.INVALID_XML_MESSAGE3,"The message error message is not in list");
metadataPopup.clickClearBtn();
metadataPopup.addTextToMetadataTextArea("xjvnkcfjblcf");
metadataPopup.clickValidateBtn();
soft.assertEquals(metadataPopup.getXMLValidationMessage(),SMPMessages.INVALID_XML_MESSAGE2,"The message error message is not in list");
metadataPopup.clickClearBtn();
soft.assertAll();
}
@Test(description = "EDT-150")
public void verifyServiceMetadataXMLClearBtn(){
SoftAssert soft = new SoftAssert();
EditPage page = new EditPage(driver);
String generator = Generator.randomAlphaNumeric(10);
ServiceGroupGrid grid = page.getGrid();
Integer index = 0;
ServiceGroupRowE row0 = grid.getRowsAs(ServiceGroupRowE.class).get(index);
ServiceMetadataPopup metadataPopup= row0.clickAddMetadata();
metadataPopup.fillForm(generator,generator,generator);
soft.assertNotEquals(metadataPopup.xmlFieldVALUE(),"","The xml field area is empty");
metadataPopup.clickClearBtn();
soft.assertEquals(metadataPopup.xmlFieldVALUE(),"","The clear button did not clear the xml field");
soft.assertAll();
}
@Test(description = "EDT-160")
public void verifyServiceMetadataWizardOkBtn(){
SoftAssert soft = new SoftAssert();
EditPage page = new EditPage(driver);
String generator = Generator.randomAlphaNumeric(10);
ServiceGroupGrid grid = page.getGrid();
int index = 0;
ServiceGroupRowE row0 = grid.getRowsAs(ServiceGroupRowE.class).get(index);
ServiceMetadataPopup metadataPopup= row0.clickAddMetadata();
ServiceMetadataWizardPopup metadataWizard = metadataPopup.clickMetadataWizard();
soft.assertTrue(!metadataPopup.isParticipantIdentifierEnabled(),"participantId field is enabled for an existing service group in service metadata popup");
soft.assertTrue(!metadataPopup.isParticipantSchemeEnabled(),"participantScheme field is enabled for an existing service group in service metadata popup");
soft.assertFalse(metadataWizard.isEnableOkBtn(),"OK button is enable before providing the valid data");
metadataWizard.fillForm(generator,generator,generator,generator,"bdxr-transport-ebms3-as4-v1p0","internal/rest/domain");
metadataWizard.fillCerificateBox(generator);
soft.assertTrue(metadataWizard.isEnableOkBtn(),"OK button is disable after providing the valid data");
soft.assertAll();
}
private int scrollToSG(String pi) {
EditPage page = new EditPage(driver);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment