diff --git a/smp-ui-tests/src/main/java/pages/components/GenericSelect.java b/smp-ui-tests/src/main/java/pages/components/GenericSelect.java index 3e27a25548b7f07a7208a1d35c03f22dd5eacd6e..4f19827fe2cea815bb10ccb530b085934c7a5fe7 100644 --- a/smp-ui-tests/src/main/java/pages/components/GenericSelect.java +++ b/smp-ui-tests/src/main/java/pages/components/GenericSelect.java @@ -82,6 +82,16 @@ public class GenericSelect extends PageComponent { waitForElementToBeGone(option); return true; } + public boolean selectWithIndex(int index){ + log.info("selecting first option"); + List<WebElement> options = getOptions(); + + WebElement option = options.get(index); + waitForElementToBeClickable(option).click(); + waitForElementToBeGone(option); + return true; + } + public String getSelectedValue() { diff --git a/smp-ui-tests/src/main/java/pages/domain/DomainPopup.java b/smp-ui-tests/src/main/java/pages/domain/DomainPopup.java index c659df403bd0ccea1159e9ddbce6a7e66fe086d2..6b6e4160adf85c40375fc570691f75b0cd597b26 100644 --- a/smp-ui-tests/src/main/java/pages/domain/DomainPopup.java +++ b/smp-ui-tests/src/main/java/pages/domain/DomainPopup.java @@ -52,6 +52,9 @@ public class DomainPopup extends PageComponent { // @FindBy(css = "#smlClientHeader_id") // WebElement smlClientHeaderInput; + @FindBy(css = "div.mat-form-field-infix > div.ng-star-inserted") + WebElement domainCodeValidationError; + @FindBy(css = "#smlClientKeyAlias_id") WebElement smlClientAliasSelectContainer; GenericSelect smlClientAliasSelect; @@ -102,6 +105,16 @@ public class DomainPopup extends PageComponent { smlClientAliasSelect.selectFirstOption(); } + public String domainCodeValidationGetErrMsg() { + try { + waitForElementToBeVisible(domainCodeValidationError); + return domainCodeValidationError.getText(); + } catch (Exception e) { + } + return null; + } + + public String getDuplicateDomainErrorMsgText() { WebElement duplicateDomainErrorMsg = driver.findElement(By.cssSelector(".mat-form-field-infix > div.ng-star-inserted")); return duplicateDomainErrorMsg.getText(); diff --git a/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataPopup.java b/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataPopup.java index 8e73058c22a534c25ccaee3126d79d434843618e..6b450c0bf1242a09ac3453fd393e6e630f0cffe9 100644 --- a/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataPopup.java +++ b/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataPopup.java @@ -18,10 +18,10 @@ public class ServiceMetadataPopup extends PageComponent { domainSelect = new GenericSelect(driver, domainSelectContainer); } - @FindBy(css = "mat-dialog-actions > div > button:nth-child(1)") + @FindBy(css = "mat-dialog-actions > button:nth-child(1)") private WebElement okButton; - @FindBy(css = "mat-dialog-actions > div > button:nth-child(2)") + @FindBy(css = "mat-dialog-actions > button:nth-child(2)") private WebElement cancelButton; @FindBy(css = "mat-card-content > mat-toolbar > mat-toolbar-row > button:nth-child(1)") @@ -46,22 +46,51 @@ public class ServiceMetadataPopup extends PageComponent { @FindBy(css = "#documentIdentifier_id") private WebElement documentIdentifierInput; + @FindBy(xpath = "//span[text() ='Metadata wizard']") + private WebElement metadataWizardBtn; + @FindBy(css = "mat-dialog-content #domain_id") private WebElement domainSelectContainer; private GenericSelect domainSelect; + public EditPage clickOK(){ + /*waitForElementToBeClickable(okButton); + okButton.click(); + waitForElementToBeGone(okButton); + return new EditPage(driver);*/ + waitForElementToBeVisible(okButton); + okButton.click(); + return new EditPage(driver); + } + public boolean isOKBtnEnabled(){ + return okButton.isEnabled(); + } + public void fillDocIdAndDocIdScheme(String docID, String docScheme){ + waitForElementToBeVisible(documentIdentifierInput); + clearAndFillInput(documentIdentifierInput, docID); + clearAndFillInput(documentSchemeInput, docScheme); + + } + public void fillForm(String domain, String docID, String docScheme) { waitForElementToBeVisible(documentIdentifierInput); - domainSelect.selectOptionWithText(domain); + domainSelect.selectWithIndex(0); clearAndFillInput(documentIdentifierInput, docID); clearAndFillInput(documentSchemeInput, docScheme); generateXMLButton.click(); - waitForElementToBeClickable(okButton).click(); + } + + + public String docIDFieldContain(){ + return documentIdentifierInput.getAttribute("value"); + } + public String docIDSchemeFieldContain(){ + return documentSchemeInput.getAttribute("value"); } public String getParticipantSchemeValue() { @@ -84,6 +113,7 @@ public class ServiceMetadataPopup extends PageComponent { return documentSchemeInput.getAttribute("value").trim(); } + public boolean isParticipantSchemeEnabled() { return isEnabled(participantSchemaInput); } @@ -96,6 +126,13 @@ public class ServiceMetadataPopup extends PageComponent { return isEnabled(documentIdentifierInput); } + public ServiceMetadataWizardPopup clickMetadataWizard(){ + waitForElementToBeClickable(metadataWizardBtn); + metadataWizardBtn.click(); + return new ServiceMetadataWizardPopup(driver); + + } + public boolean isDocumentSchemeEnabled() { return isEnabled(documentSchemeInput); } diff --git a/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataWizardPopup.java b/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataWizardPopup.java new file mode 100644 index 0000000000000000000000000000000000000000..4b97285614de9c46291b7ef32d21f2a7fd9647d0 --- /dev/null +++ b/smp-ui-tests/src/main/java/pages/service_groups/edit/ServiceMetadataWizardPopup.java @@ -0,0 +1,103 @@ +package pages.service_groups.edit; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory; +import pages.components.baseComponents.PageComponent; +import utils.Generator; +import utils.PROPERTIES; + +import java.io.File; + +public class ServiceMetadataWizardPopup extends PageComponent { + public ServiceMetadataWizardPopup(WebDriver driver) { + super(driver); + PageFactory.initElements( new AjaxElementLocatorFactory(driver, PROPERTIES.TIMEOUT), this); + } + @FindBy(css = "#documentIdentifierScheme_id") + private WebElement docIdSchemeField; + + @FindBy(css = "#processSchema_id") + private WebElement processSchemeField; + + @FindBy(css = "service-metadata-wizard-dialog input#documentIdentifier_id") + private WebElement docIdField; + + @FindBy(css = "#processidentifier_id") + private WebElement processIdField; + + @FindBy(css = "#endpointUrl_id") + private WebElement endpointUrl; + + @FindBy(css = "#transportProfiler_id") + private WebElement transportProfileField; + + @FindBy(css = "service-metadata-wizard-dialog > mat-dialog-actions > button[type='button']:nth-child(1)") + private WebElement okButton; + + @FindBy(css = "service-metadata-wizard-dialog > mat-dialog-actions > button[type='button']:nth-child(2)") + private WebElement cancelButton; + + @FindBy(css="input#certificate-file-upload") + private WebElement uploadCertificateBtn; + + + @FindBy(css="#metadatacertificate_id") + private WebElement certificateDescriptionBox; + + + public String docIDFieldContain(){ + return docIdField.getAttribute("value"); + } + + public String docIDSchemeFieldContain(){ + return docIdSchemeField.getAttribute("value"); + } + + public String transportProfileFieldContent(){ + return transportProfileField.getAttribute("value"); + } + + + public void clickUploadCertificate(){ + waitForElementToBeVisible(uploadCertificateBtn); + uploadCertificateBtn.click(); + } + + public void fillCerificateBox(String generator){ + certificateDescriptionBox.sendKeys(generator); + } + + public void uploadCertificate(String relativePath){ + waitForElementToBeVisible(uploadCertificateBtn); + uploadCertificateBtn.click(); + String path = new File(relativePath).getAbsolutePath(); + uploadCertificateBtn.sendKeys(path); + } + + public boolean isEnableOkBtn(){ + waitForElementToBeVisible(okButton); + return okButton.isEnabled(); + } + + public ServiceMetadataPopup clickOK(){ + waitForElementToBeVisible(okButton); + okButton.click(); + return new ServiceMetadataPopup(driver); + } + + public void fillForm(String docID,String docScheme,String processID,String processScheme,String transportProfile,String url){ + waitForElementToBeVisible(docIdField); + + clearAndFillInput(docIdField, docID); + clearAndFillInput(docIdSchemeField, docScheme); + clearAndFillInput(processIdField, processID); + clearAndFillInput(processSchemeField, processScheme); + clearAndFillInput(transportProfileField, transportProfile); + clearAndFillInput(endpointUrl,url); + + + } +} diff --git a/smp-ui-tests/src/main/java/utils/enums/SMPMessages.java b/smp-ui-tests/src/main/java/utils/enums/SMPMessages.java index 17e23c7932c534b82f3f81ca4dd501089c91695e..3aabdc70d5b7f026e9954b52d06e288194ca88a6 100644 --- a/smp-ui-tests/src/main/java/utils/enums/SMPMessages.java +++ b/smp-ui-tests/src/main/java/utils/enums/SMPMessages.java @@ -79,4 +79,5 @@ public class SMPMessages { public static final String KEYSTORE_DELETION_MSG = "Certificate %s deleted!"; 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."; } diff --git a/smp-ui-tests/src/main/resources/certificate/policy-test-ca.cer b/smp-ui-tests/src/main/resources/certificate/policy-test-ca.cer new file mode 100644 index 0000000000000000000000000000000000000000..ad46969e6916ca3ea7930d1724de330923b6a82e --- /dev/null +++ b/smp-ui-tests/src/main/resources/certificate/policy-test-ca.cer @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB8TCCAVqgAwIBAgICJxAwDQYJKoZIhvcNAQELBQAwKjELMAkGA1UEAwwCQ0Ex +DjAMBgNVBAoMBWRpZ2l0MQswCQYDVQQGEwJFVTAeFw0yMjA2MDkwNjM4MDVaFw0z +MjA2MDcwNjM4MDVaMCoxCzAJBgNVBAMMAkNBMQ4wDAYDVQQKDAVkaWdpdDELMAkG +A1UEBhMCRVUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJRxv2YAv8nqGnkw +tP+cDcO8BOy/Lyw0ZoVSIV3onU4lngy4mRLNOYWN+prUk1AVEAL/I0PJdrsiMT+M +3ygTNUerhdx3C/Hft2nhUU2LvJWlEAP7cOAVy3k81v3811NDi8GcZ31qKmm92AI7 +LnKA/AdP7174oF/der5bmPCHVxl/AgMBAAGjJjAkMA8GA1UdEwEB/wQFMAMBAf8w +EQYDVR0gBAowCDAGBgRVHSAAMA0GCSqGSIb3DQEBCwUAA4GBAET1y8rJkMMvqVWm +1eLT7l90evi8U+FLETrlEYgm8/d182HL5IEninuzwK10xVvfMmb8IURWEx5+wJgX +sPMBnX5xxQGy1vSVUnq26Clggo2UUP44z7xIxzCtaTqEKvXZNffM26geiu0QTWin +N0j9vezNtonTzfNRZdIEYe2vkl/C +-----END CERTIFICATE----- diff --git a/smp-ui-tests/src/test/java/ui/DomainPgTest.java b/smp-ui-tests/src/test/java/ui/DomainPgTest.java index b3694d78c5957daf730d3f34cbb48db2c8b7637c..b69c199d8dd6c8092a533aa90669714eea89d188 100644 --- a/smp-ui-tests/src/test/java/ui/DomainPgTest.java +++ b/smp-ui-tests/src/test/java/ui/DomainPgTest.java @@ -482,4 +482,31 @@ public class DomainPgTest extends BaseTest { soft.assertAll(); } + @Test(description = "USR-140") + public void domainVerification() { + SoftAssert soft = new SoftAssert(); + DomainPage page = new DomainPage(driver); + + soft.assertTrue(page.isLoaded(), "Check that the page is loaded"); + ArrayList<String> domainCode = new ArrayList<>(Arrays.asList("sddfgf@", + "123%", + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz12345678901g")); + + DomainPopup popup = page.clickNew(); + soft.assertTrue(popup.isLoaded(), "Domain popup is loaded"); + + soft.assertTrue(popup.isDomainCodeInputEnabled(), "When defining new domain - Domain Code input is disabled"); + soft.assertTrue(popup.isSMLDomainInputEnabled(), "When defining new domain -SML Domain input is disabled"); + + String rndString = Generator.randomAlphaNumeric(10); + + for (String domain : domainCode) { + popup.fillDataForNewDomain(domain, rndString, rndString, rndString); + soft.assertTrue(!popup.isEnableOkButton(),"OK button is active after s4ending invalid domain code"); + soft.assertEquals(popup.domainCodeValidationGetErrMsg(), SMPMessages.DOMAINCODE_VALIDATION_MESSAGE, "Message is not in the list"); + } + + soft.assertAll(); + } + } diff --git a/smp-ui-tests/src/test/java/ui/EditPgTest.java b/smp-ui-tests/src/test/java/ui/EditPgTest.java index 26b22fb492212bd0c241e1347f4fda759c8591e1..9da5dca7d054300fc363a71acfac7b140a161443 100644 --- a/smp-ui-tests/src/test/java/ui/EditPgTest.java +++ b/smp-ui-tests/src/test/java/ui/EditPgTest.java @@ -8,10 +8,7 @@ import pages.components.ConfirmationDialog; import pages.components.baseComponents.SMPPage; import pages.service_groups.ServiceGroupGrid; import pages.service_groups.ServiceGroupRow; -import pages.service_groups.edit.EditPage; -import pages.service_groups.edit.ServiceGroupPopup; -import pages.service_groups.edit.ServiceGroupRowE; -import pages.service_groups.edit.ServiceMetadataPopup; +import pages.service_groups.edit.*; import utils.Generator; import utils.rest.SMPRestClient; @@ -169,6 +166,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(popup.isExtensionAreaEditable(), "extension area is editable"); soft.assertTrue(!popup.isParticipantIdentifierInputEnabled(), "Participant Identifier field is disabled"); @@ -375,6 +373,70 @@ public class EditPgTest extends BaseTest { } + @Test(description = "EDT-110") + public void serviceMetadataDilogVerfication() { + 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(); + 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.assertEquals(metadataPopup.docIDFieldContain(),"","docIDField is not empty"); + soft.assertEquals(metadataPopup.docIDSchemeFieldContain(),"","docIDField is not empty"); + soft.assertTrue(row0.getParticipantIdentifier().equalsIgnoreCase(metadataPopup.getParticipantIdentifierValue()), "ServiceMetadata dialog opened for appropriate service group"); + soft.assertTrue(row0.getParticipantScheme().equalsIgnoreCase(metadataPopup.getParticipantSchemeValue()), "ServiceMetadata dialog opened for appropriate service group"); + metadataPopup.fillForm(generator,generator,generator); + ServiceMetadataWizardPopup metadataWizaedPopup = metadataPopup.clickMetadataWizard(); + metadataWizaedPopup.fillForm(generator,generator,generator,generator,"bdxr-transport-ebms3-as4-v1p0","internal/rest/domain"); + metadataWizaedPopup.fillCerificateBox(generator); + soft.assertTrue(metadataWizaedPopup.isEnableOkBtn(),"ok button is disabled after providing the valid data"); + metadataPopup = metadataWizaedPopup.clickOK(); + soft.assertEquals(metadataPopup.docIDFieldContain(),generator,"After saving the servicemetadata wizard popup with valid data the docID field of service metadata popup doc id contain the coressponding value"); + soft.assertEquals(metadataPopup.docIDSchemeFieldContain(),generator,"After saving the servicemetadata wizard popup with valid data the docIDScheme field of service metadata popup doc id scheme contain the coressponding value"); + soft.assertTrue(metadataPopup.isOKBtnEnabled(),"OK button is not enabled"); + soft.assertAll(); + + } + + @Test(description = "EDT-120") + public void verifyServicemtadataWizardDilogField(){ + 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(); + 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"); + metadataPopup.fillForm(generator,generator,generator); + ServiceMetadataWizardPopup metadataWizard= metadataPopup.clickMetadataWizard(); + soft.assertEquals(metadataWizard.docIDFieldContain(),generator,"document identifier field of metdata wizard popup not contain the corresponding doc id filled in sevice metadata popup"); + soft.assertEquals(metadataWizard.docIDSchemeFieldContain(),generator,"document identifier field of metdata wizard popup not contain the corresponding doc id scheme filled in sevice metadata popup"); + soft.assertAll(); + } + + @Test(description = "EDT-130") + public void verifyTransportProfile(){ + 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(); + 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"); + ServiceMetadataWizardPopup metadataWizard= metadataPopup.clickMetadataWizard(); + soft.assertEquals(metadataWizard.transportProfileFieldContent(),"bdxr-transport-ebms3-as4-v1p0","The transport profile field in service metadata wizard popup not contain the default value"); + + soft.assertAll(); + } + + private int scrollToSG(String pi) { EditPage page = new EditPage(driver); page.pagination.skipToFirstPage();