This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package pages; | |
| import org.openqa.selenium.WebDriver; | |
| public class BasePage { | |
| WebDriver driver; | |
| public final String BASE_URL = "https://www.saucedemo.com/"; | |
| public BasePage(WebDriver driver) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package pages; | |
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| public class ProductsPage extends BasePage{ | |
| private final By TITLE = By.cssSelector("[data-test = title]"); | |
| private final By CART = By.cssSelector("[data-test = shopping-cart-link]"); | |
| private final String ADD_TO_CART_PATTERN = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tests; | |
| import org.openqa.selenium.By; | |
| import org.testng.annotations.Test; | |
| import org.testng.asserts.SoftAssert; | |
| public class CartTest extends BaseTest { | |
| String expectedProductName = "Sauce Labs Backpack"; | |
| String expectedPriceOfProduct = "29.99"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.By; | |
| import org.testng.Assert; | |
| import org.testng.annotations.Test; | |
| public class LoginTest extends BaseTest { | |
| @Test | |
| public void checkLoginWithPositiveCred() { | |
| driver.get("https://www.saucedemo.com/"); | |
| driver.findElement(By.id("user-name")).sendKeys("standard_user"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.openqa.selenium.chrome.ChromeOptions; | |
| import org.testng.annotations.AfterMethod; | |
| import org.testng.annotations.BeforeMethod; | |
| import java.time.Duration; | |
| import java.util.HashMap; | |
| public class BaseTest { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.openqa.selenium.chrome.ChromeOptions; | |
| import org.testng.annotations.AfterMethod; | |
| import org.testng.annotations.BeforeMethod; | |
| import java.time.Duration; | |
| import java.util.HashMap; | |
| public class BaseTest { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.openqa.selenium.chrome.ChromeOptions; | |
| import org.testng.Assert; | |
| import org.testng.annotations.AfterMethod; | |
| import org.testng.annotations.BeforeMethod; | |
| import org.testng.annotations.Test; | |
| import java.time.Duration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package tests; | |
| import org.openqa.selenium.WebDriver; | |
| public class DriverManager { | |
| private static final ThreadLocal<WebDriver> driverThreadLocal = new ThreadLocal<>(); | |
| public static WebDriver getDriver() { | |
| return driverThreadLocal.get(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.testng.annotations.AfterMethod; | |
| import org.testng.annotations.BeforeMethod; | |
| import org.testng.annotations.Test; | |
| import org.testng.asserts.SoftAssert; | |
| import java.time.Duration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.openqa.selenium.By; | |
| import org.openqa.selenium.WebDriver; | |
| import org.openqa.selenium.chrome.ChromeDriver; | |
| import org.testng.annotations.Test; | |
| import java.time.Duration; | |
| public class ShoppingCartTest { | |
| @Test |
NewerOlder