Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,69 @@ SelenideLogger.addListener("AllureSelenide", new AllureSelenide().enableLogs(Log
https://github.com/SeleniumHQ/selenium/wiki/Logging
```


## Playwright Java

AspectJ-based integration for Playwright Java that reports browser actions as Allure steps and attaches
Playwright screenshots automatically:

```xml
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-playwright</artifactId>
<version>$LATEST_VERSION</version>
</dependency>
```

Enable the AspectJ weaver for automatic action steps:
```
-javaagent:/path/to/aspectjweaver.jar
```

Usage example with Playwright Java JUnit fixtures:
```java
@UsePlaywright
class UiTest {

@Test
void shouldOpenPage(Page page) {
page.navigate("https://playwright.dev");
page.screenshot();
}
}
```

The module registers an Allure test lifecycle listener automatically, so per-test cleanup, failure diagnostics,
and final trace/log flush work with any test framework that reports through Allure. Playwright pages and
contexts are tracked by the AspectJ integration when they are created or used. Use
`AllurePlaywright.register(...)` only for pages or contexts the aspect cannot observe.

Frameworks or custom runners that do not use the Allure lifecycle can call the reporting hooks directly:
```java
AllurePlaywright.beforeTest();
try {
testBody();
} catch (Throwable e) {
AllurePlaywright.afterTestFailure(e);
throw e;
} finally {
AllurePlaywright.afterTest();
}
```

The following defaults can be overridden in `allure.properties`:
```
allure.playwright.steps.enabled=true
allure.playwright.steps.mode=actions
allure.playwright.parameters=redacted
allure.playwright.screenshots.attach=true
allure.playwright.failure.screenshot=true
allure.playwright.failure.page-source=true
allure.playwright.close.trace=true
allure.playwright.close.video=true
allure.playwright.close.page-logs=true
```


## Rest Assured

Filter for rest-assured http client, that generates attachment for allure.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2016-2026 Qameta Software Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.qameta.allure.model;

/**
* Common attachment media types and file extensions.
*/
public final class AttachmentType {

public static final AttachmentType PNG = new AttachmentType("image/png", "png");
public static final AttachmentType JPEG = new AttachmentType("image/jpeg", "jpg");
public static final AttachmentType TEXT = new AttachmentType("text/plain", "txt");
public static final AttachmentType HTML = new AttachmentType("text/html", "html");
public static final AttachmentType ZIP = new AttachmentType("application/zip", "zip");
public static final AttachmentType WEBM = new AttachmentType("video/webm", "webm");
public static final AttachmentType OCTET_STREAM = new AttachmentType("application/octet-stream", "");

private final String mediaType;
private final String extension;

private AttachmentType(final String mediaType, final String extension) {
this.mediaType = mediaType;
this.extension = extension;
}

public String getMediaType() {
return mediaType;
}

public String getExtension() {
return extension;
}
}
36 changes: 36 additions & 0 deletions allure-playwright/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
description = "Allure Playwright Integration"

val agent: Configuration by configurations.creating

val playwrightVersion = "1.59.0"

dependencies {
agent("org.aspectj:aspectjweaver")
api(project(":allure-java-commons"))
compileOnly("com.microsoft.playwright:playwright:$playwrightVersion")
compileOnly("org.aspectj:aspectjrt")
testAnnotationProcessor(project(":allure-descriptions-javadoc"))
testImplementation("com.microsoft.playwright:playwright:$playwrightVersion")
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter-api")
testImplementation("org.slf4j:slf4j-simple")
testImplementation(project(":allure-assertj"))
testImplementation(project(":allure-java-commons-test"))
testImplementation(project(":allure-junit-platform"))
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
}

tasks.jar {
manifest {
attributes(mapOf(
"Automatic-Module-Name" to "io.qameta.allure.playwright"
))
}
}

tasks.test {
useJUnitPlatform()
doFirst {
jvmArgs("-javaagent:${agent.singleFile}")
}
}
Loading
Loading