Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

fixed failing tests

updated maven depedencies version
parent 24d5efcf
Branches
Tags
No related merge requests found
Showing
with 139 additions and 75 deletions
...@@ -9,19 +9,24 @@ ...@@ -9,19 +9,24 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>
<commons-csv_version>1.5</commons-csv_version> <commons-csv_version>1.10.0</commons-csv_version>
<selenium-chrome-driver_version>4.10.0</selenium-chrome-driver_version> <selenium-chrome-driver_version>4.11.0</selenium-chrome-driver_version>
<selenium-java_version>4.10.0</selenium-java_version> <selenium-java_version>4.11.0</selenium-java_version>
<poi-ooxml_version>5.2.3</poi-ooxml_version> <poi-ooxml_version>5.2.3</poi-ooxml_version>
<reflections_version>0.10.2</reflections_version> <reflections_version>0.10.2</reflections_version>
<jersey-client_version>1.19.4</jersey-client_version> <jersey-client_version>1.19.4</jersey-client_version>
<jersey-multipart_version>1.19.4</jersey-multipart_version> <jersey-multipart_version>1.19.4</jersey-multipart_version>
<json_version>20230227</json_version> <json_version>20230618</json_version>
<jackson_version>2.15.0-rc3</jackson_version> <jackson_version>2.15.2</jackson_version>
<javax.ws.rs-api_version>2.1.1</javax.ws.rs-api_version> <javax.ws.rs-api_version>2.1.1</javax.ws.rs-api_version>
<javax.ws.rs-api_version>2.1.1</javax.ws.rs-api_version> <javax.ws.rs-api_version>2.1.1</javax.ws.rs-api_version>
<xmlunit_version>1.6</xmlunit_version> <xmlunit_version>1.6</xmlunit_version>
<maven-surefire-plugin_version>3.0.0-M7</maven-surefire-plugin_version> <maven-surefire-plugin_version>3.1.2</maven-surefire-plugin_version>
<testng_version>7.8.0</testng_version>
<logback-classic_version>1.4.11</logback-classic_version>
<extentreports_version>5.1.0</extentreports_version>
<commons-lang3_version>3.13.0</commons-lang3_version>
<commons-io_version>2.13.0</commons-io_version>
</properties> </properties>
...@@ -38,11 +43,11 @@ ...@@ -38,11 +43,11 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version> <version>${maven-surefire-plugin_version}</version>
<configuration> <configuration>
<failIfNoTests>true</failIfNoTests> <failIfNoTests>true</failIfNoTests>
<systemPropertyVariables> <systemPropertyVariables>
<runBrowser>chrome</runBrowser> <runBrowser>firefox</runBrowser>
<propertiesFile>./src/main/resources/myLocal.properties</propertiesFile> <propertiesFile>./src/main/resources/myLocal.properties</propertiesFile>
</systemPropertyVariables> </systemPropertyVariables>
<properties> <properties>
...@@ -103,7 +108,7 @@ ...@@ -103,7 +108,7 @@
<dependency> <dependency>
<groupId>com.aventstack</groupId> <groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId> <artifactId>extentreports</artifactId>
<version>5.0.9</version> <version>${extentreports_version}</version>
</dependency> </dependency>
<!--**************************************--> <!--**************************************-->
...@@ -118,7 +123,7 @@ ...@@ -118,7 +123,7 @@
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>1.2.11</version> <version>${logback-classic_version}</version>
</dependency> </dependency>
<!--**************************************--> <!--**************************************-->
...@@ -138,7 +143,7 @@ ...@@ -138,7 +143,7 @@
<dependency> <dependency>
<groupId>org.testng</groupId> <groupId>org.testng</groupId>
<artifactId>testng</artifactId> <artifactId>testng</artifactId>
<version>7.4.0</version> <version>${testng_version}</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -150,7 +155,7 @@ ...@@ -150,7 +155,7 @@
<dependency> <dependency>
<groupId>org.reflections</groupId> <groupId>org.reflections</groupId>
<artifactId>reflections</artifactId> <artifactId>reflections</artifactId>
<version>0.9.12</version> <version>${reflections_version}</version>
</dependency> </dependency>
...@@ -202,7 +207,7 @@ ...@@ -202,7 +207,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.12.0</version> <version>${commons-lang3_version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-configuration</groupId> <groupId>commons-configuration</groupId>
...@@ -212,13 +217,7 @@ ...@@ -212,13 +217,7 @@
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.11.0</version> <version>${commons-io_version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.32</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/xmlunit/xmlunit --> <!-- https://mvnrepository.com/artifact/xmlunit/xmlunit -->
<dependency> <dependency>
...@@ -226,13 +225,11 @@ ...@@ -226,13 +225,11 @@
<artifactId>xmlunit</artifactId> <artifactId>xmlunit</artifactId>
<version>${xmlunit_version}</version> <version>${xmlunit_version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin_version}</version> <version>${maven-surefire-plugin_version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
...@@ -6,12 +6,12 @@ import ddsl.dcomponents.BreadcrumpComponent; ...@@ -6,12 +6,12 @@ import ddsl.dcomponents.BreadcrumpComponent;
import ddsl.dcomponents.DComponent; import ddsl.dcomponents.DComponent;
import ddsl.dcomponents.SideNavigationComponent; import ddsl.dcomponents.SideNavigationComponent;
import ddsl.dobjects.DButton; import ddsl.dobjects.DButton;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory; import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pages.LoginPage; import pages.LoginPage;
...@@ -37,6 +37,7 @@ public class DomiSMPPage extends DComponent { ...@@ -37,6 +37,7 @@ public class DomiSMPPage extends DComponent {
public DomiSMPPage(WebDriver driver) { public DomiSMPPage(WebDriver driver) {
super(driver); super(driver);
PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getTIMEOUT()), this); PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getTIMEOUT()), this);
waitForPageToLoaded();
} }
public SideNavigationComponent getSidebar() { public SideNavigationComponent getSidebar() {
...@@ -53,6 +54,7 @@ public class DomiSMPPage extends DComponent { ...@@ -53,6 +54,7 @@ public class DomiSMPPage extends DComponent {
} }
public void logout() { public void logout() {
wait.waitforOverlayToGone();
rightMenuBtn.click(); rightMenuBtn.click();
logoutMenuBtn.click(); logoutMenuBtn.click();
...@@ -80,7 +82,8 @@ public class DomiSMPPage extends DComponent { ...@@ -80,7 +82,8 @@ public class DomiSMPPage extends DComponent {
} }
} }
public void waitForPageToLoaded() { public void waitForPageToLoaded() {
wait.defaultWait.until(ExpectedConditions.visibilityOf(getBreadcrump().BreadcrumpItems.get(0))); JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return document.readyState").toString().equals("complete");
} }
} }
...@@ -30,7 +30,8 @@ public class AlertComponent extends DComponent { ...@@ -30,7 +30,8 @@ public class AlertComponent extends DComponent {
public String getAlertMessage() { public String getAlertMessage() {
try { try {
wait.forElementToBeVisible(alertToaster, true); wait.forElementToBeVisible(alertToaster, true);
String alertMesageText = alertToaster.getText().replace("×", "").replaceAll("\n", ""); String alertMesageText = alertToaster.getText();
alertMesageText = alertMesageText.replace("×", "").replaceAll("\n", "");
LOG.debug("Displayed message : {}.", alertToaster.getText()); LOG.debug("Displayed message : {}.", alertToaster.getText());
closeBtn.click(); closeBtn.click();
return alertMesageText; return alertMesageText;
......
...@@ -29,7 +29,6 @@ public class ConfirmationDialog extends DComponent { ...@@ -29,7 +29,6 @@ public class ConfirmationDialog extends DComponent {
LOG.info("dialog .. confirm"); LOG.info("dialog .. confirm");
wait.forElementToBeClickable(yesBtn); wait.forElementToBeClickable(yesBtn);
yesBtn.click(); yesBtn.click();
wait.forElementToBeGone(yesBtn);
} }
public void cancel() { public void cancel() {
......
...@@ -41,7 +41,7 @@ public class GridPagination extends DComponent { ...@@ -41,7 +41,7 @@ public class GridPagination extends DComponent {
try { try {
if (weToDButton(parentElement.findElement(nextPageBtnLocator)).isPresent()) { if (weToDButton(parentElement.findElement(nextPageBtnLocator)).isPresent()) {
weToDButton(parentElement.findElement(nextPageBtnLocator)).click(); weToDButton(parentElement.findElement(nextPageBtnLocator)).click();
LOG.error("Click on Grid Next Page button"); LOG.debug("Click on Grid Next Page button");
} else { } else {
LOG.error("Next page button is not available."); LOG.error("Next page button is not available.");
......
...@@ -60,9 +60,10 @@ public class SmallGrid extends DComponent { ...@@ -60,9 +60,10 @@ public class SmallGrid extends DComponent {
List<WebElement> rows = getRows(); List<WebElement> rows = getRows();
for (WebElement row : rows) { for (WebElement row : rows) {
List<WebElement> cells = getCells(row); List<WebElement> cells = getCells(row);
if (cells.get(columnIndex).getText().equals(value)) { WebElement currentCell = cells.get(columnIndex);
if (currentCell.getText().equals(value)) {
LOG.debug("[{}] found on page [{}]", value, pageNr); LOG.debug("[{}] found on page [{}]", value, pageNr);
return row; return currentCell;
} }
} }
getGridPagination().goToNextPage(); getGridPagination().goToNextPage();
......
...@@ -39,8 +39,9 @@ public class SetChangePasswordDialog extends DComponent { ...@@ -39,8 +39,9 @@ public class SetChangePasswordDialog extends DComponent {
LOG.info("Set new password"); LOG.info("Set new password");
weToDInput(currentPasswordInput).fill(currentPassword); weToDInput(currentPasswordInput).fill(currentPassword);
weToDInput(newPasswordInput).fill(newPassword); weToDInput(newPasswordInput).fill(newPassword, true);
weToDInput(confirmationPasswordInput).fill(newPassword); weToDInput(confirmationPasswordInput).fill(newPassword, true);
wait.forElementToBeClickable(setPasswordBtn);
weToDButton(setPasswordBtn).click(); weToDButton(setPasswordBtn).click();
SuccesfullPasswordChangedPopup popup = new SuccesfullPasswordChangedPopup(driver); SuccesfullPasswordChangedPopup popup = new SuccesfullPasswordChangedPopup(driver);
popup.closePopup(); popup.closePopup();
......
...@@ -93,7 +93,7 @@ public class SideNavigationComponent extends DomiSMPPage { ...@@ -93,7 +93,7 @@ public class SideNavigationComponent extends DomiSMPPage {
public SideNavigationComponent(WebDriver driver) { public SideNavigationComponent(WebDriver driver) {
super(driver); super(driver);
PageFactory.initElements(new AjaxElementLocatorFactory(driver, 1), this); PageFactory.initElements(new AjaxElementLocatorFactory(driver, 1), this);
wait.forElementToBeGone(overlay); waitForPageToLoaded();
} }
private MenuNavigation getNavigationLinks(Pages pages) { private MenuNavigation getNavigationLinks(Pages pages) {
...@@ -189,33 +189,6 @@ public class SideNavigationComponent extends DomiSMPPage { ...@@ -189,33 +189,6 @@ public class SideNavigationComponent extends DomiSMPPage {
throw new RuntimeException(); throw new RuntimeException();
} }
} }
// private void openSubmenu(WebElement menuBtn, WebElement submenuBtn) {
// try {
// submenuBtn.click();
// if (submenuBtn.getText().contains(getBreadcrump().getCurrentPage())) {
// LOG.info("Current page is " + getBreadcrump().getCurrentPage());
//
// } else {
// LOG.error("Current page is not as expected. EXPECTED: [{}] but ACTUAL PAGE [{}]", submenuBtn.getText().toString(), getBreadcrump().getCurrentPage().toString());
// throw new RuntimeException();
// }
//
// } catch (ElementNotInteractableException exception) {
//
// // closeExpirationPopupIfEnabled();
// menuBtn.click();
// submenuBtn.click();
// if (submenuBtn.getText().contains(getBreadcrump().getCurrentPage())) {
// LOG.info("Current page is " + getBreadcrump().getCurrentPage());
//
// } else {
// LOG.error("Current page is not as expected. EXPECTED: " + submenuBtn.getText() + "but ACTUAL PAGE: " + getBreadcrump().getCurrentPage());
// throw new RuntimeException();
// }
// }
// }
public static class MenuNavigation { public static class MenuNavigation {
WebElement menuLink; WebElement menuLink;
WebElement submenuLink; WebElement submenuLink;
......
...@@ -73,7 +73,8 @@ public class UserDataCommonComponent extends DomiSMPPage { ...@@ -73,7 +73,8 @@ public class UserDataCommonComponent extends DomiSMPPage {
weToDInput(fullNameInput).fill(fullNameValue); weToDInput(fullNameInput).fill(fullNameValue);
} }
weToDSelect(themeSel).selectByVisibleText(selectThemeValue); weToDSelect(themeSel).selectByVisibleText(selectThemeValue);
weToDSelect(localeSel).selectByVisibleText(localeValue); wait.forXMillis(50);
weToDSelect(localeSel).selectByVisibleText(localeValue, true);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -16,7 +16,6 @@ public class MembersComponent extends DComponent { ...@@ -16,7 +16,6 @@ public class MembersComponent extends DComponent {
@FindBy(id = "addMemberButton") @FindBy(id = "addMemberButton")
private WebElement inviteMemberBtn; private WebElement inviteMemberBtn;
@FindBy(id = "deleteButton") @FindBy(id = "deleteButton")
private WebElement removeMemberBtn; private WebElement removeMemberBtn;
@FindBy(css = "div domain-member-panel") @FindBy(css = "div domain-member-panel")
...@@ -25,7 +24,6 @@ public class MembersComponent extends DComponent { ...@@ -25,7 +24,6 @@ public class MembersComponent extends DComponent {
public MembersComponent(WebDriver driver) { public MembersComponent(WebDriver driver) {
super(driver); super(driver);
LOG.debug("Members component is loaded"); LOG.debug("Members component is loaded");
//wait.forElementToBeVisible(inviteMemberBtn);
} }
public SmallGrid getMembersGrid() { public SmallGrid getMembersGrid() {
......
...@@ -24,6 +24,30 @@ public class DInput extends DObject { ...@@ -24,6 +24,30 @@ public class DInput extends DObject {
} }
} }
/**
* Method to send values which are bigger which can't be handled by Angular issue
*/
public void fill(String value, Boolean slowSendValues) throws Exception {
if (null == value) {
return;
}
if (isEnabled()) {
element.clear();
if (slowSendValues) {
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
String s = new StringBuilder().append(c).toString();
element.sendKeys(s);
}
} else {
element.sendKeys(value);
}
} else {
throw new ElementNotInteractableException("Cannot type disabled field");
}
}
public void clear() throws Exception { public void clear() throws Exception {
if (isEnabled()) { if (isEnabled()) {
element.clear(); element.clear();
......
package ddsl.dobjects; package ddsl.dobjects;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.Select;
...@@ -19,11 +20,22 @@ public class DSelect extends DObject { ...@@ -19,11 +20,22 @@ public class DSelect extends DObject {
select.selectByVisibleText(value); select.selectByVisibleText(value);
} }
public void selectByVisibleText(String value, boolean forceSelection) {
if (forceSelection) {
select.getWrappedElement().sendKeys(Keys.ENTER);
}
select.selectByVisibleText(value);
}
public void selectValue(String value) { public void selectValue(String value) {
select.selectByValue(value); select.selectByValue(value);
} }
public String getCurrentValue() { public String getCurrentValue() {
try {
return select.getAllSelectedOptions().get(0).getText(); return select.getAllSelectedOptions().get(0).getText();
} catch (IndexOutOfBoundsException e) {
return null;
}
} }
} }
...@@ -71,7 +71,7 @@ public class DWait { ...@@ -71,7 +71,7 @@ public class DWait {
} }
public void forElementToBeDisabled(WebElement element) { public void forElementToBeDisabled(WebElement element) {
int maxTimeout = data.getTIMEOUT() * 1000; int maxTimeout = data.getTIMEOUT() * 100;
int waitedSoFar = 0; int waitedSoFar = 0;
while ((null == element.getAttribute("disabled")) && (waitedSoFar < maxTimeout)) { while ((null == element.getAttribute("disabled")) && (waitedSoFar < maxTimeout)) {
...@@ -141,4 +141,8 @@ public class DWait { ...@@ -141,4 +141,8 @@ public class DWait {
.until(ExpectedConditions.textToBePresentInElement(element, text)); .until(ExpectedConditions.textToBePresentInElement(element, text));
} }
public void waitforOverlayToGone() {
defaultWait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("cdk-overlay-backdrop cdk-overlay-dark-backdrop cdk-overlay-backdrop-showing")));
}
} }
...@@ -44,7 +44,7 @@ public class DomainTab extends DComponent { ...@@ -44,7 +44,7 @@ public class DomainTab extends DComponent {
public void fillDomainData(DomainModel domainModel) { public void fillDomainData(DomainModel domainModel) {
domainIdInput.sendKeys(domainModel.getDomainCode()); domainIdInput.sendKeys(domainModel.getDomainCode());
weToDSelect(responseSignatureCertificateDdl).selectByVisibleText(domainModel.getSignatureKeyAlias()); weToDSelect(responseSignatureCertificateDdl).selectByVisibleText(domainModel.getSignatureKeyAlias(), true);
weToDSelect(visibilityOfDomainDdl).selectValue(domainModel.getVisibility()); weToDSelect(visibilityOfDomainDdl).selectValue(domainModel.getVisibility());
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- pattern definition -->
<property name="encoderPattern"
value="%d{ISO8601} [%X{smp_user}] [%X{smp_session_id}] [%X{smp_request_id}] [%thread] %5p %c{1}:%L - %m%n"
scope="global"/>
<property name="consolePattern"
value="%d{ISO8601} [%X{smp_user}] [%X{smp_session_id}] [%X{smp_request_id}] [%thread] %5p %c{1}:%L - %m%n"
scope="global"/>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.folder:-target}/domismp-test.log</file>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>SECURITY</marker>
<marker>BUSINESS</marker>
</evaluator>
<onMismatch>NEUTRAL</onMismatch>
<onMatch>DENY</onMatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${log.folder:-target}/domismp-test-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- each file should be at most 30MB, keep 60 days worth of history, but at most 20GB -->
<maxFileSize>30MB</maxFileSize>
<maxHistory>60</maxHistory>
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>${encoderPattern}</pattern>
</encoder>
</appender>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<Target>System.out</Target>
<encoder>
<pattern>${consolePattern}</pattern>
</encoder>
</appender>
<logger name="eu.europa.ec.edelivery" level="INFO"/>
<logger name="eu.europa.ec.smp" level="INFO"/>
<logger name="domiSMPTests" level="DEBUG"/>
<logger name="ddsl" level="DEBUG"/>
<logger name="pages" level="DEBUG"/>
<logger name="res" level="DEBUG"/>
<logger name="utils" level="DEBUG"/>
<root level="WARN">
<appender-ref ref="file"/>
<appender-ref ref="stdout"/>
</root>
</configuration>
...@@ -62,7 +62,7 @@ public class DomainsPgTests extends SeleniumTest { ...@@ -62,7 +62,7 @@ public class DomainsPgTests extends SeleniumTest {
domainsPage.getSMLIntegrationTab().registerToSML(); domainsPage.getSMLIntegrationTab().registerToSML();
alert = domainsPage.getAlertMessageAndClose(); alert = domainsPage.getAlertMessageAndClose();
Assert.assertEquals(alert, "Domain: [" + domainModel.getDomainCode() + "] registered to sml!"); Assert.assertEquals(alert, "Domain [" + domainModel.getDomainCode() + "] registered to sml!");
//Go to SML //Go to SML
driver.get(data.getSMLUrl()); driver.get(data.getSMLUrl());
......
...@@ -72,10 +72,10 @@ public class ProfilePgTests extends SeleniumTest { ...@@ -72,10 +72,10 @@ public class ProfilePgTests extends SeleniumTest {
//Verify if data is changed //Verify if data is changed
Assert.assertEquals(profilePage.userData.getEmailAddress(), userNewProfileData.getEmailAddress()); Assert.assertEquals(profilePage.userData.getEmailAddress(), userNewProfileData.getEmailAddress(), "Email value is different");
Assert.assertEquals(profilePage.userData.getFullName(), userNewProfileData.getFullName()); Assert.assertEquals(profilePage.userData.getFullName(), userNewProfileData.getFullName(), "Full name value is different");
Assert.assertEquals(profilePage.userData.getSelectedTheme(), userNewProfileData.getSmpTheme()); Assert.assertEquals(profilePage.userData.getSelectedTheme(), userNewProfileData.getSmpTheme(), "Selected theme value is different");
Assert.assertEquals(profilePage.userData.getSelectedLocale(), userNewProfileData.getSmpLocale()); Assert.assertEquals(profilePage.userData.getSelectedLocale(), userNewProfileData.getSmpLocale(), "Locale value is different");
homePage.logout(); homePage.logout();
...@@ -107,7 +107,8 @@ public class ProfilePgTests extends SeleniumTest { ...@@ -107,7 +107,8 @@ public class ProfilePgTests extends SeleniumTest {
@Test(description = "PROF-03 Password validation is accord to the smp propeties values") @Test(description = "PROF-03 Password validation is accord to the smp propeties values")
public void PasswordValidationsShouldBeAccordingToPropertiesValue() throws Exception { public void PasswordValidationsShouldBeAccordingToPropertiesValue() throws Exception {
String propertyValue = "smp.passwordPolicy.validationRegex"; String propertyValue = "smp.passwordPolicy.validationRegex";
String newPropertyValue = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[~`!@#$%^&+=\\-_<>.,?:;*/()|\\[\\]{}'\"\\\\]).{16,35}$"; String newPropertyValue = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[~`!@#$%^&+=\\-_<>.,?:;*/()|\\[\\]{}'\"\\\\]).{16,40}$";
String new40CharactersPasswordValue = "Edeltest!23456789Edeltest!234567890sssf";
UserModel adminUser = UserModel.generateUserWithADMINrole(); UserModel adminUser = UserModel.generateUserWithADMINrole();
...@@ -120,13 +121,13 @@ public class ProfilePgTests extends SeleniumTest { ...@@ -120,13 +121,13 @@ public class ProfilePgTests extends SeleniumTest {
PropertiesPage propertiesPage = homePage.getSidebar().navigateTo(Pages.SYSTEM_SETTINGS_PROPERTIES); PropertiesPage propertiesPage = homePage.getSidebar().navigateTo(Pages.SYSTEM_SETTINGS_PROPERTIES);
propertiesPage.propertySearch(propertyValue); propertiesPage.propertySearch(propertyValue);
if (!propertiesPage.getPropertyValue(propertyValue).equals(newPropertyValue)) { if (!propertiesPage.getPropertyValue(propertyValue).equals(newPropertyValue)) {
propertiesPage.setPropertyValue("smp.passwordPolicy.validationRegex", "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[~`!@#$%^&+=\\-_<>.,?:;*/()|\\[\\]{}'\"\\\\]).{16,35}$"); propertiesPage.setPropertyValue("smp.passwordPolicy.validationRegex", newPropertyValue);
propertiesPage.save(); propertiesPage.save();
} }
ProfilePage profilePage = propertiesPage.getSidebar().navigateTo(Pages.USER_SETTINGS_PROFILE); ProfilePage profilePage = propertiesPage.getSidebar().navigateTo(Pages.USER_SETTINGS_PROFILE);
profilePage.userData.setChangePasswordBtn.click(); profilePage.userData.setChangePasswordBtn.click();
Assert.assertEquals(0, profilePage.userData.getChangePasswordDialog().setNewPassword(data.getNewPassword(), "Edeltest!23456789Edeltest!234567890").size(), "Could not change the password of the user"); Assert.assertEquals(0, profilePage.userData.getChangePasswordDialog().setNewPassword(data.getNewPassword(), new40CharactersPasswordValue).size(), "Could not change the password of the user");
} }
...@@ -152,8 +153,8 @@ public class ProfilePgTests extends SeleniumTest { ...@@ -152,8 +153,8 @@ public class ProfilePgTests extends SeleniumTest {
loginPage.login(adminUser.getUsername(), newPass); loginPage.login(adminUser.getUsername(), newPass);
profilePage = loginPage.getSidebar().navigateTo(Pages.USER_SETTINGS_PROFILE); profilePage = loginPage.getSidebar().navigateTo(Pages.USER_SETTINGS_PROFILE);
//TODO wait until the lastvalue and old password fields show value as text //TODO wait until the lastvalue and old password fields show value as text
// Assert.assertNotSame(profilePage2.getLastSetValue(), oldLastSet, "Last set value is not reseted"); // Assert.assertNotSame(profilePage.userData.getLastSetValue(), oldLastSet, "Last set value is not reseted");
//Assert.assertNotSame(profilePage2.getPasswordExpiresOnValue(), oldPasswordExpiresOn, "Password expires on value is not reseted"); // Assert.assertNotSame(profilePage.userData.getPasswordExpiresOnValue(), oldPasswordExpiresOn, "Password expires on value is not reseted");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment