Skip to content

Commit 87c6e28

Browse files
committed
misc improvements
1 parent ba50764 commit 87c6e28

23 files changed

+198
-166
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ out
1616
*.iml
1717
atlassian-ide-plugin.xml
1818

19+
### Mac OS ###
20+
.DS_Store
21+
22+
allure-results
23+
1924
src/test/resources/testvideo/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ The project is structured as follows:
159159
- ### Test Data
160160
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.
161161
162-
To add configurations for new test data, add a new Java bean in the [*dto*](./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:
162+
To add configurations for new test data, add a new Java bean in the [*dto*](./src/main/java/io/github/tahanima/fixture) 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:
163163
164164
```java
165-
package io.github.tahanima.dto;
165+
package io.github.tahanima.fixture;
166166
167167
import com.univocity.parsers.annotations.Parsed;
168168
@@ -187,7 +187,7 @@ The project is structured as follows:
187187
Test Case ID,First Name,Last Name
188188
TC-1,Tahanima,Chowdhury
189189
```
190-
For reference, check [this](./src/main/java/io/github/tahanima/dto/LoginDto.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginTest.java).
190+
For reference, check [this](./src/main/java/io/github/tahanima/fixture/LoginDto.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginTest.java).
191191

192192
- ### Page Objects and Page Component Objects
193193
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: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,49 @@ plugins {
66
group 'io.github.tahanima'
77
version '1.0-SNAPSHOT'
88

9+
configurations {
10+
agent {
11+
canBeResolved = true
12+
canBeConsumed = true
13+
}
14+
}
15+
916
repositories {
1017
mavenCentral()
1118
}
1219

1320
dependencies {
21+
agent "org.aspectj:aspectjweaver:1.9.24"
22+
23+
implementation 'com.microsoft.playwright:playwright:1.52.0'
1424
implementation 'org.aeonbits.owner:owner:1.0.12'
1525
implementation 'com.univocity:univocity-parsers:2.9.1'
16-
implementation 'com.microsoft.playwright:playwright:1.43.0'
26+
implementation 'io.qameta.allure:allure-junit5:2.29.1'
27+
implementation 'com.github.automatedowl:allure-environment-writer:1.0.0'
1728
implementation 'org.apache.commons:commons-lang3:3.14.0'
1829
implementation 'org.slf4j:slf4j-api:2.0.13'
19-
implementation 'io.qameta.allure:allure-junit-platform:2.27.0'
20-
implementation 'com.github.automatedowl:allure-environment-writer:1.0.0'
2130

22-
compileOnly 'org.projectlombok:lombok:1.18.32'
23-
annotationProcessor 'org.projectlombok:lombok:1.18.32'
24-
testCompileOnly 'org.projectlombok:lombok:1.18.32'
25-
testAnnotationProcessor 'org.projectlombok:lombok:1.18.32'
31+
compileOnly 'org.projectlombok:lombok:1.18.38'
32+
annotationProcessor 'org.projectlombok:lombok:1.18.38'
33+
testCompileOnly 'org.projectlombok:lombok:1.18.38'
34+
testAnnotationProcessor 'org.projectlombok:lombok:1.18.38'
2635

27-
testImplementation platform('org.junit:junit-bom:5.10.2')
36+
testImplementation platform('org.junit:junit-bom:5.9.1')
2837
testImplementation 'org.junit.jupiter:junit-jupiter'
2938
testImplementation 'io.github.artsok:rerunner-jupiter:2.1.6'
3039
testImplementation 'org.slf4j:slf4j-simple:2.0.13'
3140
}
3241

3342
test {
34-
systemProperties = System.getProperties() as Map<String, ?>
43+
ignoreFailures = true
44+
systemProperties = System.getProperties().collectEntries { k, v -> [(k.toString()): v] }
3545
def group = System.getProperty('group', 'regression')
3646

37-
useJUnitPlatform() {
47+
useJUnitPlatform {
3848
includeTags group
3949
}
50+
51+
jvmArgs = ["-javaagent:${configurations.agent.singleFile}"]
4052
}
4153

4254
tasks.register('playwright', JavaExec) {

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

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

33
import com.microsoft.playwright.Page;
4-
54
import io.github.tahanima.ui.page.BasePage;
6-
75
import lombok.extern.slf4j.Slf4j;
86

97
/**

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

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

3-
import static io.github.tahanima.config.ConfigurationManager.config;
4-
53
import com.microsoft.playwright.Browser;
64
import com.microsoft.playwright.BrowserType;
75
import com.microsoft.playwright.BrowserType.LaunchOptions;
86
import com.microsoft.playwright.Playwright;
97

8+
import static io.github.tahanima.config.ConfigurationManager.config;
9+
1010
/**
1111
* @author tahanima
1212
*/

src/main/java/io/github/tahanima/dto/BaseDto.java renamed to src/main/java/io/github/tahanima/fixture/BaseFixture.java

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

33
import com.univocity.parsers.annotations.Parsed;
4-
54
import lombok.Getter;
65
import lombok.ToString;
76

@@ -10,7 +9,7 @@
109
*/
1110
@Getter
1211
@ToString
13-
public class BaseDto {
12+
public class BaseFixture {
1413

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

src/main/java/io/github/tahanima/dto/LoginDto.java renamed to src/main/java/io/github/tahanima/fixture/LoginFixture.java

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

33
import com.univocity.parsers.annotations.Parsed;
4-
54
import lombok.Getter;
65
import lombok.ToString;
76

@@ -10,7 +9,7 @@
109
*/
1110
@Getter
1211
@ToString(callSuper = true)
13-
public class LoginDto extends BaseDto {
12+
public class LoginFixture extends BaseFixture {
1413

1514
@Parsed(field = "Username", defaultNullRead = "")
1615
private String username;

src/main/java/io/github/tahanima/dto/ProductsDto.java renamed to src/main/java/io/github/tahanima/fixture/ProductsFixture.java

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

33
import com.univocity.parsers.annotations.Parsed;
4-
54
import lombok.Getter;
65
import lombok.ToString;
76

@@ -10,7 +9,7 @@
109
*/
1110
@Getter
1211
@ToString(callSuper = true)
13-
public final class ProductsDto extends BaseDto {
12+
public final class ProductsFixture extends BaseFixture {
1413

1514
@Parsed(field = "Username", defaultNullRead = "")
1615
private String username;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.github.tahanima.report;
2+
3+
import com.google.common.collect.ImmutableMap;
4+
import org.apache.commons.lang3.StringUtils;
5+
6+
import static com.github.automatedowl.tools.AllureEnvironmentWriter.allureEnvironmentWriter;
7+
import static io.github.tahanima.config.ConfigurationManager.config;
8+
9+
/**
10+
* @author tahanima
11+
*/
12+
public final class AllureManager {
13+
14+
private AllureManager() {}
15+
16+
public static void setAllureEnvironmentInfo() {
17+
allureEnvironmentWriter(
18+
ImmutableMap.<String, String>builder()
19+
.put("Platform", System.getProperty("os.name"))
20+
.put("Version", System.getProperty("os.version"))
21+
.put("Browser", StringUtils.capitalize(config().browser()))
22+
.put("Context URL", config().baseUrl())
23+
.build(),
24+
config().allureResultsDir() + "/");
25+
}
26+
}

src/main/java/io/github/tahanima/ui/component/Header.java

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

33
import com.microsoft.playwright.Page;
4+
import io.qameta.allure.Step;
45

56
/**
67
* @author tahanima
@@ -11,6 +12,7 @@ public Header(final Page page) {
1112
super(page);
1213
}
1314

15+
@Step("Click on the hamburger icon")
1416
public void clickOnHamburgerIcon() {
1517
page.click("#react-burger-menu-btn");
1618
}

0 commit comments

Comments
 (0)