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 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 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); } } }