Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 4407fb75 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Merge branch 'development' of...

Merge branch 'development' of https://ec.europa.eu/digital-building-blocks/code/scm/edelivery/smp into EDELIVERY-12010-smp-automation-related-improvements

# Conflicts:
#	domiSMP-ui-tests/src/main/java/utils/TestRunData.java
parents 45515817 dfd0e958
Branches EDELIVERY-12010-smp-automation-related-improvements
No related tags found
No related merge requests found
Pipeline #97287 failed
Showing
with 180 additions and 62 deletions
......@@ -234,4 +234,5 @@
</dependency>
</dependencies>
</project>
......@@ -4,7 +4,7 @@ import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class StorePage extends PageWithGrid {
public class CommonCertificatePage extends CommonPageWithGrid {
/**
* Common page used for Keystore and Truststore
*/
......@@ -29,7 +29,7 @@ public class StorePage extends PageWithGrid {
@FindBy(css = ".smp-warning-panel span")
private WebElement smpWarningLbl;
public StorePage(WebDriver driver) {
public CommonCertificatePage(WebDriver driver) {
super(driver);
}
......
package ddsl;
import ddsl.dcomponents.Grid.GridPagination;
import ddsl.dcomponents.Grid.SmallGrid;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
......@@ -12,8 +11,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
public class PageWithGrid extends DomiSMPPage {
private final static Logger LOG = LoggerFactory.getLogger(PageWithGrid.class);
public class CommonPageWithGrid extends DomiSMPPage {
private final static Logger LOG = LoggerFactory.getLogger(CommonPageWithGrid.class);
/**
* Generic page used for pages which have small grid in the right of the page. This element gives access to action buttons and elements of the page.
......@@ -23,26 +22,24 @@ public class PageWithGrid extends DomiSMPPage {
public WebElement filterInput;
@FindBy(css = "data-panel >div >div> mat-toolbar button:first-of-type")
public WebElement addBtn;
@FindBy(css = "data-panel")
@FindBy(css = "[class=smp-column-data]")
public WebElement dataPanel;
@FindBy(css = "[class~=smp-column-label]")
public WebElement rightPanel;
@FindBy(css = "[role = \"tab\"]")
private List<WebElement> tabList;
public PageWithGrid(WebDriver driver) {
public CommonPageWithGrid(WebDriver driver) {
super(driver);
PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getWaitTimeShort()), this);
}
public SmallGrid getGrid() {
return new SmallGrid(driver, dataPanel);
}
public GridPagination getPagination() {
return new GridPagination(driver, dataPanel);
return new SmallGrid(driver, rightPanel);
}
public SmallGrid getDataPanelGrid() {
return new SmallGrid(driver, dataPanel);
return new SmallGrid(driver, rightPanel);
}
public void goToTab(String tabName) {
......
......@@ -9,6 +9,7 @@ import ddsl.dobjects.DButton;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
......@@ -56,8 +57,13 @@ public class DomiSMPPage extends DComponent {
public void logout() {
wait.waitforOverlayToGone();
rightMenuBtn.click();
logoutMenuBtn.click();
// TODO investigate why sometimes the button is not in view
// Driver Issue: is not clickable at point (105, 356). Other element would receive the click:
Actions actions = new Actions(driver);
actions.moveToElement(logoutMenuBtn);
actions.perform();
logoutMenuBtn.click();
}
public void refreshPage() {
......
......@@ -39,7 +39,7 @@ public class GridPagination extends DComponent {
public void goToNextPage() {
try {
if (weToDButton(parentElement.findElement(nextPageBtnLocator)).isPresent()) {
if (weToDButton(parentElement.findElement(nextPageBtnLocator)).isEnabled()) {
weToDButton(parentElement.findElement(nextPageBtnLocator)).click();
LOG.debug("Click on Grid Next Page button");
......
package ddsl.dcomponents;
import ddsl.DomiSMPPage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
......@@ -35,18 +36,24 @@ public class SetChangePasswordDialog extends DComponent {
PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getWaitTimeShort()), this);
}
public List<WebElement> setNewPassword(String currentPassword, String newPassword) throws Exception {
public void fillChangePassword(String currentPassword, String newPassword) throws Exception {
LOG.info("Set new password");
weToDInput(currentPasswordInput).fill(currentPassword);
weToDInput(newPasswordInput).fill(newPassword, true);
weToDInput(confirmationPasswordInput).fill(newPassword, true);
wait.forElementToBeClickable(setPasswordBtn);
weToDButton(setPasswordBtn).click();
SuccesfullPasswordChangedPopup popup = new SuccesfullPasswordChangedPopup(driver);
popup.closePopup();
}
return fieldsError;
public DomiSMPPage TryClickOnChangePassword() throws Exception {
wait.forElementToBeClickable(setPasswordBtn);
if (weToDButton(setPasswordBtn).isEnabled() && fieldsError.isEmpty()) {
weToDButton(setPasswordBtn).click();
SuccesfullPasswordChangedPopup popup = new SuccesfullPasswordChangedPopup(driver);
popup.closePopup();
return new DomiSMPPage(driver);
} else {
return null;
}
}
public List<String> getFieldErrorMessage() {
......
......@@ -5,12 +5,13 @@ import ddsl.enums.Pages;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pages.administration.EditDomainsPage;
import pages.administration.editDomainsPage.EditDomainsPage;
import pages.systemSettings.TruststorePage;
import pages.systemSettings.UsersPage;
import pages.systemSettings.domainsPage.DomainsPage;
......@@ -106,6 +107,11 @@ public class SideNavigationComponent extends DomiSMPPage {
public <T> T navigateTo(Pages page) {
LOG.debug("Get link to " + page.name());
// DomiSMP behaviour. Button is not expanded if already focused and not expanded - issue when re-login
// with this we make sure the starting point from Search
openSubmenu(resourcesExpandLnk, null);
// case SEARCH_RESOURCES:
// expandSection(resourcesExpandLnk);s
// return new DLink(driver, resourcesLnk);
......@@ -181,8 +187,16 @@ public class SideNavigationComponent extends DomiSMPPage {
private void openSubmenu(WebElement menuBtn, WebElement submenuBtn) {
if (!menuBtn.getAttribute("class").contains("cdk-focused")) {
// Driver Issue: is not clickable at point (105, 356). Other element would receive the click:
Actions actions = new Actions(driver);
actions.moveToElement(menuBtn);
actions.perform();
menuBtn.click();
}
if (submenuBtn == null){
return;
}
submenuBtn.click();
if (submenuBtn.getText().contains(getBreadcrump().getCurrentPage())) {
LOG.info("Current page is " + getBreadcrump().getCurrentPage());
......
......@@ -15,7 +15,7 @@ public class UserDataCommonComponent extends DomiSMPPage {
*/
private final static Logger LOG = LoggerFactory.getLogger(UserDataCommonComponent.class);
@FindBy(id = "changePassword_id")
public WebElement setChangePasswordBtn;
private WebElement setChangePasswordBtn;
@FindBy(id = "smpTheme_id")
private WebElement themeSel;
@FindBy(id = "smpLocale_id")
......@@ -52,18 +52,17 @@ public class UserDataCommonComponent extends DomiSMPPage {
}
public String getLastSetValue() {
return lastSetLbl.getText();
return lastSetLbl.getAttribute("value");
}
public String getPasswordExpiresOnValue() {
return passwordExpiresOnLbl.getText();
return passwordExpiresOnLbl.getAttribute("value");
}
public SetChangePasswordDialog getChangePasswordDialog() {
public SetChangePasswordDialog clickOnChangePassword() throws InterruptedException {
setChangePasswordBtn.click();
return new SetChangePasswordDialog(driver);
}
public String fillUserProfileData(String emailValue, String fullNameValue, String selectThemeValue, String localeValue) {
try {
if (!emailValue.isEmpty()) {
......@@ -93,10 +92,4 @@ public class UserDataCommonComponent extends DomiSMPPage {
return null;
}
}
public void ChangePassword(String currentPasssword, String newPassword) throws Exception {
SetChangePasswordDialog dialog = new SetChangePasswordDialog(driver);
dialog.setNewPassword(currentPasssword, newPassword);
}
}
package ddsl.dcomponents.commonComponents.subcategoryTab;
import ddsl.dcomponents.DComponent;
import ddsl.dcomponents.Grid.SmallGrid;
import org.apache.poi.ss.formula.functions.T;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SubcategoryTabComponent extends DComponent {
private final static Logger LOG = LoggerFactory.getLogger(SubcategoryTabComponent.class);
@FindBy(id = "createButton")
private WebElement createBtn;
@FindBy(id = "editButton")
private WebElement editBtn;
@FindBy(id = "groupMembersButton")
private WebElement resourceMembersBtn;
@FindBy(id = "deleteButton")
private WebElement deleteBtn;
@FindBy(css = "div smp-column-data")
private WebElement sidePanel;
public SubcategoryTabComponent(WebDriver driver) {
super(driver);
}
public SmallGrid getGrid() {
return new SmallGrid(driver, sidePanel);
}
public DComponent create() throws Exception {
weToDButton(createBtn).click();
return new DComponent(driver);
}
public T edit(String columnName, String value) throws Exception {
WebElement tobeEdited = getGrid().searchAndGetElementInColumn(columnName, value);
tobeEdited.click();
wait.forElementToBeEnabled(editBtn);
weToDButton(editBtn).click();
return new T();
}
}
package pages.administration;
import ddsl.PageWithGrid;
import org.openqa.selenium.WebDriver;
public class EditDomainsPage extends PageWithGrid {
public EditDomainsPage(WebDriver driver) {
super(driver);
}
}
package pages.administration.editDomainsPage;
import ddsl.dcomponents.DComponent;
import org.openqa.selenium.WebDriver;
public class CreateGroupDetailsDialog extends DComponent {
public CreateGroupDetailsDialog(WebDriver driver) {
super(driver);
}
}
package pages.administration.editDomainsPage;
import ddsl.dcomponents.commonComponents.members.MembersComponent;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
public class DomainMembersTab extends MembersComponent {
public DomainMembersTab(WebDriver driver) {
super(driver);
PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getWaitTimeShort()), this);
}
}
package pages.administration.editDomainsPage;
import ddsl.CommonPageWithGrid;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EditDomainsPage extends CommonPageWithGrid {
/**
* Page object for the Edit domains page. This contains the locators of the page and the methods for the behaviour of the page
*/
private final static Logger LOG = LoggerFactory.getLogger(EditDomainsPage.class);
public EditDomainsPage(WebDriver driver) {
super(driver);
LOG.debug("Loading Edit domains page.");
}
public DomainMembersTab getDomainMembersTab() {
return new DomainMembersTab(driver);
}
}
package pages.administration.editDomainsPage;
import ddsl.dcomponents.commonComponents.subcategoryTab.SubcategoryTabComponent;
import org.openqa.selenium.WebDriver;
public class GroupTab extends SubcategoryTabComponent {
public GroupTab(WebDriver driver) {
super(driver);
}
@Override
public CreateGroupDetailsDialog create() {
return new CreateGroupDetailsDialog(driver);
}
}
package pages.systemSettings;
import ddsl.StorePage;
import ddsl.CommonCertificatePage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
......@@ -8,7 +8,7 @@ import org.openqa.selenium.support.FindBy;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TruststorePage extends StorePage {
public class TruststorePage extends CommonCertificatePage {
/**
* Page object for the Truststorepage. This contains the locators of the page and the methods for the behaviour of the page
*/
......
package pages.systemSettings;
import ddsl.PageWithGrid;
import ddsl.CommonPageWithGrid;
import ddsl.dcomponents.commonComponents.UserDataCommonComponent;
import ddsl.dobjects.DButton;
import org.openqa.selenium.WebDriver;
......@@ -10,7 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rest.models.UserModel;
public class UsersPage extends PageWithGrid {
public class UsersPage extends CommonPageWithGrid {
/**
* Page object for the Users page. This contains the locators of the page and the methods for the behaviour of the page
*/
......
......@@ -42,7 +42,6 @@ public class DomainTab extends DComponent {
}
public void fillDomainData(DomainModel domainModel) {
domainIdInput.sendKeys(domainModel.getDomainCode());
weToDSelect(responseSignatureCertificateDdl).selectByVisibleText(domainModel.getSignatureKeyAlias(), true);
weToDSelect(visibilityOfDomainDdl).selectValue(domainModel.getVisibility());
......@@ -52,13 +51,14 @@ public class DomainTab extends DComponent {
if (saveBtn.isEnabled()) {
saveBtn.click();
wait.forElementToBeDisabled(saveBtn);
if (saveBtn.getAttribute("disabled").equals("true")) {
try {
saveBtn.getAttribute("disabled").equals("true");
LOG.debug("Domain tab changes were succesfully saved");
} else {
LOG.error("Domain tab changes were not saved");
} catch (NullPointerException e) {
LOG.debug("Domain tab changes were not saved");
}
} else {
LOG.error("Save domain button is disabled");
}
}
......
package pages.systemSettings.domainsPage;
import ddsl.PageWithGrid;
import ddsl.CommonPageWithGrid;
import ddsl.dobjects.DButton;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
......@@ -8,7 +8,7 @@ import org.openqa.selenium.support.FindBy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DomainsPage extends PageWithGrid {
public class DomainsPage extends CommonPageWithGrid {
/**
* Page object for the Users page. This contains the locators of the page and the methods for the behaviour of the page
*/
......
package pages.systemSettings.keyStorePage;
import ddsl.StorePage;
import ddsl.CommonCertificatePage;
import org.openqa.selenium.WebDriver;
public class KeystorePage extends StorePage {
public class KeystorePage extends CommonCertificatePage {
public KeystorePage(WebDriver driver) {
super(driver);
......
package pages.userSettings;
import ddsl.PageWithGrid;
import ddsl.DomiSMPPage;
import ddsl.dcomponents.commonComponents.UserDataCommonComponent;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ProfilePage extends PageWithGrid {
public class ProfilePage extends DomiSMPPage {
/**
* Page object for the Profile page. This contains the locators of the page and the methods for the behaviour of the page
*/
private final static Logger LOG = LoggerFactory.getLogger(ProfilePage.class);
public UserDataCommonComponent userData;
public UserDataCommonComponent profileData;
public ProfilePage(WebDriver driver) {
super(driver);
userData = new UserDataCommonComponent(driver);
profileData = new UserDataCommonComponent(driver);
LOG.debug("Profile page has loaded");
}
}
\ No newline at end of file
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