chore: fix codegen to emit new C# api (#6763)
This commit is contained in:
parent
f60b79a311
commit
95bd4b315c
|
|
@ -59,23 +59,24 @@ export class CSharpLanguageGenerator implements LanguageGenerator {
|
|||
const lines: string[] = [];
|
||||
const actionCall = this._generateActionCall(action, actionInContext.isMainFrame);
|
||||
if (signals.waitForNavigation) {
|
||||
lines.push(`await Task.WhenAll(`);
|
||||
lines.push(`${pageAlias}.WaitForNavigationAsync(/* new ${actionInContext.isMainFrame ? 'Page' : 'Frame'}WaitForNavigationOptions`);
|
||||
lines.push(`await ${pageAlias}.RunAndWaitForNavigationAsync(async () =>`);
|
||||
lines.push(`{`);
|
||||
lines.push(` await ${subject}.${actionCall};`);
|
||||
lines.push(`}/*, new ${actionInContext.isMainFrame ? 'Page' : 'Frame'}WaitForNavigationOptions`);
|
||||
lines.push(`{`);
|
||||
lines.push(` UrlString = ${quote(signals.waitForNavigation.url)}`);
|
||||
lines.push(`} */),`);
|
||||
lines.push(`${subject}.${actionCall});`);
|
||||
lines.push(`}*/);`);
|
||||
} else {
|
||||
lines.push(`await ${subject}.${actionCall};`);
|
||||
}
|
||||
|
||||
if (signals.download) {
|
||||
lines.unshift(`var download${signals.download.downloadAlias} = await ${pageAlias}.RunAndWaitForEventAsync(PageEvent.Download, async () =>\n{`);
|
||||
lines.unshift(`var download${signals.download.downloadAlias} = await ${pageAlias}.RunAndWaitForDownloadAsync(async () =>\n{`);
|
||||
lines.push(`});`);
|
||||
}
|
||||
|
||||
if (signals.popup) {
|
||||
lines.unshift(`var ${signals.popup.popupAlias} = await ${pageAlias}.RunAndWaitForEventAsync(PageEvent.Popup, async () =>\n{`);
|
||||
lines.unshift(`var ${signals.popup.popupAlias} = await ${pageAlias}.RunAndWaitForPopupAsync(async () =>\n{`);
|
||||
lines.push(`});`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ test.describe('cli codegen', () => {
|
|||
page1 = await popup_info.value`);
|
||||
|
||||
expect(sources.get('<csharp>').text).toContain(`
|
||||
var page1 = await page.RunAndWaitForEventAsync(PageEvent.Popup, async () =>
|
||||
var page1 = await page.RunAndWaitForPopupAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync(\"text=link\");
|
||||
});`);
|
||||
|
|
@ -602,12 +602,13 @@ test.describe('cli codegen', () => {
|
|||
|
||||
expect(sources.get('<csharp>').text).toContain(`
|
||||
// Click text=link
|
||||
await Task.WhenAll(
|
||||
page.WaitForNavigationAsync(/* new PageWaitForNavigationOptions
|
||||
{
|
||||
UrlString = \"about:blank#foo\"
|
||||
} */),
|
||||
page.ClickAsync(\"text=link\"));`);
|
||||
await page.RunAndWaitForNavigationAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync(\"text=link\");
|
||||
}/*, new PageWaitForNavigationOptions
|
||||
{
|
||||
UrlString = \"about:blank#foo\"
|
||||
}*/);`);
|
||||
|
||||
expect(page.url()).toContain('about:blank#foo');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ test.describe('cli codegen', () => {
|
|||
});`);
|
||||
expect(sources.get('<csharp>').text).toContain(`
|
||||
// Click text=Download
|
||||
var download1 = await page.RunAndWaitForEventAsync(PageEvent.Download, async () =>
|
||||
var download1 = await page.RunAndWaitForDownloadAsync(async () =>
|
||||
{
|
||||
await page.ClickAsync(\"text=Download\");
|
||||
});`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue