chore: remove failOnStatusCode from Browser.newContext, rename (#34936)
This commit is contained in:
parent
cd23a224f6
commit
b5fe029c1b
|
|
@ -21,8 +21,12 @@ Creates new instances of [APIRequestContext].
|
||||||
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
|
### option: APIRequest.newContext.extraHTTPHeaders = %%-context-option-extrahttpheaders-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
||||||
### option: APIRequest.newContext.apiRequestFailsOnErrorStatus = %%-context-option-apiRequestFailsOnErrorStatus-%%
|
### option: APIRequest.newContext.failOnStatusCode
|
||||||
* since: v1.51
|
* since: v1.51
|
||||||
|
- `failOnStatusCode` <[boolean]>
|
||||||
|
|
||||||
|
Whether to throw on response codes other than 2xx and 3xx. By default response object is returned
|
||||||
|
for all status codes.
|
||||||
|
|
||||||
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
|
### option: APIRequest.newContext.httpCredentials = %%-context-option-httpcredentials-%%
|
||||||
* since: v1.16
|
* since: v1.16
|
||||||
|
|
|
||||||
|
|
@ -639,11 +639,6 @@ A list of permissions to grant to all pages in this context. See
|
||||||
|
|
||||||
An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
An object containing additional HTTP headers to be sent with every request. Defaults to none.
|
||||||
|
|
||||||
## context-option-apiRequestFailsOnErrorStatus
|
|
||||||
- `apiRequestFailsOnErrorStatus` <[boolean]>
|
|
||||||
|
|
||||||
An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By default, response object is returned for all status codes.
|
|
||||||
|
|
||||||
## context-option-offline
|
## context-option-offline
|
||||||
- `offline` <[boolean]>
|
- `offline` <[boolean]>
|
||||||
|
|
||||||
|
|
@ -1001,7 +996,6 @@ between the same pixel in compared images, between zero (strict) and one (lax),
|
||||||
- %%-context-option-locale-%%
|
- %%-context-option-locale-%%
|
||||||
- %%-context-option-permissions-%%
|
- %%-context-option-permissions-%%
|
||||||
- %%-context-option-extrahttpheaders-%%
|
- %%-context-option-extrahttpheaders-%%
|
||||||
- %%-context-option-apiRequestFailsOnErrorStatus-%%
|
|
||||||
- %%-context-option-offline-%%
|
- %%-context-option-offline-%%
|
||||||
- %%-context-option-httpcredentials-%%
|
- %%-context-option-httpcredentials-%%
|
||||||
- %%-context-option-colorscheme-%%
|
- %%-context-option-colorscheme-%%
|
||||||
|
|
|
||||||
36
packages/playwright-client/types/types.d.ts
vendored
36
packages/playwright-client/types/types.d.ts
vendored
|
|
@ -9741,12 +9741,6 @@ export interface Browser {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
||||||
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
||||||
|
|
@ -14824,12 +14818,6 @@ export interface BrowserType<Unused = {}> {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
||||||
*
|
*
|
||||||
|
|
@ -16720,12 +16708,6 @@ export interface AndroidDevice {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
||||||
*
|
*
|
||||||
|
|
@ -17572,12 +17554,6 @@ export interface APIRequest {
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
newContext(options?: {
|
newContext(options?: {
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods like
|
* Methods like
|
||||||
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
|
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
|
||||||
|
|
@ -17653,6 +17629,12 @@ export interface APIRequest {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status
|
||||||
|
* codes.
|
||||||
|
*/
|
||||||
|
failOnStatusCode?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
||||||
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
||||||
|
|
@ -22157,12 +22139,6 @@ export interface BrowserContextOptions {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
||||||
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ scheme.PlaywrightNewRequestParams = tObject({
|
||||||
userAgent: tOptional(tString),
|
userAgent: tOptional(tString),
|
||||||
ignoreHTTPSErrors: tOptional(tBoolean),
|
ignoreHTTPSErrors: tOptional(tBoolean),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
failOnStatusCode: tOptional(tBoolean),
|
||||||
clientCertificates: tOptional(tArray(tObject({
|
clientCertificates: tOptional(tArray(tObject({
|
||||||
origin: tString,
|
origin: tString,
|
||||||
cert: tOptional(tBinary),
|
cert: tOptional(tBinary),
|
||||||
|
|
@ -600,7 +600,6 @@ scheme.BrowserTypeLaunchPersistentContextParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
@ -688,7 +687,6 @@ scheme.BrowserNewContextParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
@ -759,7 +757,6 @@ scheme.BrowserNewContextForReuseParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
@ -2667,7 +2664,6 @@ scheme.AndroidDeviceLaunchBrowserParams = tObject({
|
||||||
})),
|
})),
|
||||||
permissions: tOptional(tArray(tString)),
|
permissions: tOptional(tArray(tString)),
|
||||||
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
extraHTTPHeaders: tOptional(tArray(tType('NameValue'))),
|
||||||
apiRequestFailsOnErrorStatus: tOptional(tBoolean),
|
|
||||||
offline: tOptional(tBoolean),
|
offline: tOptional(tBoolean),
|
||||||
httpCredentials: tOptional(tObject({
|
httpCredentials: tOptional(tObject({
|
||||||
username: tString,
|
username: tString,
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ import type { Readable, TransformCallback } from 'stream';
|
||||||
type FetchRequestOptions = {
|
type FetchRequestOptions = {
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
extraHTTPHeaders?: HeadersArray;
|
extraHTTPHeaders?: HeadersArray;
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
failOnStatusCode?: boolean;
|
||||||
httpCredentials?: HTTPCredentials;
|
httpCredentials?: HTTPCredentials;
|
||||||
proxy?: ProxySettings;
|
proxy?: ProxySettings;
|
||||||
timeoutSettings: TimeoutSettings;
|
timeoutSettings: TimeoutSettings;
|
||||||
|
|
@ -212,7 +212,7 @@ export abstract class APIRequestContext extends SdkObject {
|
||||||
});
|
});
|
||||||
const fetchUid = this._storeResponseBody(fetchResponse.body);
|
const fetchUid = this._storeResponseBody(fetchResponse.body);
|
||||||
this.fetchLog.set(fetchUid, controller.metadata.log);
|
this.fetchLog.set(fetchUid, controller.metadata.log);
|
||||||
const failOnStatusCode = params.failOnStatusCode !== undefined ? params.failOnStatusCode : !!defaults.apiRequestFailsOnErrorStatus;
|
const failOnStatusCode = params.failOnStatusCode !== undefined ? params.failOnStatusCode : !!defaults.failOnStatusCode;
|
||||||
if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) {
|
if (failOnStatusCode && (fetchResponse.status < 200 || fetchResponse.status >= 400)) {
|
||||||
let responseText = '';
|
let responseText = '';
|
||||||
if (fetchResponse.body.byteLength) {
|
if (fetchResponse.body.byteLength) {
|
||||||
|
|
@ -608,7 +608,7 @@ export class BrowserContextAPIRequestContext extends APIRequestContext {
|
||||||
return {
|
return {
|
||||||
userAgent: this._context._options.userAgent || this._context._browser.userAgent(),
|
userAgent: this._context._options.userAgent || this._context._browser.userAgent(),
|
||||||
extraHTTPHeaders: this._context._options.extraHTTPHeaders,
|
extraHTTPHeaders: this._context._options.extraHTTPHeaders,
|
||||||
apiRequestFailsOnErrorStatus: this._context._options.apiRequestFailsOnErrorStatus,
|
failOnStatusCode: undefined,
|
||||||
httpCredentials: this._context._options.httpCredentials,
|
httpCredentials: this._context._options.httpCredentials,
|
||||||
proxy: this._context._options.proxy || this._context._browser.options.proxy,
|
proxy: this._context._options.proxy || this._context._browser.options.proxy,
|
||||||
timeoutSettings: this._context._timeoutSettings,
|
timeoutSettings: this._context._timeoutSettings,
|
||||||
|
|
@ -660,7 +660,7 @@ export class GlobalAPIRequestContext extends APIRequestContext {
|
||||||
baseURL: options.baseURL,
|
baseURL: options.baseURL,
|
||||||
userAgent: options.userAgent || getUserAgent(),
|
userAgent: options.userAgent || getUserAgent(),
|
||||||
extraHTTPHeaders: options.extraHTTPHeaders,
|
extraHTTPHeaders: options.extraHTTPHeaders,
|
||||||
apiRequestFailsOnErrorStatus: !!options.apiRequestFailsOnErrorStatus,
|
failOnStatusCode: !!options.failOnStatusCode,
|
||||||
ignoreHTTPSErrors: !!options.ignoreHTTPSErrors,
|
ignoreHTTPSErrors: !!options.ignoreHTTPSErrors,
|
||||||
httpCredentials: options.httpCredentials,
|
httpCredentials: options.httpCredentials,
|
||||||
clientCertificates: options.clientCertificates,
|
clientCertificates: options.clientCertificates,
|
||||||
|
|
|
||||||
36
packages/playwright-core/types/types.d.ts
vendored
36
packages/playwright-core/types/types.d.ts
vendored
|
|
@ -9741,12 +9741,6 @@ export interface Browser {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
||||||
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
||||||
|
|
@ -14824,12 +14818,6 @@ export interface BrowserType<Unused = {}> {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
||||||
*
|
*
|
||||||
|
|
@ -16720,12 +16708,6 @@ export interface AndroidDevice {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
* **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
|
||||||
*
|
*
|
||||||
|
|
@ -17572,12 +17554,6 @@ export interface APIRequest {
|
||||||
* @param options
|
* @param options
|
||||||
*/
|
*/
|
||||||
newContext(options?: {
|
newContext(options?: {
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods like
|
* Methods like
|
||||||
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
|
* [apiRequestContext.get(url[, options])](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get)
|
||||||
|
|
@ -17653,6 +17629,12 @@ export interface APIRequest {
|
||||||
*/
|
*/
|
||||||
extraHTTPHeaders?: { [key: string]: string; };
|
extraHTTPHeaders?: { [key: string]: string; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status
|
||||||
|
* codes.
|
||||||
|
*/
|
||||||
|
failOnStatusCode?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
* Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
|
||||||
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
* origin is specified, the username and password are sent to any servers upon unauthorized responses.
|
||||||
|
|
@ -22157,12 +22139,6 @@ export interface BrowserContextOptions {
|
||||||
*/
|
*/
|
||||||
acceptDownloads?: boolean;
|
acceptDownloads?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* An object containing an option to throw an error when API request returns status codes other than 2xx and 3xx. By
|
|
||||||
* default, response object is returned for all status codes.
|
|
||||||
*/
|
|
||||||
apiRequestFailsOnErrorStatus?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
* When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
|
||||||
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
* [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
|
||||||
|
|
|
||||||
12
packages/protocol/src/channels.d.ts
vendored
12
packages/protocol/src/channels.d.ts
vendored
|
|
@ -623,7 +623,7 @@ export type PlaywrightNewRequestParams = {
|
||||||
userAgent?: string,
|
userAgent?: string,
|
||||||
ignoreHTTPSErrors?: boolean,
|
ignoreHTTPSErrors?: boolean,
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
failOnStatusCode?: boolean,
|
||||||
clientCertificates?: {
|
clientCertificates?: {
|
||||||
origin: string,
|
origin: string,
|
||||||
cert?: Binary,
|
cert?: Binary,
|
||||||
|
|
@ -655,7 +655,7 @@ export type PlaywrightNewRequestOptions = {
|
||||||
userAgent?: string,
|
userAgent?: string,
|
||||||
ignoreHTTPSErrors?: boolean,
|
ignoreHTTPSErrors?: boolean,
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
failOnStatusCode?: boolean,
|
||||||
clientCertificates?: {
|
clientCertificates?: {
|
||||||
origin: string,
|
origin: string,
|
||||||
cert?: Binary,
|
cert?: Binary,
|
||||||
|
|
@ -1029,7 +1029,6 @@ export type BrowserTypeLaunchPersistentContextParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1111,7 +1110,6 @@ export type BrowserTypeLaunchPersistentContextOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1228,7 +1226,6 @@ export type BrowserNewContextParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1296,7 +1293,6 @@ export type BrowserNewContextOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1367,7 +1363,6 @@ export type BrowserNewContextForReuseParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -1435,7 +1430,6 @@ export type BrowserNewContextForReuseOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -4802,7 +4796,6 @@ export type AndroidDeviceLaunchBrowserParams = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
@ -4868,7 +4861,6 @@ export type AndroidDeviceLaunchBrowserOptions = {
|
||||||
},
|
},
|
||||||
permissions?: string[],
|
permissions?: string[],
|
||||||
extraHTTPHeaders?: NameValue[],
|
extraHTTPHeaders?: NameValue[],
|
||||||
apiRequestFailsOnErrorStatus?: boolean,
|
|
||||||
offline?: boolean,
|
offline?: boolean,
|
||||||
httpCredentials?: {
|
httpCredentials?: {
|
||||||
username: string,
|
username: string,
|
||||||
|
|
|
||||||
|
|
@ -520,7 +520,6 @@ ContextOptions:
|
||||||
extraHTTPHeaders:
|
extraHTTPHeaders:
|
||||||
type: array?
|
type: array?
|
||||||
items: NameValue
|
items: NameValue
|
||||||
apiRequestFailsOnErrorStatus: boolean?
|
|
||||||
offline: boolean?
|
offline: boolean?
|
||||||
httpCredentials:
|
httpCredentials:
|
||||||
type: object?
|
type: object?
|
||||||
|
|
@ -752,7 +751,7 @@ Playwright:
|
||||||
extraHTTPHeaders:
|
extraHTTPHeaders:
|
||||||
type: array?
|
type: array?
|
||||||
items: NameValue
|
items: NameValue
|
||||||
apiRequestFailsOnErrorStatus: boolean?
|
failOnStatusCode: boolean?
|
||||||
clientCertificates:
|
clientCertificates:
|
||||||
type: array?
|
type: array?
|
||||||
items:
|
items:
|
||||||
|
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { browserTest as it, expect } from '../config/browserTest';
|
|
||||||
|
|
||||||
it('should throw when apiRequestFailsOnErrorStatus is set to true inside BrowserContext options', async ({ browser, server }) => {
|
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
|
||||||
const context = await browser.newContext({ apiRequestFailsOnErrorStatus: true });
|
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
|
||||||
res.end('Not found.');
|
|
||||||
});
|
|
||||||
const error = await context.request.fetch(server.EMPTY_PAGE).catch(e => e);
|
|
||||||
expect(error.message).toContain('404 Not Found');
|
|
||||||
await context.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not throw when failOnStatusCode is set to false inside BrowserContext options', async ({ browser, server }) => {
|
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
|
||||||
const context = await browser.newContext({ apiRequestFailsOnErrorStatus: false });
|
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
|
||||||
res.end('Not found.');
|
|
||||||
});
|
|
||||||
const error = await context.request.fetch(server.EMPTY_PAGE).catch(e => e);
|
|
||||||
expect(error.message).toBeUndefined();
|
|
||||||
await context.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw when apiRequestFailsOnErrorStatus is set to true inside browserType.launchPersistentContext options', async ({ browserType, server, createUserDataDir }) => {
|
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
|
||||||
const userDataDir = await createUserDataDir();
|
|
||||||
const context = await browserType.launchPersistentContext(userDataDir, { apiRequestFailsOnErrorStatus: true });
|
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
|
||||||
res.end('Not found.');
|
|
||||||
});
|
|
||||||
const error = await context.request.fetch(server.EMPTY_PAGE).catch(e => e);
|
|
||||||
expect(error.message).toContain('404 Not Found');
|
|
||||||
await context.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not throw when apiRequestFailsOnErrorStatus is set to false inside browserType.launchPersistentContext options', async ({ browserType, server, createUserDataDir }) => {
|
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
|
||||||
const userDataDir = await createUserDataDir();
|
|
||||||
const context = await browserType.launchPersistentContext(userDataDir, { apiRequestFailsOnErrorStatus: false });
|
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
|
||||||
res.end('Not found.');
|
|
||||||
});
|
|
||||||
const error = await context.request.fetch(server.EMPTY_PAGE).catch(e => e);
|
|
||||||
expect(error.message).toBeUndefined();
|
|
||||||
await context.close();
|
|
||||||
});
|
|
||||||
|
|
@ -537,9 +537,9 @@ it('should retry ECONNRESET', {
|
||||||
await request.dispose();
|
await request.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when apiRequestFailsOnErrorStatus is set to true inside APIRequest context options', async ({ playwright, server }) => {
|
it('should throw when failOnStatusCode is set to true inside APIRequest context options', async ({ playwright, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const request = await playwright.request.newContext({ apiRequestFailsOnErrorStatus: true });
|
const request = await playwright.request.newContext({ failOnStatusCode: true });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
@ -549,9 +549,9 @@ it('should throw when apiRequestFailsOnErrorStatus is set to true inside APIRequ
|
||||||
await request.dispose();
|
await request.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not throw when apiRequestFailsOnErrorStatus is set to false inside APIRequest context options', async ({ playwright, server }) => {
|
it('should not throw when failOnStatusCode is set to false inside APIRequest context options', async ({ playwright, server }) => {
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/34204' });
|
||||||
const request = await playwright.request.newContext({ apiRequestFailsOnErrorStatus: false });
|
const request = await playwright.request.newContext({ failOnStatusCode: false });
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
res.writeHead(404, { 'Content-Length': 10, 'Content-Type': 'text/plain' });
|
||||||
res.end('Not found.');
|
res.end('Not found.');
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ it('should check the box @smoke', async ({ page }) => {
|
||||||
await page.setContent(`<input id='checkbox' type='checkbox'></input>`);
|
await page.setContent(`<input id='checkbox' type='checkbox'></input>`);
|
||||||
await page.check('input');
|
await page.check('input');
|
||||||
expect(await page.evaluate(() => window['checkbox'].checked)).toBe(true);
|
expect(await page.evaluate(() => window['checkbox'].checked)).toBe(true);
|
||||||
|
await expect(page.locator('input[type="checkbox"]')).toBeChecked({ timeout: 1000 });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not check the checked box', async ({ page }) => {
|
it('should not check the checked box', async ({ page }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue