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:
parent
4f43db686d
commit
8accabdb59
|
|
@ -661,7 +661,7 @@ it('should return security details directly from response', async ({ contextFact
|
||||||
const response = await page.goto(httpsServer.EMPTY_PAGE);
|
const response = await page.goto(httpsServer.EMPTY_PAGE);
|
||||||
const securityDetails = await response.securityDetails();
|
const securityDetails = await response.securityDetails();
|
||||||
if (browserName === 'webkit' && platform === 'win32')
|
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')
|
else if (browserName === 'webkit')
|
||||||
expect(securityDetails).toEqual({ protocol: 'TLS 1.3', subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: 33086084863 });
|
expect(securityDetails).toEqual({ protocol: 'TLS 1.3', subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: 33086084863 });
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -430,7 +430,7 @@ test('should work with multiple chunks', async ({ context, page, server }, testI
|
||||||
await context.tracing.startChunk();
|
await context.tracing.startChunk();
|
||||||
await page.setContent('<button>Click</button>');
|
await page.setContent('<button>Click</button>');
|
||||||
await page.click('"Click"');
|
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.stopChunk({ path: testInfo.outputPath('trace.zip') });
|
||||||
|
|
||||||
await context.tracing.startChunk();
|
await context.tracing.startChunk();
|
||||||
|
|
|
||||||
|
|
@ -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('js redirect overrides url bar navigation ', async ({ page, server, browserName, trace }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/21574' });
|
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) => {
|
server.setRoute('/a', (req, res) => {
|
||||||
res.writeHead(200, { 'content-type': 'text/html' });
|
res.writeHead(200, { 'content-type': 'text/html' });
|
||||||
res.end(`
|
res.end(`
|
||||||
|
|
|
||||||
|
|
@ -106,34 +106,6 @@ test('should include custom error message with web-first assertions', async ({ r
|
||||||
].join('\n'));
|
].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 }) => {
|
test('should work with generic matchers', async ({ runTSC }) => {
|
||||||
const result = await runTSC({
|
const result = await runTSC({
|
||||||
'a.spec.ts': `
|
'a.spec.ts': `
|
||||||
|
|
@ -173,6 +145,7 @@ test('should work with generic matchers', async ({ runTSC }) => {
|
||||||
y: expect.any(Number),
|
y: expect.any(Number),
|
||||||
}));
|
}));
|
||||||
expect('abc').toEqual(expect.stringContaining('bc'));
|
expect('abc').toEqual(expect.stringContaining('bc'));
|
||||||
|
expect('hello world').toEqual(expect.not.stringContaining('text'));
|
||||||
expect(['Alicia', 'Roberto', 'Evelina']).toEqual(
|
expect(['Alicia', 'Roberto', 'Evelina']).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
expect.stringMatching(/^Alic/),
|
expect.stringMatching(/^Alic/),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue