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

Skip to content
Snippets Groups Projects
Commit 384b800c authored by Catalin Comanici's avatar Catalin Comanici
Browse files

minor fixes

parent 797ec038
No related branches found
No related tags found
No related merge requests found
......@@ -14,38 +14,36 @@ import java.util.List;
public class GenericSelect extends PageComponent {
@FindBy(className = "mat-select-arrow")
WebElement expandoButton;
@FindBy(css = "div.mat-select-value span")
WebElement currentValueElement;
private WebElement container;
private By optionSelector = By.tagName("mat-option");
public GenericSelect(WebDriver driver, WebElement container) {
super(driver);
log.info("select init");
this.container = container;
PageFactory.initElements(new DefaultElementLocatorFactory(container), this);
}
private WebElement container;
@FindBy(className = "mat-select-arrow")
WebElement expandoButton;
@FindBy(css = "div.mat-select-value span")
WebElement currentValueElement;
private By optionSelector = By.tagName("mat-option");
private void expandSelect(){
private void expandSelect() {
log.info("expand select");
waitForElementToBeClickable(expandoButton).click();
waitForElementToBeClickable(expandoButton);
waitForXMillis(500);
expandoButton.click();
}
private List<WebElement> getOptions(){
private List<WebElement> getOptions() {
expandSelect();
log.info("getting options");
return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(optionSelector));
}
public List<String> getOptionTexts(){
public List<String> getOptionTexts() {
log.info("get displayed option texts");
List<WebElement> options = getOptions();
List<String> optionTexts = new ArrayList<>();
......@@ -56,13 +54,13 @@ public class GenericSelect extends PageComponent {
return optionTexts;
}
public boolean selectOptionWithText(String text){
public boolean selectOptionWithText(String text) {
log.info("selecting option with text" + text);
List<WebElement> options = getOptions();
for (WebElement option : options) {
if(option.getText().trim().equalsIgnoreCase(text)){
if (option.getText().trim().equalsIgnoreCase(text)) {
waitForElementToBeClickable(option).click();
waitForElementToBeGone(option);
log.info("return type is True");
......@@ -73,7 +71,7 @@ public class GenericSelect extends PageComponent {
return false;
}
public boolean selectFirstOption(){
public boolean selectFirstOption() {
log.info("selecting first option");
List<WebElement> options = getOptions();
......@@ -82,7 +80,8 @@ public class GenericSelect extends PageComponent {
waitForElementToBeGone(option);
return true;
}
public boolean selectWithIndex(int index){
public boolean selectWithIndex(int index) {
log.info("selecting the required option");
List<WebElement> options = getOptions();
......@@ -93,7 +92,6 @@ public class GenericSelect extends PageComponent {
}
public String getSelectedValue() {
log.info("getting current selected value");
return currentValueElement.getText().trim();
......@@ -107,20 +105,22 @@ public class GenericSelect extends PageComponent {
List<WebElement> options = wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(optionSelector));
for (WebElement option : options) {
String optionDomain = option.getText().trim();
if(optionDomain.equalsIgnoreCase(text)){
if (optionDomain.equalsIgnoreCase(text)) {
option.click();
waitForElementToBeGone(option);
return true;
}
}
log.info(text + " option not found, could not select it (2)" );
log.info(text + " option not found, could not select it (2)");
return false;
}
public boolean isLoaded() {
log.info("assert loaded state");
waitForElementToBeVisible(expandoButton);
if(!expandoButton.isDisplayed()){ return false;}
if (!expandoButton.isDisplayed()) {
return false;
}
return currentValueElement.isDisplayed();
}
}
......@@ -56,6 +56,7 @@ public class DomainPopup extends PageComponent {
public void clickOK() {
waitForElementToBeClickable(okBtn).click();
waitForXMillis(500);
waitForElementToBeGone(okBtn);
}
......
......@@ -160,12 +160,6 @@ public class LoginPgTest extends BaseTest {
soft.assertAll();
}
// This will serve as a reminder to check this message manually
@Test(description = "LGN-50")
public void SMPNotRunningTest() {
throw new SkipException("This test will be executed manually !!!");
}
@Test(description = "LGN-60")
public void loginButtonDisableVerification() {
SoftAssert soft = new SoftAssert();
......
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