Skip to content

Commit ef8f452

Browse files
committed
Updated readme, added BaseTest & homepage page object
1 parent 018b023 commit ef8f452

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ These should all be part of the pom.xml file.
1717
- Surefire - version 3.0.0-M5
1818

1919
#### Design Pattern
20-
- Page Object Model
20+
- Page Object Model - if you haven't used the Page Object Model before, check out the Page Object Model section below.
2121

2222
##
23-
###GETTING STARTED
23+
### GETTING STARTED
2424
You will need the following on your computer in order to work on this project:
2525
* Java - Using version 12 for this project
2626
* Maven - Check out the Maven section below for more info on installing it
@@ -159,6 +159,12 @@ TestNG's official site - [TestNG](https://testng.org/doc/)
159159

160160
A good tutorial [Test Automation University](https://testautomationu.applitools.com/) - [Intro to TestNG](https://testautomationu.applitools.com/introduction-to-testng/index.html)
161161

162+
##
163+
### Selenium
164+
If you haven't used Selenium before, basically it's a tool that helps with automate tasks. In testing, we use it to help automate user flows especially web-related items.
165+
166+
Selenium's official site - [Selenium](https://www.theredx.com/)
167+
162168
##
163169
#### Page Object Model
164170
The article below from BrowserStack provides good info about the POM - [Article on POM](https://www.browserstack.com/guide/page-object-model-in-selenium)

src/main/java/pages/HomePage.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package pages;
2+
3+
import org.openqa.selenium.WebDriver;
4+
5+
public class HomePage {
6+
private WebDriver driver;
7+
8+
public HomePage(WebDriver driver) {
9+
this.driver = driver;
10+
}
11+
}

src/test/java/base/BaseTests.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package base;
2+
3+
import org.openqa.selenium.WebDriver;
4+
import org.openqa.selenium.chrome.ChromeDriver;
5+
import org.testng.annotations.AfterMethod;
6+
import org.testng.annotations.BeforeMethod;
7+
import pages.HomePage;
8+
9+
public class BaseTests {
10+
private WebDriver driver;
11+
protected HomePage homePage;
12+
13+
@BeforeMethod
14+
public void setUp(){
15+
System.setProperty("webdriver.chrome.driver", "resources/chromedriver");
16+
driver = new ChromeDriver();
17+
driver.get("https://www.theredx.com/");
18+
driver.manage().window().maximize();
19+
20+
homePage = new HomePage(driver);
21+
}
22+
23+
@AfterMethod
24+
public void tearDown(){
25+
driver.quit();
26+
}
27+
}

0 commit comments

Comments
 (0)