chore: don't generate new lines in codegen (#18309)

This commit is contained in:
Pavel Feldman 2022-10-25 12:02:06 -04:00 committed by GitHub
parent 921a960921
commit d8ec7cba47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 14 deletions

View File

@ -36,7 +36,6 @@ export class JavaLanguageGenerator implements LanguageGenerator {
const action = actionInContext.action; const action = actionInContext.action;
const pageAlias = actionInContext.frame.pageAlias; const pageAlias = actionInContext.frame.pageAlias;
const formatter = new JavaScriptFormatter(6); const formatter = new JavaScriptFormatter(6);
formatter.newLine();
if (action.name === 'openPage') { if (action.name === 'openPage') {
formatter.add(`Page ${pageAlias} = context.newPage();`); formatter.add(`Page ${pageAlias} = context.newPage();`);

View File

@ -45,7 +45,6 @@ export class JavaScriptLanguageGenerator implements LanguageGenerator {
const pageAlias = actionInContext.frame.pageAlias; const pageAlias = actionInContext.frame.pageAlias;
const formatter = new JavaScriptFormatter(2); const formatter = new JavaScriptFormatter(2);
formatter.newLine();
if (action.name === 'openPage') { if (action.name === 'openPage') {
formatter.add(`const ${pageAlias} = await context.newPage();`); formatter.add(`const ${pageAlias} = await context.newPage();`);

View File

@ -52,7 +52,6 @@ export class PythonLanguageGenerator implements LanguageGenerator {
const pageAlias = actionInContext.frame.pageAlias; const pageAlias = actionInContext.frame.pageAlias;
const formatter = new PythonFormatter(4); const formatter = new PythonFormatter(4);
formatter.newLine();
if (action.name === 'openPage') { if (action.name === 'openPage') {
formatter.add(`${pageAlias} = ${this._awaitPrefix}context.new_page()`); formatter.add(`${pageAlias} = ${this._awaitPrefix}context.new_page()`);

View File

@ -100,11 +100,8 @@ test('should save the codegen output to a file if specified', async ({ browserNa
${launchOptions(channel)} ${launchOptions(channel)}
}); });
const context = await browser.newContext(); const context = await browser.newContext();
const page = await context.newPage(); const page = await context.newPage();
await page.goto('${emptyHTML}'); await page.goto('${emptyHTML}');
await page.close(); await page.close();
// --------------------- // ---------------------

View File

@ -48,7 +48,6 @@ def browser_context_args(browser_context_args, playwright):
def test_example(page: Page) -> None: def test_example(page: Page) -> None:
page.goto("${emptyHTML}") page.goto("${emptyHTML}")
`); `);
}); });
@ -62,7 +61,6 @@ test('should save the codegen output to a file if specified', async ({ runCLI },
def test_example(page: Page) -> None: def test_example(page: Page) -> None:
page.goto("${emptyHTML}") page.goto("${emptyHTML}")
`); `);
}); });

View File

@ -96,11 +96,8 @@ from playwright.async_api import Playwright, async_playwright, expect
async def run(playwright: Playwright) -> None: async def run(playwright: Playwright) -> None:
browser = await playwright.${browserName}.launch(${launchOptions(channel)}) browser = await playwright.${browserName}.launch(${launchOptions(channel)})
context = await browser.new_context() context = await browser.new_context()
page = await context.new_page() page = await context.new_page()
await page.goto("${emptyHTML}") await page.goto("${emptyHTML}")
await page.close() await page.close()
# --------------------- # ---------------------

View File

@ -86,11 +86,8 @@ test('should save the codegen output to a file if specified', async ({ runCLI, c
def run(playwright: Playwright) -> None: def run(playwright: Playwright) -> None:
browser = playwright.${browserName}.launch(${launchOptions(channel)}) browser = playwright.${browserName}.launch(${launchOptions(channel)})
context = browser.new_context() context = browser.new_context()
page = context.new_page() page = context.new_page()
page.goto("${emptyHTML}") page.goto("${emptyHTML}")
page.close() page.close()
# --------------------- # ---------------------