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

Skip to content
Snippets Groups Projects
Commit f9bc5b4c authored by Mihai BOZ's avatar Mihai BOZ
Browse files

fixed test TRST-01 System admin is able to import certificates ADDED TRST-02...

fixed test TRST-01 System admin is able to import certificates ADDED TRST-02 System admin is able to import duplicated certificates
parent dfd0e958
Branches EDELIVERY-12010-smp-automation-related-improvements
No related tags found
No related merge requests found
Pipeline #97022 passed with warnings
......@@ -34,38 +34,38 @@ public class CommonCertificatePage extends CommonPageWithGrid {
}
public String getPublicKeyTypeLbl() {
return publicKeyTypeLbl.getText();
return publicKeyTypeLbl.getAttribute("value");
}
public String getAliasIdLbl() {
return aliasIdLbl.getText();
return aliasIdLbl.getAttribute("value");
}
public String getSmpCertificateIdLbl() {
return smpCertificateIdLbl.getText();
return smpCertificateIdLbl.getAttribute("value");
}
public String getSubjectNameLbl() {
return subjectNameLbl.getText();
return subjectNameLbl.getAttribute("value");
}
public String getValidFromLbl() {
return validFromLbl.getText();
return validFromLbl.getAttribute("value");
}
public String getValidToLbl() {
return validToLbl.getText();
return validToLbl.getAttribute("value");
}
public String getIssuerLbl() {
return issuerLbl.getText();
return issuerLbl.getAttribute("value");
}
public String getSerialNumberLbl() {
return serialNumberLbl.getText();
return serialNumberLbl.getAttribute("value");
}
public String getCertificateRevolcationListURLlbl() {
return certificateRevolcationListURLlbl.getText();
return certificateRevolcationListURLlbl.getAttribute("value");
}
}
package pages.systemSettings;
import ddsl.CommonCertificatePage;
import ddsl.dcomponents.Grid.SmallGrid;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
......@@ -20,7 +21,9 @@ public class TruststorePage extends CommonCertificatePage {
super(driver);
}
public SmallGrid getCertificateGrid() {
return new SmallGrid(driver, rightPanel);
}
public String addCertificateAndReturnAlias(String filePath) {
uploadInput.sendKeys(filePath);
String certificateAlias = getAlertMessageAndClose();
......
-----BEGIN CERTIFICATE-----
MIIDAzCCAeugAwIBAgIEEQ+g2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enums.Pages;
import domiSMPTests.SeleniumTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
import org.testng.asserts.SoftAssert;
import pages.LoginPage;
......@@ -36,6 +37,7 @@ public class KeystorePgTests extends SeleniumTest {
}
//TODO: wait until the mat-select for certificate type is changed to select
@Ignore
@Test(description = "KEYS-02 System admin is able to import PKCS 12 Keystore")
public void SystemAdminIsAbleToImportPKCS12() throws Exception {
String path = FileUtils.getAbsolutePath("./src/main/resources/keystore/expired_keystore_JKS.jks");
......
......@@ -3,6 +3,7 @@ package domiSMPTests.ui;
import ddsl.DomiSMPPage;
import ddsl.enums.Pages;
import domiSMPTests.SeleniumTest;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import org.testng.asserts.SoftAssert;
import pages.LoginPage;
......@@ -11,7 +12,6 @@ import utils.FileUtils;
public class TrustorePgTests extends SeleniumTest {
//TODO work in progress - wait for input elements to get text
@Test(description = "TRST-01 System admin is able to import certificates")
public void SystemAdminIsAbleToImportCertificates() throws Exception {
......@@ -23,16 +23,50 @@ public class TrustorePgTests extends SeleniumTest {
loginPage.login(data.getAdminUser().get("username"), data.getAdminUser().get("password"));
TruststorePage truststorepage = homePage.getSidebar().navigateTo(Pages.SYSTEM_SETTINGS_TRUSTSTORE);
String path = FileUtils.getAbsolutePath("./src/main/resources/truststore/test.cer");
String path = FileUtils.getAbsolutePath("./src/main/resources/truststore/validCertificate.cer");
String certificateALias = truststorepage.addCertificateAndReturnAlias(path);
soft.assertNotNull(certificateALias);
// soft.assertEquals(truststorepage.getPublicKeyTypeLbl(), "RSA");
// soft.assertEquals(truststorepage.getAliasIdLbl(), "smp_domain_02");
soft.assertEquals(truststorepage.getPublicKeyTypeLbl(), "RSA");
soft.assertEquals(truststorepage.getAliasIdLbl(), certificateALias);
soft.assertEquals(truststorepage.getSmpCertificateIdLbl(), "CN=red_gw,O=eDelivery,C=BE:00000000110fa0d8");
soft.assertEquals(truststorepage.getSubjectNameLbl(), "C=BE,O=eDelivery,CN=red_gw");
soft.assertEquals(truststorepage.getValidFromLbl(), "23-3-2023, 10:49:22");
soft.assertEquals(truststorepage.getValidToLbl(), "22-3-2033, 10:49:22");
soft.assertEquals(truststorepage.getIssuerLbl(), "C=BE,O=eDelivery,CN=red_gw");
soft.assertEquals(truststorepage.getSerialNumberLbl(), "110fa0d8");
soft.assertAll();
}
@Test(description = "TRST-02 System admin is able to import duplicated certificates")
public void SystemAdminIsAbleToImportDuplicatedCertificates() throws Exception {
soft.assertAll();
SoftAssert soft = new SoftAssert();
DomiSMPPage homePage = new DomiSMPPage(driver);
LoginPage loginPage = homePage.goToLoginPage();
loginPage.login(data.getAdminUser().get("username"), data.getAdminUser().get("password"));
TruststorePage truststorepage = homePage.getSidebar().navigateTo(Pages.SYSTEM_SETTINGS_TRUSTSTORE);
String path = FileUtils.getAbsolutePath("./src/main/resources/truststore/validCertificate.cer");
String certificateALias = truststorepage.addCertificateAndReturnAlias(path);
String duplicatedCertificateALias = truststorepage.addCertificateAndReturnAlias(path);
WebElement certificate = truststorepage.getCertificateGrid().searchAndGetElementInColumn("Alias", certificateALias);
soft.assertNotNull(certificate);
truststorepage.getDataPanelGrid().searchAndGetElementInColumn("Alias", duplicatedCertificateALias);
soft.assertNotNull(duplicatedCertificateALias);
soft.assertEquals(truststorepage.getPublicKeyTypeLbl(), "RSA");
soft.assertEquals(truststorepage.getAliasIdLbl(), duplicatedCertificateALias);
soft.assertEquals(truststorepage.getSmpCertificateIdLbl(), "CN=red_gw,O=eDelivery,C=BE:00000000110fa0d8");
soft.assertEquals(truststorepage.getSubjectNameLbl(), "C=BE,O=eDelivery,CN=red_gw");
soft.assertEquals(truststorepage.getValidFromLbl(), "23-3-2023, 10:49:22");
soft.assertEquals(truststorepage.getValidToLbl(), "22-3-2033, 10:49:22");
soft.assertEquals(truststorepage.getIssuerLbl(), "C=BE,O=eDelivery,CN=red_gw");
soft.assertEquals(truststorepage.getSerialNumberLbl(), "110fa0d8");
soft.assertAll();
}
......
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