/// <summary> /// sign in as a student /// </summary> /// <returns>Workflows</returns> public SignInOutWorkflows SignInAsStudent(AuthenticationData authenticationData = null, StudentHomeData studentHomeData = null) { Workflows.AuthenticationPage = new AuthenticationPage(); if (authenticationData == null) {//use default data authenticationData = Workflows.AuthenticationPage.InitData(); authenticationData.GetTestDataFromResxResource("UITests.Data.Login.AuthenticationResource", "student_" + this.TestConfiguration.ApplicationName, 0); Workflows.AuthenticationPage.Data = authenticationData; } else { Workflows.AuthenticationPage.InitData(authenticationData); } Workflows.HomePage = Workflows.AuthenticationPage.Login(); Workflows.StudentHomePage = new StudentHomePage(); if (studentHomeData == null) {//use default data studentHomeData = Workflows.StudentHomePage.InitData(); studentHomeData.GetTestDataFromResxResource("UITests.Data.Login.AuthenticationResource", "student_" + this.TestConfiguration.ApplicationName, 0); Workflows.StudentHomePage.Data = studentHomeData; } else { Workflows.StudentHomePage.InitData(studentHomeData); } return(this); }
/// <summary> /// sign in as a district admin (sn_qa) /// </summary> /// <returns>Workflows</returns> public SignInOutWorkflows SignInAsDistrictAdmin(AuthenticationData authenticationData = null) { Workflows.AuthenticationPage = new AuthenticationPage(); if (authenticationData == null) {//use default data authenticationData = Workflows.AuthenticationPage.InitData(); authenticationData.GetTestDataFromResxResource("UITests.Data.Login.AuthenticationResource", "districtadmin_" + this.TestConfiguration.ApplicationName, 0); Workflows.AuthenticationPage.Data = authenticationData; } else { Workflows.AuthenticationPage.InitData(authenticationData); } Workflows.HomePage = Workflows.AuthenticationPage.Login(); return(this); }
public void testAuthenticationInputAndSubmitForm() { try { this.SchoolNet().LoadWebPage(); AuthenticationPage authenticationPage = new AuthenticationPage(); AuthenticationData authenticationData = authenticationPage.InitData(); authenticationData.GetTestDataFromResxResource("UITests.Data.Login.AuthenticationResource", "valid_" + this.SchoolNet().TestConfiguration.ApplicationName, 0); //authenticationData.DistrictName = "National"; //authenticationData.Username = "******"; //authenticationData.Password = "******"; authenticationPage.Data = authenticationData; HomePage homePage = (HomePage)authenticationPage.Form.InputAndSubmitForm(); } catch (Exception e) { TestContext.WriteLine("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace); new DriverCommands().GetScreenshotAndPageSource(); throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e); } }