コード例 #1
0
 public static void WhenIHaveLoggedIntoTheWorkspaceAsWsAdmin()
 {
     try
     {
         string browserName = WebDriver.Title.ToString(CultureInfo.InvariantCulture);
         if (browserName != "Course Enrollment")
         {
             string wsAdminUserDb = DatabaseTools.GetUsername(Enumerations.UserType.WsAdmin);
             if (wsAdminUserDb == null)
             {
                 throw new ArgumentNullException("wsAdminUserDb is NULL, Us" + "er not fullfilling his login criteria.");
             }
             string wsAdminPwdDb = DatabaseTools.GetPassword(Enumerations.UserType.WsAdmin);
             if (wsAdminPwdDb == null)
             {
                 throw new ArgumentNullException("wsAdminPwdDb is NULL, Us" + "er not fullfilling his login criteria.");
             }
             //Purpose: Credentials will be Taken From DB
             LoginPage.Login(wsAdminUserDb, wsAdminPwdDb, "workspace", "WSAdmin");
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         throw new Exception(e.ToString());
     }
 }
コード例 #2
0
 public void WhenIHaveLoggedIntoTheCourseSpaceAsCSAdmin()
 {
     try
     {
         GenericHelper.SelectDefaultWindow();
         if (!GenericHelper.IsElementPresent(By.PartialLinkText("PKT Integration")))
         {
             string wsAdminUserDb = DatabaseTools.GetUsername(Enumerations.UserType.CsAdmin);
             if (wsAdminUserDb == null)
             {
                 throw new ArgumentNullException("wsAdminUserDb is NULL, Us" + "er not fullfilling his login criteria.");
             }
             string wsAdminPwdDb = DatabaseTools.GetPassword(Enumerations.UserType.CsAdmin);
             if (wsAdminPwdDb == null)
             {
                 throw new ArgumentNullException("wsAdminPwdDb is NULL, Us" + "er not fullfilling his login criteria.");
             }
             //Purpose: Credentials will be Taken From DB
             LoginPage.Login(wsAdminUserDb, wsAdminPwdDb, "coursespace", "CSAdmin");
             GenericHelper.WaitUntillWindowAndElement("Course Enrollment", By.PartialLinkText("Publishing"));
         }
         else
         {
             return;
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         throw new Exception(e.ToString());
     }
 }
コード例 #3
0
 public static void WhenIHaveLoggedIntoTheWorkspaceAsWsTeacher()
 {
     try
     {
         string url = WebDriver.Url;
         if (url.Contains("ws") && GenericHelper.IsElementPresent(By.ClassName("ancCourseNameStuViewCls")))
         {
             ThenIselectHomeButton();
         }
         else if (url.Contains("ws") && WebDriver.Title.ToString(CultureInfo.InvariantCulture) == "Global Home")
         {
         }
         else
         {
             string wsUserDb = DatabaseTools.GetUsername(Enumerations.UserType.WsTeacher);
             if (wsUserDb == null)
             {
                 throw new ArgumentNullException("wsUserDb is NULL, Us" + "er not fulfilling his login criteria.");
             }
             string wsPwdDb = DatabaseTools.GetPassword(Enumerations.UserType.WsTeacher);
             if (wsPwdDb == null)
             {
                 throw new ArgumentNullException("wsPwdDb is NULL, Us" + "er not fulfilling his login criteria.");
             }
             //Purpose: Credentials will be Taken From DB
             LoginPage.Login(wsUserDb, wsPwdDb, "workspace", "WSTeacher");
         }
     }
     catch (Exception e)
     {
         GenericHelper.Logs(e.ToString(), "FAILED");
         throw new Exception(e.ToString());
     }
 }