review feedback

This commit is contained in:
Max Schmitt 2024-11-04 11:28:42 +01:00
parent fd69294f03
commit 6df2ec0168
7 changed files with 22 additions and 36 deletions

View file

@ -15,33 +15,26 @@
* limitations under the License.
*/
import { browserTest as base, expect } from '../config/browserTest';
import { browserTest as it, expect } from '../config/browserTest';
const it = base.extend<{ isChromiumHeadedLike: boolean }>({
isChromiumHeadedLike: async ({ browserName, headless, channel }, use) => {
const isChromiumHeadedLike = browserName === 'chromium' && ((headless && channel !== 'chromium-headless-shell') || !headless);
await use(isChromiumHeadedLike);
},
});
it('should fail without credentials', async ({ browser, server, isChromiumHeadedLike }) => {
it('should fail without credentials', async ({ browser, server, browserName, channel }) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext();
const page = await context.newPage();
const responseOrError = await page.goto(server.EMPTY_PAGE).catch(e => e);
if (isChromiumHeadedLike)
if (browserName === 'chromium' && channel !== 'chromium-headless-shell')
expect(responseOrError.message).toContain('net::ERR_INVALID_AUTH_CREDENTIALS');
else
expect(responseOrError.status()).toBe(401);
});
it('should work with setHTTPCredentials', async ({ browser, server, isChromiumHeadedLike }) => {
it('should work with setHTTPCredentials', async ({ browser, server, browserName, channel }) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext();
const page = await context.newPage();
let responseOrError = await page.goto(server.EMPTY_PAGE).catch(e => e);
if (isChromiumHeadedLike)
if (browserName === 'chromium' && channel !== 'chromium-headless-shell')
expect(responseOrError.message).toContain('net::ERR_INVALID_AUTH_CREDENTIALS');
else
expect(responseOrError.status()).toBe(401);
@ -109,21 +102,21 @@ it('should work with correct credentials and matching origin case insensitive',
await context.close();
});
it('should fail with correct credentials and mismatching scheme', async ({ browser, server, isChromiumHeadedLike }) => {
it('should fail with correct credentials and mismatching scheme', async ({ browser, server, browserName, channel }) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext({
httpCredentials: { username: 'user', password: 'pass', origin: server.PREFIX.replace('http://', 'https://') }
});
const page = await context.newPage();
const responseOrError = await page.goto(server.EMPTY_PAGE).catch(e => e);
if (isChromiumHeadedLike)
if (browserName === 'chromium' && channel !== 'chromium-headless-shell')
expect(responseOrError.message).toContain('net::ERR_INVALID_AUTH_CREDENTIALS');
else
expect(responseOrError.status()).toBe(401);
await context.close();
});
it('should fail with correct credentials and mismatching hostname', async ({ browser, server, isChromiumHeadedLike }) => {
it('should fail with correct credentials and mismatching hostname', async ({ browser, server, browserName, channel }) => {
server.setAuth('/empty.html', 'user', 'pass');
const hostname = new URL(server.PREFIX).hostname;
const origin = server.PREFIX.replace(hostname, 'mismatching-hostname');
@ -132,14 +125,14 @@ it('should fail with correct credentials and mismatching hostname', async ({ bro
});
const page = await context.newPage();
const responseOrError = await page.goto(server.EMPTY_PAGE).catch(e => e);
if (isChromiumHeadedLike)
if (browserName === 'chromium' && channel !== 'chromium-headless-shell')
expect(responseOrError.message).toContain('net::ERR_INVALID_AUTH_CREDENTIALS');
else
expect(responseOrError.status()).toBe(401);
await context.close();
});
it('should fail with correct credentials and mismatching port', async ({ browser, server, isChromiumHeadedLike }) => {
it('should fail with correct credentials and mismatching port', async ({ browser, server, browserName, channel }) => {
server.setAuth('/empty.html', 'user', 'pass');
const origin = server.PREFIX.replace(server.PORT.toString(), (server.PORT + 1).toString());
const context = await browser.newContext({
@ -147,7 +140,7 @@ it('should fail with correct credentials and mismatching port', async ({ browser
});
const page = await context.newPage();
const responseOrError = await page.goto(server.EMPTY_PAGE).catch(e => e);
if (isChromiumHeadedLike)
if (browserName === 'chromium' && channel !== 'chromium-headless-shell')
expect(responseOrError.message).toContain('net::ERR_INVALID_AUTH_CREDENTIALS');
else
expect(responseOrError.status()).toBe(401);

View file

@ -637,7 +637,7 @@ it('should be able to download a inline PDF file via response interception', asy
});
it('should be able to download a inline PDF file via navigation', async ({ browser, server, asset, browserName, channel }) => {
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell');
it.skip(browserName === 'chromium' && channel !== 'chromium-headless-shell');
const page = await browser.newPage();
await page.goto(server.EMPTY_PAGE);
await page.setContent(`

View file

@ -150,15 +150,14 @@ it('should support clipboard read', async ({ page, context, server, browserName,
it.fail(browserName === 'firefox', 'No such permissions (requires flag) in Firefox');
it.fixme(browserName === 'webkit' && isWindows, 'WebPasteboardProxy::allPasteboardItemInfo not implemented for Windows.');
it.fixme(browserName === 'webkit' && isLinux && headless, 'WebPasteboardProxy::allPasteboardItemInfo not implemented for WPE.');
const isChromiumHeadedLike = browserName === 'chromium' && channel !== 'chromium-headless-shell';
await page.goto(server.EMPTY_PAGE);
// There is no 'clipboard-read' permission in WebKit Web API.
if (browserName !== 'webkit')
expect(await getPermission(page, 'clipboard-read')).toBe('prompt');
if (!isChromiumHeadedLike) {
// Headed Chromium shows a dialog and does not resolve the promise.
if (browserName === 'chromium' && channel !== 'chromium-headless-shell') {
// Chromium shows a dialog and does not resolve the promise.
const error = await page.evaluate(() => navigator.clipboard.readText()).catch(e => e);
expect(error.toString()).toContain('denied');
}

View file

@ -126,11 +126,7 @@ for (const browserName of browserNames) {
metadata: {
platform: process.platform,
docker: !!process.env.INSIDE_DOCKER,
headless: (() => {
if (headed)
return 'headed';
return 'headless';
})(),
headless: headed ? 'headed' : 'headless',
browserName,
channel,
mode,

View file

@ -409,7 +409,7 @@ for (const params of [
]) {
browserTest(`should produce screencast frames ${params.id}`, async ({ video, contextFactory, browserName, platform, headless, channel }, testInfo) => {
browserTest.skip(browserName === 'chromium' && video === 'on', 'Same screencast resolution conflicts');
browserTest.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell', 'Chromium screencast on headed has a min width issue');
browserTest.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell', 'Chromium screencast has a min width issue');
browserTest.fixme(params.id === 'fit' && browserName === 'chromium' && platform === 'darwin', 'High DPI maxes image at 600x600');
browserTest.fixme(params.id === 'fit' && browserName === 'webkit' && platform === 'linux', 'Image size is flaky');
browserTest.fixme(browserName === 'firefox' && !headless, 'Image size is different');

View file

@ -474,8 +474,8 @@ it.describe('screencast', () => {
});
it('should scale frames down to the requested size ', async ({ browser, browserName, server, headless, channel }, testInfo) => {
const isChromiumHeadlessNew = browserName === 'chromium' && channel !== 'chromium-headless-shell';
it.fixme(!headless || isChromiumHeadlessNew, 'Fails on headed');
it.fixme(!headless, 'Fails on headed');
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell', 'Fails on Chromiums');
const context = await browser.newContext({
recordVideo: {
@ -796,8 +796,8 @@ it.describe('screencast', () => {
it('should work with video+trace', async ({ browser, trace, headless, browserName, channel }, testInfo) => {
it.skip(trace === 'on');
const isChromiumHeadlessNew = browserName === 'chromium' && channel !== 'chromium-headless-shell';
it.fixme(!headless || isChromiumHeadlessNew, 'different trace screencast image size on all browsers');
it.fixme(!headless, 'different trace screencast image size on all browsers');
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell', 'different trace screencast image size on Chromium');
const size = { width: 500, height: 400 };
const traceFile = testInfo.outputPath('trace.zip');

View file

@ -120,8 +120,7 @@ it('clicking checkbox should activate it', async ({ page, browserName, headless,
it('tab should cycle between single input and browser', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32339' }
}, async ({ page, browserName, channel }) => {
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell',
'Chromium in headful mode keeps input focused.');
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell', 'Chromium keeps input focused.');
it.fixme(browserName !== 'chromium');
await page.setContent(`<label for="input1">input1</label>
<input id="input1">
@ -148,8 +147,7 @@ it('tab should cycle between single input and browser', {
it('tab should cycle between document elements and browser', {
annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/32339' }
}, async ({ page, browserName, channel }) => {
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell',
'Chromium in headful mode keeps last input focused.');
it.fixme(browserName === 'chromium' && channel !== 'chromium-headless-shell', 'Chromium keeps last input focused.');
it.fixme(browserName !== 'chromium');
await page.setContent(`
<input id="input1">