This repository was archived by the owner on Aug 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCreateFreeAccount_Action.java
More file actions
69 lines (67 loc) · 2.63 KB
/
CreateFreeAccount_Action.java
File metadata and controls
69 lines (67 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package appModules;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import pageObjects.ChangePassword_Page;
import pageObjects.Home_Page;
import pageObjects.NewAccount_Page;
import utility.Constant;
public class CreateFreeAccount_Action {
//Method to perform create free account action
public static void CreateFreeAccount(WebDriver driver, String sEmail)
{
//go to home page
Home_Page.logo(driver).click();
//clear the text field for email
Home_Page.txt_Email(driver).clear();
//Enter the value in Email text field
Home_Page.txt_Email(driver).sendKeys(sEmail);
//Click on CreateFreeAccount button
Home_Page.btn_CreateFreeAccount(driver).click();
}
//method to pass verification token and information
public static void VerifyNewAccount(WebDriver driver,String token,String pwd,String cPwd,String c)
{
//redirect to verification page from mailbox to create account
Navigation_Action.Navigate_To_HomePage(driver,Constant.URL+"/en/new_account/virtualws.html");
//enter verification token
NewAccount_Page.txt_VerificationToken(driver).sendKeys(token);
//enter password
NewAccount_Page.txt_ChoosePassword(driver).sendKeys(pwd);
//Re-enter password
NewAccount_Page.txt_ReEnterPassword(driver).sendKeys(cPwd);
//select country
Select country = NewAccount_Page.dd_Country(driver);
country.selectByValue(c);
//submit
NewAccount_Page.btn_CreateAccount(driver).click();
//check client landed on trade
Assert.assertEquals(NewAccount_Page.IsClientOnTrade(driver).getText(),"Trade");
}
public static void VerifyAccountValidation(WebDriver driver,String token,String pwd,String cPwd,String c)
{
//redirect to verification page from mailbox to create account
Navigation_Action.Navigate_To_HomePage(driver,Constant.URL+"/en/new_account/virtualws.html");
//enter verification token
NewAccount_Page.txt_VerificationToken(driver).sendKeys(token);
//enter password
NewAccount_Page.txt_ChoosePassword(driver).sendKeys(pwd);
//Re-enter password
NewAccount_Page.txt_ReEnterPassword(driver).sendKeys(cPwd);
//select country
Select country = NewAccount_Page.dd_Country(driver);
country.selectByValue(c);
//submit
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,250)", "");
NewAccount_Page.btn_CreateAccount(driver).click();
}
//method refresh page
public static void Refresh_Page(WebDriver driver)
{
driver.navigate().refresh();
}
}