1
0
mirror of synced 2026-05-22 18:53:15 +00:00

fix: remove devices from the API (#280)

This commit is contained in:
Yury Semikhatsky
2021-02-11 12:53:18 -08:00
committed by GitHub
parent 8db59ba9a1
commit 0afb42bb0f
10 changed files with 3 additions and 167 deletions
@@ -1056,11 +1056,6 @@ class NestedClass extends TypeDefinition {
if (!isReturnType) {
writeConstructor(output, bodyOffset);
writeBuilderMethods(output, bodyOffset);
if (asList("Browser.newContext.options",
"Browser.newPage.options",
"BrowserType.launchPersistentContext.options").contains(jsonPath)) {
writeDeviceDescriptorBuilder(output, bodyOffset);
}
}
output.add(offset + "}");
}
@@ -1083,17 +1078,6 @@ class NestedClass extends TypeDefinition {
requiredFields.forEach(f -> output.add(bodyOffset + " this." + f.name + " = " + f.name + ";"));
output.add(bodyOffset + "}");
}
private void writeDeviceDescriptorBuilder(List<String> output, String bodyOffset) {
output.add(bodyOffset + "public " + name + " withDevice(DeviceDescriptor device) {");
output.add(bodyOffset + " withViewportSize(device.viewportSize());");
output.add(bodyOffset + " withUserAgent(device.userAgent());");
output.add(bodyOffset + " withDeviceScaleFactor(device.deviceScaleFactor());");
output.add(bodyOffset + " withIsMobile(device.isMobile());");
output.add(bodyOffset + " withHasTouch(device.hasTouch());");
output.add(bodyOffset + " return this;");
output.add(bodyOffset + "}");
}
}
class Enum extends TypeDefinition {
@@ -56,7 +56,6 @@ class Types {
add("Selectors.register.script", "Object|function|string", "String");
// The method has custom signatures
add("BrowserContext.cookies", "Array<Object>", "Cookie");
add("BrowserContext.route.url", "RegExp|function(URL):boolean|string", "String");
add("BrowserContext.unroute.url", "RegExp|function(URL):boolean|string", "String");
add("Page.waitForNavigation.options.url", "RegExp|function(URL):boolean|string", "Custom");
@@ -75,9 +74,6 @@ class Types {
add("ElementHandle.setInputFiles.files", "Array<Object>|Array<path>|Object|path", "String");
add("FileChooser.setFiles.files", "Array<Object>|Array<path>|Object|path", "String");
add("Route.resume.options.postData", "Buffer|string", "byte[]", new Empty());
// TODO: fix upstream types!
add("Playwright.devices", "Object", "Map<String, DeviceDescriptor>", new Empty());
}
Mapping findForPath(String jsonPath) {