test: skip dispatchEvent(deviceOrientation) tests on Android (#28077)

Its [only available to
SecureContexts](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/device_orientation/device_orientation_event.idl;l=34?q=device_orientation_event.idl&ss=chromium%2Fchromium%2Fsrc)
which our loopback in Android is not treated as a SecureContext.

We could either move it into the library tests, but then loose page test
coverage or just skip it. I decided for the latter.

Relates https://github.com/microsoft/playwright/pull/27960.
This commit is contained in:
Max Schmitt 2023-11-10 16:28:45 +01:00 коммит произвёл GitHub
Родитель 1b22c43c35
Коммит 2954e1263e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -172,7 +172,8 @@ it('should dispatch wheel event', async ({ page, server }) => {
expect(await eventsHandle.evaluate(e => ({ deltaX: e[0].deltaX, deltaY: e[0].deltaY }))).toEqual({ deltaX: 100, deltaY: 200 });
});
it('should dispatch device orientation event', async ({ page, server }) => {
it('should dispatch device orientation event', async ({ page, server, isAndroid }) => {
it.skip(isAndroid, 'DeviceOrientationEvent is only available in a secure context. While Androids loopback is not treated as secure.');
await page.goto(server.PREFIX + '/device-orientation.html');
await page.locator('html').dispatchEvent('deviceorientation', { alpha: 10, beta: 20, gamma: 30 });
expect(await page.evaluate('result')).toBe('Oriented');
@ -182,7 +183,8 @@ it('should dispatch device orientation event', async ({ page, server }) => {
expect(await page.evaluate('absolute')).toBeFalsy();
});
it('should dispatch absolute device orientation event', async ({ page, server }) => {
it('should dispatch absolute device orientation event', async ({ page, server, isAndroid }) => {
it.skip(isAndroid, 'DeviceOrientationEvent is only available in a secure context. While Androids loopback is not treated as secure.');
await page.goto(server.PREFIX + '/device-orientation.html');
await page.locator('html').dispatchEvent('deviceorientationabsolute', { alpha: 10, beta: 20, gamma: 30, absolute: true });
expect(await page.evaluate('result')).toBe('Oriented');