You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -41,13 +44,23 @@ The project uses the following:
41
44
-*[Allure Report](https://qameta.io/allure-report/)* as the test reporting strategy.
42
45
-*[Gradle](https://gradle.org/)* as the Java build tool.
43
46
-*[IntelliJ IDEA](https://www.jetbrains.com/idea/)* as the IDE.
47
+
-*[Gemini CLI](https://github.com/google-gemini/gemini-cli)* as an AI collaborator for code reviews, locator healing, and test generation.
48
+
---
44
49
45
50
## Project Structure
46
51
47
52
The project is structured as follows:
48
53
49
54
```bash
50
55
📦 playwright-java-test-automation-architecture
56
+
├─ .gemini
57
+
│ └─ skills
58
+
│ └─ code-reviewer
59
+
| └─ review-rules.md
60
+
| └─ SKILL.md
61
+
| └─ healing-agent
62
+
| └─ locator-healer.md
63
+
| └─ SKILL.md
51
64
├─ .github
52
65
│ ├─ FUNDING.yml
53
66
│ ├─ dependabot.yml
@@ -56,6 +69,7 @@ The project is structured as follows:
56
69
├─ .gitignore
57
70
├─ LICENSE
58
71
├─ README.md
72
+
├─ GEMINI.md
59
73
├─ build.gradle
60
74
├─ gradle
61
75
│ └─ wrapper
@@ -76,10 +90,10 @@ The project is structured as follows:
76
90
│ │ ├─ factory
77
91
│ │ │ ├─ BasePageFactory.java
78
92
│ │ │ └─ BrowserFactory.java
79
-
│ │ ├─ fixture
80
-
│ │ │ ├─ BaseFixture.java
81
-
│ │ │ ├─ LoginFixture.java
82
-
│ │ │ └─ ProductsFixture.java
93
+
│ │ ├─ testData
94
+
│ │ │ ├─ BaseTestData.java
95
+
│ │ │ ├─ LoginTestData.java
96
+
│ │ │ └─ ProductsTestData.java
83
97
│ │ ├─ report
84
98
│ │ │ └─ AllureManager.java
85
99
│ │ ├─ ui
@@ -112,13 +126,14 @@ The project is structured as follows:
112
126
│ │ └─ ProductsTest.java
113
127
│ └─ util
114
128
│ ├─ TestDataArgumentsProvider.java
115
-
│ └─ TestFixtureCsvLoader.java
129
+
│ └─ CsvLoader.java
116
130
└─ resources
117
131
├─ junit-platform.properties
118
132
└─ testdata
119
133
├─ login.csv
120
134
└─ products.csv
121
135
```
136
+
---
122
137
123
138
## Basic Usage
124
139
@@ -162,10 +177,10 @@ The project is structured as follows:
162
177
- ### Test Data
163
178
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.
164
179
165
-
To add configurations for new test data, add a new Java bean in the [*fixture*](./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:
180
+
To add configurations for new test data, add a new Java bean in the [*testData*](./src/main/java/io/github/tahanima/testdata) 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:
166
181
167
182
```java
168
-
package io.github.tahanima.fixture;
183
+
package io.github.tahanima.testdata;
169
184
170
185
import com.univocity.parsers.annotations.Parsed;
171
186
@@ -174,7 +189,7 @@ The project is structured as follows:
@@ -183,17 +198,47 @@ The project is structured as follows:
183
198
private String lastName;
184
199
}
185
200
```
186
-
Note that the class extends from BaseFixture and thus, inherits the attribute `Test Case ID`.
201
+
Note that the class extends from BasetestData and thus, inherits the attribute `Test Case ID`.
187
202
188
203
Now, in the [*testdata*](./src/test/resources/testdata) folder you can add a csv file `user.csv` for `User` with the below contents and use it in your tests.
189
204
```
190
205
Test Case ID,First Name,Last Name
191
206
TC-1,Tahanima,Chowdhury
192
207
```
193
-
For reference, check [this](./src/main/java/io/github/tahanima/fixture/LoginFixture.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginTest.java).
208
+
For reference, check [this](./src/main/java/io/github/tahanima/testdata/LogintestData.java), [this](./src/test/resources/testdata/login.csv) and [this](./src/test/java/io/github/tahanima/e2e/LoginTest.java).
194
209
195
210
-### Page Objects and Page Component Objects
196
211
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.
197
212
198
213
-### Tests
199
214
The project uses *JUnit 5* as the test runner. Check [this implementation](./src/test/java/io/github/tahanima/e2e/LoginTest.java) for reference.
215
+
---
216
+
217
+
## AI-Augmented Workflow
218
+
219
+
This project is optimized for use with **Gemini CLI**, providing a specialized AI agent that understands the architecture.
220
+
221
+
### Prerequisites
222
+
- Gemini CLI: -[Installed and authenticated](https://github.com/google-gemini/gemini-cli) via your Google Account.
223
+
- Project Root: Ensure you run the CLI from the project root to allow it to parse the .gemini/ configuration.
224
+
225
+
### Project Context (GEMINI.md)
226
+
The project includes a `GEMINI.md` file which serves as the AI's "Source of Truth." This ensures that any code generated or reviewed by the AI adheres to:
227
+
-**BasePageFactory** initialization patterns.
228
+
-**Layer Separation** (Pages vs. TestData POJOs vs. E2E Tests).
229
+
-**Playwright Best Practices** (Accessibility-first locators over brittle XPaths).
230
+
231
+
### Specialized AI Skills
232
+
We have implemented custom **Skills** in the `.gemini/skills/` directory to automate common QA tasks:
233
+
234
+
-**`code-reviewer`**: Automatically audits new Page Objects, POJOs, and Tests to ensure they follow the project's layer separation and naming conventions.
235
+
-**`healing-agent`**: Diagnoses test failures (like `TimeoutError`) and suggests robust, accessibility-first Playwright locators (e.g., `getByRole`) to replace brittle XPaths.
236
+
237
+
### How to Use
238
+
Simply run `gemini` in the project root. You can trigger skills manually or let the AI suggest them:
239
+
```bash
240
+
# To perform a code review
241
+
gemini "Review this new test class: @src/test/java/io/github/tahanima/e2e/NewFeatureTest.java"
242
+
243
+
# To fix a failing locator
244
+
gemini "The login button locator is failing. Use the healing-agent to suggest a fix for @src/main/java/io/github/tahanima/ui/page/LoginPage.java"
0 commit comments