Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: update dotnet channels generator (#36593)

Dmitry Gozman966f7f58950e
diff --git a/utils/generate_dotnet_channels.js b/utils/generate_dotnet_channels.js
index 15a04af5f1..6ff4b8925d 100644
--- a/utils/generate_dotnet_channels.js
+++ b/utils/generate_dotnet_channels.js
@@ -109,7 +109,7 @@ function inlineType(type, indent = '', name, level) {
if (type.type.startsWith('object')) {
const optional = type.type.endsWith('?');
- const custom = processCustomType(type, optional);
+ const custom = processCustomType(type, optional, name);
if (custom)
return custom;
if (level >= 1) {
@@ -186,8 +186,8 @@ fs.mkdirSync(dir, { recursive: true });
for (const [name, item] of Object.entries(protocol)) {
if (item.type === 'interface') {
- const init = objectType(item.initializer || {}, '');
const initializerName = name + 'Initializer';
+ const init = objectType(item.initializer || {}, '', false, initializerName);
const superName = inherits.has(name) ? inherits.get(name) + 'Initializer' : null;
writeCSharpClass(initializerName, superName, init.ts);
} else if (item.type === 'object') {
@@ -234,7 +234,7 @@ function toTitleCase(name) {
return name.charAt(0).toUpperCase() + name.substring(1);
}
-function processCustomType(type, optional) {
+function processCustomType(type, optional, fullName) {
if (type.properties.name
&& type.properties.value
&& inlineType(type.properties.name).ts === 'string'
@@ -258,4 +258,6 @@ function processCustomType(type, optional) {
&& inlineType(type.properties.name).ts === 'string')
return { ts: 'DeviceDescriptorEntry', scheme: 'tObject()', optional };
+ if (fullName === 'BrowserContextInitializerOptions')
+ return { ts: 'System.Text.Json.JsonElement', scheme: 'tObject()', optional };
}