cherry-pick(#12022): chore: don't close page in generated test
This commit is contained in:
parent
d73d188ae7
commit
8a52c3ca76
|
|
@ -36,14 +36,15 @@ export class JavaScriptLanguageGenerator implements LanguageGenerator {
|
||||||
|
|
||||||
generateAction(actionInContext: ActionInContext): string {
|
generateAction(actionInContext: ActionInContext): string {
|
||||||
const action = actionInContext.action;
|
const action = actionInContext.action;
|
||||||
|
if (this._isTest && (action.name === 'openPage' || action.name === 'closePage'))
|
||||||
|
return '';
|
||||||
|
|
||||||
const pageAlias = actionInContext.frame.pageAlias;
|
const pageAlias = actionInContext.frame.pageAlias;
|
||||||
const formatter = new JavaScriptFormatter(2);
|
const formatter = new JavaScriptFormatter(2);
|
||||||
formatter.newLine();
|
formatter.newLine();
|
||||||
formatter.add('// ' + actionTitle(action));
|
formatter.add('// ' + actionTitle(action));
|
||||||
|
|
||||||
if (action.name === 'openPage') {
|
if (action.name === 'openPage') {
|
||||||
if (this._isTest)
|
|
||||||
return '';
|
|
||||||
formatter.add(`const ${pageAlias} = await context.newPage();`);
|
formatter.add(`const ${pageAlias} = await context.newPage();`);
|
||||||
if (action.url && action.url !== 'about:blank' && action.url !== 'chrome://newtab/')
|
if (action.url && action.url !== 'about:blank' && action.url !== 'chrome://newtab/')
|
||||||
formatter.add(`await ${pageAlias}.goto(${quote(action.url)});`);
|
formatter.add(`await ${pageAlias}.goto(${quote(action.url)});`);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue