Skip to content

Commit 17a542a

Browse files
committed
feat: remove testng, extentreport and add junit5, allure report
1 parent 06e5795 commit 17a542a

23 files changed

+224
-364
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ out
1414
*.ipr
1515
*.iws
1616
*.iml
17-
atlassian-ide-plugin.xml
18-
19-
testoutput
17+
atlassian-ide-plugin.xml

build.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
id 'java'
3+
id 'io.qameta.allure' version '2.11.2'
34
}
45

56
group 'io.github.tahanima'
@@ -17,27 +18,25 @@ java {
1718
dependencies {
1819
implementation 'org.aeonbits.owner:owner:1.0.12'
1920
implementation 'com.univocity:univocity-parsers:2.9.1'
20-
implementation 'com.aventstack:extentreports:5.0.9'
21-
implementation 'com.microsoft.playwright:playwright:1.31.0'
21+
implementation 'com.microsoft.playwright:playwright:1.33.0'
2222
implementation 'org.apache.commons:commons-lang3:3.12.0'
23-
implementation 'org.apache.commons:commons-text:1.10.0'
2423
implementation 'org.slf4j:slf4j-api:2.0.6'
24+
implementation 'io.qameta.allure:allure-junit-platform:2.22.0'
25+
implementation 'com.github.automatedowl:allure-environment-writer:1.0.0'
2526

2627
compileOnly 'org.projectlombok:lombok:1.18.26'
2728
annotationProcessor 'org.projectlombok:lombok:1.18.26'
2829

29-
testImplementation 'org.testng:testng:7.7.1'
30+
testImplementation platform('org.junit:junit-bom:5.9.1')
31+
testImplementation 'org.junit.jupiter:junit-jupiter'
3032
testImplementation 'org.slf4j:slf4j-simple:2.0.6'
3133
}
3234

3335
test {
3436
systemProperties = System.getProperties() as Map<String, ?>
3537
def group = System.getProperty('group', 'regression')
36-
def thread = System.getProperty('thread', '100')
3738

38-
useTestNG() {
39-
includeGroups group
40-
parallel 'classes'
41-
threadCount thread as int
39+
useJUnitPlatform() {
40+
includeTags group
4241
}
4342
}

src/main/java/io/github/tahanima/config/Configuration.java

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,27 @@
55
import org.aeonbits.owner.Config.Sources;
66

77
/**
8-
* Mapping interface for the global parameters contained within config.properties file.
9-
*
108
* @author tahanima
119
*/
1210
@LoadPolicy(Config.LoadType.MERGE)
13-
@Sources({"system:properties", "classpath:config.properties"})
11+
@Sources({"system:properties", "classpath:general.properties", "classpath:allure.properties"})
1412
public interface Configuration extends Config {
15-
/**
16-
* @return a string containing the browser name
17-
*/
13+
1814
String browser();
1915

20-
/**
21-
* @return a string containing the base url of the AUT
22-
*/
2316
@Key("base.url")
2417
String baseUrl();
2518

26-
/**
27-
* @return a boolean containing the choice whether the browser will run in headless mode
28-
*/
29-
Boolean headless();
19+
boolean headless();
3020

31-
/**
32-
* @return an integer containing the slow motion value
33-
*/
3421
@Key("slow.motion")
3522
int slowMotion();
3623

37-
/**
38-
* @return an integer containing the timeout value
39-
*/
40-
@Key("timeout")
4124
int timeout();
4225

43-
/**
44-
* @return a string containing the base path to store all the test data
45-
*/
4626
@Key("base.test.data.path")
4727
String baseTestDataPath();
4828

49-
/**
50-
* @return a string containing the base path to store all the test reports
51-
*/
52-
@Key("base.report.path")
53-
String baseReportPath();
54-
55-
/**
56-
* @return a string containing the base path to store all the failed test screenshots
57-
*/
58-
@Key("base.screenshot.path")
59-
String baseScreenshotPath();
29+
@Key("allure.results.directory")
30+
String allureResultsDir();
6031
}

src/main/java/io/github/tahanima/config/ConfigurationManager.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
import org.aeonbits.owner.ConfigCache;
44

55
/**
6-
* This class provides a singleton instance of the Configuration class.
7-
*
86
* @author tahanima
97
*/
108
public final class ConfigurationManager {
9+
1110
private ConfigurationManager() {}
1211

13-
/**
14-
* @return an instance of Configuration class from an internal cache
15-
* @see <a href="http://owner.aeonbits.org/docs/singleton">reference</a>
16-
*/
1712
public static Configuration config() {
1813
return ConfigCache.getOrCreate(Configuration.class);
1914
}

src/main/java/io/github/tahanima/data/BaseTestData.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66
import lombok.ToString;
77

88
/**
9-
* This class provides common properties for all the test data.
10-
*
119
* @author tahanima
1210
*/
1311
@Getter
1412
@ToString
1513
public class BaseTestData {
14+
1615
@Parsed(field = "Test Case ID", defaultNullRead = "")
1716
private String testCaseId;
18-
19-
@Parsed(field = "Test Case Description", defaultNullRead = "")
20-
private String testCaseDescription;
2117
}

src/main/java/io/github/tahanima/data/login/LoginTestData.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
import lombok.ToString;
99

1010
/**
11-
* This class captures all the test data properties required for the login page.
12-
*
1311
* @author tahanima
1412
*/
1513
@Getter
1614
@ToString(callSuper = true)
1715
public class LoginTestData extends BaseTestData {
16+
1817
@Parsed(field = "User Name", defaultNullRead = "")
1918
private String userName;
2019

src/main/java/io/github/tahanima/page/BasePage.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,22 @@
44

55
import com.microsoft.playwright.Page;
66

7-
import java.nio.file.Path;
7+
import io.qameta.allure.Step;
88

99
/**
1010
* @author tahanima
1111
*/
1212
public class BasePage {
13+
1314
protected Page page;
1415

1516
public void setAndConfigurePage(Page page) {
1617
this.page = page;
1718
page.setDefaultTimeout(config().timeout());
1819
}
1920

20-
private String getScreenshotFilePath(String path) {
21-
return config().baseScreenshotPath() + path;
22-
}
23-
24-
public void captureScreenshot(String fileName) {
25-
page.screenshot(
26-
new Page.ScreenshotOptions()
27-
.setPath(Path.of(String.format("%s.png", getScreenshotFilePath(fileName))))
28-
.setFullPage(true));
21+
@Step
22+
public byte[] captureScreenshot() {
23+
return page.screenshot();
2924
}
3025
}

src/main/java/io/github/tahanima/page/BasePageFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @author tahanima
77
*/
88
public final class BasePageFactory {
9+
910
private BasePageFactory() {}
1011

1112
public static <T extends BasePage> T createInstance(Page page, Class<T> basePage) {

src/main/java/io/github/tahanima/page/login/LoginPage.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,40 @@
55
import com.microsoft.playwright.Locator;
66

77
import io.github.tahanima.page.BasePage;
8+
import io.qameta.allure.Step;
89

910
/**
10-
* This class captures the relevant UI components and functionalities of the login page.
11-
*
1211
* @author tahanima
1312
*/
1413
public class LoginPage extends BasePage {
14+
15+
@Step
1516
public LoginPage navigateToUrl() {
1617
page.navigate(config().baseUrl());
1718

1819
return this;
1920
}
2021

22+
@Step
2123
public LoginPage fillUsernameInTextBox(String username) {
2224
page.fill("id=user-name", username);
2325

2426
return this;
2527
}
2628

29+
@Step
2730
public LoginPage fillPasswordInTextBox(String password) {
2831
page.fill("id=password", password);
2932

3033
return this;
3134
}
3235

36+
@Step
3337
public Locator getErrorMessage() {
3438
return page.locator(".error-message-container h3");
3539
}
3640

41+
@Step
3742
public void clickOnLoginButton() {
3843
page.click("id=login-button");
3944
}

src/main/java/io/github/tahanima/page/product/ProductsPage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
import com.microsoft.playwright.Locator;
44

55
import io.github.tahanima.page.BasePage;
6+
import io.qameta.allure.Step;
67

78
/**
8-
* This class captures only those features needed to support test functionalities of the login page.
9-
*
109
* @author tahanima
1110
*/
1211
public class ProductsPage extends BasePage {
12+
13+
@Step
1314
public Locator getTitle() {
1415
return page.locator(".title");
1516
}

0 commit comments

Comments
 (0)