Esempio n. 1
0
 /// <summary>
 /// Default Parameterized Constructor
 /// </summary>
 /// <param name="browser">browser value to store session</param>
 public LoginPage(Browser browser)
     : base(browser)
 {
     /// Initiate object repository
     objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.Common),EnumHelper.OfType(Page.LoginPage));
     objectRepository = new ObjectRepository(objectRepositoryFilePath);
 }
Esempio n. 2
0
 public HomeBase(Browser browser)
 {
     if (browser == null)
     {
         throw new ArgumentNullException("browser");
     }
     this.Browser = browser;
 }
Esempio n. 3
0
        /// <summary>
        /// SuperNavigationMenu Constructor 
        /// </summary>
        /// <param name="browser"></param>
        public SuperNavigationMenu(Browser browser)
            : base(browser)
        {
            try
            {
                SuperMenu = new SiteNavigationMenu(browser);
                SuperMenu.LocateSuperMenuControls();
            }
            catch (Exception exception)
            {

                throw new Exception("Error Locating - " + exception.Message); ;
            }
        }
 /// <summary>
 /// Concepts management page constructor
 /// </summary>
 /// <param name="browser"></param>
 public SchoolTechManageQuestionBankPage(Browser browser)
     : base(browser)
 {
     /// Initiate User management page object repository
     try
     {
         objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.SchoolTech), EnumHelper.OfType(Page.ConceptManagementPage));
         objectRepository = new ObjectRepository(objectRepositoryFilePath);
     }
     catch (Exception e)
     {
         throw new Exception("Error locating" + e.Message);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Change Password Page constructor
 /// </summary>
 /// <param name="browser"></param>
 public ChangePasswordPage(Browser browser)
     : base(browser)
 {
     try
     {
         objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.Common),EnumHelper.OfType(Page.ChangePasswordPage));
         objectRepository = new ObjectRepository(objectRepositoryFilePath);
         this.LocateControl();
      }
     catch (Exception e)
     {
         throw new Exception("Unable to find control - " + e.Message);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Set Password Question page Constructor
 /// </summary>
 /// <param name="browser"></param>
 public SetPasswordQuestionPage(Browser browser)
     : base(browser)
 {
     try
     {
         objectRepositoryFilePath = PrepareObjectRepositoryFilePath( EnumHelper.OfType(Role.Common),EnumHelper.OfType(Page.SetPaswordQuestionPage));
         objectRepository = new ObjectRepository(objectRepositoryFilePath);
         this.LocateControls();
     }
     catch (Exception e)
     {
         throw new Exception("Error locating - " + e.Message);
     }
 }
Esempio n. 7
0
 /// <summary>
 /// SuperAdminPage constructor
 /// </summary>
 /// <param name="browser"></param>
 public SuperAdminPage(Browser browser)
     : base(browser)
 {
     /// Initiate Super AdminPage repository
     try
     {
         objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.Super), EnumHelper.OfType(Page.AdminPage));
         objectRepository = new ObjectRepository(objectRepositoryFilePath);
         this.LocateControls();
     }
     catch (Exception e)
     {
         throw new Exception("Error locating" + e.Message);
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Create course page constructor 
 /// </summary>
 /// <param name="browser"></param>
 public CreateCoursePage(Browser browser)
     : base(browser)
 {
     /// Initiate Schooltech Homepage repository
     try
     {
         objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.SchoolTech), EnumHelper.OfType(Page.CreateCoursePage));
         objectRepository = new ObjectRepository(objectRepositoryFilePath);
         //this.LocateControls();
     }
     catch (Exception e)
     {
         throw new Exception("Error locating" + e.Message);
     }
 }
 /// <summary>
 /// User management page constructor
 /// </summary>
 /// <param name="browser"></param>
 public SchoolTechUserManagementPage(Browser browser)
     : base(browser)
 {
     /// Initiate User management page object repository
     try
     {
         /// TODO: see if this work
         /// objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.SchoolTech), Enum.GetName(typeof(Page), Page.LoginPage));
         objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.SchoolTech), EnumHelper.OfType(Page.UserManagementPage));
         objectRepository = new ObjectRepository(objectRepositoryFilePath);
         this.LocateControls();
     }
     catch (Exception e)
     {
         throw new Exception("Error locating" + e.Message);
     }
 }
 /// <summary>
 /// Default Parameterized Constructor
 /// </summary>
 /// <param name="browser">browser value to store session</param>
 public VirtualMachinePage(Browser browser)
     : base(browser)
 {
     LocateControls();
 }
Esempio n. 11
0
 /// <summary>
 /// Schooltech Navigation menu constructor
 /// </summary>
 /// <param name="browser"></param>
 public SchoolTechNavigationMenu(Browser browser)
     : base(browser)
 {
     SchooltechMenu = new SiteNavigationMenu(browser);
 }
Esempio n. 12
0
        /// <summary>
        /// Function to take ScreenShot
        /// </summary>
        /// <param name="argument">test step no</param>
        /// <returns>bool</returns>
        /// <author>rajan.bansod</author> 
        /// <ModifiedBy>rajan.bansod</ModifiedBy>
        /// <Date>06-Sept-2011</Date>
        private bool TakeScreenShot(string argument, string currentResultDirectory, Browser browser)
        {
            try
            {
                if (!Directory.Exists(currentResultDirectory))
                {
                    // create directory
                    Directory.CreateDirectory(currentResultDirectory);
                }
                string filePath = currentResultDirectory + "\\" + argument + ".png";

                IWebDriver ITakesScreenshotDriver = browser.Driver;
                Screenshot ScreenShotObject = ((ITakesScreenshot)ITakesScreenshotDriver).GetScreenshot();
                string screenshot = ScreenShotObject.AsBase64EncodedString;
                byte[] screenshotAsByteArray = ScreenShotObject.AsByteArray;
                ScreenShotObject.SaveAsFile(filePath, ImageFormat.Png);
                return true;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
                return false;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Function to write logs to a csv file
        /// </summary>
        /// <param name="testID">Test case XPATH</param>
        /// <param name="stepNum">Step Num</param>
        /// <param name="stepDescription">Error description</param>
        /// <param name="stepResult">Result of step</param>
        /// <author>rajan.bansod</author> 
        /// <ModifiedBy>rajan.bansod</ModifiedBy>
        /// <Date>12-Aug-2011</Date>
        public void WriteLogs(string testID, int stepNum, string stepDescription, string stepResult, Browser browser)
        {
            StreamWriter logWriter = null;
            try
            {
                // check if log directory exist or not
                string filePath = this.logFileDirectory;
                //Console.WriteLine("filePath " + filePath);
                try
                {
                    if (!Directory.Exists(filePath))
                    {
                        // create directory
                        Directory.CreateDirectory(filePath);
                    }
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }

                if ("FAIL".Equals(stepResult))
                {
                    // check if html report directory exist or not
                    try
                    {
                        if (!Directory.Exists(this.reportFileDirectory))
                        {
                            // create directory
                            Directory.CreateDirectory(this.reportFileDirectory);
                        }
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine(exception.Message);
                    }

                    // Code to take screen shot
                    CaptureScreenShot(testID + "_" + stepNum.ToString(), this.reportFileDirectory + "\\" + testID);
                    if (browser != null)
                    {
                        TakeScreenShot(testID + "_" + stepNum.ToString(), this.reportFileDirectory + "\\" + testID, browser);
                    }
                }
                // convert description string in to readable string, remove ',' from string
                stepDescription = ConvertToLogDescription(stepDescription);
                // append csv file name to directory path
                filePath = filePath + @"\" + testID + ".csv";
                //Console.WriteLine("log file filePath " + filePath);
                // check if log file exist or not
                if (File.Exists(filePath))
                {
                    // append data to the log file
                    logWriter = File.AppendText(filePath);
                    logWriter.WriteLine(testID + "," + stepNum.ToString() + "," + stepDescription + "," + stepResult + "," + DateTime.Now);
                    // close logWriter
                    logWriter.Close();
                    // write detials to console for visual studio result
                    Console.WriteLine(testID + "," + stepNum.ToString() + "," + stepDescription + "," + stepResult + "," + DateTime.Now);
                }
                else
                {
                    // add header to the log file
                    logWriter = File.AppendText(filePath);
                    logWriter.WriteLine("TCID,STEPNO,DESCRIPTION,RESULT,DATE_TIME");
                    // append data to the log file
                    logWriter.WriteLine(testID + "," + stepNum.ToString() + "," + stepDescription + "," + stepResult + "," + DateTime.Now);
                    // close logWriter
                    logWriter.Close();
                    // write detials to console for visual studio result
                    Console.WriteLine(testID + "," + stepNum.ToString() + "," + stepDescription + "," + stepResult + "," + DateTime.Now);
                }
                GenerateLog(testID, stepNum, stepDescription, stepResult);
            }
            catch (Exception exception)
            {
                Console.WriteLine("WriteLog " + exception.Message);
            }
        }
Esempio n. 14
0
 /// <summary>
 /// Function for kill all open IE browsers, close the browser object gracefully and return the exception
 /// </summary>
 /// <returns>Exception string</returns>
 public string ExceptionCleanUp(string errorMessage, Browser browser)
 {
     try
     {
         //Automation.Development.Pages.SearchPage searchPage = new Automation.Development.Pages.SearchPage(browser);
         //searchPage.LogOut();
         //// close the browser
         //browser.Close();
         //// kill all open IE browsers
         //KillAlreadyOpenBrowsers();
         // set browser object to null
         browser = null;
     }
     catch (Exception)
     {
         // close the browser
         browser.Close();
         // kill all open IE browsers
         KillAlreadyOpenBrowsers();
         // set browser object to null
         browser = null;
     }
     // throw exception forcefully to fail the test case
     Console.WriteLine("Execution of clean up script terminated. " + errorMessage);
     return null;
 }
Esempio n. 15
0
 /// <summary>
 /// Site navigation page Constructor
 /// </summary>
 /// <param name="browser"></param>
 public SiteNavigationMenu(Browser browser)
     : base(browser)
 {
     objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.Common),EnumHelper.OfType(Page.SiteNavPage));
     objectRepository = new ObjectRepository(objectRepositoryFilePath);
 }
