Commit a52e5901 authored by mrahim's avatar mrahim

project work

parents
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="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<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>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="c3a7bc8b-2204-42f3-aa01-260d573e34da" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/org/example/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/test/java/com/example/StepDefinations/AddToCartSteps.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/src/main/java/org/example/Main.java" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/java/com/example/PageObjects/AddToCartPage.java" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/java/com/example/StepDefinations/AddToCartSteps.java" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/java/com/example/TestRunner.java" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/resources/Feature/AddToCart.feature" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2AfH0CQp0h14adWjnKeNZyEHHvG" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;/Users/mrahim/Desktop/BiatussalamPakistanAutomation/src/main/resources&quot;
}
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/main/resources" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.example" />
</key>
</component>
<component name="RunManager" selected="TestNG.TestRunner">
<configuration name="Feature: AddToCart" type="CucumberJavaRunConfigurationType" factoryName="Cucumber java" temporary="true" nameIsGenerated="true">
<option name="CUCUMBER_CORE_VERSION" value="5" />
<option name="FILE_PATH" value="$PROJECT_DIR$/src/test/resources/Feature/AddToCart.feature" />
<option name="GLUE" value="com.example.StepDefinations" />
<option name="MAIN_CLASS_NAME" value="io.cucumber.core.cli.Main" />
<module name="WebTest" />
<option name="PROGRAM_PARAMETERS" value=" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter" />
<option name="SUGGESTED_NAME" value="Feature: AddToCart" />
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="io.cucumber.core.cli.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Feature: PublicationPage" type="CucumberJavaRunConfigurationType" factoryName="Cucumber java" temporary="true" nameIsGenerated="true">
<option name="CUCUMBER_CORE_VERSION" value="5" />
<option name="FILE_PATH" value="$PROJECT_DIR$/src/test/resources/Feature/PublicationPage.feature" />
<option name="GLUE" value="com.example.StepDefinations" />
<option name="MAIN_CLASS_NAME" value="io.cucumber.core.cli.Main" />
<module name="BiatussalamPakistanAutomation" />
<option name="PROGRAM_PARAMETERS" value=" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter" />
<option name="SUGGESTED_NAME" value="Feature: PublicationPage" />
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="io.cucumber.core.cli.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Scenario: To verify 1000-Monthly donation on Recurring Weekly basis is added to the cart" type="CucumberJavaRunConfigurationType" factoryName="Cucumber java" temporary="true" nameIsGenerated="true">
<option name="CUCUMBER_CORE_VERSION" value="5" />
<option name="FILE_PATH" value="$PROJECT_DIR$/src/test/resources/Feature/WelfarePage.feature" />
<option name="GLUE" value="com.example.StepDefinations" />
<option name="MAIN_CLASS_NAME" value="io.cucumber.core.cli.Main" />
<module name="BiatussalamPakistanAutomation" />
<option name="NAME_FILTER" value="^To verify 1000\-Monthly donation on Recurring Weekly basis is added to the cart$" />
<option name="PROGRAM_PARAMETERS" value=" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter --name &quot;^To verify 1000\-Monthly donation on Recurring Weekly basis is added to the cart$&quot;" />
<option name="SUGGESTED_NAME" value="Scenario: To verify 1000-Monthly donation on Recurring Weekly basis is added to the cart" />
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="io.cucumber.core.cli.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="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" type="CucumberJavaRunConfigurationType" factoryName="Cucumber java" temporary="true" nameIsGenerated="true">
<option name="CUCUMBER_CORE_VERSION" value="5" />
<option name="FILE_PATH" value="$PROJECT_DIR$/src/test/resources/Feature/AddToCart.feature" />
<option name="GLUE" value="com.example.StepDefinations" />
<option name="MAIN_CLASS_NAME" value="io.cucumber.core.cli.Main" />
<module name="WebTest" />
<option name="NAME_FILTER" value="^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$" />
<option name="PROGRAM_PARAMETERS" value=" --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm5SMFormatter --name &quot;^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$&quot;" />
<option name="SUGGESTED_NAME" value="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" />
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="io.cucumber.core.cli.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="TestRunner" type="TestNG" temporary="true" nameIsGenerated="true">
<module name="WebTest" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.example.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="com.example" />
<option name="MAIN_CLASS_NAME" value="com.example.TestRunner" />
<option name="TEST_OBJECT" value="CLASS" />
<properties />
<listeners />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="TestNG.TestRunner" />
<item itemvalue="Cucumber Java.Feature: PublicationPage" />
<item itemvalue="Cucumber Java.Scenario: To verify 1000-Monthly donation on Recurring Weekly basis is added to the cart" />
<item itemvalue="Cucumber Java.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" />
<item itemvalue="Cucumber Java.Feature: AddToCart" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="c3a7bc8b-2204-42f3-aa01-260d573e34da" name="Changes" comment="" />
<created>1655393496042</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1655393496042</updated>
</task>
<servers />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>WebTest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<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>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.3.4</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.3.4</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>7.3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>7.3.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>6.6.6</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
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
package com.example;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.DataProvider;
@CucumberOptions(
plugin = {"pretty",
"html:target/cucumber-reports/cucumber.html",
"json:target/cucumber-reports/cucumber.json"
},
features = {"@target/failed_scenario.txt"},
glue = {"com.example.StepDefinations"},
monochrome = true,
tags = "@web"
)
public class FailedTestRunner extends AbstractTestNGCucumberTests {
@Override
@DataProvider(parallel = true)
public Object [][] scenarios() {
return super.scenarios();
}
}
\ No newline at end of file
package com.example.PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
public class AddToCartPage {
public WebDriver driver;
public AddToCartPage(WebDriver driver) {
this.driver=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 void closePopup() {
driver.findElement(By.xpath("//button[@aria-label='Close']")).click();
}
public void contributeButton() {
driver.findElement(By.cssSelector("div.container a:nth-child(1) > button")).click();
}
public void donateNowButton() {
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 addItem2() {
driver.findElement(By.cssSelector("div:nth-child(6) > div:nth-child(5) > div > a:nth-child(3) > p")).click();
}
public WebElement paymentTypes(String payment) {
return driver.findElement(By.xpath(String.format("//label[normalize-space()='%s']", payment)));
}
public WebElement clickButton(String buttons) {
return driver.findElement(By.xpath(String.format("//button[normalize-space()='%s']", buttons)));
}
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();
}
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)));
}
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)));
}
// 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();
// }
}
package com.example.PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class BayanatPage {
public WebDriver 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']"));
}
public WebElement successAlertMessageLocator() {
return driver.findElement(By.xpath("//div[@class='alert alert-success alert-dismissible']"));
}
}
package com.example.PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class HomePage {
public WebDriver driver;
public HomePage(WebDriver 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+")"));
}
public WebElement featureLearnMoreButtonLocator(String 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)));
}
public WebElement publicationListLocator(String 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)));
}
public WebElement welfareProjectLocator(String bayan) {
return driver.findElement(By.xpath(String.format("(//h3[normalize-space()='%s'])",bayan)));
}
}
package com.example.PageObjects;
import org.openqa.selenium.WebDriver;
public class PagesObject {
public AddToCartPage addToCartPage;
public WelfarePage welfarePage;
public HomePage homePage;
public PublicationPage publicationPage;
public BayanatPage bayanatPage;
public WebDriver driver;
public PagesObject(WebDriver driver)
{
this.driver=driver;
}
public AddToCartPage getAddToCartPage(){
addToCartPage=new AddToCartPage(driver);
return addToCartPage;
}
public WelfarePage getWelfarePage(){
welfarePage =new WelfarePage(driver);
return welfarePage;
}
public HomePage getHomePage(){
homePage=new HomePage(driver);
return homePage;
}
public PublicationPage getPublicationPage(){
publicationPage=new PublicationPage(driver);
return publicationPage;
}
public BayanatPage getBayanatPage(){
bayanatPage=new BayanatPage(driver);
return bayanatPage;
}
}
package com.example.PageObjects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
public class PublicationPage {
public WebDriver 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)));
}
public void publicationType(String type) {
Select publicationType = new Select(driver.findElement(By.xpath("//select[@name='for']")));
publicationType.selectByVisibleText(type);
}
public WebElement email() {
return driver.findElement(By.cssSelector("#email"));
}
public WebElement searchButton() {
return driver.findElement(By.cssSelector(".fa.fa-search"));
}
public WebElement searchFieldLocator() {
return driver.findElement(By.cssSelector("//input[@placeholder='Click to Search']"));
}
}
package com.example.PageObjects;
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.math.BigInteger;
import java.util.Random;
public class WelfarePage {
public WebDriver driver;
public WelfarePage(WebDriver driver) {
this.driver = driver;
}
public By donationCauseDropDownLocator = By.xpath("//select[@id='item_name']");
public By donationTypeDropDownLocator = By.xpath("//select[@id='donation_type']");
public By donationAmountLocator = By.xpath("//input[@id='input_other_amount']");
public WebElement amountField() {
return driver.findElement(By.xpath("//input[@id='amount']"));
}
public WebElement donationSubCategory() {
return driver.findElement(By.xpath("//select[@id='donation_sub_category_id']"));
}
public WebElement donationCategory() {
return driver.findElement(By.xpath("//select[@id='donation_category_id']"));
}
public void SelectDonationCause(String type) {
driver.findElement(donationCauseDropDownLocator).click();
Select donationCause = new Select(driver.findElement(By.xpath("//select[@id='item_name']")));
donationCause.selectByVisibleText(type);
}
public void SelectDonationType(String type) {
driver.findElement(donationTypeDropDownLocator).click();
Select donationCause = new Select(driver.findElement(By.xpath("//select[@id='donation_type']")));
donationCause.selectByVisibleText(type);
}
public WebElement donationInCart(String donation) {
return driver.findElement(By.xpath(String.format("//h4[normalize-space()='%s']", donation)));
}
public WebElement amountFieldWelfare() {
return driver.findElement(By.xpath("//select[@name='amount']"));
}
public WebElement welfarePageHeaderItem(String pageHeader) {
return driver.findElement(By.xpath(String.format("//a[contains(text(),'%s')]", pageHeader)));
}
public void welfarePageHeader(String pageHeader) {
WebElement welfarePageHeader = driver.findElement(By.xpath(String.format("//a[normalize-space()='%s']", pageHeader)));
Actions action = new Actions(driver);
action.moveToElement(welfarePageHeader).perform();
}
public WebElement fullNameFieldLocator() {
return driver.findElement(By.cssSelector("input[name='full_name']"));
}
public WebElement dateOfBirthFieldLocator() {
return driver.findElement(By.cssSelector("input[name='date_of_birth']"));
}
public WebElement emailFieldLocator() {
return driver.findElement(By.cssSelector("input[name='email']"));
}
public WebElement phoneFieldLocator() {
return driver.findElement(By.cssSelector("input[name='phone']"));
}
public WebElement mobileFieldLocator() {
return driver.findElement(By.cssSelector("input[name='mobile']"));
}
public WebElement cnicFieldLocator() {
return driver.findElement(By.cssSelector("input[name='cnic']"));
}
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 postalCodeFieldLocator() {
return driver.findElement(By.cssSelector("input[name='postal_code']"));
}
public WebElement alternateFullNameFieldLocator() {
return driver.findElement(By.cssSelector("input[name='alternative_name']"));
}
public WebElement relationFieldLocator() {
return driver.findElement(By.cssSelector("input[name='relation']"));
}
public WebElement educationLocator() {
return driver.findElement(By.cssSelector("input[name='education']"));
}
public WebElement alternatePhoneFieldLocator() {
return driver.findElement(By.cssSelector("input[name='alternative_phone']"));
}
public WebElement alternateMobileFieldLocator() {
return driver.findElement(By.cssSelector("input[name='alternative_mobile']"));
}
public WebElement alternateAddressFieldLocator() {
return driver.findElement(By.cssSelector("input[name='alternative_address']"));
}
public WebElement alternateCityFieldLocator() {
return driver.findElement(By.cssSelector("input[name='alternative_city']"));
}
public WebElement alternateCountryFieldLocator() {
return driver.findElement(By.cssSelector("input[id='txt_alternative_country']"));
}
public WebElement alternatePostalCodeFieldLocator() {
return driver.findElement(By.cssSelector("input[name='alternative_postal_code']"));
}
// Occupation fields
public WebElement occupationFieldLocator() {
return driver.findElement(By.cssSelector("input[name='occupation']"));
}
public void typeOfOccupationField(String type) {
Select occupationType = new Select(driver.findElement(By.cssSelector("select[name='employment']")));
occupationType.selectByVisibleText(type);
}
public WebElement employmentName() {
return driver.findElement(By.cssSelector("input[name='employment_name']"));
}
public WebElement areaOfInterest() {
return driver.findElement(By.cssSelector("input[name='area_of_interest']"));
}
// Volunteer detail
public WebElement volunteerExperienceRadioButton(String radioButton) {
return driver.findElement(By.xpath(String.format("//label[@for='volunteer_experience'][normalize-space()='%s']", radioButton)));
}
public WebElement volunteerExperienceDescription() {
return driver.findElement(By.cssSelector("input[id='txt_volunteer_experience_description']"));
}
public WebElement workStartDate() {
return driver.findElement(By.cssSelector("input[id='txt_date_of_joining']"));
}
public WebElement workHourPerDay() {
return driver.findElement(By.cssSelector("input[id='txt_time_for_institution']"));
}
public WebElement languageProficiency() {
return driver.findElement(By.xpath("//input[@id='txt_language']"));
}
public WebElement timeToVolunteerToggle(String radioButton) {
return driver.findElement(By.xpath(String.format("//label[@for='volunteer_time'][normalize-space()='%s']", radioButton)));
}
public WebElement monthsAvailability(String month) {
return driver.findElement(By.xpath(String.format("//input[@value='%s']", month)));
}
public WebElement daysAvailability(String day, String quarter) {
return driver.findElement(By.cssSelector(String.format("input[value='%s'][name='availability_%s[]']", day, quarter)));
}
public WebElement reasonToWork() {
return driver.findElement(By.cssSelector("input[id='txt_working_reason']"));
}
public WebElement fieldToPerform() {
return driver.findElement(By.cssSelector("input[id='txt_field_of_interest']"));
}
public WebElement drivingLicenseAvailability(String radioButton) {
return driver.findElement(By.xpath(String.format("//label[@for='driving_license'][normalize-space()='%s']", radioButton)));
}
public WebElement knownWorkToggle(String radioButton) {
return driver.findElement(By.xpath(String.format("//label[@for='knowing_someone'][normalize-space()='%s']", radioButton)));
}
public String cnicNumber(){
BigInteger maxLimit = new BigInteger("5000000000000");
Random randNum = new Random();
String len = String.valueOf(maxLimit.bitLength());
String res = String.valueOf(new BigInteger(Integer.parseInt(len), randNum));
return res;
}
public String mobileNumber(){
BigInteger maxLimit = new BigInteger("500000000");
Random randNum = new Random();
int len = maxLimit.bitLength();
String phone = "03"+ new BigInteger(len, randNum);
return phone;
}
public String phoneNumber(){
BigInteger maxLimit = new BigInteger("50000000000");
Random randNum = new Random();
int len = maxLimit.bitLength();
String phone = String.valueOf(new BigInteger(len, randNum));
return phone;
}
}
package com.example.StepDefinations;
import com.example.PageObjects.AddToCartPage;
import com.example.Utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import org.testng.Assert;
import java.util.List;
import java.util.Map;
public class AddToCartSteps {
TextContextSetup textContextSetup;
public AddToCartSteps(TextContextSetup textContextSetup) {
this.textContextSetup = textContextSetup;
}
AddToCartPage addToCartPage;
@And("Close the popup")
public void closePopUp() throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(3000);
addToCartPage.closePopup();
}
@When("^Click on Contribute button$")
public void iClickOnContributeButton() {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
addToCartPage.contributeButton();
}
@When("^Click on Donate Now$")
public void iClickOnDonateNow() {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
addToCartPage.donateNowButton();
}
@When("^I add 1000-Monthly donation to the cart$")
public void iAddItemToCart() throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(2000);
addToCartPage.addItem();
}
@When("^I add donation to the cart$")
public void iAddItem2ToCart() throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(2000);
addToCartPage.addItem2();
}
@When("I select {string} payment")
public void iSelectPayment(String paymentType) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(2000);
addToCartPage.paymentTypes(paymentType).click();
}
@When("I press {string}")
public void iPressButton(String button) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(1000);
addToCartPage.clickButton(button).click();
Thread.sleep(4000);
}
@When("I should see {string} is added to the cart")
public void iShouldSeeDonationAddedToCart(String donation) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(1000);
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();
Thread.sleep(7000);
addToCartPage.closeMessengerPopUp();
}
@When("I remove {string} Donation to the cart")
public void iRemoveDonationToCart(String donation) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(1000);
addToCartPage.removeDonation(donation).click();
}
@Then("I should see You are donating to {string} cause")
public void iShouldSeeNumberOfDonationAddedToCart(String donation) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
String donationCount = donation;
Thread.sleep(2000);
String actual = addToCartPage.numberOfDonation();
System.out.println("Visible On Web : " + actual);
Assert.assertEquals(donationCount, actual);
}
@Then("User should be redirected to {string} page")
public void iShouldSeeCheckOutPage(String page) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
Thread.sleep(2000);
addToCartPage.pageHeader(page).isDisplayed();
}
@Then("I should see total amount Rs{string} on add to cart module")
public void iShouldSeeTotalAmountOnCartModule(String amount) throws InterruptedException {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
String totalAmount = amount;
Thread.sleep(2000);
String actual = addToCartPage.DonationTotalAmountInCart();
System.out.println("Visible On Web : " + actual);
Assert.assertEquals(totalAmount, actual);
}
@When("^I should see the following donation detail added to the cart$")
public void iShouldSeeFollowingDonationAmountAddedToCart(DataTable donations) {
AddToCartPage addToCartPage = textContextSetup.pagesObject.getAddToCartPage();
List<Map<String, String>> data = donations.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("title")) {
addToCartPage.donationInCart(itemData.get("title")).isDisplayed();
}
if (itemData.containsKey("amount")) {
addToCartPage.amountInCart(itemData.get("amount")).isDisplayed();
}
}
}
}
package com.example.StepDefinations;
import com.example.PageObjects.BayanatPage;
import com.example.Utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.When;
import org.testng.Assert;
import java.util.List;
import java.util.Map;
public class BayanatsPageSteps {
TextContextSetup textContextSetup;
public BayanatsPageSteps(TextContextSetup textContextSetup) {
this.textContextSetup = textContextSetup;
}
@When("I fill the Become a Volunteer form with the following data:")
public void iFillFromOfBecomeAVolunteerForm(DataTable formData) {
BayanatPage bayanatPage = textContextSetup.pagesObject.getBayanatPage();
List<Map<String, String>> data = formData.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("firstName")) {
bayanatPage.firstNameFieldLocator().clear();
bayanatPage.firstNameFieldLocator().sendKeys(itemData.get("firstName"));
}
if (itemData.containsKey("lastName")) {
bayanatPage.lastNameFieldLocator().click();
bayanatPage.lastNameFieldLocator().sendKeys(itemData.get("lastName"));
}
if (itemData.containsKey("email")) {
bayanatPage.emailFieldLocator().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];
bayanatPage.emailFieldLocator().sendKeys(emailAddress);
}
}
if (itemData.containsKey("phoneNumber")) {
bayanatPage.phoneFieldLocator().clear();
bayanatPage.phoneFieldLocator().sendKeys(itemData.get("phoneNumber"));
}
if (itemData.containsKey("address")) {
bayanatPage.addressFieldLocator().clear();
bayanatPage.addressFieldLocator().sendKeys(itemData.get("address"));
}
if (itemData.containsKey("city")) {
bayanatPage.cityFieldLocator().clear();
bayanatPage.cityFieldLocator().sendKeys(itemData.get("city"));
}
if (itemData.containsKey("country")) {
bayanatPage.countryFieldLocator().clear();
bayanatPage.countryFieldLocator().sendKeys(itemData.get("country"));
}
if (itemData.containsKey("skillsOrQualification")) {
bayanatPage.skillsFieldLocator().clear();
bayanatPage.skillsFieldLocator().sendKeys(itemData.get("skillsOrQualification"));
}
if (itemData.containsKey("volunteeringExperience")) {
bayanatPage.volunteerExperienceFieldLocator().clear();
bayanatPage.volunteerExperienceFieldLocator().sendKeys(itemData.get("volunteeringExperience"));
}
}
}
@When("^I Should see success message on become a volunteer page$")
public void iFillFromOfBecomeAVolunteerForm() {
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");
}
}
package com.example.StepDefinations;
import com.example.PageObjects.HomePage;
import com.example.Utils.TextContextSetup;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.util.List;
import java.util.Map;
public class HomePageSteps {
TextContextSetup textContextSetup;
public HomePageSteps(TextContextSetup textContextSetup) {
this.textContextSetup = textContextSetup;
}
@When("I Click on About Us button on Home page")
public void i_click_on_about_us_button_on_home_page() {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
homePage.aboutUsButtonLocator().click();
}
@When("I Click On Our Timeline Button On home page")
public void i_click_on_our_timeline_button_on_home_page() {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
homePage.timeLineButtonLocator().click();
}
@When("I Click On Our contact Button On home page")
public void i_click_on_our_contact_button_on_home_page() {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
homePage.contactButtonLocator().click();
}
@When("I select a {string} feature on home page")
public void i_select_feature(String feature) throws InterruptedException {
HomePage homePage = textContextSetup.pagesObject.getHomePage();
if (feature.equalsIgnoreCase("welfare")) {
homePage.featureLocator(1).click();
homePage.featureLearnMoreButtonLocator(feature).click();
}
if (feature.equalsIgnoreCase("education")) {
homePage.featureLocator(2).click();
homePage.featureLearnMoreButtonLocator(feature).click();
}
if (feature.equalsIgnoreCase("publication")) {
homePage.featureLocator(3).click();
homePage.featureLearnMoreButtonLocator(feature).click();
}
if (feature.equalsIgnoreCase("bayanat")) {
homePage.featureLocator(4).click();
homePage.featureLearnMoreButtonLocator(feature).click();
}
}
@Then("^I should see the following bayanat on bayan page:$")
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){
homePage.bayanListLocator(itemData.get("Bayanat")).isDisplayed();
}
}
@Then("^I should see the following publication on Publication page:$")
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);
for (Map<String, String> itemData : data)
homePage.publicationListLocator(itemData.get("Publication")).isDisplayed();
}
@Then("^I should see the following education projects on Education page:$")
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);
for (Map<String, String> itemData : data)
homePage.educationProjectListLocator(itemData.get("Education")).isDisplayed();
}
@Then("^I should see the following welfare project on Welfare page:$")
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);
for (Map<String, String> itemData : data)
homePage.welfareProjectLocator(itemData.get("Welfare Project")).isDisplayed();
}
}
package com.example.StepDefinations;
import com.example.PageObjects.AddToCartPage;
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;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import java.io.File;
import java.io.IOException;
public class Hooks {
TextContextSetup textContextSetup;
public Hooks(TextContextSetup textContextSetup){
this.textContextSetup=textContextSetup;
}
@After
public void closingDriver() throws IOException {
textContextSetup.baseClass.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");
}
}
}
package com.example.StepDefinations;
import com.example.PageObjects.PublicationPage;
import com.example.Utils.TextContextSetup;
import io.cucumber.java.en.When;
public class PublicationPageSteps {
TextContextSetup textContextSetup;
public PublicationPageSteps(TextContextSetup textContextSetup) {
this.textContextSetup = textContextSetup;
}
@When("I select header {string} on publication page")
public void iShouldSelectItemFromDropDownHeaderTitle(String header) throws InterruptedException {
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
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);
publicationPage.publicationType(publicationType);
}
@When("I enter email {string} on Subscribe for our publication modal")
public void iEnterEmailOnSubscribeForPublicationModal(String email) throws InterruptedException {
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){
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
publicationPage.searchFieldLocator().sendKeys(searchItem);
publicationPage.searchButton().click();
}
}
package com.example.StepDefinations;
import com.example.PageObjects.PublicationPage;
import com.example.PageObjects.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 {
TextContextSetup textContextSetup;
public WelfarePageSteps(TextContextSetup textContextSetup) {
this.textContextSetup = textContextSetup;
}
@Given("I select {string} Donation category form dropdown on welfare page")
public void i_select_donation_category_form_dropdown_on_welfare_page(String DonationCategory) throws InterruptedException {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
Thread.sleep(4000);
Select Donation = new Select(welfarePage.donationCategory());
Donation.selectByVisibleText(DonationCategory);
}
@Given("I select {string} Sub Donation category form dropdown on welfare page")
public void i_select_sub_donation_category_form_dropdown_on_welfare_page(String subDonationCategory) throws InterruptedException {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
Thread.sleep(4000);
Select subDonation = new Select(welfarePage.donationSubCategory());
subDonation.selectByVisibleText(subDonationCategory);
}
@Given("I fill {string} in Amount field on welfare page")
public void i_fill_in_in_amount_field_on_welfare_page(String amount) throws InterruptedException {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
Thread.sleep(4000);
String attr = welfarePage.amountField().getAttribute("readonly");
welfarePage.amountField().sendKeys(amount);
// Thread.sleep(4000);
// System.out.println("attribute : "+attr);
// if (attr.equalsIgnoreCase("null")){
// welfarePage.amountField().sendKeys(amount);
// }
}
@When("I select donation {string} cause in 'Donation now modal' on Home page")
public void iSelectDonationCause(String type) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
welfarePage.SelectDonationCause(type);
}
@When("I select donation {string} type in 'Donation now modal' on Home page")
public void iSelectDonationType(String type) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
welfarePage.SelectDonationType(type);
}
@When("I Enter Donation {string} amount")
public void iEnterDonationAmount(String amount) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
Select selectAmount = new Select(welfarePage.amountFieldWelfare());
selectAmount.selectByVisibleText(amount);
}
@When("I should see the {string} Donation is added to the cart")
public void iShouldSeeDonationAddedToCart(String donation) throws InterruptedException {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
Thread.sleep(3000);
welfarePage.donationInCart(donation).isDisplayed();
}
@When("I should hover on {string} welfare header title to select {string} item from drop down on welfare page")
public void iShouldSelectItemFromDropDownHeaderTitle(String header, String headerItem) throws InterruptedException {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
Thread.sleep(300);
welfarePage.welfarePageHeader(header);
Thread.sleep(3000);
welfarePage.welfarePageHeaderItem(headerItem).click();
}
@When("I click on {string} button on welfare page")
public void iShouldSelectItemFromDropDownHeaderTitle(String header) throws InterruptedException {
PublicationPage publicationPage = textContextSetup.pagesObject.getPublicationPage();
Thread.sleep(300);
publicationPage.pageHeader(header).click();
}
@When("I fill Volunteer information in the Become a Volunteer form with the following data on welfare Page:")
public void iFillFromOfVolunteerInformation(DataTable formData) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
List<Map<String, String>> data = formData.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("fullName")) {
welfarePage.fullNameFieldLocator().clear();
welfarePage.fullNameFieldLocator().sendKeys(itemData.get("fullName"));
}
if (itemData.containsKey("DateOfBirth")) {
welfarePage.dateOfBirthFieldLocator().clear();
welfarePage.dateOfBirthFieldLocator().sendKeys(itemData.get("DateOfBirth"));
}
if (itemData.containsKey("email")) {
welfarePage.emailFieldLocator().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];
welfarePage.emailFieldLocator().sendKeys(emailAddress);
}
}
if (itemData.containsKey("phoneNumber")) {
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")){
welfarePage.cnicFieldLocator().clear();
String cnicNumber=welfarePage.cnicNumber();
welfarePage.cnicFieldLocator().sendKeys(cnicNumber);
}
else{
welfarePage.cnicFieldLocator().clear();
welfarePage.cnicFieldLocator().sendKeys(itemData.get("CNIC"));
}}
if (itemData.containsKey("address")) {
welfarePage.addressFieldLocator().clear();
welfarePage.addressFieldLocator().sendKeys(itemData.get("address"));
}
if (itemData.containsKey("city")) {
welfarePage.cityFieldLocator().clear();
welfarePage.cityFieldLocator().sendKeys(itemData.get("city"));
}
if (itemData.containsKey("country")) {
welfarePage.countryFieldLocator().clear();
welfarePage.countryFieldLocator().sendKeys(itemData.get("country"));
}
if (itemData.containsKey("mobileNumber")) {
if (itemData.get("mobileNumber").equalsIgnoreCase("random")) {
welfarePage.mobileFieldLocator().clear();
String mobileNumber = welfarePage.mobileNumber();
welfarePage.mobileFieldLocator().sendKeys(mobileNumber);
} else {
welfarePage.mobileFieldLocator().clear();
welfarePage.mobileFieldLocator().sendKeys(itemData.get("mobileNumber"));
}
}
if (itemData.containsKey("postalCode")) {
welfarePage.postalCodeFieldLocator().clear();
welfarePage.postalCodeFieldLocator().sendKeys(itemData.get("postalCode"));
}
}
}
@When("I fill alternate contact information in the Become a Volunteer form with the following data on welfare Page:")
public void iFillFromOfAlternateContactInformation(DataTable formData) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
List<Map<String, String>> data = formData.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("alternateFullName")) {
welfarePage.alternateFullNameFieldLocator().clear();
welfarePage.alternateFullNameFieldLocator().sendKeys(itemData.get("alternateFullName"));
}
if (itemData.containsKey("relation")) {
welfarePage.relationFieldLocator().clear();
welfarePage.relationFieldLocator().sendKeys(itemData.get("relation"));
}
if (itemData.containsKey("education")) {
welfarePage.educationLocator().clear();
welfarePage.educationLocator().sendKeys(itemData.get("education"));
}
if (itemData.containsKey("alternatePhoneNumber")) {
welfarePage.alternatePhoneFieldLocator().clear();
welfarePage.alternatePhoneFieldLocator().sendKeys(itemData.get("alternatePhoneNumber"));
}
if (itemData.containsKey("alternateAddress")) {
welfarePage.alternateAddressFieldLocator().clear();
welfarePage.alternateAddressFieldLocator().sendKeys(itemData.get("alternateAddress"));
}
if (itemData.containsKey("alternateCity")) {
welfarePage.alternateCityFieldLocator().clear();
welfarePage.alternateCityFieldLocator().sendKeys(itemData.get("alternateCity"));
}
if (itemData.containsKey("alternateCountry")) {
welfarePage.alternateCountryFieldLocator().clear();
welfarePage.alternateCountryFieldLocator().sendKeys(itemData.get("alternateCountry"));
}
if (itemData.containsKey("alternateMobileNumber")) {
welfarePage.alternateMobileFieldLocator().clear();
welfarePage.alternateMobileFieldLocator().sendKeys(itemData.get("alternateMobileNumber"));
}
if (itemData.containsKey("alternatePostalCode")) {
welfarePage.alternatePostalCodeFieldLocator().clear();
welfarePage.alternatePostalCodeFieldLocator().sendKeys(itemData.get("alternatePostalCode"));
}
}
}
@When("I fill occupation information in the Become a Volunteer form with the following data on welfare Page:")
public void iFillFromOfOccupationInformation(DataTable formData) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
List<Map<String, String>> data = formData.asMaps(String.class, String.class);
for (Map<String, String> itemData : data) {
if (itemData.containsKey("Occupation")) {
welfarePage.occupationFieldLocator().clear();
welfarePage.occupationFieldLocator().sendKeys(itemData.get("Occupation"));
}
if (itemData.containsKey("typeOfEmployment")) {
welfarePage.typeOfOccupationField(itemData.get("typeOfEmployment"));
}
if (itemData.containsKey("employmentName")) {
welfarePage.employmentName().clear();
welfarePage.employmentName().sendKeys(itemData.get("employmentName"));
}
if (itemData.containsKey("areaOfInterest")) {
welfarePage.areaOfInterest().clear();
welfarePage.areaOfInterest().sendKeys(itemData.get("areaOfInterest"));
}
}
}
@When("I fill Voluntarism Details in the Become a Volunteer form with the following data on welfare Page:")
public void iFillVolunteerDetail(DataTable formData) {
WelfarePage welfarePage = textContextSetup.pagesObject.getWelfarePage();
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("startWorkingDate")) {
welfarePage.workStartDate().clear();
welfarePage.workStartDate().sendKeys(itemData.get("startWorkingDate"));
}
if (itemData.containsKey("workingHourPerDay")) {
welfarePage.workHourPerDay().clear();
welfarePage.workHourPerDay().sendKeys(itemData.get("workingHourPerDay"));
}
if (itemData.containsKey("proficiencyInLanguage")) {
welfarePage.languageProficiency().clear();
welfarePage.languageProficiency().sendKeys(itemData.get("proficiencyInLanguage"));
}
if (itemData.containsKey("timeDetail")) {
welfarePage.timeToVolunteerToggle(itemData.get("timeDetail")).click();
}
if (itemData.containsKey("monthlyAvailability")) {
welfarePage.monthsAvailability(itemData.get("monthlyAvailability")).click();
}
if (itemData.containsKey("dayAvailability")) {
String arr[]= itemData.get("dayAvailability").split(",");
welfarePage.daysAvailability(arr[0],arr[1]).click();
}
if (itemData.containsKey("reasonForWorking")) {
welfarePage.reasonToWork().sendKeys(itemData.get("reasonForWorking"));
}
if (itemData.containsKey("preferredField")) {
welfarePage.fieldToPerform().sendKeys(itemData.get("preferredField"));
}
if (itemData.containsKey("haveDrivingLicense")) {
welfarePage.drivingLicenseAvailability(itemData.get("haveDrivingLicense")).click();
}
if (itemData.containsKey("didKnownPersonWorking")) {
welfarePage.knownWorkToggle(itemData.get("didKnownPersonWorking")).click();
}
}
}
}
package com.example;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.DataProvider;
@CucumberOptions(
plugin = {"pretty",
"html:target/cucumber-reports/cucumber.html",
"json:target/cucumber-reports/cucumber.json",
"rerun:target/failed_scenario.txt"
},
features = {"src/test/resources/Feature/AddToCart.feature"},
glue = {"com.example.StepDefinations"},
monochrome = true,
tags = "@web"
)
public class TestRunner extends AbstractTestNGCucumberTests {
// @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.Utils;
import com.example.PageObjects.PagesObject;
import org.openqa.selenium.WebDriver;
import java.io.IOException;
public class TextContextSetup {
public WebDriver driver;
public PagesObject pagesObject;
public BaseClass baseClass;
public TextContextSetup() throws IOException {
baseClass=new BaseClass();
pagesObject=new PagesObject(baseClass.WebDriverManager());
}
}
Feature: Add_To_Cart
Background:
When Close the popup
And I close the messenger popUp
And Click on Contribute button
And Click on Donate Now
@web
Scenario: To verify 1000-Monthly donation for One-time added 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
@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
And I select "Recurring" payment
And I select "Weekly" payment
And I press "Add Donation"
Then I should see "1000 - Monthly" is added to the 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
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
Then I should see "1000 - Monthly" is added to the 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
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
Then I should see "1000 - Monthly" is added to the cart
@web
Scenario: To verify multiple donation of 1000-Monthly monthly added 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 1000-Monthly donation to the cart
And I select "Recurring" payment
And I select "Yearly" payment
And I press "Add Donation"
Then I should see the following donation detail added to the cart
| title |
| 1000 - Monthly |
| 1000 - Monthly |
@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
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 |
| 1000 - Monthly |
| 1000 - Monthly |
| 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 select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
Then I should see You are donating to "3" cause
Scenario:To check checkout button is clickable and user is redirected to checkout page
When I add 1000-Monthly donation to the cart
And I select "Recurring" payment
And I select "Monthly" payment
And I press "Add Donation"
And I press "Checkout"
Then User should be redirected to "Checkout" page
@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"
When I remove "1" Donation to the cart
Then I should see You are donating to "2" cause
@web
Scenario:User should see correct amount of added donation in 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 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 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
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 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 | Rs. 1000 |
| Baitussalam Nusrat Roti Pack - Syria - Sadqa | Rs. 2000 |
| 1000 - Monthly | Rs. 1000 |
When I press "Checkout"
Then User should be redirected to "Checkout" page
Feature: Publication Feature
Background:
When Close the popup
And I close the messenger popUp
@web
Scenario: User should be able redirecting to correct pages by selecting header from publication page
When I select a "bayanat" feature on home page
And I select header "Become a Volunteer" on publication page
And I fill the Become a Volunteer form with the following data:
| firstName | lastName | email | phoneNumber | address | city | country | skillsOrQualification | volunteeringExperience |
| Muhammad | rahim | test@123gmail.com | 12323123 | karachi | xyz street | Pakistan | Bachelor | 2 years |
And I press "Become a volunteer"
#Bug <----------- On missing any field it doesn't show alert of missing filed instead it give 500 response -------------->
#Bug <----------- On entering same email web is crashing -------------->
Then I Should see success message on become a volunteer page
\ No newline at end of file
Feature: Education_Page
Background:
When Close the popup
And I close the messenger popUp
@web
Scenario Outline: User should be redirected to correct pages when Selecting Projects from drop down
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
Examples:
| headerItems | pages |
| Jamia Baitussalam | Baitussalam Ration distribution program |
@web
Scenario Outline: User should be redirected to correct pages when Selecting Events from drop down
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
Examples:
| headerItems | pages |
| British Council Study UK Exhibition Tour Lahore | British Council Study UK Exhibition Tour Lahore |
@web
Scenario Outline: User should be redirected to correct pages when Selecting News from drop down
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
Examples:
| headerItems | pages |
| Ilmofy Pakistan | Ilmofy Pakistan |
| Jamia Baitussalam Talagang achieves yet another milestone! | Jamia Baitussalam Talagang achieves yet another milestone! |
| Appreciating Baitussalam's welfare | Appreciating Baitussalam's welfare |
| Abdülhamit School | Abdülhamit School |
@web
Scenario Outline: User should be redirected to correct pages when Selecting Media from drop down
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
Examples:
| headerItems | pages |
| Images | Gallery |
| Videos | Gallery |
Feature: HomePage
Background:
When Close the popup
And I close the messenger popUp
@web
Scenario: User should be redirected to About Us ,TimeLine pages
When I Click on About Us button on Home page
And Close the popup
Then User should be redirected to "About us" page
When I Click On Our Timeline Button On home page
And Close the popup
Then User should be redirected to "Timeline" page
@web
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
@web
Scenario: User should be redirected to bayanat page
When I select a "bayanat" feature on home page
Then I should see the following bayanat on bayan page:
| Bayanat |
| Islahi Bayanaat |
| Juma Bayan |
| Morning Dars |
| Tarbiati Majlis |
| Mufti Taqi Usmani |
| Special Series |
| Reflections of Quran |
@web
Scenario: User should be redirected to publication page
When I select a "publication" feature on home page
Then I should see the following publication on Publication page:
| Publication |
| Radiance |
| Bulletin |
| Intellect Magazine |
| Fahmedeen Magazine |
| Majalld us Salam |
| Articles |
@web
Scenario: User should be redirected to education page
When I select a "education" feature on home page
Then I should see the following education projects on Education page:
| Education |
| Jamia Baitussalam |
| Markaz-e-Fahmedeen |
@web
Scenario: User should be redirected to welfare page
When I select a "welfare" feature on home page
Then I should see the following welfare project on Welfare page:
| Welfare Project |
| Ilmofy |
| RELIEF FOR BEIRUT |
Feature: Publication Feature
Background:
When Close the popup
And I close the messenger popUp
@web
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
Examples:
| headerItems | pages |
| Radiance | Radiance |
| Bulletin | Bulletin |
| Intellect Magazine | Intellect Magazine |
| Fahmedeen Magazine | Fahmedeen Magazine |
| Majalld us Salam | Majalld us Salam |
| Articles | Articles |
| 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
And I select header "Subscribe Now" on publication page
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 ------>
@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) -------->
Feature: Welfare Feature
Background:
When Close the popup
And I close the messenger popUp
@web
Scenario Outline: User should be able to 'Quick Donate' on welfare page
When I select a "welfare" feature on home page
And I select "<donation>" Donation category form dropdown on welfare page
And I select "<Sub donation>" Sub Donation category form dropdown on welfare page
And I fill "100" in Amount field on welfare page
And I press "Donate"
Then User should be redirected to "Checkout" page
Examples:
| donation | Sub donation |
| Zakat | Zakat General |
| Qurbani | Cow-A-Share |
| Membership | 1000 - Monthly |
| Featured | Tuhfa Test zakat |
| Fitra | Fitra - Wheat (گندم) |
| Sadqa | Sadqah General (Donation) |
@web
Scenario Outline: User should be able to 'Make A Donation' on welfare page
When I select a "welfare" feature on home page
And I select "Recurring" payment
And I select "Weekly" payment
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 "1000" amount
And I press "Donate Now"
Then I should see the "<donation>" Donation is added to the cart
And I press "Checkout"
Then User should be redirected to "Checkout" page
Examples:
| cause | type | donation |
| Zakat | Zakat General | Zakat General |
| Qurbani | Cow-A-Share | Cow-A-Share |
| Membership | 1000 - Monthly | 1000 - Monthly |
| Featured | Tuhfa Test zakat | Tuhfa Test zakat |
@web
Scenario Outline: User should be redirected to correct pages when selecting projects
When I select a "welfare" 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
Examples:
| headerItems | pages |
| Foodbank | Foodbank |
@web
Scenario Outline: User should be redirected to correct pages when Selecting News from drop down
When I select a "welfare" 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
Examples:
| headerItems | pages |
| Baitussalam Ration distribution program | Baitussalam Ration distribution program |
| Do good and good will come to you! | Do good and good will come to you! |
| Baitussalam volunteers on duty! | Baitussalam volunteers on duty! |
| The orphan kids were succoured with food and other life necessities by Baitussalam | The orphan kids were succoured with food and other life necessities by Baitussalam |
@web
Scenario Outline: User should be redirected to correct pages when Selecting Images from drop down
When I select a "welfare" 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
Examples:
| headerItems | pages |
| Images | Gallery |
| Videos | Gallery |
@web
Scenario: User should be redirected to correct pages when Selecting About Us
When I select a "welfare" 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
When I select a "welfare" 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
When I select a "welfare" feature on home page
When I click on "Contribute" button on welfare page
Then User should be redirected to "Ways to Donate" page
@web
Scenario: User should be able to become a volunteer
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 |
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 |
And I fill occupation information in the Become a Volunteer form with the following data on welfare Page:
| Occupation | typeOfEmployment | employmentName | areaOfInterest |
| testing | EMPLOYED | software engineer | field work |
And I fill Voluntarism Details in the Become a Volunteer form with the following data on welfare Page:
| workExperience | workExperienceDetail | startWorkingDate | workingHourPerDay | proficiencyInLanguage | timeDetail | monthlyAvailability | dayAvailability | reasonForWorking | preferredField | haveDrivingLicense | didKnownPersonWorking |
| Yes | 3 year of working experience | 2022-10-03 | 2 | urdu/english | Yes | JUNE | WEDNESDAY,afternoon | like to do volunteer work | xyz | No | No |
# <--------- Bug Voluntarism detail on click on 'No' button text Yes is selected------------>
And I press "Submit"
# <--------- Bug website is crashing------------>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Test Suite" verbose="1">
<test name="Regression Tests">
<classes>
<class name="com.example.TestRunner">
</class>
</classes>
</test>
</suite>
\ No newline at end of file
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