chore: set --allow-pre-commit-input flag on Android/Electron (#16383)

This commit is contained in:
Max Schmitt 2022-08-09 23:18:15 +02:00 committed by GitHub
parent 2efe947dc8
commit ff5f241b84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 5 deletions

View File

@ -35,6 +35,7 @@ import { gracefullyCloseSet } from '../../utils/processLauncher';
import { TimeoutSettings } from '../../common/timeoutSettings';
import type * as channels from '../../protocol/channels';
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
import { DEFAULT_ARGS } from '../chromium/chromium';
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
@ -247,7 +248,13 @@ export class AndroidDevice extends SdkObject {
debug('pw:android')('Force-stopping', pkg);
await this._backend.runCommand(`shell:am force-stop ${pkg}`);
const socketName = isUnderTest() ? 'webview_devtools_remote_playwright_test' : ('playwright-' + createGuid());
const commandLine = `_ --disable-fre --no-default-browser-check --no-first-run --remote-debugging-socket-name=${socketName}`;
const commandLine = [
'_',
'--disable-fre',
'--no-default-browser-check',
`--remote-debugging-socket-name=${socketName}`,
...DEFAULT_ARGS,
].join(' ');
debug('pw:android')('Starting', pkg, commandLine);
await this._backend.runCommand(`shell:echo "${commandLine}" > /data/local/tmp/chrome-command-line`);
await this._backend.runCommand(`shell:am start -a android.intent.action.VIEW -d about:blank ${pkg}`);

View File

@ -324,7 +324,7 @@ export class Chromium extends BrowserType {
}
}
const DEFAULT_ARGS = [
export const DEFAULT_ARGS = [
'--disable-field-trial-config', // https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
'--disable-background-networking',
'--enable-features=NetworkService,NetworkServiceInProcess',

View File

@ -1,6 +1,9 @@
const { app, protocol } = require('electron');
const path = require('path');
app.commandLine.appendSwitch('disable-features', 'AutoExpandDetailsElement');
app.commandLine.appendSwitch('allow-pre-commit-input')
app.on('window-all-closed', e => e.preventDefault());
app.whenReady().then(() => {

View File

@ -202,10 +202,8 @@ it('allInnerTexts should work', async ({ page }) => {
expect(await page.locator('div').allInnerTexts()).toEqual(['A', 'B', 'C']);
});
it('isVisible and isHidden should work with details', async ({ page, isAndroid, isElectron }) => {
it('isVisible and isHidden should work with details', async ({ page }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/10674' });
it.skip(isElectron, 'We don\'t disable the AutoExpandDetailsElement feature on Electron');
it.skip(isAndroid, 'We can\'t disable the AutoExpandDetailsElement feature on Android');
await page.setContent(`<details>
<summary>click to open</summary>
<ul>

View File

@ -379,6 +379,13 @@ it('should press the meta key', async ({ page, browserName, isMac }) => {
});
it('should work with keyboard events with empty.html', async ({ page, server }) => {
await page.goto(server.PREFIX + '/empty.html');
const lastEvent = await captureLastKeydown(page);
await page.keyboard.press('a');
expect(await lastEvent.evaluate(l => l.key)).toBe('a');
});
it('should work after a cross origin navigation', async ({ page, server }) => {
await page.goto(server.PREFIX + '/empty.html');
await page.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');