Advertisement
Guest User

Untitled

a guest
May 29th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.97 KB | None | 0 0
  1. @Test
  2.     public void LogInTest() throws InterruptedException{
  3.         //INIT TEST
  4.         Settings s = Settings.getInstance();
  5.         List<String> uList = Arrays.asList(
  6.                 "buy1");
  7.         List<String> rList = Arrays.asList(
  8.                 "Administrator",
  9.                 "Dossier Manager",
  10.                 "Buyer Manager",
  11.                 "Buyer",
  12.                 "Delivery Receiver",
  13.                 "Warehouse",
  14.                 "Viewer");
  15.         List<String> oList = Arrays.asList(
  16.                 "SPF/FOD P-O en",
  17.                 "en_CA1",
  18.                 "en_CA2",
  19.                 "SPF/FOD P-O en",
  20.                 "en_CA1.1",
  21.                 "en_CA1.1.1",
  22.                 "SPF/FOD P-O en",
  23.                 "en_CA1.1",
  24.                 "en_CA1.1.1",
  25.                 "en_CA1.1",
  26.                 "en_CA1.1.1",
  27.                 "en_CA1.1.4",
  28.                 "en_CA1.1",
  29.                 "en_CA1.1.1",
  30.                 "ePROCen",
  31.                 "en_CA1.1",
  32.                 "en_CA1.1.1",
  33.                 "ePROCen",
  34.                 "en_CA1.1",
  35.                 "en_CA1.1.1",
  36.                 "ePROCen");
  37.         int index=0;
  38.         //INIT END
  39.        
  40.         //BEGIN TEST
  41.         validatePresent(By.cssSelector("li.Password:nth-child(2) > a:nth-child(1)")).click();
  42.         validatePresent(By.id("username")).sendKeys(s.getLoginUser());
  43.         validatePresent(By.id("password")).sendKeys(s.getLoginPass());
  44.         validatePresent(By.name("submit")).click();
  45.        
  46. //        validatePresent(By.cssSelector("div#Message p"));
  47. //        Arrays.asList("Administrator", "Dossier Manager", "Buyer Manager", "Buyer", "Delivery Receiver", "Warehouse", "Viewer")
  48. //            .forEach((text)->validatePresent(By.xpath("//select[@id='switchRoleId']/option[text()='"+text+"']"))
  49. //            .click());
  50. ////             .validatePresent(BySuccessAppMsg(text)));
  51. //
  52. //        Thread.sleep(1000);
  53. //        validatePresent(By.xpath("//*[@id=\"loginLoadOrgsButton\"]")).click();
  54. //        validatePresent(By.xpath("/html/body/div[5]/div[2]/div/div/p[1]/a")).click();
  55. //        validatePresent(By.xpath("//*[@id=\"loginLoadOrgsButton\"]")).click();
  56. //        validatePresent(By.xpath("/html/body/div[5]/div[2]/div/div/p[2]/a")).click();
  57.  
  58.         validatePresent(BySuccessAppMsg("You have logged in as \""+uList.get(0)+"\"."));
  59.         for (String user:rList){
  60.             validatePresent(By.xpath("//select[@id='switchRoleId']/option[text()='"+user+"']")).click();
  61.             validatePresent(BySuccessAppMsg("You have switched to user role \""+user+"\"."));
  62.             for (int i=1; i<4; i++){
  63.                 validatePresent(By.xpath("//*[@id=\"loginLoadOrgsButton\"]")).click();
  64.                 validatePresent(By.xpath("/html/body/div[5]/div[2]/div/div/p["+i+"]/a")).click();
  65.                 validatePresent(BySuccessAppMsg("You have switched to organisation \""+oList.get(index)+"\"."));
  66.                 index++;
  67.             }
  68.         }
  69.         //END TEST
  70.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement