fix(screencast): register AnnotatePosition enum serializer - #1948
Conversation
AnnotatePosition had no Gson serializer registered, so Screencast.showActions() sent the raw enum constant (e.g. TOP_RIGHT) to the driver, which rejected it with "position: expected one of (top-left|top|top-right|...)". Register it with ToLowerCaseAndDashSerializer so values serialize as top-right, matching the other dashed enums. Fixes: microsoft#1912
|
@microsoft-github-policy-service agree |
yury-s
left a comment
There was a problem hiding this comment.
The change looks good, let's update the test
|
|
||
| public class TestSerialization { | ||
| @Test | ||
| void annotatePositionSerializesToLowerCaseAndDash() { |
There was a problem hiding this comment.
let's turn it into and e2e test and check that actual playwright api call doesn't throw page.screencast().showActions(new Screencast.ShowActionsOptions().setPosition(AnnotatePosition.TOP_RIGHT))
|
Done — dropped the serializer unit test and moved the coverage into for (AnnotatePosition position : AnnotatePosition.values()) {
AutoCloseable disposable = page.screencast().showActions(
new Screencast.ShowActionsOptions().setPosition(position));
assertNotNull(disposable);
disposable.close();
}Ran it against a real browser both ways. Without the serializer registration every position fails with I looped over all six values rather than just |
Summary
AnnotatePositionhad no Gson serializer registered, sopage.screencast().showActions(new Screencast.ShowActionsOptions().setPosition(AnnotatePosition.TOP_RIGHT))sent the raw constantTOP_RIGHTto the driver, which rejected it:position: expected one of (top-left|top|top-right|...).ToLowerCaseAndDashSerializer(as used forColorScheme,ServiceWorkerPolicy, …) so values serialize astop-rightetc.Fixes #1912