public void OneTimeSetUpTest() { wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(2)); webDriver.Manage().Window.Maximize(); webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2); //Open Login Page webDriver.Url = baseURL; wait.Until((driver) => LoginPage.IsLoginPageOpened(driver)); loginPageInstance = new LoginPage(webDriver); //Login as Teacher loginPageInstance.LogIn("sasha", "1234"); wait.Until((d) => MainPage.IsMainPageOpened(d)); mainPageInstance = new MainPage(webDriver); //Go to group's DP-093-JS students page webDriver.Url = baseURL + "/Students/Dnipro/DP-093-JS/list"; wait.Until((d) => StudentsContent.IsOpened(d)); //Open modal window 'EditStudentListWindow' mainPageInstance.CenterContainer.StudentsContent.EditButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); //Create new student for test mainPageInstance.ModalWindow.EditStudentListWindow.CreateStudentButton.Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); mainPageInstance.ModalWindow.EditStudentWindow.FillForm("Andrey", "Magera", 3, "137", "4.2", 1); mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); }
public void SetUpTest() { //Open last student in table for editing mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.EditButtonsColumn).Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); }
public StudentDTO Create() { var createStudentWindow = new EditStudentWindow(); var createResult = createStudentWindow.ShowDialog(); return(createResult == true ? ((EditStudentViewModel)createStudentWindow.DataContext).Student : null); }
public bool Edit(StudentDTO student) { var editStudentWindow = new EditStudentWindow(student); var editResult = editStudentWindow.ShowDialog(); return(editResult ?? false); }
private void EditStudentFromDB(University_Student obj) { var childWindow = new EditStudentWindow() { DataContext = this, Title = "Edit Student" }; CloseCommand = new Action(() => childWindow.Close()); StudentName = obj.First_Name; StudentLastName = obj.Last_Name; StudentEmail = obj.Email; StudentBirthdate = obj.Birthday; if (obj.Photo == null) { StudentPhoto = null; } else { StudentPhoto = ByteToImage(obj.Photo); } ButtonName = "Edit"; SaveButton = new Command <object>(UpdateStudent, (s) => !string.IsNullOrWhiteSpace(StudentName) && !string.IsNullOrWhiteSpace(StudentLastName) && StudentBirthdate != null); childWindow.ShowDialog(); }
public void ExecuteTest_UploadFiles_FilesUploaded(int expected, string CV, string photo) { //Upload CV path = EditStudentWindow.GetTestFile(CV); mainPageInstance.ModalWindow.EditStudentWindow.BrowseCVButton.Click(); Acts.UploadFile(path); //Accep Allert if necessary if (Acts.IsAlertPresent(wait)) { webDriver.SwitchTo().Alert().Accept(); } //Upload photo path = EditStudentWindow.GetTestFile(photo); mainPageInstance.ModalWindow.EditStudentWindow.BrowsePhotoButton.Click(); Acts.UploadFile(path); //Accep Allert if necessary if (Acts.IsAlertPresent(wait)) { webDriver.SwitchTo().Alert().Accept(); } //Save changes mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); //Check if files saved mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.EditButtonsColumn).Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); Assert.AreEqual(expected, mainPageInstance.ModalWindow.EditStudentWindow.CountUploadedFiles()); }
public void ExecuteTest_AddStudent_StudentAdded(string expected, string firstName, string lastName, int englishLevelIndex, string incomingTest, string entryScore, int approvedByIndex) { mainPageInstance.ModalWindow.EditStudentListWindow.CreateStudentButton.Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); mainPageInstance.ModalWindow.EditStudentWindow.FillForm(firstName, lastName, englishLevelIndex, incomingTest, entryScore, approvedByIndex); mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); Assert.AreEqual(expected, mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetValueFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, "Name")); }
private void EditStudentMenuItem_OnClick(object sender, RoutedEventArgs e) { try { Window window = new EditStudentWindow((StudentsListBox.SelectedItem as Student).Id); window.ShowDialog(); } catch (NullReferenceException) { throw new NullReferenceException(); } UpdateList(); }
public void ExecuteTest_DeleteFiles_FilesDeleted() { //Remove files mainPageInstance.ModalWindow.EditStudentWindow.RemoveCVButton.Click(); mainPageInstance.ModalWindow.EditStudentWindow.RemovePhotoButton.Click(); //Save changes mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); //Open last student in table for editing mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.EditButtonsColumn).Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); Assert.AreEqual(0, mainPageInstance.ModalWindow.EditStudentWindow.CountUploadedFiles()); }
private async void UpdateConsultant_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { StudentDisplayModel selectStudent = this.gvStudent.SelectedItem as StudentDisplayModel; if (selectStudent != null) { string strErrorMsg = string.Empty; try { EditStudentWindow newStudentWindow = new EditStudentWindow(); newStudentWindow.StudentId = selectStudent.Id; newStudentWindow.Om = OperationMode.EditMode; if (newStudentWindow.ShowDialog() == true) { await bindStudentList(); } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "更新学员失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } } }
public void ExecuteTest_DropFiles_FilesUploaded() { //Upload CV path = EditStudentWindow.GetTestFile("TC_3_04 CV.doc"); IWebElement droparea = webDriver.FindElement(By.ClassName("modal_singleStudent")); Acts.DropFile(droparea, path); //Upload photo path = EditStudentWindow.GetTestFile("TC_3_04 photo.png"); Acts.DropFile(droparea, path); //Save changes mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); //Check if files saved mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.EditButtonsColumn).Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); Assert.AreEqual(2, mainPageInstance.ModalWindow.EditStudentWindow.CountUploadedFiles()); }
private void AddNewStudentToDB(object obj) { var childWindow = new EditStudentWindow() { DataContext = this, Title = "Add new Student" }; CloseCommand = new Action(() => childWindow.Close()); StudentName = null; StudentLastName = null; StudentEmail = null; StudentBirthdate = new DateTime(2000, 01, 01); StudentPhoto = null; //StudentPhoto = new BitmapImage(new Uri("bin/Debug/no_img.jpg", UriKind.Relative)); ButtonName = "Add"; SaveButton = new Command <object>(AddStudent, (s) => !string.IsNullOrWhiteSpace(StudentName) && !string.IsNullOrWhiteSpace(StudentLastName) && StudentBirthdate != null); childWindow.ShowDialog(); }
public void SetUpTest() { //Open last student in table for editing mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.EditButtonsColumn).Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); //Upload CV and photo path = EditStudentWindow.GetTestFile("TC_3_04 CV.docx"); mainPageInstance.ModalWindow.EditStudentWindow.BrowseCVButton.Click(); Acts.UploadFile(path); path = EditStudentWindow.GetTestFile("TC_3_04 photo.png"); mainPageInstance.ModalWindow.EditStudentWindow.BrowsePhotoButton.Click(); Acts.UploadFile(path); //Save changes mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click(); wait.Until((d) => EditStudentListWindow.IsOpened(d)); //Open last student in table for editing mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.EditButtonsColumn).Click(); wait.Until((d) => EditStudentWindow.IsOpened(d)); }
private async void gvStudent_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e) { string strErrorMsg = string.Empty; try { EditStudentWindow newStudentWindow = new EditStudentWindow(); newStudentWindow.Om = OperationMode.AddMode; if (newStudentWindow.ShowDialog() == true) { await bindStudentList(); } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "添加学员信息失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } }