public void CleanEnvironment() { var okrListPageObject = new OKRListPageObject(driver); okrListPageObject.UsersComboBox.SelectByText(MANAGER_USERNAME); var approveOKRPageObject = new ApproveOKRPageObject(driver); var lastCreatedOKR = okrListPageObject.OKRsList.Last(); // Last created OKR is placed to the bottom of OKRs list if (lastCreatedOKR.TitleLabel.Text == TESTOKR_NAME) { approveOKRPageObject.SettingsButton.Click(); approveOKRPageObject.SettingsMenu.DeleteMenuItem.Click(); var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(EXPLICIT_WAIT_SECONDS)); wait.Until(ExpectedConditions.AlertIsPresent()); driver.SwitchTo().Alert().Accept(); } else { throw new Exception(TEARDOWN_EXCEPTION_TEXT); } driver.Quit(); }
public void Initialization() { // Configuring Implicit Timeout and navigating to Application driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(IMPLICIT_WAIT_TIMEOUT); driver.Navigate().GoToUrl(APPLICATION_URL); // Pre-condition: Logging in as manager var loginPageObject = new LoginPageObject(driver); SetInputField(loginPageObject.UserEmailTextBox, MANAGER_EMAIL); SetInputField(loginPageObject.UserPasswordTextBox, MANAGER_PASSWORD); loginPageObject.LoginButton.Click(); // Navigating to OKRs list page var sidebarMenuPageObject = new SideBarMenuPageObject(driver); sidebarMenuPageObject.OKRItem.Click(); // Pre-condition: creating temporary OKR for Admin User okrListPageObject = new OKRListPageObject(driver); okrListPageObject.UsersComboBox.SelectByText(MANAGER_USER_NAME); okrListPageObject.NewOKRButton.Click(); var newOKRPageObject = new SetOKRPageObject(driver); testOKRName = TEST_OKR_NAME + new Random().Next(0, 999).ToString(); SetInputField(newOKRPageObject.OKRNameField, testOKRName); SetInputField(newOKRPageObject.ObjectivesList[0].ObjectiveNameField, TEST_OKR_OBJECTIVE_TEXT); newOKRPageObject.ObjectivesList[0].KeyResultsList[0].RemoveKeyResultLink.Click(); // Removing unnecessary Key Result SetInputField(newOKRPageObject.ObjectivesList[0].KeyResultsList[0].KeyResultField, TEST_OKR_KEYRESULT_TEXT); newOKRPageObject.SaveButton.Click(); }
public void BeforeAllMethods() { // General driver configuration driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(IMPLICIT_WAIT_SECONDS); driver.Navigate().GoToUrl(APPLICATION_URL); // Applied Page Objects login = new LoginPageObject(driver); sideBarMenu = new SideBarMenuPageObject(driver); OKRList = new OKRListPageObject(driver); setOKR = new SetOKRPageObject(driver); deleteOKR = new ApproveOKRPageObject(driver); // Login into system login.UserEmailTextBox.Click(); login.UserEmailTextBox.Clear(); login.UserEmailTextBox.SendKeys(email.ToString()); login.UserPasswordTextBox.Click(); login.UserPasswordTextBox.Clear(); login.UserPasswordTextBox.SendKeys(password); login.LoginButton.Click(); // Navigate to OKR Page sideBarMenu.OKRItem.Click(); // Click button "New OKR" OKRList.NewOKRButton.Click(); }
public void SetupEnvironment() { // Configuring timeout and navigating to Application driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(IMPLICIT_WAIT_TIMEOUT); driver.Navigate().GoToUrl(APPLICATION_URL); // Preconditions: login as manager and create OKR var loginObject = new LoginPageObject(driver); loginObject.UserEmailTextBox.SendKeys(MANAGER_EMAIL); loginObject.UserPasswordTextBox.SendKeys(MANAGER_PASSWORD); loginObject.LoginButton.Click(); var sidebarMenu = new SideBarMenuPageObject(driver); sidebarMenu.OKRItem.Click(); var okrListPageObject = new OKRListPageObject(driver); okrListPageObject.UsersComboBox.SelectByText(MANAGER_USERNAME); okrListPageObject.NewOKRButton.Click(); // OKR fillout var newOKRPageObject = new SetOKRPageObject(driver); newOKRPageObject.OKRNameField.SendKeys(TESTOKR_NAME); newOKRPageObject.ObjectivesList[0].ObjectiveNameField.SendKeys(TESTOKR_OBJECTIVENAME); newOKRPageObject.ObjectivesList[0].KeyResultsList[0].KeyResultField.SendKeys(TESTOKR_V2); newOKRPageObject.ObjectivesList[0].KeyResultsList[1].KeyResultField.SendKeys(TESTOKR_V2); newOKRPageObject.SaveButton.Click(); }
public void Initialization() { // Configuring Implicit Timeout and navigating to Application driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(IMPLICIT_WAIT_TIMEOUT); driver.Navigate().GoToUrl(APPLICATION_URL); //Initializing globals approveOKRPageObject = new ApproveOKRPageObject(driver); editOKRPageObject = new SetOKRPageObject(driver); okrListPageObject = new OKRListPageObject(driver); // Pre-condition: Logging in as manager var loginPageObject = new LoginPageObject(driver); loginPageObject.UserEmailTextBox.Clear(); loginPageObject.UserEmailTextBox.SendKeys(MANAGER_EMAIL); loginPageObject.UserPasswordTextBox.Clear(); loginPageObject.UserPasswordTextBox.SendKeys(MANAGER_PASSWORD); loginPageObject.LoginButton.Click(); // Navigating to OKRs list page and selecting Team Lead User var sidebarMenuPageObject = new SideBarMenuPageObject(driver); sidebarMenuPageObject.OKRItem.Click(); }
// Selecting an assigned person private void SelectUser(string assignedPerson, OKRListPageObject okrList) { // Clicking button 'OKR' for (int i = 0; i < RETRYING_ITERATION_COUNT; i++) { try { sideBarMenuPageObject.OKRItem.Click(); if (myTasksPageObject.MyTasksTitleLabel.Displayed) { isNotStaleElement = true; } } catch (Exception) { isNotStaleElement = false; } if (isNotStaleElement && myTasksPageObject.MyTasksTitleLabel.Text == "OKR") { break; } } // To avoid choosing a false person for (int i = 0; i < RETRYING_ITERATION_COUNT; i++) { try { okrList.ActualUserName.Click(); okrList.UserComboBoxInput.SendKeys(assignedPerson + Keys.Enter); if (okrList.ActualUserName.Displayed) { isNotStaleElement = true; } } catch (Exception) { isNotStaleElement = false; } if (isNotStaleElement && okrList.ActualUserName.Text == assignedPerson) { break; } } // To avoid choosing false value (Firefox changes sended value to default value after short time) if (currentBrowser == SelenoidDrivers.FIREFOX) { Thread.Sleep(FIREFOX_SLEEP_WAITER); } }
public void Initialization() { // General driver configuration driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(IMPLICIT_WAIT_SECONDS); driver.Navigate().GoToUrl(APPLICATION_URL); // Assigning of Page Objects login = new LoginPageObject(driver); sideBarMenuPageObject = new SideBarMenuPageObject(driver); myTasksPageObject = new MyTasksPageObject(driver); topPanelPageObject = new TopPanelPageObject(driver); addTaskPageObject = new AddTaskPageObject(driver); deleteTaskPageObject = new DeleteTaskPageObject(driver); okrListForAssignedPerson1 = new OKRListPageObject(driver); okrListForAssignedPerson2 = new OKRListPageObject(driver); approveOKRPageObject = new ApproveOKRPageObject(driver); setOKRPageObject = new SetOKRPageObject(driver); identificationNumber = DateTime.Now.ToString("dd:MM:yyyy/HH:mm"); assigneesList = new List <UserKeyResultsPageObject>(); taskList = new List <TaskPageObject>(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(EXPLICIT_WAIT_SECONDS)); // Login into system login.UserEmailTextBox.Click(); login.UserEmailTextBox.Clear(); login.UserEmailTextBox.SendKeys(MANAGER_EMAIL); login.UserPasswordTextBox.Click(); login.UserPasswordTextBox.Clear(); login.UserPasswordTextBox.SendKeys(MANAGER_PASSWORD); login.LoginButton.Click(); // Assigning unique names to OKRs okrName1 = ASSIGNED_PERSON_1_OKR_NAME + identificationNumber; okrName2 = ASSIGNED_PERSON_2_OKR_NAME + identificationNumber; // Creating OKRs for the assignees CreateOkr(ASSIGNED_PERSON_1, okrName1, ASSIGNED_PERSON_1_OBJECTIVE, ASSIGNED_PERSON_1_KEY_RESULT_1, ASSIGNED_PERSON_1_KEY_RESULT_2, okrListForAssignedPerson1); CreateOkr(ASSIGNED_PERSON_2, okrName2, ASSIGNED_PERSON_2_OBJECTIVE, ASSIGNED_PERSON_2_KEY_RESULT_1, ASSIGNED_PERSON_2_KEY_RESULT_2, okrListForAssignedPerson2); }
// Deleting OKR private void DeleteOkr(string assignedPerson, string okrName, OKRListPageObject okrList) { // Selecting an assigned person SelectUser(assignedPerson, okrList); // Сleaning (removal of the created OKR) if (okrList.OKRsList.Last().TitleLabel.Text == okrName) { // Clicking on 'okrList.OKRsList.Last().TitleLabel' sometimes causes an incorrect result var okrLink = okrList.OKRsList.Last().OKRCardLink.GetAttribute("href"); driver.Navigate().GoToUrl(okrLink); approveOKRPageObject.SettingsButton.Click(); approveOKRPageObject.SettingsMenu.DeleteMenuItem.Click(); wait.Until(ExpectedConditions.AlertIsPresent()); driver.SwitchTo().Alert().Accept(); } }
// Creating OKR private void CreateOkr(string assignedPerson, string okrName, string objectiveName, string keyResultFirst, string keyResultSecond, OKRListPageObject okrList) { SelectUser(assignedPerson, okrList); // Click button "New OKR" okrList.NewOKRButton.Click(); // Adding new OKR setOKRPageObject.OKRNameField.Click(); setOKRPageObject.OKRNameField.Clear(); setOKRPageObject.OKRNameField.SendKeys(okrName); setOKRPageObject.ObjectivesList[0].ObjectiveNameField.Click(); setOKRPageObject.ObjectivesList[0].ObjectiveNameField.Clear(); setOKRPageObject.ObjectivesList[0].ObjectiveNameField.SendKeys(objectiveName); setOKRPageObject.ObjectivesList[0].KeyResultsList[0].KeyResultField.Click(); setOKRPageObject.ObjectivesList[0].KeyResultsList[0].KeyResultField.Clear(); setOKRPageObject.ObjectivesList[0].KeyResultsList[0].KeyResultField.SendKeys(keyResultFirst); setOKRPageObject.ObjectivesList[0].KeyResultsList[1].KeyResultField.Click(); setOKRPageObject.ObjectivesList[0].KeyResultsList[1].KeyResultField.Clear(); setOKRPageObject.ObjectivesList[0].KeyResultsList[1].KeyResultField.SendKeys(keyResultSecond); setOKRPageObject.SaveButton.Click(); }