Advertisement
Guest User

Untitled

a guest
Sep 9th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. package com.company;
  2.  
  3. import static org.junit.Assert.*;
  4.  
  5. import org.junit.After;
  6. import org.junit.AfterClass;
  7. import org.junit.Before;
  8. import org.junit.BeforeClass;
  9. import org.junit.Test;
  10. import com.hp.lft.sdk.*;
  11. import com.hp.lft.verifications.*;
  12. import com.hp.lft.sdk.web.*;
  13.  
  14. import unittesting.*;
  15.  
  16. public class LeanFtTest extends UnitTestClassBase {
  17.  
  18. Browser browser;
  19. BrowserType browserType = BrowserType.CHROME;
  20. String username = "Madalina";
  21. String password = "abcd";
  22.  
  23. public LeanFtTest() {
  24. //Change this constructor to private if you supply your own public constructor
  25. }
  26.  
  27. @BeforeClass
  28. public static void setUpBeforeClass() throws Exception {
  29. instance = new LeanFtTest();
  30. globalSetup(LeanFtTest.class);
  31. }
  32.  
  33. @AfterClass
  34. public static void tearDownAfterClass() throws Exception {
  35. globalTearDown();
  36. }
  37.  
  38. @Before
  39. public void setUp() throws Exception {
  40. browser = BrowserFactory.launch(browserType);
  41. browser.navigate("www.advantageonlineshopping.com");
  42. }
  43.  
  44. @After
  45. public void tearDown() throws Exception {
  46. }
  47.  
  48. @Test
  49. public void Login() throws GeneralLeanFtException {
  50.  
  51.  
  52.  
  53. WebElement userMenu = browser.describe(WebElement.class, new WebElementDescription.Builder()
  54. .accessibilityName("")
  55. .tagName("svg")
  56. .innerText("")
  57. .index(7).build());
  58.  
  59. EditField userName = browser.describe(EditField.class, new EditFieldDescription.Builder()
  60. .type("password")
  61. .tagName("INPUT")
  62. .name("password").build());
  63.  
  64. EditField userPass = browser.describe(EditField.class, new EditFieldDescription.Builder()
  65. .type("password")
  66. .tagName("INPUT")
  67. .name("password").build());
  68.  
  69.  
  70. Button signInBtn = browser.describe(Button.class, new ButtonDescription.Builder()
  71. .buttonType("button")
  72. .tagName("BUTTON")
  73. .name("SIGN IN").build());
  74.  
  75.  
  76. userMenu.click();
  77. userName.setValue(username);
  78. userPass.setValue(password);
  79. signInBtn.click();
  80. }
  81.  
  82. @Test
  83. public void CreateAccount() throws GeneralLeanFtException {
  84.  
  85. WebElement userMenu = browser.describe(WebElement.class, new WebElementDescription.Builder()
  86. .accessibilityName("")
  87. .tagName("svg")
  88. .innerText("")
  89. .index(7).build());
  90.  
  91. WebElement userNameCreate = browser.describe(EditField.class, new EditFieldDescription.Builder()
  92. .type("text")
  93. .tagName("INPUT")
  94. .name("usernameRegisterPage").build());
  95.  
  96. WebElement userPass = browser.describe(WebElement.class, new WebElementDescription.Builder()
  97. .className("")
  98. .tagName("LABEL")
  99. .innerText("Password").build());
  100.  
  101. Button createNewAccRegister = browser.describe(Button.class, new ButtonDescription.Builder()
  102. .buttonType("button")
  103. .tagName("BUTTON")
  104. .name("REGISTER").build());
  105.  
  106. WebElement confirmEmail = browser.describe(WebElement.class, new WebElementDescription.Builder()
  107. .tagName("LABEL")
  108. .innerText("Confirm password").build());
  109.  
  110. EditField createAccEmail = browser.describe(EditField.class, new EditFieldDescription.Builder()
  111. .type("text")
  112. .tagName("INPUT")
  113. .name("emailRegisterPage").build());
  114.  
  115. WebElement agreeBtn = browser.describe(WebElement.class, new WebElementDescription.Builder()
  116. .tagName("LABEL")
  117. .innerText("I agree to the www.AdvantageOnlineShopping.com Conditions of Use and Privacy Notice").build());
  118.  
  119. userMenu.click();
  120. userNameCreate.click();
  121. userPass.setValue(username);
  122. username.setValue(password);
  123. username.setValue(createAccEmail);
  124. username.setValue(createAccEmail);
  125. agreeBtn.click();
  126. createNewAccRegister.click();
  127.  
  128. }
  129.  
  130.  
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement