...26import org.openqa.selenium.By;27import org.openqa.selenium.WebDriver;28import org.openqa.selenium.WebElement;29import org.openqa.selenium.firefox.FirefoxDriver;30import org.openqa.selenium.firefox.FirefoxOptions;31import org.openqa.selenium.firefox.FirefoxProfile;32import org.openqa.selenium.firefox.FirefoxBinary;33import cucumber.api.java.en.Given;34import cucumber.api.java.en.Then;35import cucumber.api.java.en.When;36import org.junit.*;37public class StepDefinition {38 WebDriver driver;39 @Given("^Start firefox browser and open the application$")40 public void SetUp() throws Throwable {41 System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");42 FirefoxBinary firefoxBinary = new FirefoxBinary();43 firefoxBinary.addCommandLineOptions("--headless");44 FirefoxProfile profile=new FirefoxProfile();45 FirefoxOptions firefoxOptions = new FirefoxOptions();46 firefoxOptions.setBinary(firefoxBinary);47 firefoxOptions.setProfile(profile);48 driver=new FirefoxDriver(firefoxOptions);49 driver.get("https://webapps.tekstac.com/shippingDetails/");50 }51 @When("^Test the text in H2 tag and the \"([^\"]*)\" for ShipmentID$")52 public void testShippingDetails(String arg1) throws Throwable {53 //Please fill the required codes54 String H2tag = driver.findElement(By.xpath("//h2")).getText();55 Assert.assertEquals("Shipping Details", H2tag);56 String ShipmentID = driver.findElement(By.xpath("//div[@id='shippingTable']/table/tbody/tr[2]/td[1]/a")).getText();57 Assert.assertEquals(arg1, ShipmentID);58 }59 @Then("^Validate the Customer name \"([^\"]*)\" is displayed$")60 public void validateResult(String arg1) throws Throwable {61 //Please fill the required codes62 driver.findElement(By.xpath("//div[@id='shippingTable']/table/tbody/tr[2]/td[1]/a")).click();63 String customerName = driver.findElement(By.xpath("//div[@id='result']/table/tbody/tr[2]/td[1]")).getText();64 Assert.assertEquals("Maya", customerName);65 }66 @Then("^Quit the browser$")67 public void Quit_the_browser() throws Throwable {68 driver.close();69 }70}71--L2C2--72---user.feature---73Scenario: Validate Shipment status and details with enrolled User Details.74 #Please Do not change Given Templet75 Given User loads the application and navigate to home page76 When User enters "Shamili" on the tracking page77 Then following should be displayed 78 |Name |Shamili |79 |Shipment Id |SHIP1236 |80 |Phone Number|9224158877 |81 |E-mail |shamili93@gamil.com|82 83---StepDefinition---84package stepDefinition;85import java.util.List;86import java.util.concurrent.TimeUnit;87import org.junit.Assert;88import org.openqa.selenium.By;89import org.openqa.selenium.WebDriver;90import org.openqa.selenium.chrome.ChromeDriver;91import org.openqa.selenium.firefox.FirefoxDriver;92import org.openqa.selenium.firefox.FirefoxOptions;93import org.openqa.selenium.firefox.FirefoxProfile;94import org.openqa.selenium.firefox.FirefoxBinary;95import cucumber.api.DataTable;96import cucumber.api.java.After;97import cucumber.api.java.en.*;98public class StepDefinition {99 WebDriver driver;100 String text;101 @Given("^User loads the application and navigate to home page$")102 public void setUp(){ 103 System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");104 FirefoxBinary firefoxBinary = new FirefoxBinary();105 firefoxBinary.addCommandLineOptions("--headless");106 FirefoxProfile profile=new FirefoxProfile();107 FirefoxOptions firefoxOptions = new FirefoxOptions();108 firefoxOptions.setBinary(firefoxBinary);109 firefoxOptions.setProfile(profile);110 driver=new FirefoxDriver(firefoxOptions);111 driver.get("https://webapps.tekstac.com/Handling_Reg_Expression");112 System.out.println("Application is launched");113 }114 @When("^User enters \"([^\"]*)\" on the tracking page$")115 public void testUserDetails(String Name){116 //Please fill the required codes117 driver.findElement(By.id("userId")).sendKeys(Name);118 driver.findElement(By.id("track")).click();119 }120 @Then("^following should be displayed$")121 public void validateResult(DataTable ShipmentDetails) {122 //Please fill the required codes123 List<List<String>> data = ShipmentDetails.raw();124 text = driver.findElement(By.id("result")).getText();125 Assert.assertTrue(text.contains(data.get(1).get(0))); 126 Assert.assertTrue(text.contains(data.get(1).get(1)));127 Assert.assertTrue(text.contains(data.get(1).get(2)));128 Assert.assertTrue(text.contains(data.get(1).get(3)));129 }130 @After131 public void closeDriver(){132 driver.quit();133 }134}135--L2C3--136---discount.feature---137#Please Do not change Scenario Outline Templet138Feature: DATAX Shipping Discount calculation.139#Please Do not change Scenario Outline Templet140Scenario Outline: Validate Shipping company offers discount for different weights and Distances.141 #Please Do not change Given Templet142 Given User loads the application and navigate to DATAX shipping company home143 When User enters "<weight>" and "<distance>" on Company Offers Discount page144 Then The text "<discount>" should be displayed145 Examples:146 |weight|distance|discount|147 |100 |200 |Datax shipping company offers discount|148 |80 |500 |Datax shipping company offers discount|149 |120 |520 |Datax shipping company offers discount|150 |300 |200 |Datax shipping company offers discount|151 152---nodiscount.feature---153#Please Do not change Scenario Outline Templet154Feature: DATAX Shipping Discount calculation.155#Please Do not change Scenario Outline Templet156Scenario Outline: Validate Shipping company doesn't offers discount for different weights and Distances.157 #Please Do not change Given Templet158 Given User navigates to DATAX shipping company home159 When User enters "<weight>" and "<distance>"160 Then The text "<noDiscount>" should be present161 Examples:162 |weight|distance|noDiscount|163 |60 |110 |Datax shipping offers no discount|164 |50 |150 |Datax shipping offers no discount| 165---discountstepdefinition.java---166package stepDefinition;167import java.util.concurrent.TimeUnit;168import org.junit.Assert;169import org.openqa.selenium.By;170import org.openqa.selenium.WebDriver;171import org.openqa.selenium.chrome.ChromeDriver;172import org.openqa.selenium.firefox.FirefoxDriver;173import org.openqa.selenium.firefox.FirefoxOptions;174import org.openqa.selenium.firefox.FirefoxProfile;175import org.openqa.selenium.firefox.FirefoxBinary;176import cucumber.api.java.en.*;177public class DiscountStepDefinition {178 WebDriver driver;179 String text;180 @Given("^User loads the application and navigate to DATAX shipping company home$")181 public void setUp() {182 System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");183 FirefoxBinary firefoxBinary = new FirefoxBinary();184 firefoxBinary.addCommandLineOptions("--headless");185 FirefoxProfile profile=new FirefoxProfile();186 FirefoxOptions firefoxOptions = new FirefoxOptions();187 firefoxOptions.setBinary(firefoxBinary);188 firefoxOptions.setProfile(profile);189 driver=new FirefoxDriver(firefoxOptions);190 driver.get("https://webapps.tekstac.com/CompanyOffersDiscount/");191 System.out.println("Application is launched");192 }193 @When("^User enters \"([^\"]*)\" and \"([^\"]*)\" on Company Offers Discount page$")194 public void testDiscount(String weight, String distance) { 195 //Please fill the required codes196 driver.findElement(By.xpath("//input[@id='weight']")).sendKeys(weight);197 driver.findElement(By.xpath("//input[@id='distance']")).sendKeys(distance);198 driver.findElement(By.xpath("//button[@id='submit']")).click();199 }200 @Then("^The text \"([^\"]*)\" should be displayed$")201 public void validateResult(String message) {202 //Please fill the required codes203 String actual = driver.findElement(By.xpath("//div[@id='result']")).getText();204 //Assert.assertTrue(text.contains(Message));205 Assert.assertEquals(actual, message);206 driver.quit();207 }208}209---noDiscountstepdefiniton.java---210package stepDefinition;211import java.util.concurrent.TimeUnit;212import org.junit.Assert;213import org.openqa.selenium.By;214import org.openqa.selenium.WebDriver;215import org.openqa.selenium.chrome.ChromeDriver;216import org.openqa.selenium.firefox.FirefoxDriver;217import org.openqa.selenium.firefox.FirefoxOptions;218import org.openqa.selenium.firefox.FirefoxProfile;219import org.openqa.selenium.firefox.FirefoxBinary;220import cucumber.api.java.en.Given;221import cucumber.api.java.en.Then;222import cucumber.api.java.en.When;223public class NodiscountStepDefinition {224 WebDriver driver;225 String text;226 @Given("^User navigates to DATAX shipping company home$")227 public void setUp() {228 System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");229 FirefoxBinary firefoxBinary = new FirefoxBinary();230 firefoxBinary.addCommandLineOptions("--headless");231 FirefoxProfile profile=new FirefoxProfile();232 FirefoxOptions firefoxOptions = new FirefoxOptions();233 firefoxOptions.setBinary(firefoxBinary);234 firefoxOptions.setProfile(profile);235 driver=new FirefoxDriver(firefoxOptions);236 driver.get("https://webapps.tekstac.com/CompanyOffersDiscount/");237 System.out.println("Application is launched");238 }239 @When("^User enters \"([^\"]*)\" and \"([^\"]*)\"$")240 public void testNodiscount(String weight, String distance) {241 //Please fill the required codes242 driver.findElement(By.xpath("//input[@id='weight']")).sendKeys(weight);243 driver.findElement(By.xpath("//input[@id='distance']")).sendKeys(distance);244 driver.findElement(By.xpath("//button[@id='submit']")).click();245 }246 @Then("^The text \"([^\"]*)\" should be present$")247 public void validateResult(String message) {248 //Please fill the required codes249 String actual = driver.findElement(By.xpath("//div[@id='result']")).getText();250 //Assert.assertTrue(text.contains(Message));251 Assert.assertEquals(actual, message);252 driver.quit();253 }254}255 256--L2C4--257---stepDefinition.java---258package stepDefinition;259import org.openqa.selenium.By;260import org.openqa.selenium.WebDriver;261import org.openqa.selenium.chrome.ChromeDriver;262import org.openqa.selenium.firefox.FirefoxDriver;263import org.openqa.selenium.firefox.FirefoxOptions;264import org.openqa.selenium.firefox.FirefoxProfile;265import org.openqa.selenium.firefox.FirefoxBinary;266import cucumber.api.PendingException;267import cucumber.api.java.After;268import cucumber.api.java.Before;269import cucumber.api.java.en.Given;270import cucumber.api.java.en.Then;271import cucumber.api.java.en.When;272import org.junit.*;273public class StepDefinition {274 WebDriver driver;275 public static String result; 276 public static String weights;277 public static String trnsmode;278 @Before279 public void setUp(){280 System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");281 FirefoxBinary firefoxBinary = new FirefoxBinary();282 firefoxBinary.addCommandLineOptions("--headless");283 FirefoxProfile profile=new FirefoxProfile();284 FirefoxOptions firefoxOptions = new FirefoxOptions();285 firefoxOptions.setBinary(firefoxBinary);286 firefoxOptions.setProfile(profile);287 driver=new FirefoxDriver(firefoxOptions);288 }289 @Given("^I have navigated to shipping application home page$")290 public void loadUrl(){291 driver.get("https://webapps.tekstac.com/CostCalculation/"); 292 System.out.println("Application is launched");293 }294 @When("^I enter \"(.*)\" and select \"(.*)\" Transport mode$")295 public void testCalculateCost(String weight, String transportmode){296 //Please fill the required codes297 weights = weight;298 trnsmode = transportmode;...