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
Select Git revision
  • a9571420c6a38a655a2683ec26cd0de795c89212
  • stable default
  • feat-fchv-bus
  • fix-h2-ice-bus
  • powertrains-multiple-axles
  • amdm3/develop
  • issue-1039
  • amdm3/main
  • test/nuget_publish
  • IEPC-experiments
  • amdm2/main
  • amdm2/develop
  • aptngearbox-not-auto
  • playground
  • official/main
  • official/develop
  • issue-templates
  • pdf-reports
  • HEV-timeruns-dev
  • timerun-empower-hybrids
  • timerun-pwheel-hybrids
  • Release/v5.0.3
  • Release/v5.0.1
  • Release/5.0.0-RC
  • Nuget/v0.11.4-DEV
  • Release/v0.11.4-DEV
  • Release/4.3.4-DEV
  • Release/4.3.3
  • Release/4.3.2-RC
  • Release/v4.3.0-DEV
  • Release/4.2.7
  • XMLConverterTool/4.2.6.0
  • Release/4.2.6-RC
  • Release/v4.2.5
  • Release/v4.2.3
  • Release/v4.2.2.3539-RC
  • Release/v4.2.1.3469
  • Release/v0.11.2.3456-DEV
  • Release/v4.2.0.3448-RC
  • Release/v4.1.3.3415
  • Release/v4.1.1.3413
41 results

MultistageModule.cs

Blame
  • Forked from VECTO / VECTO Sim
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    SetChangePasswordDialog.java 2.05 KiB
    package ddsl.dcomponents;
    
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    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 java.util.ArrayList;
    import java.util.List;
    
    public class SetChangePasswordDialog extends DComponent {
        private final static Logger LOG = LoggerFactory.getLogger(SetChangePasswordDialog.class);
        @FindBy(css = ".smp-field-error")
        List<WebElement> fieldsError;
        @FindBy(id = "cp_id")
        private WebElement currentPasswordInput;
        @SuppressWarnings("SpellCheckingInspection")
        @FindBy(id = "np_id")
        private WebElement newPasswordInput;
        @FindBy(id = "cnp_id")
        private WebElement confirmationPasswordInput;
        @FindBy(id = "cnp_id")
        private WebElement setPasswordBtn;
        @FindBy(id = "cnp_id")
        private WebElement closeBtn;
    
    
        public SetChangePasswordDialog(WebDriver driver) {
            super(driver);
            PageFactory.initElements(new AjaxElementLocatorFactory(driver, data.getTIMEOUT()), this);
        }
    
        public boolean trySetPassword(String currentPassword, String newPassword) throws Exception {
    
            LOG.info("Set new password");
            weToDInput(currentPasswordInput).fill(currentPassword);
            weToDInput(newPasswordInput).fill(newPassword);
            weToDInput(confirmationPasswordInput).fill(newPassword);
            Integer hasError;
            if (weToDButton(setPasswordBtn).isEnabled() && fieldsError.size() < 1) {
                weToDButton(setPasswordBtn).click();
                return true;
            }
            {
                getFieldErrorMessage().forEach(LOG::error);
                return false;
            }
    
        }
    
        public List<String> getFieldErrorMessage() {
            ArrayList<String> fieldErrors = new ArrayList<>();
            if (fieldsError.size() > 0) {
                fieldsError.forEach(error -> {
                    fieldErrors.add(error.getText());
                });
            }
            return fieldErrors;
        }
    }