Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fix for selenium tests #4650

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public static class CoreUiTestConstants
public const string ConsentAcceptId = "idBtn_Accept";
public const string PasswordInput = "password";
public const string AlternativePasswordInput = "Passwd";
public const string NextButton = "nextButton";

// ADFSv2 fields
public const string AdfsV2WebUsernameInputId = "ContentPlaceHolder1_UsernameTextBox";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@ public static IWebDriver CreateDefaultWebDriver()
driver = new EdgeDriver(env, options);
}

driver.Manage().Timeouts().ImplicitWait = ImplicitTimespan;
driver.Manage().Window.Maximize();

try
{
driver.Manage().Timeouts().ImplicitWait = ImplicitTimespan;
driver.Manage().Window.Maximize();
neha-bhargava marked this conversation as resolved.
Show resolved Hide resolved
}
catch (WebDriverException e)
{
Trace.WriteLine("Failed to maximize the window: " + e.Message);
}

return driver;
}

Expand Down Expand Up @@ -181,12 +188,30 @@ public static void PerformLogin(this IWebDriver driver, LabUser user, Prompt pro
UserInformationFieldIds fields = new UserInformationFieldIds(user);

EnterUsername(driver, user, withLoginHint, adfsOnly, fields);
HandleConfirmation(driver);
EnterPassword(driver, user, fields);

HandleConsent(driver, user, fields, prompt);
HandleStaySignedIn(driver);
}

private static void HandleConfirmation(IWebDriver driver)
{
try
{
Trace.WriteLine("Finding next prompt");
var nextBtn = driver.WaitForElementToBeVisibleAndEnabled(
ByIds(CoreUiTestConstants.NextButton),
waitTime: ShortExplicitTimespan,
ignoreFailures: true);
nextBtn?.Click();
}
catch
{
Trace.WriteLine("No accept prompt found accept prompt");
neha-bhargava marked this conversation as resolved.
Show resolved Hide resolved
}
}

private static void HandleStaySignedIn(IWebDriver driver)
{
try
Expand Down
Loading