Skip to content

Commit 8fc931e

Browse files
committed
refactor and improvements
1 parent 389fe11 commit 8fc931e

File tree

14 files changed

+51
-52
lines changed

14 files changed

+51
-52
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ The project is structured as follows:
148148
- ### Test Data
149149
The project uses *csv* file to store test data and [*univocity-parsers*](https://github.com/uniVocity/univocity-parsers) to retrieve the data and map it to a Java bean.
150150
151-
To add configurations for new test data, add a new Java bean in the [*data*](./src/main/java/io/github/tahanima/data) package. For example, let's say I want to add test data for a `User` with the attributes `First Name` and `Last Name`. The code for this is as follows:
152-
151+
To add configurations for new test data, add a new Java bean in the [*data*](./src/main/java/io/github/tahanima/dto) package. For example, let's say I want to add test data for a `User` with the attributes `First Name` and `Last Name`. The code for this is as follows:
152+
153153
```java
154-
package io.github.tahanima.data;
154+
package io.github.tahanima.dto;
155155
156156
import com.univocity.parsers.annotations.Parsed;
157157
@@ -176,7 +176,7 @@ The project is structured as follows:
176176
Test Case ID,First Name,Last Name
177177
TC-1,Tahanima,Chowdhury
178178
```
179-
For reference, check [this](./src/main/java/io/github/tahanima/data/LoginData.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginE2ETest.java).
179+
For reference, check [this](./src/main/java/io/github/tahanima/dto/LoginData.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginE2ETest.java).
180180

181181
- ### Page Objects and Page Component Objects
182182
The project uses [*Page Objects* and *Page Component Objects*](https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/) to capture the relevant behaviors of a web page. Check the [*ui*](./src/main/java/io/github/tahanima/ui) package for reference.

build.gradle

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ repositories {
1010
mavenCentral()
1111
}
1212

13-
java {
14-
sourceCompatibility = JavaVersion.VERSION_11
15-
targetCompatibility = JavaVersion.VERSION_11
16-
}
17-
1813
dependencies {
1914
implementation 'org.aeonbits.owner:owner:1.0.12'
2015
implementation 'com.univocity:univocity-parsers:2.9.1'
@@ -26,6 +21,8 @@ dependencies {
2621

2722
compileOnly 'org.projectlombok:lombok:1.18.30'
2823
annotationProcessor 'org.projectlombok:lombok:1.18.30'
24+
testCompileOnly 'org.projectlombok:lombok:1.18.30'
25+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.30'
2926

3027
testImplementation platform('org.junit:junit-bom:5.10.0')
3128
testImplementation 'org.junit.jupiter:junit-jupiter'

src/main/java/io/github/tahanima/data/BaseData.java renamed to src/main/java/io/github/tahanima/dto/BaseDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.tahanima.data;
1+
package io.github.tahanima.dto;
22

33
import com.univocity.parsers.annotations.Parsed;
44

@@ -10,7 +10,7 @@
1010
*/
1111
@Getter
1212
@ToString
13-
public class BaseData {
13+
public class BaseDto {
1414

1515
@Parsed(field = "Test Case ID", defaultNullRead = "")
1616
private String testCaseId;

src/main/java/io/github/tahanima/data/LoginData.java renamed to src/main/java/io/github/tahanima/dto/LoginDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.tahanima.data;
1+
package io.github.tahanima.dto;
22

33
import com.univocity.parsers.annotations.Parsed;
44

@@ -10,7 +10,7 @@
1010
*/
1111
@Getter
1212
@ToString(callSuper = true)
13-
public class LoginData extends BaseData {
13+
public class LoginDto extends BaseDto {
1414

1515
@Parsed(field = "Username", defaultNullRead = "")
1616
private String username;

src/main/java/io/github/tahanima/data/ProductsData.java renamed to src/main/java/io/github/tahanima/dto/ProductsDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.github.tahanima.data;
1+
package io.github.tahanima.dto;
22

33
import com.univocity.parsers.annotations.Parsed;
44

@@ -10,7 +10,7 @@
1010
*/
1111
@Getter
1212
@ToString(callSuper = true)
13-
public final class ProductsData extends BaseData {
13+
public final class ProductsDto extends BaseDto {
1414

1515
@Parsed(field = "Username", defaultNullRead = "")
1616
private String username;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
import io.github.tahanima.ui.page.BasePage;
66

7+
import lombok.extern.slf4j.Slf4j;
8+
79
/**
810
* @author tahanima
911
*/
12+
@Slf4j
1013
public final class BasePageFactory {
1114

1215
private BasePageFactory() {}
@@ -20,7 +23,7 @@ public static <T extends BasePage> T createInstance(final Page page, final Class
2023

2124
return clazz.cast(instance);
2225
} catch (Exception e) {
23-
e.printStackTrace();
26+
log.error("BasePageFactory::createInstance", e);
2427
}
2528

2629
throw new NullPointerException("Page class instantiation failed.");

src/main/java/io/github/tahanima/factory/BrowserFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
* @author tahanima
1212
*/
1313
public enum BrowserFactory {
14-
1514
CHROMIUM {
1615
@Override
1716
public Browser createInstance(final Playwright playwright) {

src/main/java/io/github/tahanima/util/BrowserManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public final class BrowserManager {
1515
private BrowserManager() {}
1616

1717
public static Browser getBrowser(final Playwright playwright) {
18-
return BrowserFactory.valueOf(config().browser().toUpperCase())
19-
.createInstance(playwright);
18+
return BrowserFactory.valueOf(config().browser().toUpperCase()).createInstance(playwright);
2019
}
2120
}

src/test/java/io/github/tahanima/annotation/DataSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.github.tahanima.annotation;
22

3-
import io.github.tahanima.data.BaseData;
3+
import io.github.tahanima.dto.BaseDto;
44
import io.github.tahanima.util.DataArgumentsProvider;
55

66
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -20,5 +20,5 @@
2020

2121
String fileName();
2222

23-
Class<? extends BaseData> clazz();
23+
Class<? extends BaseDto> clazz();
2424
}

src/test/java/io/github/tahanima/e2e/BaseE2ETest.java renamed to src/test/java/io/github/tahanima/e2e/BaseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* @author tahanima
2929
*/
3030
@TestInstance(Lifecycle.PER_CLASS)
31-
public abstract class BaseE2ETest {
31+
public abstract class BaseTest {
3232

3333
protected Playwright playwright;
3434
protected Browser browser;

0 commit comments

Comments
 (0)