Commit 5d3dd9ba authored by mrahim's avatar mrahim

bwt web automation

parent a52e5901
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
</project>
\ No newline at end of file
......@@ -11,4 +11,7 @@
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="azul-1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
# baitussalam-web-pk-usa
Baitussalam Pakistan and usa Website atuomation
This automation scripts conatains Ui automation of baitussalam Pakistan and Usa
website
# Project structure:
Contains separate pacakages for Pakistan and Usa website work
features/: Gherkin feature files with test scenarios.
hooks/: Cucumber hooks.
runners/: Cucumber test runners.
stepdefinitions/: step definition classes.
transformations/: Cucumber
# Working:
Parallel test runs.
Shared state across cucumber step definitions.
Dependency injection.
Page Object pattern.
Commonly used test utility classes
# Tools:
Maven.
Cucumber-JVM
Testng
Selenium Webdriver
# Notes:
This application contains separate runner classes for Running baitussalam Pakistan
and baitussalam usa Website
# Installation requirement:
This program doesnot require and Installation however need to update the chrome
driver in resources file according to Running system chrome version in resources
file
# Reports:
Cucumber reports will generate in Cucumber-reports under target folder.
\ No newline at end of file
......@@ -20,12 +20,6 @@
<version>4.2.2</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.testng</groupId>-->
<!-- <artifactId>testng</artifactId>-->
<!-- <version>7.6.0</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
......@@ -71,6 +65,13 @@
<version>6.6.6</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-cucumber7-jvm -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber7-jvm</artifactId>
<version>2.19.0</version>
</dependency>
</dependencies>
......
package org.example;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
\ No newline at end of file
browser=Chrome
Url=https://dev.baitussalam.org/
\ No newline at end of file
......@@ -10,7 +10,7 @@ import org.testng.annotations.DataProvider;
"json:target/cucumber-reports/cucumber.json"
},
features = {"@target/failed_scenario.txt"},
glue = {"com.example.StepDefinations"},
glue = {"com.example.stepdefinations.pakistan"},
monochrome = true,
tags = "@web"
)
......
......@@ -10,13 +10,15 @@ import org.testng.annotations.DataProvider;
"json:target/cucumber-reports/cucumber.json",
"rerun:target/failed_scenario.txt"
},
features = {"src/test/resources/Feature/AddToCart.feature"},
glue = {"com.example.StepDefinations"},
features = {"src/test/java/features/pakistan/HomePage.feature"},
glue = {"com.example.stepdefinations.pakistan"},
monochrome = true,
tags = "@web"
)
public class TestRunner extends AbstractTestNGCucumberTests {
public class TestRunnerPk extends AbstractTestNGCucumberTests {
// For parallel execution of test cases
// @Override
// @DataProvider(parallel = true)
......
package com.example;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(
plugin = {"pretty",
"html:target/cucumber-reports/cucumber.html",
"json:target/cucumber-reports/cucumber.json",
"rerun:target/failed_scenario.txt"
},
features = {"src/test/java/features/usa/USA_Website.feature"},
glue = {"com.example.stepdefinations.usa"},
monochrome = true,
tags = "@web"
)
public class TestRunnerUsa extends AbstractTestNGCucumberTests {
// For parallel execution of test cases
// @Override
// @DataProvider(parallel = true)
// public Object [][] scenarios() {
// return super.scenarios();
// }
}
\ No newline at end of file
package com.example.Utils;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
public class BaseClass {
public WebDriver driver;
public WebDriver WebDriverManager() throws IOException {
FileInputStream fis=new FileInputStream(System.getProperty("user.dir")+"//src//main//resources//global.properties");
Properties prop=new Properties();
prop.load(fis);
String url=prop.getProperty("Url");
String browser_properties=prop.getProperty("browser");
String browser_maven=System.getProperty("browser");
String browser=browser_maven!=null ?browser_maven:browser_properties;
if(driver==null) {
if(browser.equalsIgnoreCase("chrome"))
{ //For chrome browser any other browser can add their
System.setProperty("webdriver.chrome.driver", "src/main/resources/chromedriver");
DesiredCapabilities caps = new DesiredCapabilities();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
driver = new ChromeDriver(caps);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
}
// if(browser.equalsIgnoreCase("firefox"))
// {
// System.setProperty("webdriver.gecko.driver", "src/main/resources/geckodriver");
// driver= new FirefoxDriver();
// driver.manage().window().maximize();
// }
driver.get(url);
}
return driver;
}
}
package com.example.PageObjects;
package com.example.pageobjects.pakistan;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
import org.openqa.selenium.support.ui.Select;
public class AddToCartPage {
public WebDriver driver;
public AddToCartPage(WebDriver driver) {
this.driver=driver;
}
public WebDriver driver;
// public List<WebElement> itemsInCartLocator= driver.findElements(By.cssSelector(".box-cart-item h4"));
// public List<WebElement> itemsInCart() {
// return driver.findElements(By.cssSelector(".box-cart-item h4"));
// }
// public void text() {
// driver.findElement(By.cssSelector(".box-cart-item h4"));
// }
public AddToCartPage(WebDriver driver) {
this.driver = driver;
}
public void closePopup() {
driver.findElement(By.xpath("//button[@aria-label='Close']")).click();
......@@ -32,9 +24,10 @@ public class AddToCartPage {
driver.findElement(By.cssSelector("div:nth-child(3) div:nth-child(3) img:nth-child(1)")).click();
}
public void addItem() {
driver.findElement(By.cssSelector("div:nth-child(6) > div:nth-child(2) a:nth-child(3) > p:nth-child(1)")).click();
public void addToCartItem(String items) {
driver.findElement(By.xpath(String.format("//p[normalize-space()='%s']/../../a[2]/p", items))).click();
}
public void addItem2() {
driver.findElement(By.cssSelector("div:nth-child(6) > div:nth-child(5) > div > a:nth-child(3) > p")).click();
}
......@@ -50,33 +43,45 @@ public class AddToCartPage {
public WebElement donationAddedToCart(String text) {
return driver.findElement(By.xpath(String.format("//h4[contains(text(),'%s')]", text)));
}
public WebElement donationInCart(String text) {
return driver.findElement(By.xpath(String.format("//h4[normalize-space()='%s']", text)));
}
public void closeMessengerPopUp() throws InterruptedException {
Thread.sleep(8000);
driver.findElement(By.cssSelector("#fb-root > div.fb_dialog.fb_dialog_advanced > div > iframe:nth-child(1)")).click();
driver.findElement(By.cssSelector("#fb-root > div.fb_dialog.fb_dialog_advanced > div > iframe:nth-child(1)")).click();
}
public WebElement removeDonation(String donation) {
return driver.findElement(By.xpath(String.format("(//button[normalize-space()='Remove'])['%s']",donation)));
public WebElement removeDonation(String donation) {
return driver.findElement(By.xpath(String.format("(//button[normalize-space()='Remove'])['%s']", donation)));
}
public String numberOfDonation() {
return driver.findElement(By.cssSelector(".modal-body .no-of-cart-items")).getText().trim();
}
public WebElement pageHeader(String page) {
return driver.findElement(By.xpath(String.format("//h2[normalize-space()='%s']",page)));
return driver.findElement(By.xpath(String.format("//h2[normalize-space()='%s']", page)));
}
public String DonationTotalAmountInCart() {
return driver.findElement(By.cssSelector("span.cart-amount")).getText();
}
public WebElement amountInCart(String amount) {
return driver.findElement(By.xpath(String.format("(//div[@class='col-xs-5 text-right'][normalize-space()='%s'])",amount)));
return driver.findElement(By.xpath(String.format("(//div[@class='col-xs-5 text-right'][normalize-space()='%s'])", amount)));
}
public void amountAddedForDonationInCart(String amount) {
Select donationAmount = new Select(driver.findElement(By.xpath("//select[@name='amount']")));
donationAmount.selectByVisibleText(amount);
}
// public void jsExecutor(String locator) {
// WebElement element = driver.findElement(By.xpath(String.format("//button[normalize-space()='%s']",locator)));
// Actions actions = new Actions(driver);
// actions.moveToElement(element).click().perform();
// }
public WebElement enterAmountForDonationInCart() {
return driver.findElement(By.cssSelector("input[id='input_other_amount']"));
}
}
package com.example.PageObjects;
package com.example.pageobjects.pakistan;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
......@@ -7,32 +7,42 @@ import org.openqa.selenium.WebElement;
public class BayanatPage {
public WebDriver driver;
public BayanatPage(WebDriver driver) {this.driver = driver;}
public BayanatPage(WebDriver driver) {
this.driver = driver;
}
public WebElement firstNameFieldLocator() {
return driver.findElement(By.cssSelector("input[name='first_name']"));
}
public WebElement lastNameFieldLocator() {
return driver.findElement(By.cssSelector("input[name='last_name']"));
}
public WebElement emailFieldLocator() {
return driver.findElement(By.xpath("//input[@id='form_email']"));
}
public WebElement phoneFieldLocator() {
return driver.findElement(By.cssSelector("input[name='phone']"));
}
public WebElement addressFieldLocator() {
return driver.findElement(By.cssSelector("input[name='address']"));
}
public WebElement cityFieldLocator() {
return driver.findElement(By.cssSelector("input[name='city']"));
}
public WebElement countryFieldLocator() {
return driver.findElement(By.cssSelector("input[name='country']"));
}
public WebElement skillsFieldLocator() {
return driver.findElement(By.cssSelector("textarea[name='qualification']"));
}
public WebElement volunteerExperienceFieldLocator() {
return driver.findElement(By.cssSelector("textarea[name='experience']"));
}
......
package com.example.PageObjects;
package com.example.pageobjects.pakistan;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
......@@ -6,37 +6,77 @@ import org.openqa.selenium.WebElement;
public class HomePage {
public WebDriver driver;
public HomePage(WebDriver driver) {
this.driver=driver;
this.driver = driver;
}
public WebElement aboutUsButtonLocator() {
return driver.findElement(By.cssSelector("div.col-sm-3.text-center.box-about > a > img"));
}
public WebElement timeLineButtonLocator() {
return driver.findElement(By.cssSelector("div.col-sm-3.text-center.box-timeline > a > img"));
}
public WebElement contactButtonLocator() {
return driver.findElement(By.cssSelector("a:nth-child(2) > button"));
}
public WebElement featureLocator(Integer feature) {
return driver.findElement(By.cssSelector("body > div.container-fluid > div > div:nth-child("+feature+")"));
return driver.findElement(By.cssSelector("body > div.container-fluid > div > div:nth-child(" + feature + ")"));
}
public WebElement featureLearnMoreButtonLocator(String feature) {
return driver.findElement(By.xpath(String.format("//a[@href='https://dev.baitussalam.org/%s']",feature)));
return driver.findElement(By.xpath(String.format("//a[@href='https://dev.baitussalam.org/%s']", feature)));
}
public WebElement bayanListLocator(String bayan) {
return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])",bayan)));
return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])", bayan)));
}
public WebElement publicationListLocator(String publication) {
return driver.findElement(By.xpath(String.format("//span[normalize-space()='%s']",publication)));
return driver.findElement(By.xpath(String.format("//span[normalize-space()='%s']", publication)));
}
public WebElement educationProjectListLocator(String educationProject) {
return driver.findElement(By.xpath(String.format("//h5[normalize-space()='%s']",educationProject)));
return driver.findElement(By.xpath(String.format("//h5[normalize-space()='%s']", educationProject)));
}
public WebElement welfareProjectLocator(String bayan) {
return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])",bayan)));
return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])", bayan)));
}
public WebElement emailFieldForSubscription() {
return driver.findElement(By.cssSelector("input[name='email']"));
}
public WebElement successMessage() {
return driver.findElement(By.cssSelector("div[class='alert alert-success']"));
}
public WebElement socialMediaButton(String socialMedia) {
return driver.findElement(By.cssSelector(String.format("i[class='fab fa-%s']", socialMedia)));
}
public WebElement contactNameField() {
return driver.findElement(By.cssSelector("input[placeholder='Enter Name']"));
}
public WebElement contactEmailField() {
return driver.findElement(By.cssSelector("input[placeholder='Enter Email']"));
}
public WebElement contactSubjectField() {
return driver.findElement(By.cssSelector("input[placeholder='Enter Subject']"));
}
public WebElement contactPhoneField() {
return driver.findElement(By.cssSelector("input[placeholder='Enter Phone']"));
}
public WebElement messageField() {
return driver.findElement(By.cssSelector("textarea[placeholder='Enter Message']"));
}
}
package com.example.PageObjects;
package com.example.pageobjects.pakistan;
import com.example.pageobjects.usa.WebPage;
import org.openqa.selenium.WebDriver;
public class PagesObject {
......@@ -8,35 +9,41 @@ public class PagesObject {
public HomePage homePage;
public PublicationPage publicationPage;
public BayanatPage bayanatPage;
public WebPage webPage;
public WebDriver driver;
public PagesObject(WebDriver driver)
{
this.driver=driver;
public PagesObject(WebDriver driver) {
this.driver = driver;
}
public AddToCartPage getAddToCartPage(){
addToCartPage=new AddToCartPage(driver);
public AddToCartPage getAddToCartPage() {
addToCartPage = new AddToCartPage(driver);
return addToCartPage;
}
public WelfarePage getWelfarePage(){
welfarePage =new WelfarePage(driver);
public WelfarePage getWelfarePage() {
welfarePage = new WelfarePage(driver);
return welfarePage;
}
public HomePage getHomePage(){
homePage=new HomePage(driver);
public HomePage getHomePage() {
homePage = new HomePage(driver);
return homePage;
}
public PublicationPage getPublicationPage(){
publicationPage=new PublicationPage(driver);
public PublicationPage getPublicationPage() {
publicationPage = new PublicationPage(driver);
return publicationPage;
}
public BayanatPage getBayanatPage(){
bayanatPage=new BayanatPage(driver);
public BayanatPage getBayanatPage() {
bayanatPage = new BayanatPage(driver);
return bayanatPage;
}
public WebPage getWebPage() {
webPage = new WebPage(driver);
return webPage;
}
}
package com.example.PageObjects;
package com.example.pageobjects.pakistan;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
......@@ -9,10 +9,12 @@ import org.openqa.selenium.support.ui.Select;
public class PublicationPage {
public WebDriver driver;
public PublicationPage(WebDriver driver){this.driver = driver;}
public PublicationPage(WebDriver driver) {
this.driver = driver;
}
public WebElement pageHeader(String pageHeader) {
return driver.findElement(By.xpath(String.format("//a[normalize-space()='%s']", pageHeader)));
return driver.findElement(By.xpath(String.format("//a[normalize-space()='%s']", pageHeader)));
}
public void publicationType(String type) {
......@@ -25,10 +27,10 @@ public class PublicationPage {
}
public WebElement searchButton() {
return driver.findElement(By.cssSelector(".fa.fa-search"));
return driver.findElement(By.cssSelector("button[class='btn search-button']"));
}
public WebElement searchFieldLocator() {
return driver.findElement(By.cssSelector("//input[@placeholder='Click to Search']"));
return driver.findElement(By.xpath("//input[@placeholder='Click to Search']"));
}
}
package com.example.PageObjects;
package com.example.pageobjects.pakistan;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
......@@ -207,7 +207,7 @@ public class WelfarePage {
return driver.findElement(By.xpath(String.format("//label[@for='knowing_someone'][normalize-space()='%s']", radioButton)));
}
public String cnicNumber(){
public String cnicNumber() {
BigInteger maxLimit = new BigInteger("5000000000000");
Random randNum = new Random();
String len = String.valueOf(maxLimit.bitLength());
......@@ -215,14 +215,15 @@ public class WelfarePage {
return res;
}
public String mobileNumber(){
public String mobileNumber() {
BigInteger maxLimit = new BigInteger("500000000");
Random randNum = new Random();
int len = maxLimit.bitLength();
String phone = "03"+ new BigInteger(len, randNum);
String phone = "03" + new BigInteger(len, randNum);
return phone;
}
public String phoneNumber(){
public String phoneNumber() {
BigInteger maxLimit = new BigInteger("50000000000");
Random randNum = new Random();
int len = maxLimit.bitLength();
......
package com.example.pageobjects.usa;
import org.openqa.selenium.WebDriver;
public class PagesObject {
public WebPage webPage;
public WebDriver driver;
public PagesObject(WebDriver driver)
{
this.driver=driver;
}
public WebPage getWebPage(){
webPage=new WebPage(driver);
return webPage;
}
}
package com.example.pageobjects.usa;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import java.util.Iterator;
import java.util.Set;
public class WebPage {
public WebDriver driver;
public WebPage(WebDriver driver) {
this.driver = driver;
}
public By donationCauseDropDownLocator = By.cssSelector("#dropdown1");
public By donationTypeDropDownLocator = By.cssSelector("#dropdown2");
public By donationAmountLocator = By.cssSelector("#dropdown3");
public void selectDonationCause(String type) {
driver.findElement(donationCauseDropDownLocator).click();
Select donationCause = new Select(driver.findElement(By.cssSelector("#dropdown1")));
donationCause.selectByVisibleText(type);
}
public void selectDonationType(String type) {
driver.findElement(donationTypeDropDownLocator).click();
Select donationCause = new Select(driver.findElement(By.cssSelector("#dropdown2")));
donationCause.selectByVisibleText(type);
}
public WebElement paymentTypes(String payment) {
return driver.findElement(By.xpath(String.format("//label[normalize-space()='%s']", payment)));
}
public void clickButton(String buttons) {
driver.findElement(By.xpath(String.format("//button[normalize-space()='%s']", buttons))).click();
}
public WebElement titleButton(String title) {
return driver.findElement(By.xpath(String.format("//p[normalize-space()='%s']", title)));
}
public WebElement payPalButton() {
return driver.findElement(By.xpath(" //button[@type='submit']"));
}
public WebElement title(String title) {
return driver.findElement(By.xpath(String.format("//h2[normalize-space()='%s']", title)));
}
public WebElement contactTitle(String title) {
return driver.findElement(By.xpath(String.format("//h3[normalize-space()='%s']", title)));
}
public String payPalTitle() {
return driver.findElement(By.xpath("//h1[normalize-space()='Log in to PayPal']")).getText();
}
public void selectPrograms(String programs) {
WebElement menuOption = driver.findElement(By.xpath("//p[normalize-space()='Programs']"));
Actions actions = new Actions(driver);
actions.moveToElement(menuOption).perform();
driver.findElement(By.xpath(String.format("//p[normalize-space()='%s']", programs))).click();
}
public String getCurrentUrl() {
String CurrentUrl = driver.getCurrentUrl();
System.out.println(CurrentUrl);
return CurrentUrl;
}
public void switchScreen() throws InterruptedException {
Thread.sleep(2000);
Set<String> s1 = driver.getWindowHandles();
Iterator<String> i1 = s1.iterator();
String parentWindow = i1.next();
String childWindow = i1.next();
driver.switchTo().window(childWindow);
}
}
package com.example.StepDefinations;
package com.example.stepdefinations.pakistan;
import com.example.PageObjects.AddToCartPage;
import com.example.Utils.TextContextSetup;
import com.example.pageobjects.pakistan.AddToCartPage;
import com.example.utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Then;
......@@ -41,11 +41,11 @@ public class AddToCartSteps {
addToCartPage.donateNowButton();
}
@When("^I add 1000-Monthly donation to the cart$")
public void iAddItemToCart() throws InterruptedException {
@When("I add {string} donation to the cart")
public void iAddItemToCart(String addItem) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(2000);
addToCartPage.addItem();
addToCartPage.addToCartItem(addItem);
}
@When("^I add donation to the cart$")
......@@ -77,16 +77,6 @@ public class AddToCartSteps {
addToCartPage.donationAddedToCart(donation).isDisplayed();
}
// @When("^I should see the following donation added to the cart$")
// public void iShouldSeeFollowingDonationAddedToCart(DataTable donations) throws Throwable {
// AddToCartPage addToCartPage=textContextSetup.pagesObject.getAddToCartPage();
// Thread.sleep(4000);
// List<Map<String,String>> data = donations.asMaps(String.class,String.class);
// for (Map<String, String> form : data)
// {
//
// }
// }
@When("^I close the messenger popUp$")
public void messengerPopUp() throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
......@@ -141,7 +131,17 @@ public class AddToCartSteps {
addToCartPage.amountInCart(itemData.get("amount")).isDisplayed();
}
}
}
@Then("I select {string} amount for the donation")
public void iShouldSelectAmountOfDonation(String amount) {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
addToCartPage.amountAddedForDonationInCart(amount);
}
@Then("I enter amount of {string} for donation")
public void iShouldEnterAmountOfDonation(String amount) {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
addToCartPage.enterAmountForDonationInCart().clear();
addToCartPage.enterAmountForDonationInCart().sendKeys(amount);
}
}
package com.example.StepDefinations;
package com.example.stepdefinations.pakistan;
import com.example.PageObjects.BayanatPage;
import com.example.Utils.TextContextSetup;
import com.example.pageobjects.pakistan.BayanatPage;
import com.example.utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.When;
import org.testng.Assert;
......@@ -74,6 +74,6 @@ public class BayanatsPageSteps {
BayanatPage bayanatPage = textContextSetup.pagesObject.getBayanatPage();
String successMessage = bayanatPage.successAlertMessageLocator().getText();
System.out.println(successMessage);
Assert.assertEquals(successMessage,"×\nAlert!\nThank you for applying as a volunteer");
Assert.assertEquals(successMessage, "×\nAlert!\nThank you for applying as a volunteer");
}
}
package com.example.StepDefinations;
package com.example.stepdefinations.pakistan;
import com.example.PageObjects.HomePage;
import com.example.Utils.TextContextSetup;
import com.example.pageobjects.pakistan.HomePage;
import com.example.utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.openqa.selenium.Keys;
import java.util.List;
import java.util.Map;
......@@ -60,8 +61,8 @@ public class HomePageSteps {
public void i_should_see_bayanat_list(DataTable bayanList) throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
Thread.sleep(7000);
List<Map<String,String>> data = bayanList.asMaps(String.class,String.class);
for (Map<String, String> itemData : data){
List<Map<String, String>> data = bayanList.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
homePage.bayanListLocator(itemData.get("Bayanat")).isDisplayed();
}
}
......@@ -70,7 +71,7 @@ public class HomePageSteps {
public void i_should_see_publication_list(DataTable bayanList) throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
Thread.sleep(7000);
List<Map<String,String>> data = bayanList.asMaps(String.class,String.class);
List<Map<String, String>> data = bayanList.asMaps(String.class, String.class);
for (Map<String, String> itemData : data)
homePage.publicationListLocator(itemData.get("Publication")).isDisplayed();
}
......@@ -79,7 +80,7 @@ public class HomePageSteps {
public void i_should_see_education_project_list(DataTable bayanList) throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
Thread.sleep(7000);
List<Map<String,String>> data = bayanList.asMaps(String.class,String.class);
List<Map<String, String>> data = bayanList.asMaps(String.class, String.class);
for (Map<String, String> itemData : data)
homePage.educationProjectListLocator(itemData.get("Education")).isDisplayed();
}
......@@ -88,11 +89,71 @@ public class HomePageSteps {
public void i_should_see_welfare_project_list(DataTable bayanList) throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
Thread.sleep(7000);
List<Map<String,String>> data = bayanList.asMaps(String.class,String.class);
List<Map<String, String>> data = bayanList.asMaps(String.class, String.class);
for (Map<String, String> itemData : data)
homePage.welfareProjectLocator(itemData.get("Welfare Project")).isDisplayed();
}
@Then("I enter email {string} to subscribe 'BAITUSSALAMS NEWSLETTER' on home page")
public void i_enter_email_text(String email) {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
homePage.emailFieldForSubscription().sendKeys(email);
homePage.emailFieldForSubscription().sendKeys(Keys.ENTER);
}
@Then("^I should see the success message$")
public void i_Should_See_Success_Message() throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
Thread.sleep(3000);
homePage.successMessage().isDisplayed();
String successMessage = homePage.successMessage().getText();
System.out.println("Success alert " + successMessage);
}
@Then("I click on {string} to follow other social media account")
public void i_Click_Other_Social_Media_Account(String button) throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
Thread.sleep(3000);
homePage.socialMediaButton(button).click();
Thread.sleep(7000);
}
@When("I fill contact form with following data :")
public void iFillFromOfOccupationInformation(DataTable formData) {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
List<Map<String, String>> data = formData.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("name")) {
homePage.contactNameField().clear();
homePage.contactNameField().sendKeys(itemData.get("name"));
}
if (itemData.containsKey("subject")) {
homePage.contactSubjectField().clear();
homePage.contactSubjectField().sendKeys(itemData.get("subject"));
}
if (itemData.containsKey("phone")) {
homePage.contactPhoneField().clear();
homePage.contactPhoneField().sendKeys(itemData.get("phone"));
}
if (itemData.containsKey("message")) {
homePage.messageField().clear();
homePage.messageField().sendKeys(itemData.get("message"));
}
if (itemData.containsKey("email")) {
homePage.contactEmailField().clear();
String[] arrSplit = itemData.get("email").split("@");
String emailAddress = "";
while (emailAddress.length() < 5) {
emailAddress += arrSplit[0];
emailAddress += Integer.valueOf((int) (Math.random() * 99)).toString();
emailAddress += "@" + arrSplit[1];
homePage.contactEmailField().sendKeys(emailAddress);
}
}
}
}
}
package com.example.StepDefinations;
package com.example.stepdefinations.pakistan;
import com.example.PageObjects.AddToCartPage;
import com.example.Utils.TextContextSetup;
import com.example.utils.TextContextSetup;
import io.cucumber.java.After;
import io.cucumber.java.AfterStep;
import io.cucumber.java.BeforeStep;
import io.cucumber.java.Scenario;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
......@@ -16,24 +14,25 @@ import java.io.IOException;
public class Hooks {
TextContextSetup textContextSetup;
public Hooks(TextContextSetup textContextSetup){
this.textContextSetup=textContextSetup;
}
public Hooks(TextContextSetup textContextSetup) {
this.textContextSetup = textContextSetup;
}
@After
public void closingDriver() throws IOException {
textContextSetup.baseClass.WebDriverManager().quit();
}
textContextSetup.driverManager.WebDriverManager().quit();
}
@AfterStep
public void addScreenShot(Scenario scenario) throws IOException {
WebDriver driver= textContextSetup.baseClass.WebDriverManager();
if(scenario.isFailed())
{
File sourcePath=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
byte[] fileContent= FileUtils.readFileToByteArray(sourcePath);
scenario.attach(fileContent,"image/png","Error image");
}
WebDriver driver = textContextSetup.driverManager.WebDriverManager();
if (scenario.isFailed()) {
File sourcePath = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
byte[] fileContent = FileUtils.readFileToByteArray(sourcePath);
scenario.attach(fileContent, "image/png", "Error image");
}
}
}
package com.example.StepDefinations;
package com.example.stepdefinations.pakistan;
import com.example.PageObjects.PublicationPage;
import com.example.Utils.TextContextSetup;
import com.example.pageobjects.pakistan.PublicationPage;
import com.example.utils.TextContextSetup;
import io.cucumber.java.en.When;
public class PublicationPageSteps {
......@@ -14,26 +14,25 @@ public class PublicationPageSteps {
@When("I select header {string} on publication page")
public void iShouldSelectItemFromDropDownHeaderTitle(String header) throws InterruptedException {
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
Thread.sleep(300);
Thread.sleep(300);
publicationPage.pageHeader(header).click();
}
@When("I select {string} Publication Type on Subscribe for our publications on publication page")
public void iShouldSelectPublicationType(String publicationType) throws InterruptedException {
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
Thread.sleep(300);
Thread.sleep(300);
publicationPage.publicationType(publicationType);
}
@When("I enter email {string} on Subscribe for our publication modal")
public void iEnterEmailOnSubscribeForPublicationModal(String email) throws InterruptedException {
public void iEnterEmailOnSubscribeForPublicationModal(String email) {
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
Thread.sleep(300);
publicationPage.email().sendKeys(email);
}
@When("I enter {string} in Search field in order to search on publication page")
public void iSearchFromSearchBoxForPublicationPage(String searchItem){
public void iSearchFromSearchBoxForPublicationPage(String searchItem) {
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
publicationPage.searchFieldLocator().sendKeys(searchItem);
publicationPage.searchButton().click();
......
package com.example.StepDefinations;
package com.example.stepdefinations.pakistan;
import com.example.PageObjects.PublicationPage;
import com.example.PageObjects.WelfarePage;
import com.example.Utils.TextContextSetup;
import com.example.pageobjects.pakistan.PublicationPage;
import com.example.pageobjects.pakistan.WelfarePage;
import com.example.utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.When;
import org.openqa.selenium.support.ui.Select;
import java.util.List;
import java.util.Map;
import java.util.Random;
public class WelfarePageSteps {
......@@ -118,24 +118,25 @@ public class WelfarePageSteps {
}
}
if (itemData.containsKey("phoneNumber")) {
if(itemData.get("phoneNumber").equalsIgnoreCase("random")){
welfarePage.phoneFieldLocator().clear();
String phoneNumber= welfarePage.phoneNumber();
welfarePage.phoneFieldLocator().sendKeys(phoneNumber);
}else {
if (itemData.get("phoneNumber").equalsIgnoreCase("random")) {
welfarePage.phoneFieldLocator().clear();
String phoneNumber = welfarePage.phoneNumber();
welfarePage.phoneFieldLocator().sendKeys(phoneNumber);
} else {
welfarePage.phoneFieldLocator().clear();
welfarePage.phoneFieldLocator().sendKeys(itemData.get("phoneNumber"));
}}
}
}
if (itemData.containsKey("CNIC")) {
if(itemData.get("CNIC").equalsIgnoreCase("random")){
if (itemData.get("CNIC").equalsIgnoreCase("random")) {
welfarePage.cnicFieldLocator().clear();
String cnicNumber=welfarePage.cnicNumber();
String cnicNumber = welfarePage.cnicNumber();
welfarePage.cnicFieldLocator().sendKeys(cnicNumber);
} else {
welfarePage.cnicFieldLocator().clear();
welfarePage.cnicFieldLocator().sendKeys(itemData.get("CNIC"));
}
else{
welfarePage.cnicFieldLocator().clear();
welfarePage.cnicFieldLocator().sendKeys(itemData.get("CNIC"));
}}
}
if (itemData.containsKey("address")) {
welfarePage.addressFieldLocator().clear();
welfarePage.addressFieldLocator().sendKeys(itemData.get("address"));
......@@ -240,15 +241,16 @@ public class WelfarePageSteps {
List<Map<String, String>> data = formData.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("workExperience"))
{
if ((itemData.get("workExperience")).equalsIgnoreCase("Yes")) {
welfarePage.volunteerExperienceRadioButton(itemData.get("workExperience")).click();
}}
if (itemData.containsKey("workExperienceDetail")){
if (itemData.get("workExperience").equalsIgnoreCase("Yes") ){
welfarePage.volunteerExperienceDescription().sendKeys(itemData.get("workExperienceDetail"));
}}
if (itemData.containsKey("workExperience")) {
if ((itemData.get("workExperience")).equalsIgnoreCase("Yes")) {
welfarePage.volunteerExperienceRadioButton(itemData.get("workExperience")).click();
}
}
if (itemData.containsKey("workExperienceDetail")) {
if (itemData.get("workExperience").equalsIgnoreCase("Yes")) {
welfarePage.volunteerExperienceDescription().sendKeys(itemData.get("workExperienceDetail"));
}
}
if (itemData.containsKey("startWorkingDate")) {
welfarePage.workStartDate().clear();
welfarePage.workStartDate().sendKeys(itemData.get("startWorkingDate"));
......@@ -268,8 +270,8 @@ public class WelfarePageSteps {
welfarePage.monthsAvailability(itemData.get("monthlyAvailability")).click();
}
if (itemData.containsKey("dayAvailability")) {
String arr[]= itemData.get("dayAvailability").split(",");
welfarePage.daysAvailability(arr[0],arr[1]).click();
String arr[] = itemData.get("dayAvailability").split(",");
welfarePage.daysAvailability(arr[0], arr[1]).click();
}
if (itemData.containsKey("reasonForWorking")) {
welfarePage.reasonToWork().sendKeys(itemData.get("reasonForWorking"));
......
package com.example.stepdefinations.usa;
import com.example.utils.TextContextSetupUSA;
import io.cucumber.java.After;
import io.cucumber.java.AfterStep;
import io.cucumber.java.Scenario;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import java.io.File;
import java.io.IOException;
public class HooksUsa {
TextContextSetupUSA textContextSetup;
public HooksUsa(TextContextSetupUSA textContextSetup) {
this.textContextSetup = textContextSetup;
}
@After
public void closingDriver() throws IOException {
textContextSetup.driverManager.WebDriverManagerUsa().quit();
}
@AfterStep
public void addScreenShot(Scenario scenario) throws IOException {
WebDriver driver = textContextSetup.driverManager.WebDriverManager();
if (scenario.isFailed()) {
File sourcePath = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
byte[] fileContent = FileUtils.readFileToByteArray(sourcePath);
scenario.attach(fileContent, "image/png", "Error image");
}
}
}
package com.example.stepdefinations.usa;
import com.example.pageobjects.usa.WebPage;
import com.example.utils.TextContextSetupUSA;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.testng.Assert;
public class WebPageSteps {
TextContextSetupUSA textContextSetup;
public WebPageSteps(TextContextSetupUSA textContextSetup) {
this.textContextSetup = textContextSetup;
}
@When("I select donation {string} cause in 'Donation now modal' on Home page")
public void iSelectDonationCause(String type) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.selectDonationCause(type);
}
@When("I select donation {string} type in 'Donation now modal' on Home page")
public void iSelectDonationType(String type) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.selectDonationType(type);
}
@When("I select {string} payment type")
public void iSelectPayment(String paymentType) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.paymentTypes(paymentType).click();
}
@When("^I press paypal button$")
public void iPressButton() throws InterruptedException {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
Thread.sleep(1000);
webPage.payPalButton().click();
Thread.sleep(7000);
}
@When("I Enter Donation {string} amount")
public void iEnterDonationAmount(String amount) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.driver.findElement(webPage.donationAmountLocator).sendKeys(amount);
}
@When("I press {string} title button on home page")
public void iPressTitleButton(String button) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.titleButton(button).click();
}
@Then("I should see tile button is redirected to {string}")
public void iShouldSee(String title) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.title(title).isDisplayed();
}
@Then("I should see tile button is redirected to contacts {string}")
public void iShouldSeeContactsInformation(String title) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.contactTitle(title).isDisplayed();
}
@When("I hover on program and select the {string} program")
public void iSelectPrograms(String title) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.selectPrograms(title);
}
@When("I click on {string} button")
public void iClickOnButton(String button) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.clickButton(button);
}
@When("User redirected to correct website {string}")
public void iRedirectedToWebsite(String websiteUrl) {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
String currentUrl = webPage.getCurrentUrl();
Assert.assertEquals(websiteUrl, currentUrl);
}
@When("User landed on paypal {string} page")
public void iRedirectedToPaypal(String paypalTitle) throws InterruptedException {
WebPage webPage = textContextSetup.pagesObject.getWebPage();
webPage.switchScreen();
String pageTitle = webPage.payPalTitle();
System.out.println(pageTitle);
Assert.assertEquals(paypalTitle, pageTitle);
}
}
package com.example.utils;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.logging.LogType;
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
public class DriverManager {
public WebDriver driver;
public WebDriver WebDriverManager() throws IOException {
FileInputStream fis = new FileInputStream(System.getProperty("user.dir") + "//src//test//resources//global.properties");
Properties prop = new Properties();
prop.load(fis);
String urlPk = prop.getProperty("UrlPk");
String browser_properties = prop.getProperty("browser");
String browser_maven = System.getProperty("browser");
String browser = browser_maven != null ? browser_maven : browser_properties;
if (driver == null) {
//Todo: For chrome browser any other browser can add their
if (browser.equalsIgnoreCase("chrome")) {
System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver");
DesiredCapabilities caps = new DesiredCapabilities();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
driver = new ChromeDriver(caps);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
}
//Todo: Fire fox work will be included
// if(browser.equalsIgnoreCase("firefox"))
// {
// System.setProperty("webdriver.gecko.driver", "src/test/resources/geckodriver");
// driver= new FirefoxDriver();
// driver.manage().window().maximize();
// }
driver.get(urlPk);
}
return driver;
}
public WebDriver WebDriverManagerUsa() throws IOException {
FileInputStream fis = new FileInputStream(System.getProperty("user.dir") + "//src//test//resources//global.properties");
Properties prop = new Properties();
prop.load(fis);
String urlPk = prop.getProperty("UrlUsa");
String browser_properties = prop.getProperty("browser");
String browser_maven = System.getProperty("browser");
String browser = browser_maven != null ? browser_maven : browser_properties;
if (driver == null) {
if (browser.equalsIgnoreCase("chrome")) { //For chrome browser any other browser can add their
System.setProperty("webdriver.chrome.driver", "src/test/resources/chromedriver");
DesiredCapabilities caps = new DesiredCapabilities();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
driver = new ChromeDriver(caps);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
}
//Todo: Fire fox work will be included
// if(browser.equalsIgnoreCase("firefox"))
// {
// System.setProperty("webdriver.gecko.driver", "src/test/resources/geckodriver");
// driver= new FirefoxDriver();
// driver.manage().window().maximize();
// }
driver.get(urlPk);
}
return driver;
}
}
package com.example.Utils;
package com.example.utils;
import com.example.PageObjects.PagesObject;
import com.example.pageobjects.pakistan.PagesObject;
import org.openqa.selenium.WebDriver;
import java.io.IOException;
......@@ -8,9 +8,12 @@ import java.io.IOException;
public class TextContextSetup {
public WebDriver driver;
public PagesObject pagesObject;
public BaseClass baseClass;
public DriverManager driverManager;
public TextContextSetup() throws IOException {
baseClass=new BaseClass();
pagesObject=new PagesObject(baseClass.WebDriverManager());
driverManager = new DriverManager();
pagesObject = new PagesObject(driverManager.WebDriverManager());
}
}
package com.example.utils;
import com.example.pageobjects.pakistan.PagesObject;
import org.openqa.selenium.WebDriver;
import java.io.IOException;
public class TextContextSetupUSA {
public WebDriver driver;
public PagesObject pagesObject;
public DriverManager driverManager;
public TextContextSetupUSA() throws IOException {
driverManager = new DriverManager();
pagesObject = new PagesObject(driverManager.WebDriverManagerUsa());
}
}
......@@ -8,7 +8,7 @@ Feature: Add_To_Cart
@web
Scenario: To verify 1000-Monthly donation for One-time added to the cart
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "One Time" payment
And I press "Add Donation"
Then I should see "1000 - Monthly" is added to the cart
......@@ -16,7 +16,7 @@ Feature: Add_To_Cart
@web
Scenario: To verify 1000-Monthly donation on Recurring Weekly basis is added to the cart
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Weekly" payment
And I press "Add Donation"
......@@ -24,8 +24,8 @@ Feature: Add_To_Cart
@web
Scenario: To verify 1000-Monthly donation on Recurring Monthly basis is added to the cart
When I add 1000-Monthly donation to the cart
Scenario: To verify 1000-Monthly donation on Recurring Monthly basis is added to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
......@@ -34,7 +34,7 @@ Feature: Add_To_Cart
@web
Scenario: To verify 1000-Monthly donation on Recurring Yearly basis is added to the cart
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
......@@ -42,12 +42,12 @@ Feature: Add_To_Cart
@web
Scenario: To verify multiple donation of 1000-Monthly monthly added to cart
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
......@@ -58,17 +58,17 @@ Feature: Add_To_Cart
@web
Scenario:Verify user shouldn't see removed listed donation to the cart when add new donation to cart
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
......@@ -79,14 +79,15 @@ Feature: Add_To_Cart
| 1000 - Monthly |
When I remove "1" Donation to the cart
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
Then I should see You are donating to "3" cause
# <------ After remove of any donation Use see removed listed donation in the cart-------->
Scenario:To check checkout button is clickable and user is redirected to checkout page
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
......@@ -95,17 +96,17 @@ Feature: Add_To_Cart
@web
Scenario:User Should be able to see correct number of donation after removing donation to cart list
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
......@@ -114,57 +115,36 @@ Feature: Add_To_Cart
@web
Scenario:User should see correct amount of added donation in the cart
When I add 1000-Monthly donation to the cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
Then I should see total amount Rs"3000" on add to cart module
@web
Scenario:User Should be able to see correct number of donation after removing donation to cart list
When I add 1000-Monthly donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
Then I should see the following donation detail added to the cart
| title | amount |
| 1000 - Monthly | 1000 |
| 1000 - Monthly | 1000 |
| 1000 - Monthly | 1000 |
@web
Scenario:User should not be able to remove all the donation of 1000-Monthly Recurring donation to cart when remove the first donation to cart list
When I add 1000-Monthly donation to the cart
Scenario:User should be redirected to checkout page after adding donation to cart
When I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
When I press "Add Another"
And I add donation to the cart
And I add "Baitussalam Nusrat Roti Pack - Syria - Sadqa" donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
When I press "Add Another"
And I add 1000-Monthly donation to the cart
And I add "1000 - Monthly" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
......@@ -176,3 +156,17 @@ Feature: Add_To_Cart
When I press "Checkout"
Then User should be redirected to "Checkout" page
@web
Scenario:User should be redirected to checkout page after adding donation to cart in which user able to enter amount of donation
When I add "Sadaqah - Water" donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I select "Other Amount" amount for the donation
And I enter amount of "100" for donation
And I press "Add Donation"
Then I should see the following donation detail added to the cart
| title | amount |
| Sadaqah - Water | Rs. 100 |
When I press "Checkout"
Then User should be redirected to "Checkout" page
\ No newline at end of file
......@@ -6,7 +6,7 @@ Feature: Education_Page
@web
Scenario Outline: User should be redirected to correct pages when Selecting Projects from drop down
Scenario Outline: User should be redirected to correct pages when Selecting Projects from drop down On Education Page
When I select a "education" feature on home page
And I should hover on "Projects" welfare header title to select "<headerItems>" item from drop down on welfare page
Then User should be redirected to "<pages>" page
......@@ -17,7 +17,7 @@ Feature: Education_Page
@web
Scenario Outline: User should be redirected to correct pages when Selecting Events from drop down
Scenario Outline: User should be redirected to correct pages when Selecting Events from drop down On Education Page
When I select a "education" feature on home page
And I should hover on "Events" welfare header title to select "<headerItems>" item from drop down on welfare page
Then User should be redirected to "<pages>" page
......@@ -28,7 +28,7 @@ Feature: Education_Page
@web
Scenario Outline: User should be redirected to correct pages when Selecting News from drop down
Scenario Outline: User should be redirected to correct pages when Selecting News from drop down On Education Page
When I select a "education" feature on home page
And I should hover on "News" welfare header title to select "<headerItems>" item from drop down on welfare page
Then User should be redirected to "<pages>" page
......@@ -41,7 +41,7 @@ Feature: Education_Page
| Abdülhamit School | Abdülhamit School |
@web
Scenario Outline: User should be redirected to correct pages when Selecting Media from drop down
Scenario Outline: User should be redirected to correct pages when Selecting Media from drop down On Education Page
When I select a "education" feature on home page
And I should hover on "Media" welfare header title to select "<headerItems>" item from drop down on welfare page
Then User should be redirected to "<pages>" page
......@@ -50,3 +50,21 @@ Feature: Education_Page
| headerItems | pages |
| Images | Gallery |
| Videos | Gallery |
@web
Scenario: User should be redirected to correct pages when Selecting About Us On Education Page
When I select a "education" feature on home page
When I click on "About us" button on welfare page
Then User should be redirected to "About us" page
@web
Scenario: User should be redirected to correct pages when Selecting Contact Us On Education Page
When I select a "education" feature on home page
When I click on "Contact" button on welfare page
Then User should be redirected to "Contact" page
@web
Scenario: User should be redirected to correct pages when Selecting Contribute On Education Page
When I select a "education" feature on home page
When I click on "Contribute" button on welfare page
Then User should be redirected to "Ways to Donate" page
......@@ -6,10 +6,14 @@ Feature: HomePage
@web
Scenario: User should be redirected to About Us ,TimeLine pages
Scenario: User should be redirected to About Us
When I Click on About Us button on Home page
And Close the popup
Then User should be redirected to "About us" page
@web
Scenario: User should be redirected to TimeLine pages
When I Click On Our Timeline Button On home page
And Close the popup
Then User should be redirected to "Timeline" page
......@@ -19,7 +23,11 @@ Feature: HomePage
Scenario: User should be redirected to Contact page
When I Click On Our contact Button On home page
Then User should be redirected to "Contact" page
When I fill contact form with following data :
| name | email | subject | phone | message |
| testing | abc@123.com | software engineer | 031232131231231 | testing a web app |
And I press "Send your message"
# <-------- Bug after click on Send your message button -------->
@web
Scenario: User should be redirected to bayanat page
......@@ -64,5 +72,9 @@ Feature: HomePage
| RELIEF FOR BEIRUT |
@web
Scenario: User should be able to subscribe 'BAITUSSALAM NEWSLETTER'
When I enter email "abc@123.com" to subscribe 'BAITUSSALAMS NEWSLETTER' on home page
Then I should see the success message
......@@ -6,7 +6,7 @@ Feature: Publication Feature
@web
Scenario Outline: User should be able redirecting to correct pages by selecting header from publication page
Scenario Outline: User should be able redirecting to correct pages by selecting header from publication page
When I select a "publication" feature on home page
And I select header "<headerItems>" on publication page
Then User should be redirected to "<pages>" page
......@@ -22,7 +22,6 @@ Feature: Publication Feature
| Booklets by Maulana Adbul Sattar | Booklets by Maulana Adbul Sattar |
@web
Scenario: User should be able to subscribe for publication
When I select a "publication" feature on home page
......@@ -30,13 +29,12 @@ Feature: Publication Feature
And I select "Bulletin" Publication Type on Subscribe for our publications on publication page
And I enter email "abc@abc.com" on Subscribe for our publication modal
And I press "Subscribe Now"
# <-------- Bug "Subscribe now button" is not working ------>
# <-------- Bug "Subscribe now button" is not working after click its start loading not redirect to any page ------>
@web
Scenario: User should be able to search for publication
When I select a "publication" feature on home page
And I select header "Subscribe Now" on publication page
And I enter "Intellect Magazine" in Search field in order to search on publication page
Then User should be redirected to "Results for Intellect Magazine" page
# <------ Bug Always directed to search page even if page is not present(return empty page) -------->
......@@ -101,12 +101,12 @@ Feature: Welfare Feature
Then User should be redirected to "Ways to Donate" page
@web
Scenario: User should be able to become a volunteer
Scenario: User should be able to become a volunteer on welfare Page
When I select a "welfare" feature on home page
When I click on "Join Us" button on welfare page
And I fill Volunteer information in the Become a Volunteer form with the following data on welfare Page:
| fullName | DateOfBirth | email | phoneNumber | address | city | country | CNIC | mobileNumber | postalCode |
| Muhammad rahim | 2000-10-03 | test@123gmail.com | random | karachi | xyz street | Pakistan | random | random | 12313 |
| Muhammad rahim | 2000-10-03 | test@123gmail.com | random | karachi | xyz street | Pakistan | random | random | 12313 |
And I fill alternate contact information in the Become a Volunteer form with the following data on welfare Page:
| alternateFullName | relation | alternatePhoneNumber | alternateAddress | alternateCity | alternateCountry | alternateMobileNumber | alternatePostalCode | education |
| Muhammad rahim | Friend | 12323123 | abc street | karachi | Pakistan | 0312313141414 | 42233 | Graduation |
......
Feature: Add donation
@web
Scenario Outline: User should be able to make a donation
When I select "One Time" payment type
And I select donation "<cause>" cause in 'Donation now modal' on Home page
And I select donation "<type>" type in 'Donation now modal' on Home page
And I Enter Donation "200" amount
And I press paypal button
Then User landed on paypal "Log in to PayPal" page
Examples:
| cause | type |
| General | SADAQAH |
| General | ZAKAT |
| General | ATYAAT |
| General | AQEEQA |
| General | WAQF |
| General | BRANCH_ONLINE |
| Monthly Scholarship | ZAKAT |
| Construction of Schools | ATYAAT |
| Monthly USD$50 Food Basket | WAQF |
| Monthly Scholarship | SADAQAH |
| Monthly Kafalat Program | WAQF |
| Construction of Schools | ZAKAT |
| Construction of Saiban | WAQF |
@web
Scenario: User should be correctly redirected by clicking on header buttons
When I press "About Us" title button on home page
Then I should see tile button is redirected to "About Baitussalam USA"
When I press "Programs" title button on home page
Then I should see tile button is redirected to "Projects & Programs"
When I press "Programs" title button on home page
Then I should see tile button is redirected to contacts "Quick Connect"
@web
Scenario: User should be see to selected programs
When I hover on program and select the "Monthly Food Basket Distribution Program" program
Then I should see tile button is redirected to "Monthly Food Basket Distribution Program"
When I hover on program and select the "Eid-ul-Adha Qurbani (Waqf) Program" program
Then I should see tile button is redirected to "Eid-ul-Adha Qurbani (Waqf) Program"
@web
Scenario: User should be redirected to Baitussalam Pakistan by clicking on Our Partner button
When I click on "Our Partner" button
Then User redirected to correct website "https://www.baitussalam.org/"
browser=Chrome
UrlPk=https://dev.baitussalam.org/
UrlUsa=https://dev.baitussalamusa.org/
\ No newline at end of file
......@@ -3,7 +3,7 @@
<suite name="Test Suite" verbose="1">
<test name="Regression Tests">
<classes>
<class name="com.example.TestRunner">
<class name="com.example.TestRunnerPk">
</class>
</classes>
</test>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment