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

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

renamed common pages, added soft asserts on UsersPgTests, changed duration to seconds.

parent f1ef2c0d
No related branches found
No related tags found
No related merge requests found
Pipeline #96990 passed with warnings
Showing with 41 additions and 30 deletions
......@@ -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);
}
......
......@@ -11,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.
......@@ -29,7 +29,7 @@ public class PageWithGrid extends DomiSMPPage {
@FindBy(css = "[role = \"tab\"]")
private List<WebElement> tabList;
public PageWithGrid(WebDriver driver) {
public CommonPageWithGrid(WebDriver driver) {
super(driver);
PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getTIMEOUT()), this);
}
......
package pages.administration.editDomainsPage;
import ddsl.PageWithGrid;
import ddsl.CommonPageWithGrid;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EditDomainsPage extends PageWithGrid {
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
*/
......
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
*/
......
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);
......
......@@ -95,7 +95,7 @@ public class TestRunData {
}
public Duration getTIMEOUTinDuration() {
return Duration.ofMinutes(Long.parseLong((prop.getProperty("SHORT_TIMEOUT_SECONDS"))));
return Duration.ofSeconds(Long.parseLong((prop.getProperty("SHORT_TIMEOUT_SECONDS"))));
}
public Integer getLongWait() {
......@@ -103,7 +103,7 @@ public class TestRunData {
}
public Duration getLongWaitInDuration() {
return Duration.ofMinutes(Long.parseLong(prop.getProperty("LONG_TIMEOUT_SECONDS")));
return Duration.ofSeconds(Long.parseLong(prop.getProperty("LONG_TIMEOUT_SECONDS")));
}
......
......@@ -4,18 +4,27 @@ import ddsl.DomiSMPPage;
import ddsl.enums.Pages;
import domiSMPTests.SeleniumTest;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.testng.asserts.SoftAssert;
import pages.LoginPage;
import pages.systemSettings.UsersPage;
import rest.models.UserModel;
public class UsersPgTests extends SeleniumTest {
SoftAssert soft;
DomiSMPPage homePage;
LoginPage loginPage;
@BeforeMethod(alwaysRun = true)
public void beforeTest() throws Exception {
soft = new SoftAssert();
homePage = new DomiSMPPage(driver);
loginPage = homePage.goToLoginPage();
}
@Test(description = "USR-01 System admin is able to create new users")
public void SystemAdminIsAbleToCreateNewUsers() throws Exception {
DomiSMPPage homePage = new DomiSMPPage(driver);
LoginPage loginPage = homePage.goToLoginPage();
loginPage.login(data.getAdminUser().get("username"), data.getAdminUser().get("password"));
UsersPage usersPage = homePage.getSidebar().navigateTo(Pages.SYSTEM_SETTINGS_USERS);
......@@ -26,24 +35,25 @@ public class UsersPgTests extends SeleniumTest {
usersPage.refreshPage();
// usersPage.filter(adminNewUserData.getUsername());
WebElement newUser = usersPage.getDataPanelGrid().searchAndGetElementInColumn("Username", adminNewUserData.getUsername());
Assert.assertNotNull(newUser);
soft.assertNotNull(newUser);
newUser.click();
Assert.assertEquals(usersPage.getApplicationRoleValue(), adminNewUserData.getRole());
Assert.assertEquals(usersPage.getFullNameValue(), adminNewUserData.getFullName());
Assert.assertTrue(usersPage.isSelectedUserActive(), "User active status is true");
soft.assertEquals(usersPage.getApplicationRoleValue(), adminNewUserData.getRole());
soft.assertEquals(usersPage.getFullNameValue(), adminNewUserData.getFullName());
soft.assertTrue(usersPage.isSelectedUserActive(), "User active status is true");
Assert.assertEquals(usersPage.getEmailValue(), adminNewUserData.getEmailAddress());
Assert.assertEquals(usersPage.getSelectedThemeValue(), adminNewUserData.getSmpTheme());
Assert.assertEquals(usersPage.getSelectedLocaleValue(), adminNewUserData.getSmpLocale());
soft.assertEquals(usersPage.getEmailValue(), adminNewUserData.getEmailAddress());
soft.assertEquals(usersPage.getSelectedThemeValue(), adminNewUserData.getSmpTheme());
soft.assertEquals(usersPage.getSelectedLocaleValue(), adminNewUserData.getSmpLocale());
soft.assertAll();
}
@Test(description = "USR-02 USR-02 System admin is not able to create duplicated user")
public void SystemAdminIsNotAbleToCreateDuplicatedUser() throws Exception {
DomiSMPPage homePage = new DomiSMPPage(driver);
LoginPage loginPage = homePage.goToLoginPage();
loginPage.login(data.getAdminUser().get("username"), data.getAdminUser().get("password"));
UsersPage usersPage = homePage.getSidebar().navigateTo(Pages.SYSTEM_SETTINGS_USERS);
......@@ -54,6 +64,7 @@ public class UsersPgTests extends SeleniumTest {
usersPage.refreshPage();
usersPage.getCreateUserBtn().click();
String alertMessage = usersPage.fillNewUserDataAndSave(adminNewUserData);
Assert.assertEquals(alertMessage, "Invalid request [CreateUser]. Error: User with username [" + adminNewUserData.getUsername() + "] already exists!!");
soft.assertEquals(alertMessage, "Invalid request [CreateUser]. Error: User with username [" + adminNewUserData.getUsername() + "] already exists!!");
soft.assertAll();
}
}
\ 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