Ejemplo n.º 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));
 }
Ejemplo n.º 2
0
 public void TearDownTest()
 {
     Log4Caesar.Log();
     //Save changes
     mainPageInstance.ModalWindow.EditStudentWindow.SaveButton.Click();
     wait.Until((d) => EditStudentListWindow.IsOpened(d));
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 4
0
 public void ExecuteTest_ImportStudentList_ListNotImported()
 {
     mainPageInstance.ModalWindow.EditStudentListWindow.ImportStudentsButton.Click();
     path = EditStudentListWindow.GetTestFile("TC_3_06_05.docx");
     Acts.UploadFile(path);
     wait.Until((d) => EditStudentListWindow.IsNotEmpty(d));
     Assert.AreEqual(0, mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count);
 }
Ejemplo n.º 5
0
 public void ExecuteTest_ImportStudentList_ListImported()
 {
     mainPageInstance.ModalWindow.EditStudentListWindow.ImportStudentsButton.Click();
     path = EditStudentListWindow.GetTestFile("TC_3_06_01-03.txt");
     Acts.UploadFile(path);
     mainPageInstance.ModalWindow.EditStudentListWindow.SaveFormButton.Click();
     Assert.AreEqual(4, mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count);
 }
Ejemplo n.º 6
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);
 }
Ejemplo n.º 7
0
        public void ExecuteTest_DropStudentList_ListImported()
        {
            path = EditStudentListWindow.GetTestFile("TC_3_06_01-03.txt");
            IWebElement droparea = webDriver.FindElement(By.ClassName("modal_editStudentlist"));

            Acts.DropFile(droparea, path);
            mainPageInstance.ModalWindow.EditStudentListWindow.SaveFormButton.Click();
            Assert.AreEqual(4, mainPageInstance.ModalWindow.EditStudentListWindow.Students.Count);
        }
Ejemplo n.º 8
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();
 }
Ejemplo n.º 9
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"));
        }
Ejemplo n.º 10
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());
        }
Ejemplo n.º 11
0
        public void ExecuteTest_DeclieStudentList_ListNotImported()
        {
            mainPageInstance.ModalWindow.EditStudentListWindow.ImportStudentsButton.Click();
            path = EditStudentListWindow.GetTestFile("TC_3_06_01-03.txt");
            Acts.UploadFile(path);
            wait.Until((d) => EditStudentListWindow.IsNotEmpty(d));
            mainPageInstance.ModalWindow.EditStudentListWindow.ExitFormButton.Click();
            IList <IWebElement> rowsInTable = mainPageInstance.CenterContainer.StudentsContent.StudentTable.GetRows();
            string expected = "";
            string actual   = "";

            foreach (var row in rowsInTable)
            {
                actual += row.Text;
            }
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 12
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));
 }
Ejemplo n.º 13
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());
        }
Ejemplo n.º 14
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));
 }