Commit 7ff7baa3 authored by Bui Tien Vu's avatar Bui Tien Vu

init

parent 0eef0d8e
<?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>Glamira</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.6.1</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package Page;
import org.openqa.selenium.WebDriver;
public class Header_Page {
WebDriver driver;
public Header_Page(WebDriver driver) {
this.driver = driver;
}
}
package Page;
import org.openqa.selenium.WebDriver;
public class ListingPage {
WebDriver driver;
public ListingPage(WebDriver driver) {
this.driver = driver;
}
}
package Page;
import org.openqa.selenium.WebDriver;
public class LogIn_LogOut_Page {
WebDriver driver;
public LogIn_LogOut_Page(WebDriver driver) {
this.driver = driver;
}
}
package Page;
import org.openqa.selenium.WebDriver;
public class ProductDetail_Page {
WebDriver driver;
public ProductDetail_Page(WebDriver driver) {
this.driver = driver;
}
}
package Page_Element;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
public class Header_Element {
WebDriver driver;
public Header_Element(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
}
package Page_Element;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import java.util.List;
public class ListingPage_Element
{
WebDriver driver;
public ListingPage_Element(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
}
package Page_Element;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
public class LogIn_LogOut_Element {
WebDriver driver;
public LogIn_LogOut_Element(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
}
package Page_Element;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
public class ProductDetail_Element {
WebDriver driver;
public ProductDetail_Element(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(driver, this);
}
}
package Page_Lib;
import org.openqa.selenium.WebDriver;
public class App_Lib {
private WebDriver driver;
private Page_Lib page;
private Flow_Lib flow;
public App_Lib(WebDriver driver) {
this.driver = driver;
page = new Page_Lib(this.driver);
flow = new Flow_Lib(this.driver);
}
public Page_Lib Pages() {
return page;
}
public Flow_Lib Flow() {
return flow;
}
}
package Page_Lib;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
public class Flow_Lib {
private WebDriver driver;
public Flow_Lib(WebDriver driver) {
this.driver = driver;
}
public void navigateToUrl(String url) {
this.driver.get(url);
}
public String getCurrentPageUrl() {
return this.driver.getCurrentUrl();
}
public String getCurrentPageTitle() {
return this.driver.getTitle();
}
}
package Page_Lib;
import Page.Header_Page;
import Page.LogIn_LogOut_Page;
import Page.ProductDetail_Page;
import Page_Element.ListingPage_Element;
import org.openqa.selenium.WebDriver;
public class Page_Lib {
private WebDriver driver;
private Header_Page headerPage;
private LogIn_LogOut_Page logInOutPage;
private ProductDetail_Page productDetailPage;
private ListingPage_Element listingPage;
public Page_Lib(WebDriver driver) {
this.driver = driver;
listingPage = new ListingPage_Element(this.driver);
headerPage = new Header_Page(this.driver);
logInOutPage = new LogIn_LogOut_Page(this.driver);
productDetailPage = new ProductDetail_Page(this.driver);
}
public Header_Page HeaderPage() {
return headerPage;
}
public LogIn_LogOut_Page LogInOutage() {
return logInOutPage;
}
public ProductDetail_Page ProductDetailPage() {
return productDetailPage;
}
public ListingPage_Element ListingPage(){ return listingPage; }
}
package Common_Page;
import Page_Lib.App_Lib;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
public class AbstractBase_Test {
WebDriver driver;
private App_Lib app;
@BeforeTest
public void setUp() throws Exception {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
app = new App_Lib(driver);
}
@AfterTest
public void tearDown() {
driver.close();
}
public App_Lib App() {
return app;
}
}
package Tests;
public class Header_Test {
}
package Tests;
public class ListingPage_Test {
}
package Tests;
public class LogIn_LogOut_Test {
}
package Tests;
public class ProductDetail_Test {
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment