Example #1
0
 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));
 }
Example #2
0
 public void TearDownTest()
 {
     Log4Caesar.Log();
     //Save changes
     mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click();
     wait.Until((d) => EditStudentListWindow.IsOpened(d));
 }
Example #3
0
 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());
 }
Example #4
0
 public void ExecuteTest_ImportStudentList_CorrectDataImported()
 {
     mainPageInstance.ModalWindow.EditStudentListWindow.ImportStudentsButton.Click();
     path = EditStudentListWindow.GetTestFile("TC_3_06_04.csv");
     Acts.UploadFile(path);
     wait.Until((d) => EditStudentListWindow.IsOpened(d));
     mainPageInstance.ModalWindow.EditStudentListWindow.SaveFormButton.Click();
     Assert.AreEqual(1, mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count);
 }
Example #5
0
 public void OneTimeTearDownTest()
 {
     //Delete test students
     mainPageInstance.ModalWindow.EditStudentListWindow.StudentTable.GetElementFromCell
         (mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count, EditStudentListWindow.DeleteButtonsColumn).Click();
     Acts.PressKeyboardButton(@"{Enter}");
     wait.Until((d) => EditStudentListWindow.IsOpened(d));
     webDriver.Close();
     webDriver.Quit();
 }
Example #6
0
        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"));
        }
Example #7
0
        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());
        }
Example #8
0
 public void OneTimeSetUp()
 {
     wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(2));
     webDriver.Manage().Window.Maximize();
     webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2);
     //Open Login Page
     webDriver.Url     = baseURL;
     loginPageInstance = new LoginPage(webDriver);
     //Login as Teacher
     loginPageInstance.LogIn("sasha", "1234", wait);
     mainPageInstance = new MainPage(webDriver);
     //Go to group's LV-023-UX students page
     webDriver.Url = baseURL + "/Students/Lviv/Lv-023-UX/list";
     wait.Until((d) => StudentsContent.IsOpened(d));
     //Open modal window 'EditStudentListWindow'
     mainPageInstance.CenterContainer.StudentsContent.EditButton.Click();
     wait.Until((d) => EditStudentListWindow.IsOpened(d));
 }
Example #9
0
        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());
        }
Example #10
0
 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));
 }