Fixes login flow in Microsoft social login test

Closes #22657
This commit is contained in:
wojnarfilip 2023-08-09 12:24:46 +02:00 committed by Alexander Schwartz
parent 217a09ce46
commit 5603ee7b46

View file

@ -35,6 +35,9 @@ public class MicrosoftLoginPage extends AbstractSocialLoginPage {
@FindBy(id = "idSIButton9")
private WebElement submitButton;
@FindBy(xpath = "//input[contains(@class,'btn-primary')]")
private WebElement appAccessButton;
@Override
public void login(String user, String password) {
WaitUtils.pause(5000); // we need to take it a bit slower
@ -50,5 +53,23 @@ public class MicrosoftLoginPage extends AbstractSocialLoginPage {
catch (NoSuchElementException e) {
log.info("Already logged in to Microsoft IdP, no need to enter password");
}
// While logging into the app for the first time user is asked if he wants to stay signed in
try {
WaitUtils.pause(3000);
submitButton.click();
}
catch (NoSuchElementException e) {
log.info("User already allowed in the app");
}
// The app requires user consent for access to their information
try {
WaitUtils.pause(3000);
appAccessButton.click();
}
catch (NoSuchElementException e) {
log.info("App already has access to user information");
}
}
}