mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
chore: don't generate new lines in codegen (#18309)
This commit is contained in:
parent
921a960921
commit
d8ec7cba47
@ -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();`);
|
||||||
|
@ -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();`);
|
||||||
|
@ -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()`);
|
||||||
|
@ -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();
|
||||||
|
|
||||||
// ---------------------
|
// ---------------------
|
||||||
|
@ -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}")
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
@ -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()
|
||||||
|
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
@ -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()
|
||||||
|
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user