public void LogOutPatientExecute() { try { MainWindow main = new MainWindow(); main.Show(); patientWindow.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void FrontDeskID_Test() { SetupApp(); Window mainWindow = application.GetWindow("Login Window"); string Username = "******"; TextBox loginBox = mainWindow.Get <TextBox>(SearchCriteria.ByAutomationId("LoginBox")); loginBox.Text = Username; ComboBox cb_Roles = mainWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("RoleCombobox")); cb_Roles.Select("Front Desk"); Button loginBtn = mainWindow.Get <Button>(SearchCriteria.ByText("OK")); loginBtn.Click(); mainWindow = application.GetWindow("FrontDeskView"); Label WelcomeText = mainWindow.Get <Label>(SearchCriteria.ByAutomationId("WelcomeText")); Assert.AreEqual(Username, WelcomeText.Text); Console.Write("Logged in with username " + Username); var Grid = mainWindow.Get <ListView>(SearchCriteria.ByAutomationId("PatientSchedulingGrid")); Window PatientWindow; int index = 3; foreach (var row in Grid.Rows) { var DetailsButton = mainWindow.Get <Button>(SearchCriteria.Indexed(index++)); DetailsButton.Click(); PatientWindow = application.GetWindow("PatientScheduling"); TextBox name = PatientWindow.Get <TextBox>(SearchCriteria.ByAutomationId("PatientName")); Assert.AreEqual(name.Text, row.Cells["PatientName"].Text); PatientWindow.Close(); } Tab tabControl = mainWindow.Get <Tab>(SearchCriteria.ByClassName("TabControl")); tabControl.SelectTabPage("Appointments"); CheckBox ShowUpsFilter = mainWindow.Get <CheckBox>(SearchCriteria.ByAutomationId("ShowUpsOnly")); ShowUpsFilter.Click(); Grid = mainWindow.Get <ListView>(SearchCriteria.ByAutomationId("AppointmentsGrid")); int testedRows = 0; while (Grid.Rows.Count >= 0 && testedRows < 7) { var OpenListButton = mainWindow.Get <Button>(SearchCriteria.Indexed(5)); OpenListButton.Click(); PatientWindow = application.GetWindow("AddToOpenList"); string Name = PatientWindow.Get <Label>(SearchCriteria.ByAutomationId("TextBoxPatientName")).Text; Assert.AreEqual(Name, Grid.Rows[0].Cells[1].Text); Button Add = PatientWindow.Get <Button>(SearchCriteria.ByText("Add")); Add.Click(); tabControl.SelectTabPage("Open List"); var OpenListGrid = mainWindow.Get <ListView>(SearchCriteria.ByAutomationId("OpenListGrid")); var NewRow = OpenListGrid.Rows[testedRows++]; Assert.AreEqual(Name, NewRow.Cells[1].Text); tabControl.SelectTabPage("Appointments"); } application.Close(); }