mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03:00
chore: unflake the network status test (#23551)
This commit is contained in:
parent
1cd8f7543b
commit
7579572688
@ -420,6 +420,7 @@ export class Route extends ChannelOwner<channels.RouteChannel> implements api.Ro
|
||||
method: options.method,
|
||||
headers: options.headers ? headersObjectToArray(options.headers) : undefined,
|
||||
postData: options.postDataBuffer,
|
||||
isFallback: internal,
|
||||
}));
|
||||
}, !!internal);
|
||||
}
|
||||
|
@ -2003,6 +2003,7 @@ scheme.RouteContinueParams = tObject({
|
||||
headers: tOptional(tArray(tType('NameValue'))),
|
||||
postData: tOptional(tBinary),
|
||||
requestUrl: tString,
|
||||
isFallback: tBoolean,
|
||||
});
|
||||
scheme.RouteContinueResult = tOptional(tObject({}));
|
||||
scheme.RouteFulfillParams = tObject({
|
||||
|
@ -132,6 +132,7 @@ export class RouteDispatcher extends Dispatcher<Route, channels.RouteChannel, Re
|
||||
method: params.method,
|
||||
headers: params.headers,
|
||||
postData: params.postData,
|
||||
isFallback: params.isFallback,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ export class Route extends SdkObject {
|
||||
}
|
||||
this._request._setOverrides(overrides);
|
||||
await this._delegate.continue(this._request, overrides);
|
||||
if (Object.values(overrides).some(value => value !== undefined))
|
||||
if (!overrides.isFallback)
|
||||
this._request._context.emit(BrowserContext.Events.RequestContinued, this._request);
|
||||
this._endHandling();
|
||||
}
|
||||
|
@ -146,6 +146,7 @@ export type NormalizedContinueOverrides = {
|
||||
method?: string,
|
||||
headers?: HeadersArray,
|
||||
postData?: Buffer,
|
||||
isFallback?: boolean,
|
||||
};
|
||||
|
||||
export type EmulatedSize = { viewport: Size, screen: Size };
|
||||
|
@ -228,7 +228,7 @@ export class TestInfoImpl implements TestInfo {
|
||||
}
|
||||
|
||||
_addStep(data: Omit<TestStepInternal, 'complete' | 'stepId' | 'steps'>, parentStep?: TestStepInternal): TestStepInternal {
|
||||
const stepId = `${data.category}@${data.title}@${++this._lastStepId}`;
|
||||
const stepId = `${data.category}@${++this._lastStepId}`;
|
||||
if (!parentStep)
|
||||
parentStep = zones.zoneData<TestStepInternal>('stepZone', captureRawStack()) || undefined;
|
||||
|
||||
|
@ -3562,6 +3562,7 @@ export type RouteContinueParams = {
|
||||
headers?: NameValue[],
|
||||
postData?: Binary,
|
||||
requestUrl: string,
|
||||
isFallback: boolean,
|
||||
};
|
||||
export type RouteContinueOptions = {
|
||||
url?: string,
|
||||
|
@ -2818,6 +2818,7 @@ Route:
|
||||
items: NameValue
|
||||
postData: binary?
|
||||
requestUrl: string
|
||||
isFallback: boolean
|
||||
|
||||
fulfill:
|
||||
parameters:
|
||||
|
@ -66,6 +66,7 @@ body.dark-mode .drop-target {
|
||||
}
|
||||
|
||||
.progress {
|
||||
flex: none;
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
margin-top: -3px;
|
||||
|
@ -31,7 +31,6 @@ test.beforeAll(async function recordTrace({ browser, browserName, browserType, s
|
||||
const context = await browser.newContext();
|
||||
await context.tracing.start({ name: 'test', screenshots: true, snapshots: true, sources: true });
|
||||
const page = await context.newPage();
|
||||
await page.route('**/style.css', route => route.abort());
|
||||
await page.goto(`data:text/html,<html>Hello world</html>`);
|
||||
await page.setContent('<button>Click</button>');
|
||||
await expect(page.locator('button')).toHaveText('Click');
|
||||
@ -102,7 +101,6 @@ test('should open simple trace viewer', async ({ showTraceViewer }) => {
|
||||
const traceViewer = await showTraceViewer([traceFile]);
|
||||
await expect(traceViewer.actionTitles).toHaveText([
|
||||
/browserContext.newPage/,
|
||||
/page.route/,
|
||||
/page.gotodata:text\/html,<html>Hello world<\/html>/,
|
||||
/page.setContent/,
|
||||
/expect.toHaveTextlocator\('button'\)/,
|
||||
@ -115,7 +113,6 @@ test('should open simple trace viewer', async ({ showTraceViewer }) => {
|
||||
/page.waitForResponse/,
|
||||
/page.waitForTimeout/,
|
||||
/page.gotohttp:\/\/localhost:\d+\/frames\/frame.html/,
|
||||
/route.abort/,
|
||||
/page.setViewportSize/,
|
||||
]);
|
||||
});
|
||||
@ -220,10 +217,32 @@ test('should have network requests', async ({ showTraceViewer }) => {
|
||||
await traceViewer.selectAction('http://localhost');
|
||||
await traceViewer.showNetworkTab();
|
||||
await expect(traceViewer.networkRequests).toContainText([/200GETframe.htmltext\/html/]);
|
||||
await expect(traceViewer.networkRequests).toContainText([/aborted.*style.cssx-unknown/]);
|
||||
await expect(traceViewer.networkRequests).toContainText([/200GETstyle.csstext\/css/]);
|
||||
await expect(traceViewer.networkRequests).toContainText([/200GETscript.jsapplication\/javascript/]);
|
||||
});
|
||||
|
||||
test('should have network request overrides', async ({ page, server, runAndTrace }) => {
|
||||
const traceViewer = await runAndTrace(async () => {
|
||||
await page.route('**/style.css', route => route.abort());
|
||||
await page.goto(server.PREFIX + '/frames/frame.html');
|
||||
});
|
||||
await traceViewer.selectAction('http://localhost');
|
||||
await traceViewer.showNetworkTab();
|
||||
await expect(traceViewer.networkRequests).toContainText([/200GETframe.htmltext\/html/]);
|
||||
await expect(traceViewer.networkRequests).toContainText([/abort.*style.cssx-unknown/]);
|
||||
});
|
||||
|
||||
test('should have network request overrides 2', async ({ page, server, runAndTrace }) => {
|
||||
const traceViewer = await runAndTrace(async () => {
|
||||
await page.route('**/script.js', route => route.continue());
|
||||
await page.goto(server.PREFIX + '/frames/frame.html');
|
||||
});
|
||||
await traceViewer.selectAction('http://localhost');
|
||||
await traceViewer.showNetworkTab();
|
||||
await expect(traceViewer.networkRequests).toContainText([/200GETframe.htmltext\/html/]);
|
||||
await expect(traceViewer.networkRequests).toContainText([/continue.*script.jsapplication\/javascript/]);
|
||||
});
|
||||
|
||||
test('should show snapshot URL', async ({ page, runAndTrace, server }) => {
|
||||
const traceViewer = await runAndTrace(async () => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -637,7 +637,8 @@ test('should store postData for global request', async ({ request, server }, tes
|
||||
}));
|
||||
});
|
||||
|
||||
test('should not flush console events', async ({ context, page }, testInfo) => {
|
||||
test('should not flush console events', async ({ context, page, mode }, testInfo) => {
|
||||
test.skip(mode === 'service', 'Uses artifactsFolderName');
|
||||
const testId = test.info().testId;
|
||||
await context.tracing.start({ name: testId });
|
||||
const promise = new Promise<void>(f => {
|
||||
|
Loading…
Reference in New Issue
Block a user