@Given("^I am logged in as (.*) in Salesforce$") public static void logMeAs(String UserType) throws Exception { String UserName = ""; if (UserType.equalsIgnoreCase("SalesUser")) { UserName = EnvironmentURLs.SalesUser; } else if (UserType.equalsIgnoreCase("SalesSupportUser")) { UserName = EnvironmentURLs.SalesSupportUser; } else if (UserType.equalsIgnoreCase("AdminUser")) { UserName = EnvironmentURLs.AdminUser; } else { System.out.println("User Type Unknown"); } WebNavPage.openWebPage(EnvironmentURLs.SalesforceLoginPage); WebNavPage.enterAnyTextInAFieldWithCssLocator(LoginPage.username, UserName); WebNavPage.enterAnyTextInAFieldWithCssLocator(LoginPage.password, EnvironmentURLs.Password); WebNavPage.clickALinkWithCssLocator(LoginPage.loginBTN); // Selecting NewsInternational if its not selected if (WebNavPage.getText(HomePage.orgLabel).equalsIgnoreCase("News International") != true) { WebNavPage.clickALink(HomePage.groupMenu); // WebNavPage.waitForElementToBeVisible(HomePage.orgMenu); WebNavPage.clickALink(HomePage.newIntLNK); } }
@When("^I link the Parent Account to the Child Account$") public void linkChildToParent() { WebNavPage.clickALink(AccountsPage.edit); WebNavPage.waitForElementToLoad(); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.parentAccount, parent_Account); WebNavPage.clickALink(HomePage.saveBTN); WebNavPage.waitForElementToLoad(); }
public static void createAnAccount(String AccountName) throws InterruptedException { if (!WebNavPage.elementWithXPathExists("//div[@id = 'createNewButton']")) { WebNavPage.clickALink(HomePage.activateSideMenu); } WebNavPage.clickALinkWithCssLocator(HomePage.createNewDropdown); WebNavPage.clickALinkWithCssLocator(HomePage.accountOptionFromDropdown); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.accountName, AccountName); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.phone, "0208456789"); WebNavPage.enterAnyTextInAField(AccountsPage.email, "*****@*****.**"); WebNavPage.checkACheckBox(AccountsPage.dynamicTeleTracking); WebNavPage.enterAnyTextInAField(AccountsPage.telephoneTrackingNum, "25823"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.website, "http://www.test.com"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.billingStreet, "1, Some Street"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.billingCity, "Some City"); WebNavPage.enterAnyTextInAFieldWithCssLocator(AccountsPage.billingPostcode, "E98 1XY"); WebNavPage.enterAnyTextInAField(AccountsPage.SAPId, "9777777"); WebNavPage.selectingAnOptionFromList("Car Dealer", AccountsPage.accType); WebNavPage.selectAnOptionFromAList("Key Account", AccountsPage.accSubType); WebNavPage.enterAnyTextInAField(AccountsPage.billCountry, "UK"); WebNavPage.selectingAnOptionFromList("South-East", AccountsPage.region); WebNavPage.clickALink(AccountsPage.copyBillingAddress); WebNavPage.clickALink(HomePage.saveBTN); if (WebNavPage.getText("//div[@id='00N3000000AeABd_ileinner']").contains("SF") != false) { WebNavPage.waitForElementToLoad(); } else { System.out.println( "The Dealer ID for the Account is :" + WebNavPage.getText("//div[@id='00N3000000AeABd_ileinner']")); } }