Skip to content

Commit a62a857

Browse files
committed
added XML files
1 parent 6af051e commit a62a857

13 files changed

+85
-58
lines changed
File renamed without changes.

CompareProductsSingle.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite thread-count="1" parallel="tests" name="Suite">
4+
<test thread-count="1" parallel="classes" name="Test">
5+
<classes>
6+
<class name="com.lambdatest.CompareProducts"/>
7+
</classes>
8+
</test> <!-- Test -->
9+
</suite> <!-- Suite -->

ProductFilterSingle.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite thread-count="1" parallel="tests" name="Suite">
4+
<test thread-count="1" parallel="classes" name="Test">
5+
<classes>
6+
<class name="com.lambdatest.ProductFilters"/>
7+
</classes>
8+
</test> <!-- Test -->
9+
</suite> <!-- Suite -->

ProductPageSingle.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite thread-count="1" parallel="tests" name="Suite">
4+
<test thread-count="1" parallel="classes" name="Test">
5+
<classes>
6+
<class name="com.lambdatest.ProductPage"/>
7+
</classes>
8+
</test> <!-- Test -->
9+
</suite> <!-- Suite -->

PurchaseProductsSingle.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite thread-count="1" parallel="tests" name="Suite">
4+
<test thread-count="1" parallel="classes" name="Test">
5+
<classes>
6+
<class name="com.lambdatest.purchaseProduct"/>
7+
</classes>
8+
</test> <!-- Test -->
9+
</suite> <!-- Suite -->

RegisterAccountSingle.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
3+
<suite thread-count="1" parallel="tests" name="Suite">
4+
<test thread-count="1" parallel="classes" name="Test">
5+
<classes>
6+
<class name="com.lambdatest.RegisterAccount"/>
7+
</classes>
8+
</test> <!-- Test -->
9+
</suite> <!-- Suite -->

src/test/java/com/lambdatest/AddProduct.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,45 @@
1515

