Skip to content
Open
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
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<!-- Cucumber (optional - for BDD step definitions) -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.15.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit-platform-engine</artifactId>
<version>7.15.0</version>
<scope>test</scope>
</dependency>

</dependencies>
<distributionManagement>
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/io/percy/playwright/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,33 @@ class Environment {
private final static String SDK_VERSION = "1.0.2";
private final static String SDK_NAME = "percy-playwright-java";

private String clientInfoOverride;
private String environmentInfoOverride;

public String getClientInfo() {
if (clientInfoOverride != null) {
return clientInfoOverride;
}
return SDK_NAME + "/" + SDK_VERSION;
}

public String getEnvironmentInfo() {
if (environmentInfoOverride != null) {
return environmentInfoOverride;
}
String playwrightVersion = Playwright.class.getPackage().getImplementationVersion();
return String.format("playwright-java; %s", playwrightVersion);
}

void setClientInfo(String clientInfo) {
this.clientInfoOverride = clientInfo;
}

void setEnvironmentInfo(String environmentInfo) {
this.environmentInfoOverride = environmentInfo;
}

public static String getSdkVersion() {
return SDK_VERSION;
}
}
16 changes: 16 additions & 0 deletions src/main/java/io/percy/playwright/Percy.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ public Percy(Page page) {
this.env = new Environment();
}

/**
* Override the client info reported to Percy.
* Used by framework wrappers (e.g., Cucumber) to identify themselves.
*/
public void setClientInfo(String clientInfo, String environmentInfo) {
this.env.setClientInfo(clientInfo);
this.env.setEnvironmentInfo(environmentInfo);
}

/**
* Get the SDK version string.
*/
public static String getSdkVersion() {
return Environment.getSdkVersion();
}

/**
* Creates a region configuration based on the provided parameters.
*
Expand Down
Loading
Loading