test: gardening (#21814)

Notable changes:
- `page-event-crash` is not a page test, moving out of page/.
- One of the expect tests is directly covered by another, merging them.
This commit is contained in:
Dmitry Gozman 2023-03-20 12:52:52 -07:00 committed by GitHub
parent 4f43db686d
commit 8accabdb59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 32 deletions

View File

@ -661,7 +661,7 @@ it('should return security details directly from response', async ({ contextFact
const response = await page.goto(httpsServer.EMPTY_PAGE);
const securityDetails = await response.securityDetails();
if (browserName === 'webkit' && platform === 'win32')
expect(securityDetails).toEqual({ subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: -1 });
expect({ ...securityDetails, protocol: undefined }).toEqual({ subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: -1 });
else if (browserName === 'webkit')
expect(securityDetails).toEqual({ protocol: 'TLS 1.3', subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: 33086084863 });
else

View File

@ -430,7 +430,7 @@ test('should work with multiple chunks', async ({ context, page, server }, testI
await context.tracing.startChunk();
await page.setContent('<button>Click</button>');
await page.click('"Click"');
page.click('"ClickNoButton"').catch(() => {});
page.click('"ClickNoButton"', { timeout: 0 }).catch(() => {});
await context.tracing.stopChunk({ path: testInfo.outputPath('trace.zip') });
await context.tracing.startChunk();

View File

@ -419,8 +419,10 @@ it('should fail when replaced by another navigation', async ({ page, server, bro
}
});
it('js redirect overrides url bar navigation ', async ({ page, server, browserName }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21574' });
it('js redirect overrides url bar navigation ', async ({ page, server, browserName, trace }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20749' });
it.skip(trace === 'on', 'tracing waits for snapshot that never arrives because pending navigation');
server.setRoute('/a', (req, res) => {
res.writeHead(200, { 'content-type': 'text/html' });
res.end(`

View File

@ -106,34 +106,6 @@ test('should include custom error message with web-first assertions', async ({ r
].join('\n'));
});
test('should work with default expect prototype functions', async ({ runTSC, runInlineTest }) => {
const spec = `
import { test, expect } from '@playwright/test';
test('pass', async () => {
const expected = [1, 2, 3, 4, 5, 6];
test.expect([4, 1, 6, 7, 3, 5, 2, 5, 4, 6]).toEqual(
expect.arrayContaining(expected),
);
expect('foo').toEqual(expect.any(String));
expect('foo').toEqual(expect.anything());
expect('hello world').toEqual(expect.not.stringContaining('text'));
});
`;
{
const result = await runTSC({
'a.spec.ts': spec,
});
expect(result.exitCode).toBe(0);
}
{
const result = await runInlineTest({
'a.spec.ts': spec,
});
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
}
});
test('should work with generic matchers', async ({ runTSC }) => {
const result = await runTSC({
'a.spec.ts': `
@ -173,6 +145,7 @@ test('should work with generic matchers', async ({ runTSC }) => {
y: expect.any(Number),
}));
expect('abc').toEqual(expect.stringContaining('bc'));
expect('hello world').toEqual(expect.not.stringContaining('text'));
expect(['Alicia', 'Roberto', 'Evelina']).toEqual(
expect.arrayContaining([
expect.stringMatching(/^Alic/),