Skip to content

Instantly share code, notes, and snippets.

@fdama
Created January 9, 2023 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdama/d6a595a5eca322c0d7c5e86a869dccf9 to your computer and use it in GitHub Desktop.
Save fdama/d6a595a5eca322c0d7c5e86a869dccf9 to your computer and use it in GitHub Desktop.
package com.internetBanking.testCases;
import java.io.IOException;
import java.time.Duration;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.internetBanking.pageObjects.EditCustomerPage;
import com.internetBanking.pageObjects.LoginPage;
import com.internetBanking.utilities.XLUtils;
public class TC_EditCustomer_004 extends BaseClass {
EditCustomerPage ec;
LoginPage lp;
@Test
public void EditCustomer() throws IOException {
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
driver.get(baseURL);
ec = new EditCustomerPage(driver);
lp = new LoginPage(driver);
if (lp.iframeIsExists()) {
if (lp.iframeIsVisible()) {
logger.info("GDPR popup displayed");
System.out.println("GDPR popup displayed");
lp.switchToFrame();
lp.clickAccept();
lp.switchToDefault();
}
}
lp.setUserName(username);
lp.setPassword(password);
lp.clickSubmit();
ec.clickEditCustomer();
// retrieve customer number
String path = System.getProperty("user.dir") + "\\src\\test\\java\\com\\internetBanking\\testData\\login.xls";
String customerNumber = XLUtils.getCellData(path, "Sheet1", 1, 2);
// fill cust id and submit
ec.setCustomerID(customerNumber);
ec.submit();
// edit customer
ec.custCity("Sheffield");
ec.custState("Yorkshire");
ec.submitForm();
// dismiss alert
driver.switchTo().alert().accept();
// fill cust id and submit
ec.setCustomerID(customerNumber);
ec.submit();
//Verify if successfully edited
if(ec.getCustCity().equalsIgnoreCase("Sheffield") && ec.getCustState().equalsIgnoreCase("Yorkshire")) {
Assert.assertTrue(true);
}
else {
Assert.assertTrue(false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment