Skip to content

Commit f556390

Browse files
committed
initialCommit
1 parent 521b310 commit f556390

33 files changed

+1325
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/
2+
Downloads/
3+
.idea/

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Thank you for investing your time in contributing to my project!
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
4+
5+
Please note we have a code of conduct, please follow it in all your interactions with the project.
6+
7+
See the README to get an overview of the project.
8+
9+
!!! HAPPY TESTING !!!

README.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
<!-- TABLE OF CONTENTS -->
2+
<h2>
3+
<details open="open">
4+
<summary class="normal">Table of Contents</summary>
5+
<h5>
6+
<ol>
7+
<li>
8+
<a href="#about-the-project">About the Project</a>
9+
<ul>
10+
<li><a href="#built-with">Built With</a>
11+
</ul>
12+
</li>
13+
<li>
14+
<a href="#getting-started">Getting Started</a>
15+
<ul>
16+
<li><a href="#prerequisites">Prerequisites</a>
17+
<li><a href="#installation">Installation</a>
18+
</ul>
19+
</li>
20+
<li><a href="#usage">Usage</a></li>
21+
<li><a href="#reports">Reports</a></li>
22+
</ol>
23+
</h5>
24+
</details>
25+
</h2>
26+
27+
<!-- ABOUT THE PROJECT -->
28+
29+
## About the Project
30+
31+
Playwright Demo - This project is based on Microsoft Playwright which enables reliable end-to-end testing for modern web
32+
apps.
33+
34+
Top Features:
35+
36+
- Easy to Configure.
37+
- Auto-waits for all the relevant checks to pass and only then performs the requested action.
38+
- Records the test script and every action on the target page is turned into generated script.
39+
- Generates trace file on failure, which gives in-depth details of Test Case execution.
40+
- Execution of test case is faster when compared with other competitive framework in market.
41+
- Supports Headful/Headless mode execution for Firefox/Webkit/Google Chrome/Chromium/MS Edge on Windows/Linux/Mac
42+
machines.
43+
- Rerun Failed Test cases
44+
- Supports 'download' event monitoring, so there is no need for user to actually wait for downloads to finish.
45+
- Supports Serial and Parallel execution.
46+
- Spark PDF/HTML Reports are generated after execution with an option to capture screenshot/video/trace file on failure.
47+
- Nonetheless Support from Microsoft so FREQUENT RELEASES and turn around time for any queries is 48 hours.
48+
49+
### Built With
50+
51+
- [Playwright](https://playwright.dev)
52+
- [Cucumber](https://cucumber.io/)
53+
- [JUnit](https://junit.org/junit5/)
54+
- [Maven](https://maven.apache.org/)
55+
- [OpenJDK](https://www.openlogic.com/openjdk-downloads)
56+
57+
## Getting Started
58+
59+
### Prerequisites
60+
61+
The following software are required:
62+
63+
- java : Download and Install java 1.8
64+
```sh
65+
https://www.openlogic.com/openjdk-downloads
66+
```
67+
- Maven must be configured
68+
69+
### Installation
70+
71+
1. Clone the repo using below URL
72+
73+
```sh
74+
https://github.com/akshayp7/playwright-typescipt-playwright-test.git
75+
```
76+
77+
2. Navigate to folder and install dependencies using:
78+
79+
```sh
80+
mvn clean install
81+
```
82+
83+
<!-- USAGE EXAMPLES-->
84+
85+
## Usage
86+
87+
1. For Browser Configuration, change required value in browser and headless mode in `src/test/resources/config/config.properties`.
88+
2. For executing test cases in parallel, navigate to pom.xml and in plugin in configuration section
89+
provide `<skipTests>false</skipTests>`
90+
Now if you want to run 4 features in parallel provide `<threadCount>4</threadCount>` in maven-failsafe-plugin section
91+
in pom.xml and execute below command
92+
```JS
93+
mvn verify
94+
```
95+
3. For executing test cases in sequence, provide a suitable tag `@smoke` at the start of your scenario and execute below
96+
command:
97+
```JS
98+
mvn test "-Dcucumber. options=--tags @smoke"
99+
```
100+
4. For recording test scripts execute below command with desired url:
101+
```JS
102+
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen https://demoqa.com/"
103+
```
104+
5. For HTML Report configuration navigate to `src/test/resources/extent.properties` and provide destination folder as
105+
value in `extent.reporter.spark.out`
106+
6. For PDF Report configuration navigate to `src/test/resources/extent.properties` and provide destination folder as
107+
value in `extent.reporter.pdf.out`
108+
7. Screenshots and Trace files will be generated in target folder on failure this configuration is provided
109+
in `src/test/java/hooks/Hooks.java` in `takeScreenshotAndTrace` method.
110+
8. To change your username go to `src/test/resources/config/config.properties` and provide value against `adminUsername`
111+
9. To change password, go to `src/main/java/utils/WebActions.java` in `encrypt()` and
112+
replace `yourPassword` with your password, execute the test case, Encrypted password will be printed on your
113+
console .
114+
Copy Encrypted password in `src/test/resources/config/config.properties` against `adminPassword` field.
115+
10. You can even execute test cases by running `src/test/java/testrunner/TestRunner.java` file all the failed test cases
116+
are saved in `target/rerun.txt`
117+
11. For rerunning failed test cases run `src/test/java/testrunner/ReRunner.java`
118+
12. Reports will be generated in `target/HTMLReport` and `target/PdfReport` folders.
119+
120+
## Reports
121+
122+
- <b>Overall Report</b>
123+
![Overall Report Screenshot][overall-report-screenshot]
124+
125+
- <b>Failure Report</b>
126+
![Failure Report Screenshot][failure-report-screenshot]
127+
128+
- <b>PDF Report</b>
129+
![PDF Report Screenshot][pdf-report-screenshot]
130+
131+
<!-- MARKDOWN LINKS & IMAGES -->
132+
133+
[overall-report-screenshot]: ReadMeImages/OverallReport.PNG
134+
135+
[failure-report-screenshot]: ReadMeImages/FailureReport.PNG
136+
137+
[pdf-report-screenshot]: ReadMeImages/PDFReport.PNG

ReadMeImages/FailureReport.PNG

135 KB
Loading

ReadMeImages/OverallReport.PNG

66.5 KB
Loading

ReadMeImages/PDFReport.PNG

190 KB
Loading

pom.xml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>playwright-java-cucumber</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>8</maven.compiler.source>
13+
<maven.compiler.target>8</maven.compiler.target>
14+
<java.version>1.8</java.version>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<junit.version>4.13.2</junit.version>
17+
<cucumber.version>7.11.1</cucumber.version>
18+
<maven.compiler.version>3.8.1</maven.compiler.version>
19+
<maven.surefire.version>2.22.2</maven.surefire.version>
20+
</properties>
21+
22+
<dependencies>
23+
<dependency>
24+
<groupId>io.cucumber</groupId>
25+
<artifactId>cucumber-java</artifactId>
26+
<version>${cucumber.version}</version>
27+
<scope>test</scope>
28+
</dependency>
29+
30+
<dependency>
31+
<groupId>io.cucumber</groupId>
32+
<artifactId>cucumber-junit</artifactId>
33+
<version>${cucumber.version}</version>
34+
<scope>test</scope>
35+
</dependency>
36+
37+
<dependency>
38+
<groupId>junit</groupId>
39+
<artifactId>junit</artifactId>
40+
<version>${junit.version}</version>
41+
<scope>test</scope>
42+
</dependency>
43+
44+
<!-- https://mvnrepository.com/artifact/com.microsoft.playwright/playwright -->
45+
<dependency>
46+
<groupId>com.microsoft.playwright</groupId>
47+
<artifactId>playwright</artifactId>
48+
<version>1.31.0</version>
49+
</dependency>
50+
51+
<!-- https://mvnrepository.com/artifact/tech.grasshopper/extentreports-cucumber7-adapter -->
52+
<dependency>
53+
<groupId>tech.grasshopper</groupId>
54+
<artifactId>extentreports-cucumber7-adapter</artifactId>
55+
<version>1.10.1</version>
56+
</dependency>
57+
58+
<dependency>
59+
<groupId>org.projectlombok</groupId>
60+
<artifactId>lombok</artifactId>
61+
<version>1.18.22</version>
62+
</dependency>
63+
64+
</dependencies>
65+
66+
<build>
67+
<plugins>
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-compiler-plugin</artifactId>
71+
<version>${maven.compiler.version}</version>
72+
<configuration>
73+
<encoding>UTF-8</encoding>
74+
<source>${java.version}</source>
75+
<target>${java.version}</target>
76+
</configuration>
77+
</plugin>
78+
<plugin>
79+
<groupId>org.apache.maven.plugins</groupId>
80+
<artifactId>maven-surefire-plugin</artifactId>
81+
<version>${maven.surefire.version}</version>
82+
<configuration>
83+
<skipTests>false</skipTests>
84+
</configuration>
85+
</plugin>
86+
87+
<plugin>
88+
<groupId>org.apache.maven.plugins</groupId>
89+
<artifactId>maven-failsafe-plugin</artifactId>
90+
<version>3.0.0-M9</version>
91+
<executions>
92+
<execution>
93+
<goals>
94+
<goal>integration-test</goal>
95+
</goals>
96+
<configuration>
97+
<includes>
98+
<include>**/TestRunner.java</include>
99+
</includes>
100+
<parallel>methods</parallel>
101+
<threadCount>4</threadCount>
102+
<perCoreThreadCount>true</perCoreThreadCount>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
</plugins>
108+
</build>
109+
110+
</project>

0 commit comments

Comments
 (0)