Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import static org.junit.Assert.*;
- import org.junit.After;
- import org.junit.AfterClass;
- import org.junit.Before;
- import org.junit.BeforeClass;
- import org.junit.Test;
- import com.hp.lft.sdk.*;
- import com.hp.lft.verifications.*;
- import com.hp.lft.sdk.web.*;
- import unittesting.*;
- public class LeanFtTest extends UnitTestClassBase {
- Browser browser;
- BrowserType browserType = BrowserType.CHROME;
- String username = "Madalina";
- String password = "abcd";
- public LeanFtTest() {
- //Change this constructor to private if you supply your own public constructor
- }
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- instance = new LeanFtTest();
- globalSetup(LeanFtTest.class);
- }
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- globalTearDown();
- }
- @Before
- public void setUp() throws Exception {
- browser = BrowserFactory.launch(browserType);
- browser.navigate("www.advantageonlineshopping.com");
- }
- @After
- public void tearDown() throws Exception {
- }
- @Test
- public void Login() throws GeneralLeanFtException {
- WebElement userMenu = browser.describe(WebElement.class, new WebElementDescription.Builder()
- .accessibilityName("")
- .tagName("svg")
- .innerText("")
- .index(7).build());
- EditField userName = browser.describe(EditField.class, new EditFieldDescription.Builder()
- .type("password")
- .tagName("INPUT")
- .name("password").build());
- EditField userPass = browser.describe(EditField.class, new EditFieldDescription.Builder()
- .type("password")
- .tagName("INPUT")
- .name("password").build());
- Button signInBtn = browser.describe(Button.class, new ButtonDescription.Builder()
- .buttonType("button")
- .tagName("BUTTON")
- .name("SIGN IN").build());
- userMenu.click();
- userName.setValue(username);
- userPass.setValue(password);
- signInBtn.click();
- }
- @Test
- public void CreateAccount() throws GeneralLeanFtException {
- WebElement userMenu = browser.describe(WebElement.class, new WebElementDescription.Builder()
- .accessibilityName("")
- .tagName("svg")
- .innerText("")
- .index(7).build());
- WebElement userNameCreate = browser.describe(EditField.class, new EditFieldDescription.Builder()
- .type("text")
- .tagName("INPUT")
- .name("usernameRegisterPage").build());
- WebElement userPass = browser.describe(WebElement.class, new WebElementDescription.Builder()
- .className("")
- .tagName("LABEL")
- .innerText("Password").build());
- Button createNewAccRegister = browser.describe(Button.class, new ButtonDescription.Builder()
- .buttonType("button")
- .tagName("BUTTON")
- .name("REGISTER").build());
- WebElement confirmEmail = browser.describe(WebElement.class, new WebElementDescription.Builder()
- .tagName("LABEL")
- .innerText("Confirm password").build());
- EditField createAccEmail = browser.describe(EditField.class, new EditFieldDescription.Builder()
- .type("text")
- .tagName("INPUT")
- .name("emailRegisterPage").build());
- WebElement agreeBtn = browser.describe(WebElement.class, new WebElementDescription.Builder()
- .tagName("LABEL")
- .innerText("I agree to the www.AdvantageOnlineShopping.com Conditions of Use and Privacy Notice").build());
- userMenu.click();
- userNameCreate.click();
- userPass.setValue(username);
- username.setValue(password);
- username.setValue(createAccEmail);
- username.setValue(createAccEmail);
- agreeBtn.click();
- createNewAccRegister.click();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement