Exemple #1
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);
                }
            }
        }
Exemple #2
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);
                }
            }
        }
Exemple #3
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);
                }
            }
        }
Exemple #4
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);
                }
            }
        }
        public void TestCase2101()
        {
            int stepNo = 1;

            // Gets scriptname through reflection
            string testScriptName = GetTestScriptName();

            // Loads config data and creates a Singleton object of Configuration and loads data into generic test case variables
            this.GetConfigData();

            // Get process exe file path
            string[] processPath = PrepareProcessFilePath();

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

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

            // Start debug viewer
            ApplicationLog applicationLog = new ApplicationLog();
            applicationLog.StartDebugViewer(configFilesLocation, reportFileDirectory, testScriptName);

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

            // Loads test case specific data
            TestData testData = new TestData(testDataFilePath);
            string applicationName = (string)testData.TestDataTable["ApplicationName"];
            string[] applicationsName = applicationName.Split(',');
            string pageNumber = (string)testData.TestDataTable["PageNumber"];
            string fileName = (string)testData.TestDataTable["FileName"];

            //file path to upload
            fileName = PrepareDocumentPath(testScriptName, fileName);

            CleanUpTestScripts.CleanUp_2100 cleanUp_2100 = new CleanUpTestScripts.CleanUp_2100();

            SessionHandler sessionHandler = new SessionHandler();
            Browser browser = sessionHandler.GetBrowserInstance();
            try
            {
                // Execute all clean up scripts if marked as true in xml file
                try
                {
                    // store session in session handler
                    sessionHandler.StoreBrowserInstance(browser);
                    // Execute all clean up scripts if marked as true in xml file
                    CleanUpExecution cleanUpExecution = new CleanUpExecution();
                    cleanUpExecution.ExecuteCleanUp(configFilesLocation, this.projectDirectory);
                    // get browser session from session handler
                    browser = sessionHandler.GetBrowserInstance();
                }
                catch (Exception) { }
                //// call clean up script for test script
                //try
                //{
                //    sessionHandler.StoreBrowserInstance(browser);
                //    cleanUp_2100.CleanUp2100();
                //    browser = sessionHandler.GetBrowserInstance();
                //}
                //catch (Exception) { }
                try
                {
                    SearchPage searchPageNew = new SearchPage(browser);
                    bool isMenuSelectedFlag = searchPageNew.SelectMenuItem("Search", null, null);
                    Assert.IsTrue(isMenuSelectedFlag, "Navigation to search page failed.");
                    WriteLogs(testScriptName, stepNo, "Navigation to search page passed.", "PASS", browser);
                }
                catch (Exception)
                {
                    browser = null;
                }
                if (null == browser)
                {

                    browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation);
                    LoginPage loginPage = new LoginPage(browser);
                    SearchPage searchPageNew = loginPage.Login(this.userName, this.password, this.applicationURL, this.timeout, processPath);
                    searchPageNew.LocateControls();
                    Assert.IsNotNull(searchPageNew, "Failed to login in application");
                }

                WriteLogs(testScriptName, stepNo, "Verify ILS has been enabled for the application - in prerequisite", "PASS", browser);

                stepNo++;
                SearchPage searchPage = new SearchPage(browser);
                bool isSelected = searchPage.SelectMenuItem("Admin", "User Configurations", null);
                Assert.IsTrue(isSelected, "Failed to navigate to Search page");
                WriteLogs(testScriptName, stepNo, "Go to admin tab. Select user configuration. all iSynergy users are listed", "PASS", browser);

                stepNo++;
                UserConfigurationPage userConfigurationPage = new UserConfigurationPage(browser);
                UserPermissionPage userPermissionPage = new UserPermissionPage(browser);
                userPermissionPage = userConfigurationPage.ClickAccessUserConfiguration(this.userName);
                Assert.IsNotNull(userPermissionPage, "Failed to select the key next to sysadmin user");
                WriteLogs(testScriptName, stepNo, "select the key next to sysadmin user. User permissions screen appears. ", "PASS", browser);

                stepNo++;
                IndexLevelPermissionPage indexLevelPermissionPage = new IndexLevelPermissionPage(browser);
                indexLevelPermissionPage = userPermissionPage.NavigateToIndexLevelPermissionsPage(applicationName);
                Assert.IsNotNull(indexLevelPermissionPage,"Failed to select the Configuration gear icon under ILS configuration for the application "+applicationName);
                WriteLogs(testScriptName,stepNo,"Under application Permissions, select the Configuration gear icon under ILS configuration for the application in which ILS was enabled on An index field. Index Level Permissions configuration screen appears. Each ILS enabled index field for the application should be listed. A view column with check boxes and an edit column with check boxes Should be displayed. ","PASS",browser);

                stepNo++;
                indexLevelPermissionPage = indexLevelPermissionPage.SelectViewOrEditIndexLevelPermissions("View","ST1");
                Assert.IsNotNull(indexLevelPermissionPage, "View ILS options selected");

                userPermissionPage = indexLevelPermissionPage.ClickUpdateButtonAppConfILS();
                Assert.IsNotNull(userPermissionPage, "ILS Permission Update button clicked");

                userConfigurationPage = userPermissionPage.ClickUpdateButtonUserPermission();
                Assert.IsNotNull(userConfigurationPage, "User Permission Update button clicked");
                WriteLogs(testScriptName,stepNo,"Select the index field. Check the view check box To enable. Leave edit disabled. Click update button. ","PASS",browser);

            }
            catch (Exception exception)
            {
                ExceptionCleanUp(testScriptName, stepNo, exception.Message, browser);
            }
            finally
            {
                sessionHandler.StoreBrowserInstance(browser);
                //cleanUp_2100.CleanUp2100();
                stepNo++;
                // to stop debeg viewer
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
        public void Prerequisites()
        {
            bool isMenuSelected = false;
            int stepNo = 0;
            int applicationNumber = 0;
            int indexNumber = 0;
            int fileNumber = 0;
            // Gets scriptname through reflection
            string testScriptName = GetTestScriptName();

            // Loads config data and creates a Singleton object of Configuration and loads data into generic test case variables
            GetConfigData();

            // Get process exe file path
            string[] processPath = PrepareProcessFilePath();

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

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

            // Start debug viewer
            ApplicationLog applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
            applicationLog.StartDebugViewer();

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

            string applicationName = null;

            SessionHandler sessionHandler = new SessionHandler();
            Browser browser = sessionHandler.GetBrowserInstance();
            try
            {
                if (null == browser)
                {
                    browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation);
                    LoginPage loginPage = new LoginPage(browser);
                    stepNo++;
                    SearchPage searchPageNew = loginPage.Login(this.userName, this.password, this.applicationURL, this.timeout, processPath);
                    Assert.IsNotNull(searchPageNew, "Failed to login in application");
                    WriteLogs(testScriptName, stepNo, "Login succssfull.", "PASS", browser);

                }

                SearchPage searchPage = new SearchPage(browser);
                string emailAddress = GetValuesFromXML("Prerequisite", "EmailAddress", testDataFilePath);
                string userPassword = GetValuesFromXML("Prerequisite", "Password", testDataFilePath);

                stepNo++;
                isMenuSelected = searchPage.SelectMenuItem("Admin", "User Configurations", null);
                Assert.IsTrue(isMenuSelected, "Navigation to User Configurations page failed.");
                WriteLogs(testScriptName, stepNo, "Navigation to User Configurations page passed.", "PASS", browser);

                for (int count1 = 1; count1 <= 2; count1++)
                {
                    string userNode = "User";
                    userNode = userNode + count1.ToString();
                    string user = GetValuesFromXML("Prerequisite", userNode, testDataFilePath);

                    stepNo++;
                    UserConfigurationPage userConfigurationPage = new UserConfigurationPage(browser);
                    userConfigurationPage = userConfigurationPage.VerifyUserPresent(user);

                    if (null == userConfigurationPage)
                    {
                        stepNo++;
                        userConfigurationPage = new UserConfigurationPage(browser);
                        UserDetailsPage userDetailsPage = userConfigurationPage.ClickAddUserButton();
                        Assert.IsNotNull(userDetailsPage, "Click add user failed");
                        WriteLogs(testScriptName, stepNo, "Add user button Clicked", "PASS", browser);

                        stepNo++;
                        userConfigurationPage = userDetailsPage.AddUpdateUser(user, emailAddress, userPassword,true,false);
                        Assert.IsNotNull(userConfigurationPage, "Adding user failed");
                        WriteLogs(testScriptName, stepNo, "Adding user passed", "PASS", browser);

                        stepNo++;
                        UserPermissionPage userPermissionPage = userConfigurationPage.ClickAccessUserConfiguration(user);
                        Assert.IsNotNull(userPermissionPage, "Click User aceess button failed");
                        WriteLogs(testScriptName, stepNo, "Click User aceess button passed", "PASS", browser);

                        stepNo++;
                        userPermissionPage = userPermissionPage.UncheckResetPasswordNextLoginCheckbox();
                        Assert.IsNotNull(userPermissionPage, "Uncheck Reset Password Next Login Checkbox failed");
                        WriteLogs(testScriptName, stepNo, "Uncheck Reset Password Next Login Checkbox passed", "PASS", browser);

                        stepNo++;
                        userConfigurationPage = userPermissionPage.ClickUpdateButtonUserPermission();
                        Assert.IsNotNull(userConfigurationPage, "Click Update Button User Permission failed");
                        WriteLogs(testScriptName, stepNo, "Click Update Button User Permission passed", "PASS", browser);
                    }
                    else
                    {
                        WriteLogs(testScriptName, stepNo, "User already present", "PASS", browser);
                    }
                }
                string appliactionCount = GetValuesFromXML("Prerequisite", "ApplicationCount", testDataFilePath);
                int count = Int32.Parse(appliactionCount);
                for (applicationNumber = 1; applicationNumber <= count; applicationNumber++)
                {
                    string applicationNameNode = "Application";
                    applicationNameNode = applicationNameNode + applicationNumber.ToString();
                    applicationName = GetValuesFromXML(applicationNameNode, "Name", testDataFilePath);

                    //Navigating To Applications Page
                    stepNo++;
                    isMenuSelected = searchPage.SelectMenuItem("Admin", "Applications", null);
                    Assert.IsTrue(isMenuSelected, "Navigation to application page failed.");
                    WriteLogs(testScriptName, stepNo, "Navigation to application page passed.", "PASS", browser);

                    stepNo++;
                    ApplicationPage applicationPage = new ApplicationPage(browser);
                    applicationPage = applicationPage.IsApplicationExist(applicationName);
                    if (null == applicationPage)
                    {
                        applicationPage = new ApplicationPage(browser);
                        AddApplicationPage addApplicationPage = applicationPage.ClickAddApplicationButton();
                        Assert.IsNotNull(addApplicationPage, "Click add application failed");
                        WriteLogs(testScriptName, stepNo, "Add Application Button Clicked", "PASS", browser);

                        stepNo++;
                        EditApplicationPage editApplicationPage = new EditApplicationPage(browser);
                        if (applicationNumber == 4)
                        {
                            editApplicationPage = addApplicationPage.addApplicationDetails(applicationName, applicationName, false, false, false, false, false, true, false, null);
                            Assert.IsNotNull(editApplicationPage, applicationName + " application Added Failed");
                            WriteLogs(testScriptName, stepNo, applicationName + " application Added Succesfully ", "PASS", browser);
                        }
                        else if (applicationNumber == 1 || applicationNumber == 5)
                        {
                            editApplicationPage = addApplicationPage.addApplicationDetails(applicationName, applicationName, false, false, false, false, false, false, false, null);
                            Assert.IsNotNull(editApplicationPage, applicationName + " application Added Failed");
                            WriteLogs(testScriptName, stepNo, applicationName + " application Added Succesfully ", "PASS", browser);
                        }
                        else
                        {
                            editApplicationPage = addApplicationPage.addApplicationDetails(applicationName, applicationName, true, false, false, false, false, false, false, null);
                            Assert.IsNotNull(editApplicationPage, applicationName + " application added Failed");
                            WriteLogs(testScriptName, stepNo, applicationName + " application added Succesfully ", "PASS", browser);
                        }
                        string indexCount = GetValuesFromXML(applicationNameNode, "IndexCount", testDataFilePath);
                        int count1 = Int32.Parse(indexCount);
                        //Adding Application Index
                        for (indexNumber = 1; indexNumber <= count1; indexNumber++)
                        {
                            string indexNameNade = "IndexName";
                            string indexTypeNade = "IndexType";
                            indexNameNade = indexNameNade + indexNumber.ToString();
                            indexTypeNade = indexTypeNade + indexNumber.ToString();
                            string indexName = GetValuesFromXML(applicationNameNode, indexNameNade, testDataFilePath);
                            string indexType = GetValuesFromXML(applicationNameNode, indexTypeNade, testDataFilePath);
                            stepNo++;
                            if (1 == indexNumber)
                            {
                                editApplicationPage = editApplicationPage.AddApplicationIndex(true, indexName, indexType, false, false, false, false);
                            }
                            else
                            {
                                editApplicationPage = editApplicationPage.AddApplicationIndex(false, indexName, indexType, false, false, false, false);
                            }
                            Assert.IsNotNull(editApplicationPage, "Adding application index failed");
                            WriteLogs(testScriptName, stepNo, "Index in application Added Succesfully ", "PASS", browser);
                        }
                        //Implementing Application
                        stepNo++;
                        editApplicationPage = editApplicationPage.ImplementApplication(true);
                        Assert.IsNotNull(editApplicationPage, "Implement application failed for application " + applicationName);
                        WriteLogs(testScriptName, stepNo, applicationName + " application Implemented Succesfully ", "PASS", browser);

                        //Navigating To User Configuration Page
                        stepNo++;
                        isMenuSelected = searchPage.SelectMenuItem("Admin", "User Configurations", null);
                        Assert.IsTrue(isMenuSelected, "Navigating to user configuration failed");
                        WriteLogs(testScriptName, stepNo, "Navigation to User Configurations page passed.", "PASS", browser);

                        stepNo++;
                        UserConfigurationPage userConfigurationPage = new UserConfigurationPage(browser);
                        UserPermissionPage userPermissionPage = userConfigurationPage.ClickAccessUserConfiguration(this.userName);
                        Assert.IsNotNull(userPermissionPage, "Click user Access link failed");
                        WriteLogs(testScriptName, stepNo, "Click on User Access on User Configuration Page ", "PASS", browser);

                        stepNo++;
                        ApplicationLevelPermissionPage applicationLevelPermissionPage = userPermissionPage.NavigateToApplicationConfiguration(applicationName);
                        Assert.IsNotNull(applicationLevelPermissionPage, "Click  on application configuration image failed");
                        WriteLogs(testScriptName, stepNo, "Click on Application Configuration image ", "PASS", browser);

                        stepNo++;
                        applicationLevelPermissionPage = applicationLevelPermissionPage.SelectAllAccountFuncMgnt();
                        Assert.IsNotNull(applicationLevelPermissionPage, "Select all account function management failed");
                        WriteLogs(testScriptName, stepNo, "Select All Account Management Checkbox Clicked ", "PASS", browser);

                        stepNo++;
                        applicationLevelPermissionPage = applicationLevelPermissionPage.SelectAllCabinetMgnt();
                        Assert.IsNotNull(applicationLevelPermissionPage, "Select all cabinet mangement failed");
                        WriteLogs(testScriptName, stepNo, "Select All Cabinet Management Checkbox Clicked ", "PASS", browser);

                        stepNo++;
                        userPermissionPage = applicationLevelPermissionPage.ClickUpdateButtonAppConf();
                        Assert.IsNotNull(userPermissionPage, "Update application level permissions failed");
                        WriteLogs(testScriptName, stepNo, "Update Application Level Permissions Clicked ", "PASS", browser);

                        stepNo++;
                        userConfigurationPage = userPermissionPage.ClickUpdateButtonUserPermission();
                        Assert.IsNotNull(userConfigurationPage, "Update user permissions failed");
                        WriteLogs(testScriptName, stepNo, "Update User Permissions Clicked ", "PASS", browser);

                        string user1 = GetValuesFromXML("Prerequisite", "User1", testDataFilePath);
                        string user2 = GetValuesFromXML("Prerequisite", "User2", testDataFilePath);

                        stepNo++;
                        userPermissionPage = userConfigurationPage.ClickAccessUserConfiguration(user1);
                        Assert.IsNotNull(userPermissionPage, "Click user Access link failed");
                        WriteLogs(testScriptName, stepNo, "Click on User Access on User Configuration Page ", "PASS", browser);

                        stepNo++;
                        userPermissionPage = userPermissionPage.CheckUncheckApplicationUserConf(applicationName, true);
                        Assert.IsNotNull(userPermissionPage, "Selecting Application for UserA failed");
                        WriteLogs(testScriptName, stepNo, "Selecting Application for UserA passed ", "PASS", browser);

                        stepNo++;
                        userConfigurationPage = userPermissionPage.ClickUpdateButtonUserPermission();
                        Assert.IsNotNull(userConfigurationPage, "Click Update Button failed");
                        WriteLogs(testScriptName, stepNo, "Click Update Button passed ", "PASS", browser);

                        stepNo++;
                        userPermissionPage = userConfigurationPage.ClickAccessUserConfiguration(user2);
                        Assert.IsNotNull(userPermissionPage, "Click user Access link failed");
                        WriteLogs(testScriptName, stepNo, "Click on User Access on User Configuration Page ", "PASS", browser);

                        stepNo++;
                        userPermissionPage = userPermissionPage.CheckUncheckApplicationUserConf(applicationName, true);
                        Assert.IsNotNull(userPermissionPage, "Selecting Application for UserA failed");
                        WriteLogs(testScriptName, stepNo, "Selecting Application for UserA passed ", "PASS", browser);

                        stepNo++;
                        userConfigurationPage = userPermissionPage.ClickUpdateButtonUserPermission();
                        Assert.IsNotNull(userConfigurationPage, "Click Update Button failed");
                        WriteLogs(testScriptName, stepNo, "Click Update Button passed ", "PASS", browser);
                        applicationName = GetValuesFromXML(applicationNameNode, "Name", testDataFilePath);
                        string fileCount = GetValuesFromXML(applicationNameNode, "FileCount", testDataFilePath);
                        int count2 = Int32.Parse(fileCount);
                        string sourceFolder = this.currentDirectory + this.projectDirectory + "\\" + this.testDataDirectory + "\\" + testScriptName + "\\";
                        string[] files = new string[count2];
                        for (fileNumber = 1; fileNumber <= count2; fileNumber++)
                        {
                            string fileNameNode = "FileName";
                            fileNameNode = fileNameNode + fileNumber.ToString();
                            files[fileNumber - 1] = GetValuesFromXML(applicationNameNode, fileNameNode, testDataFilePath);
                        }
                        stepNo++;
                        bool isFilesCopied = userConfigurationPage.CopyFilesToIncomingFolder(applicationName, sourceFolder, files);
                        Assert.IsTrue(isFilesCopied, "Copying files to incoming folder failed for " + applicationName);
                        WriteLogs(testScriptName, stepNo, "Copying files to incoming folder passed for " + applicationName, "PASS", browser);

                        stepNo++;
                        isMenuSelected = userConfigurationPage.SelectMenuItem("Indexing", null, null);
                        Assert.IsTrue(isMenuSelected, "Navigation to indexing page failed ");
                        WriteLogs(testScriptName, stepNo, "Navigation to indexing page passed ", "PASS", browser);

                        stepNo++;
                        IndexingPage indexingPage = new IndexingPage(browser);
                        indexingPage = indexingPage.SelectApplication(applicationName);
                        Assert.IsNotNull(indexingPage, "Select application failed for " + applicationName);
                        WriteLogs(testScriptName, stepNo, "Select application passed for " + applicationName, "PASS", browser);

                        stepNo++;
                        isMenuSelected = userConfigurationPage.SelectMenuItem("Indexing", null, null);
                        Assert.IsTrue(isMenuSelected, "Navigation to indexing page failed ");
                        WriteLogs(testScriptName, stepNo, "Navigation to indexing page passed ", "PASS", browser);

                        stepNo++;
                        indexingPage = indexingPage.SelectApplication(applicationName);
                        Assert.IsNotNull(indexingPage, "Select application failed for " + applicationName);
                        WriteLogs(testScriptName, stepNo, "Select application passed for " + applicationName, "PASS", browser);

                        stepNo++;
                        indexingPage = indexingPage.NavigateToFirstPage();
                        Assert.IsNotNull(indexingPage, "Navigation to first document failed ");
                        WriteLogs(testScriptName, stepNo, "Navigation to first document passed ", "PASS", browser);

                        string indexValeNode = "IndexValue";
                        string indexValue = GetValuesFromXML(applicationNameNode, indexValeNode, testDataFilePath);
                        if (indexValue == "null")
                        {
                            indexValue = null;
                        }
                        for (fileNumber = 1; fileNumber <= count2; fileNumber++)
                        {
                            stepNo++;
                            indexingPage = indexingPage.AddIndexDetails(indexValue, applicationName);
                            Assert.IsNotNull(indexingPage, indexValue + " adding index failed for " + applicationName);
                            WriteLogs(testScriptName, stepNo, indexValue + " adding index passed for " + applicationName, "PASS", browser);
                        }
                    }
                    else
                    {
                        stepNo++;
                        WriteLogs(testScriptName, stepNo, applicationName + " application exist", "PASS", browser);
                    }
                }

            }
            catch (Exception exception)
            {
                stepNo++;
                WriteLogs(testScriptName, stepNo, "Execution of script terminated. Exception is " + exception.Message, "FAIL", browser);
                Assert.IsTrue(false, "Execution of script terminated.");
            }
            finally
            {

                sessionHandler.StoreBrowserInstance(browser);
                stepNo++;
                // to stop debeg viewer
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }
        public void TestCaseLogin()
        {
            int stepNo = 1;

            string test = TestContext.TestName;

            // Gets scriptname through reflection
            string testScriptName = GetTestScriptName();

            // Loads config data and creates a Singleton object of Configuration and loads data into generic test case variables
            this.GetConfigData();

            // Get process exe file path
            string[] processPath = PrepareProcessFilePath();

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

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

            // Start debug viewer
            ApplicationLog applicationLog = new ApplicationLog(configFilesLocation, reportFileDirectory, testScriptName);
            applicationLog.StartDebugViewer();

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

            // Loads test case specific data
            TestData testData = new TestData(testDataFilePath);
            string resourceType = (string)testData.TestDataTable["ResourceType"];
            string provider = (string)testData.TestDataTable["Provider"];
            string resourceDescription = (string)testData.TestDataTable["ResourceDescription"];
            SessionHandler sessionHandler = new SessionHandler();
            Browser browser = sessionHandler.GetBrowserInstance();

            try
            {
                try
                {
                    // store session in session handler
                    sessionHandler.StoreBrowserInstance(browser);

                    // get browser session from session handler
                    browser = sessionHandler.GetBrowserInstance();
                }
                catch (Exception)
                { }

                VirtualMachinePage virtualMachinePage = null;
                LoginPage loginPage = null;

                try
                {

                    virtualMachinePage.LocateControls();

                }
                catch (Exception)
                {
                    browser = null;
                }

                if (null == browser)
                {

                    //Create Browser Instance
                    browser = BrowserFactory.Instance.GetBrowser(browserId, testScriptName, configFilesLocation, driverPath);
                    //Login to ComputeNext Application
                    loginPage = new LoginPage(browser);
                    virtualMachinePage = loginPage.Login(this.userName, this.password, this.applicationURL, this.timeout, processPath);
                    virtualMachinePage.LocateControls();
                    Assert.IsNotNull(virtualMachinePage, "Failed to login to ComputeNext application ");
                    WriteLogs(testScriptName, stepNo, "Login to ComputeNext Application", "Pass", browser);

                    //Select Resource Type
                    stepNo++;
                    virtualMachinePage = virtualMachinePage.SelectResourceType(resourceType);
                    Assert.IsNotNull(virtualMachinePage, "Failed to Select Resource Type ");
                    WriteLogs(testScriptName, stepNo, "Resource Type Selected", "Pass", browser);

                    stepNo++;
                    virtualMachinePage = virtualMachinePage.SelectProvider(provider);
                    Assert.IsNotNull(virtualMachinePage, "Failed To Select Provider");
                    WriteLogs(testScriptName, stepNo, "Provider Selected", "Pass", browser);

                    stepNo++;
                    virtualMachinePage = virtualMachinePage.AddResourceToWorkSpace(resourceDescription);
                    Assert.IsNotNull(virtualMachinePage, "Failed To Add Resource To Workspace");
                    WriteLogs(testScriptName, stepNo, "Resource Added To Workspace", "Pass", browser);

                    stepNo++;
                    WorkspacePage workspacePage = virtualMachinePage.clickWorkSpaceButton();
                    Assert.IsNotNull(workspacePage, "Failed To Click Workspace Button");
                    WriteLogs(testScriptName, stepNo, "Workspace Button Clicked", "Pass", browser);

                    stepNo++;
                    DashboardPage DashboardPage = workspacePage.ActivateWorkload();
                    Assert.IsNotNull(DashboardPage, "Failed To Activate Workload");
                    WriteLogs(testScriptName, stepNo, "Activate Workload", "Pass", browser);

                    stepNo++;
                    //LogOut ComputeNext Application
                    bool isLoggedOut = loginPage.LogOut();
                    Assert.IsTrue(isLoggedOut, "Failed to Log Out to ComputeNext Application");
                    WriteLogs(testScriptName, stepNo, "Log Out to ComputeNext Application", "Pass", browser);
                }

            }
            catch (Exception exception)
            {
                WriteLogs(testScriptName, stepNo, exception.Message.ToString() + " Exception Occured in " + testScriptName, "FAIL", browser);
            }
            finally
            {
                sessionHandler.StoreBrowserInstance(browser);
                HomePage homePage = new HomePage(browser);
                homePage.LogOut();
                stepNo++;
                // to stop debug viewer
                applicationLog.StopDebugViewer();
                bool isExceptionFound = applicationLog.VerifyDebugLogFiles(reportFileDirectory, testScriptName);
                if (!isExceptionFound)
                {
                    WriteLogs(testScriptName, stepNo, "Exception/error found in log file", "INFO", browser);
                }
            }
        }