Esempio n. 16
0
        public void LoginTestCase()
        {
            /// Test case name
            testScriptName = "LoginTestCase";

            try
            {
                /// Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                /// Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);

                /// Test Data
                TestData testData = new TestData(testDataFilePath);
                string schooltechUName = (string)testData.TestDataTable["SchooltechUName"];
                string schooltechPassword = (string)testData.TestDataTable["SchooltechPassword"];

                /// Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                /// Log in as Schooltech
                SchoolTechHomePage st_Homepage = loginPage.LoginAsSchoolTech(schooltechUName, schooltechPassword, base.applicationURL);
                Assert.IsNotNull(st_Homepage, "Failed to login to InPods application as Schooltech");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Schooltech", "Pass", browser);
                stepNo++;

                /// Validate if the login is of type SchoolTech
                Assert.IsTrue(st_Homepage.ValidateSchoolTechUserProfile(), "Failed to validate current login as Schooltech");
                WriteLogs(testScriptName, stepNo, "Validate current Login as Schooltech", "Pass", browser);
            }
               catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in  \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Esempio n. 17
0
        public void CreateTechadminAndInstituteManually()
        {
            ///Test name
            testScriptName = "CreateTechadminAndInstituteManually";

            try
            {
                /// Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                /// Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);
                string testDataDirectoryPath = PrepareTestDataDirectory(testScriptName);

                /// Test Data
                TestData testData = new TestData(testDataFilePath);
                string superUName = (string)testData.TestDataTable["SuperUName"];
                string superPassword = (string)testData.TestDataTable["SuperPassword"];
                string firstName = (string)testData.TestDataTable["FirstName"];
                string lastName = (string)testData.TestDataTable["LastName"];
                string email  = (string)testData.TestDataTable["Email"];
                string password = (string)testData.TestDataTable["Password"];
                string instituteName = (string)testData.TestDataTable["InstituteName"];
                string instituteDescription = (string)testData.TestDataTable["InstituteDescription"];
                string instituteShortName= (string)testData.TestDataTable["InstituteShortName"];
                string logoFilePath= testDataDirectoryPath + (string)testData.TestDataTable["LogoFileName"];
                string schoolTechName= (string)testData.TestDataTable["SchoolTechName"];
                string timeZone= (string)testData.TestDataTable["TimeZone"];
                string passwordReset= (string)testData.TestDataTable["PasswordReset"];

                /// Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                /// Log in as Super
                SuperHomePage s_Homepage = loginPage.LoginAsSuper(superUName, superPassword, base.applicationURL);
                Assert.IsNotNull(s_Homepage, "Failed to login to InPods application as Super");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Super", "Pass", browser);
                stepNo++;

                /// Go to Admin Page
                SuperAdminPage admin = s_Homepage.GotoSuperAdminPage();
                Assert.IsNotNull(admin, "Failed to navigate to super admin page");
                WriteLogs(testScriptName, stepNo, "Navigate to Admin page", "Pass", browser);
                stepNo++;

                /// Click on CreateInstitute Link
                CreateInstitutePage newInstitute = admin.GoToCreateInstitutePage();
                Assert.IsNotNull(newInstitute, "Failed to navigate to Create Institute Page");
                WriteLogs(testScriptName, stepNo, "Navigate to CreateNewInstitutePage", "Pass", browser);
                stepNo++;

                /// Create TechAdmin as schooltech
                Assert.IsTrue(newInstitute.CreateTechadmin(firstName, lastName, email, password), "Failed to create tech admin");
                WriteLogs(testScriptName, stepNo, "Create TechAdmin", "Pass", browser);
                stepNo++;

                /// Add new institute
                Assert.IsTrue(newInstitute.AddNewInstitute(instituteName, instituteDescription, instituteShortName, logoFilePath, schoolTechName, timeZone, passwordReset), "Failed to create new institute");
                WriteLogs(testScriptName, stepNo, "Create New institute", "Pass", browser);
                stepNo++;

                /// LogOff
                Assert.IsTrue(newInstitute.LogOut(), "Failed to Log out");
                WriteLogs(testScriptName, stepNo, "LogOff", "Pass", browser);
            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Esempio n. 18
0
 /// <summary>
 /// Default Parameterized Constructor
 /// </summary>
 /// <param name="browser">browser value to store session</param>
 public TeacherHomePage(Browser browser)
     : base(browser)
 {
 }
 /// <summary>
 /// Default Parameterized Constructor
 /// </summary>
 /// <param name="browser">browser value to store session</param>
 public DashboardPage(Browser browser)
     : base(browser)
 {
     this.LocateControls();
 }
 /// <summary>
 /// Default Parameterized Constructor
 /// </summary>
 /// <param name="browser">browser value to store session</param>
 public WorkspacePage(Browser browser)
     : base(browser)
 {
     this.LocateControls();
 }
Esempio n. 21
0
 /// <summary>
 /// Contact support page constructor
 /// </summary>
 public ContactSupportPage(Browser browser)
     : base(browser)
 {
     objectRepositoryFilePath = PrepareObjectRepositoryFilePath(EnumHelper.OfType(Role.Common),EnumHelper.OfType(Page.ContactSupportPage));
     objectRepository = new ObjectRepository(objectRepositoryFilePath);
 }
Esempio n. 22
0
        public void CreateSemester()
        {
            ///Test name
            testScriptName = "CreateSemester";

            try
            {
                // Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                // Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);
                string testDataDirectoryPath = PrepareTestDataDirectory(testScriptName);

                // Test Data
                TestData testData = new TestData(testDataFilePath);
                string schooltechUName = (string)testData.TestDataTable["schooltechUName"];
                string schooltechPassword = (string)testData.TestDataTable["schooltechPassword"];

                string semesterTitle = (string)testData.TestDataTable["semesterTitle"];
                string semesterYear = (string)testData.TestDataTable["semesterYear"];
                string semesterDescription = (string)testData.TestDataTable["semesterDescription"];
                string schoolYear = (string)testData.TestDataTable["schoolYear"];
                string startDate = (string)testData.TestDataTable["startDate"];
                string endDate = (string)testData.TestDataTable["endDate"];

                // Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                // Log in as Schooltech
                SchoolTechHomePage s_Homepage = loginPage.LoginAsSchoolTech(schooltechUName, schooltechPassword, base.applicationURL);
                Assert.IsNotNull(s_Homepage, "Failed to login to InPods application as Schooltech");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Schooltech", "Pass", browser);
                stepNo++;

                // Navigate to schooltech admin
                SchoolTechAdminPage admin = s_Homepage.GoToSchooltechAdmin();
                Assert.IsNotNull(admin, "Failed to navigate to Schooltech Admin Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Schooltech Admin Page", "Pass", browser);
                stepNo++;

                // Navigate to Course Management page
                SchoolTechCourseManagementPage manage = admin.GotoCourseManagementPage();
                Assert.IsNotNull(manage, "Failed to navigate to Manage Course Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Manage Course Page", "Pass", browser);
                stepNo++;

                // Navigate to create Semester page
                CreateSemesterPage semester = manage.GoToCreateSemesterPage();
                Assert.IsNotNull(manage, "Failed to navigate to Create Semester Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Create Semester Page", "Pass", browser);
                stepNo++;

                // Create new semester
                Assert.IsTrue(semester.CreateNewSemester(semesterTitle, semesterYear, semesterDescription, schoolYear, startDate, endDate), "Unable to create new semester");
                WriteLogs(testScriptName, stepNo, "Create new semester " + semesterTitle, "Pass", browser);
                stepNo++;

                // Log out
                Assert.IsTrue(manage.LogOut(), "Failed to Log out");
                WriteLogs(testScriptName, stepNo, "LogOff", "Pass", browser);
            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + "And Exception Occured in \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
 /// <summary>
 /// Function to store browser session
 /// </summary>
 /// <param name="browser">browser session to store</param>
 public void StoreBrowserInstance(Browser browser)
 {
     try
     {
         //gets common xpath for all pages of ComputeNext application
         string xpathAspDotNetform = "//*[@id=\"aspnetForm\"]";
         //checking browser session available or not
         IWebElement aspDotNetForm = browser.Driver.FindElement(By.XPath(xpathAspDotNetform));
         if (aspDotNetForm != null)
         {
             browserSession = browser;
         }
         else
         {
             browserSession = null;
         }
     }
     catch (Exception)
     {
         browserSession = null;
     }
 }
Esempio n. 24
0
        public void CreateUsersOfEachRoleType()
        {
            ///Test name
            testScriptName = "CreateUsersOfEachRoleType";

            try
            {
                // Start debug viewer for writting application logs
                applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
                applicationLog.StartDebugViewer();

                // Prepare test data file path
                string testDataFilePath = PrepareTestDataFilePath(testScriptName);
                string testDataDirectoryPath = PrepareTestDataDirectory(testScriptName);

                // Test Data
                TestData testData = new TestData(testDataFilePath);
                string schooltechUName = (string)testData.TestDataTable["schooltechUName"];
                string schooltechPassword = (string)testData.TestDataTable["schooltechPassword"];

                string teacherRole = (string)testData.TestDataTable["teacherRole"];
                string firstNameTeacher = (string)testData.TestDataTable["firstNameTeacher"];
                string lastNameTeacher = (string)testData.TestDataTable["lastNameTeacher"];
                string emailTeacher = (string)testData.TestDataTable["emailTeacher"];
                string passwordTeacher = (string)testData.TestDataTable["passwordTeacher"];

                string parentRole = (string)testData.TestDataTable["parentRole"];
                string firstNameParent = (string)testData.TestDataTable["firstNameParent"];
                string lastNameParent = (string)testData.TestDataTable["lastNameParent"];
                string emailParent = (string)testData.TestDataTable["emailParent"];
                string passwordParent = (string)testData.TestDataTable["passwordParent"];

                string authorRole = (string)testData.TestDataTable["authorRole"];
                string firstNameAuthor = (string)testData.TestDataTable["firstNameAuthor"];
                string lastNameAuthor = (string)testData.TestDataTable["lastNameAuthor"];
                string emailAuthor = (string)testData.TestDataTable["emailAuthor"];
                string passwordAuthor = (string)testData.TestDataTable["passwordAuthor"];

                string administratorRole = (string)testData.TestDataTable["administratorRole"];
                string firstNameAdministrator = (string)testData.TestDataTable["firstNameAdministrator"];
                string lastNameAdministrator = (string)testData.TestDataTable["lastNameAdministrator"];
                string emailAdministrator = (string)testData.TestDataTable["emailAdministrator"];
                string passwordAdministrator = (string)testData.TestDataTable["passwordAdministrator"];

                string schooltechRole = (string)testData.TestDataTable["schooltechRole"];
                string firstNameSchooltech = (string)testData.TestDataTable["firstNameSchooltech"];
                string lastNameSchooltech = (string)testData.TestDataTable["lastNameSchooltech"];
                string emailSchooltech = (string)testData.TestDataTable["emailSchooltech"];
                string passwordSchooltech = (string)testData.TestDataTable["passwordSchooltech"];

                string studentRole = (string)testData.TestDataTable["studentRole"];
                string firstNameStudent = (string)testData.TestDataTable["firstNameStudent"];
                string lastNameStudent = (string)testData.TestDataTable["lastNameStudent"];
                string emailStudent = (string)testData.TestDataTable["emailStudent"];
                string passwordStudent = (string)testData.TestDataTable["passwordStudent"];

                // Create browser instace
                browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                LoginPage loginPage = new LoginPage(browser);

                // Log in as Schooltech
                SchoolTechHomePage s_Homepage = loginPage.LoginAsSchoolTech(schooltechUName, schooltechPassword, base.applicationURL);
                Assert.IsNotNull(s_Homepage, "Failed to login to InPods application as Schooltech");
                WriteLogs(testScriptName, stepNo, "Login to InPods Application as Schooltech", "Pass", browser);
                stepNo++;

                // Navigate to schooltech admin
                SchoolTechAdminPage admin = s_Homepage.GoToSchooltechAdmin();
                Assert.IsNotNull(admin, "Failed to navigate to Schooltech Admin Page");
                WriteLogs(testScriptName, stepNo, "Navigate to Schooltech Admin Page", "Pass", browser);
                stepNo++;

                // Navigate to User Management page
                SchoolTechUserManagementPage manage = admin.GotoUserManagementPage();
                Assert.IsNotNull(manage, "Failed to navigate to User management Page");
                WriteLogs(testScriptName, stepNo, "Navigate to User management Page", "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Teacher'
                Assert.IsTrue(manage.CreateUser(teacherRole, firstNameTeacher, lastNameTeacher, emailTeacher, passwordTeacher), "Unable to Create User of type " + teacherRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + teacherRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Parent'
                Assert.IsTrue(manage.CreateUser(parentRole, firstNameParent, lastNameParent, emailParent, passwordParent), "Unable to Create User of type " + parentRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + parentRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Author'
                Assert.IsTrue(manage.CreateUser(authorRole, firstNameAuthor, lastNameAuthor, emailAuthor, passwordAuthor), "Unable to Create User of type " + authorRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + authorRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Administrator'
                Assert.IsTrue(manage.CreateUser(administratorRole, firstNameAdministrator, lastNameAdministrator, emailAdministrator, passwordAdministrator), "Unable to Create User of type " + administratorRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + administratorRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Schooltech'
                Assert.IsTrue(manage.CreateUser(schooltechRole, firstNameSchooltech, lastNameSchooltech, emailSchooltech, passwordSchooltech), "Unable to Create User of type " + schooltechRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + schooltechRole, "Pass", browser);
                stepNo++;

                // Create new user of Role - 'Student'
                Assert.IsTrue(manage.CreateUser(studentRole, firstNameStudent, lastNameStudent, emailStudent, emailStudent), "Unable to Create User of type " + studentRole);
                WriteLogs(testScriptName, stepNo, "Create new user of role " + studentRole, "Pass", browser);
                stepNo++;

                /// LogOff
                Assert.IsTrue(manage.LogOut(), "Failed to Log out");
                WriteLogs(testScriptName, stepNo, "LogOff", "Pass", browser);
            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in \"" + testScriptName + "\" Test case", "FAIL", browser);
                Assert.Fail();
            }
            finally
            {
                /// Close Debug viewer and verify log file
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Function for write log, kill all open IE browsers, close the browser object gracefully and return the exception
        /// </summary>
        /// <returns>Exception string</returns>
        public void ExceptionCleanUp(string testScriptName, int stepNo, string exception, Browser browser)
        {
            try
            {
                // write log for failed step and to take screen-shot
                WriteLogs(testScriptName, stepNo, "Execution of script terminated. " + exception, "FAIL", browser);

                // Logout script
                //Automation.Development.Pages.SearchPage searchPage = new Automation.Development.Pages.SearchPage(browser);
                //searchPage.ReleaseAllKey();
                //searchPage.LogOut();

                // close the browser
                browser.Close();
                // kill all open IE browsers
                KillAlreadyOpenBrowsers();
                // set browser object to null
                browser = null;
            }
            catch (Exception)
            {
                // close the browser
                browser.Close();
                // kill all open IE browsers
                KillAlreadyOpenBrowsers();
                // set browser object to null
                browser = null;
            }
            // throw exception forcefully to fail the test case
            Assert.Fail();
        }
Esempio n. 26
0
        public void TestFixtureSetup()
        {
            try
            {
                // Loads config data and creates a Singleton object of Configuration and loads data into generic test case variables
                GetConfigData();

                // Get debug viewer exe file path
                configFilesLocation = PrepareConfigureDataFilePath();

                // Prepare log directory details from xml file
                PrepareLogDirectoryPath(configFilesLocation);

                // Initializing Automation report related parameters
                ExecutionStartDateTime = GetValuesFromXML("TestDataConfig", "ExecutionStartDateTime", configFilesLocation + "\\RunTime.xml");
                startTimeOfExecution = Convert.ToDateTime(ExecutionStartDateTime.ToString());

                // Initialize temp instance
                browser = null;
                applicationLog = null;
            }
            catch (Exception e)
            {
                Console.WriteLine("Test Fixture Setup Failed - " + e.Message);
            }
        }
Esempio n. 27
0
 /// <summary>
 /// Default Parameterized Constructor
 /// </summary>
 /// <param name="browser">browser value to store session</param>
 public LoginPage(Browser browser)
     : base(browser)
 {
 }