1616
public class AddProduct {
1717
private RemoteWebDriver driver;
18+
UtilsMethods methods = new UtilsMethods();
1819

1920
private String Status = "failed";
2021

21-
@BeforeMethod
22-
public void setup(Method m, ITestContext ctx) throws MalformedURLException {
23-
// String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
24-
String username = System.getProperty("LT_USERNAME");
25-
// String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
26-
String authKey = System.getProperty("LT_ACCESS_KEY");
22+
@BeforeMethod public void setup(Method m, ITestContext ctx) throws MalformedURLException {
23+
String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
24+
String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
2725
String hub = "@hub.lambdatest.com/wd/hub";
2826
DesiredCapabilities caps = new DesiredCapabilities();
2927
caps.setCapability("platform", "win10");
3028
caps.setCapability("browserName", "chrome");
3129
caps.setCapability("version", "latest");
32-
caps.setCapability("build", System.getProperty("Build_Name") == null ? m.getName() + " - " + this.getClass().getName() : System.getProperty("Build_Name"));
30+
caps.setCapability("build", "TestNG With Java");
3331
caps.setCapability("name", m.getName() + " - " + this.getClass().getName());
3432
caps.setCapability("plugin", "git-testng");
3533
String[] Tags = new String[] { "Feature", "Falcon", "Severe" };
3634
caps.setCapability("tags", Tags);
3735
driver = new RemoteWebDriver(new URL("https://" + username + ":" + authKey + hub), caps);
3836
}
3937

40-
@Test
41-
public void addProducts() {
38+
@Test public void addProducts() {
4239
driver.get("https://ecommerce-playground.lambdatest.io/");
43-
driver.findElement(By.cssSelector("shop-by-category")).click();
40+
methods.wait(driver, By.className("shop-by-category"), 30);
41+
driver.findElement(By.className("shop-by-category")).click();
4442
driver.findElement(By.cssSelector(".mz-pure-drawer:first-of-type .navbar-nav>li:nth-of-type(3)")).click();
45-
driver.findElement(By.cssSelector("#container .manufacturer .mz-filter-group-content div:first-of-type div")).click();
43+
driver.findElement(By.cssSelector("#container .manufacturer .mz-filter-group-content div:first-of-type div"))
44+
.click();
4645
driver.findElement(By.cssSelector(".carousel-item:first-of-type [title='HTC Touch HD']"));
47-
driver.findElement(By.cssSelector("div[data-view_id='grid'] .product-layout:first-of-type button[title='Add to Cart']")).click();
46+
driver.findElement(
47+
By.cssSelector("div[data-view_id='grid'] .product-layout:first-of-type button[title='Add to Cart']"))
48+
.click();
4849
driver.findElement(By.cssSelector("#notification-box-top .btn-primary")).click();
4950
driver.findElement(By.cssSelector("#content .btn-secondary")).click();
50-
driver.findElement(By.xpath("//strong[contains(text(),'This is a dummy website for Web Automation Testing')]")).isSelected();
51+
driver.findElement(By.xpath("//strong[contains(text(),'This is a dummy website for Web Automation Testing')]"))
52+
.isSelected();
5153
Status = "Passed";
5254
}
5355

54-
@AfterMethod
55-
public void tearDown() {
56+
@AfterMethod public void tearDown() {
5657
driver.executeScript("lambda-status=" + Status);
5758
driver.quit();
5859
}

src/test/java/com/lambdatest/CompareProducts.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import Utills.UtilsMethods;
44
import org.openqa.selenium.By;
5-
import org.openqa.selenium.Keys;
65
import org.openqa.selenium.remote.DesiredCapabilities;
76
import org.openqa.selenium.remote.RemoteWebDriver;
87
import org.testng.ITestContext;
@@ -22,16 +21,14 @@ public class CompareProducts {
2221

2322
@BeforeMethod
2423
public void setup(Method m, ITestContext ctx) throws MalformedURLException {
25-
// String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
26-
String username = System.getProperty("LT_USERNAME");
27-
// String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
28-
String authKey = System.getProperty("LT_ACCESS_KEY");
24+
String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
25+
String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
2926
String hub = "@hub.lambdatest.com/wd/hub";
3027
DesiredCapabilities caps = new DesiredCapabilities();
3128
caps.setCapability("platform", "win10");
3229
caps.setCapability("browserName", "chrome");
3330
caps.setCapability("version", "latest");
34-
caps.setCapability("build", System.getProperty("Build_Name") == null ? m.getName() + " - " + this.getClass().getName() : System.getProperty("Build_Name"));
31+
caps.setCapability("build", "TestNG With Java");
3532
caps.setCapability("name", m.getName() + " - " + this.getClass().getName());
3633
caps.setCapability("plugin", "git-testng");
3734
String[] Tags = new String[] { "Feature", "Falcon", "Severe" };
@@ -52,6 +49,7 @@ public void compareProducts() {
5249
driver.findElement(By.cssSelector("div[data-view_id='grid'] .product-layout:first-of-type button[title='Compare this Product']")).click();
5350
driver.findElement(By.cssSelector("#notification-box-top a.btn-secondary")).click();
5451
methods.wait(driver, By.cssSelector(".h4"), 30);
52+
Status = "Passed";
5553
}
5654

5755
@AfterMethod

src/test/java/com/lambdatest/ProductFilters.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,14 @@ public class ProductFilters {
1919

2020
@BeforeMethod
2121
public void setup(Method m, ITestContext ctx) throws MalformedURLException {
22-
// String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
23-
String username = System.getProperty("LT_USERNAME");
24-
// String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
25-
String authKey = System.getProperty("LT_ACCESS_KEY");
22+
String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
23+
String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
2624
String hub = "@hub.lambdatest.com/wd/hub";
2725
DesiredCapabilities caps = new DesiredCapabilities();
2826
caps.setCapability("platform", "win10");
2927
caps.setCapability("browserName", "chrome");
3028
caps.setCapability("version", "latest");
31-
caps.setCapability("build", System.getProperty("Build_Name") == null ? m.getName() + " - " + this.getClass().getName() : System.getProperty("Build_Name"));
29+
caps.setCapability("build", "TestNG With Java");
3230
caps.setCapability("name", m.getName() + " - " + this.getClass().getName());
3331
caps.setCapability("plugin", "git-testng");
3432
String[] Tags = new String[] { "Feature", "Falcon", "Severe" };
@@ -46,6 +44,7 @@ public void productFilters() {
4644
driver.findElement(By.cssSelector("#container input[name='mz_fp[max]']")).sendKeys(Keys.ENTER);
4745
driver.findElement(By.cssSelector("#container .manufacturer .mz-filter-group-content div:first-of-type div")).click();
4846
driver.findElement(By.cssSelector("#container .module-category a:nth-of-type(5)")).click();
47+
Status = "Passed";
4948
}
5049

5150
@AfterMethod

src/test/java/com/lambdatest/ProductPage.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package com.lambdatest;
22

3-
import Utills.UtilsMethods;
43
import org.openqa.selenium.By;
5-
import org.openqa.selenium.Keys;
64
import org.openqa.selenium.remote.DesiredCapabilities;
75
import org.openqa.selenium.remote.RemoteWebDriver;
8-
import org.openqa.selenium.support.ui.Select;
9-
import org.testng.Assert;
106
import org.testng.ITestContext;
117
import org.testng.annotations.AfterMethod;
128
import org.testng.annotations.BeforeMethod;
@@ -22,16 +18,14 @@ public class ProductPage {
2218

2319
@BeforeMethod
2420
public void setup(Method m, ITestContext ctx) throws MalformedURLException {
25-
// String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
26-
String username = System.getProperty("LT_USERNAME");
27-
// String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
28-
String authKey = System.getProperty("LT_ACCESS_KEY");
21+
String username = System.getenv("LT_USERNAME") == null ? "Your LT Username" : System.getenv("LT_USERNAME");
22+
String authKey = System.getenv("LT_ACCESS_KEY") == null ? "Your LT AccessKey" : System.getenv("LT_ACCESS_KEY");
2923
String hub = "@hub.lambdatest.com/wd/hub";
3024
DesiredCapabilities caps = new DesiredCapabilities();
3125
caps.setCapability("platform", "win10");
3226
caps.setCapability("browserName", "chrome");
3327
caps.setCapability("version", "latest");
34-
caps.setCapability("build", System.getProperty("Build_Name") == null ? m.getName() + " - " + this.getClass().getName() : System.getProperty("Build_Name"));
28+
caps.setCapability("build", "TestNG With Java");
3529
caps.setCapability("name", m.getName() + " - " + this.getClass().getName());
3630
caps.setCapability("plugin", "git-testng");
3731
String[] Tags = new String[] { "Feature", "Falcon", "Severe" };
@@ -46,6 +40,7 @@ public void searchProduct() {
4640
driver.findElement(By.cssSelector(".mz-pure-drawer:first-of-type .navbar-nav>li:nth-of-type(3)")).click();
4741
driver.findElement(By.cssSelector("#container .manufacturer .mz-filter-group-content div:first-of-type div")).click();
4842
driver.findElement(By.cssSelector(".order-1 .btn-cart")).click();
43+
Status = "Passed";
4944
}
5045

5146
@AfterMethod

0 commit comments

Comments
 (0)