chore: set --allow-pre-commit-input flag on Android/Electron (#16383)
This commit is contained in:
parent
2efe947dc8
commit
ff5f241b84
|
|
@ -35,6 +35,7 @@ import { gracefullyCloseSet } from '../../utils/processLauncher';
|
||||||
import { TimeoutSettings } from '../../common/timeoutSettings';
|
import { TimeoutSettings } from '../../common/timeoutSettings';
|
||||||
import type * as channels from '../../protocol/channels';
|
import type * as channels from '../../protocol/channels';
|
||||||
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
|
import { SdkObject, serverSideCallMetadata } from '../instrumentation';
|
||||||
|
import { DEFAULT_ARGS } from '../chromium/chromium';
|
||||||
|
|
||||||
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
|
const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-');
|
||||||
|
|
||||||
|
|
@ -247,7 +248,13 @@ export class AndroidDevice extends SdkObject {
|
||||||
debug('pw:android')('Force-stopping', pkg);
|
debug('pw:android')('Force-stopping', pkg);
|
||||||
await this._backend.runCommand(`shell:am force-stop ${pkg}`);
|
await this._backend.runCommand(`shell:am force-stop ${pkg}`);
|
||||||
const socketName = isUnderTest() ? 'webview_devtools_remote_playwright_test' : ('playwright-' + createGuid());
|
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);
|
debug('pw:android')('Starting', pkg, commandLine);
|
||||||
await this._backend.runCommand(`shell:echo "${commandLine}" > /data/local/tmp/chrome-command-line`);
|
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}`);
|
await this._backend.runCommand(`shell:am start -a android.intent.action.VIEW -d about:blank ${pkg}`);
|
||||||
|
|
|
||||||
|
|
@ -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-field-trial-config', // https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
|
||||||
'--disable-background-networking',
|
'--disable-background-networking',
|
||||||
'--enable-features=NetworkService,NetworkServiceInProcess',
|
'--enable-features=NetworkService,NetworkServiceInProcess',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
const { app, protocol } = require('electron');
|
const { app, protocol } = require('electron');
|
||||||
const path = require('path');
|
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.on('window-all-closed', e => e.preventDefault());
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
|
|
|
||||||
|
|
@ -202,10 +202,8 @@ it('allInnerTexts should work', async ({ page }) => {
|
||||||
expect(await page.locator('div').allInnerTexts()).toEqual(['A', 'B', 'C']);
|
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.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>
|
await page.setContent(`<details>
|
||||||
<summary>click to open</summary>
|
<summary>click to open</summary>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
||||||
|
|
@ -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 }) => {
|
it('should work after a cross origin navigation', async ({ page, server }) => {
|
||||||
await page.goto(server.PREFIX + '/empty.html');
|
await page.goto(server.PREFIX + '/empty.html');
|
||||||
await page.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
|
await page.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue