Skip to content

Commit 3823986

Browse files
authored
fix(screencast): register AnnotatePosition enum serializer (#1948)
1 parent c9cdbf9 commit 3823986

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

playwright/src/main/java/com/microsoft/playwright/impl/Serialization.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Serialization {
4545
.registerTypeAdapter(Date.class, new DateSerializer())
4646
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeSerializer())
4747
.registerTypeAdapter(SameSiteAttribute.class, new SameSiteAdapter().nullSafe())
48+
.registerTypeAdapter(AnnotatePosition.class, new ToLowerCaseAndDashSerializer<AnnotatePosition>())
4849
.registerTypeAdapter(BrowserChannel.class, new ToLowerCaseAndDashSerializer<BrowserChannel>())
4950
.registerTypeAdapter(ColorScheme.class, new ToLowerCaseAndDashSerializer<ColorScheme>())
5051
.registerTypeAdapter(Contrast.class, new ToLowerCaseAndDashSerializer<Contrast>())

playwright/src/test/java/com/microsoft/playwright/TestScreencast.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.microsoft.playwright;
1818

19+
import com.microsoft.playwright.options.AnnotatePosition;
1920
import org.junit.jupiter.api.Test;
2021
import org.junit.jupiter.api.io.TempDir;
2122

@@ -247,4 +248,21 @@ void screencastShowAndHideActions() throws Exception {
247248
context.close();
248249
}
249250
}
251+
252+
@Test
253+
void screencastShowActionsShouldAcceptEveryPosition() throws Exception {
254+
BrowserContext context = browser.newContext();
255+
Page page = context.newPage();
256+
try {
257+
page.navigate(server.EMPTY_PAGE);
258+
for (AnnotatePosition position : AnnotatePosition.values()) {
259+
AutoCloseable disposable = page.screencast().showActions(
260+
new Screencast.ShowActionsOptions().setPosition(position));
261+
assertNotNull(disposable);
262+
disposable.close();
263+
}
264+
} finally {
265+
context.close();
266+
}
267+
}
250268
}

0 commit comments

Comments
 (0)