test: unskip csp tests (#10960)

This commit is contained in:
Alex Rudenko 2023-09-20 16:27:55 +02:00 committed by GitHub
parent 7aa3063acd
commit a4f13b53af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 16 deletions

View File

@ -10,7 +10,7 @@ Toggles bypassing page's Content-Security-Policy.
```typescript
class Page {
setBypassCSP(enabled: boolean): Promise<void>;
abstract setBypassCSP(enabled: boolean): Promise<void>;
}
```

View File

@ -1904,10 +1904,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* evaluation. Usually, this means that `page.setBypassCSP` should be called
* before navigating to the domain.
*/
async setBypassCSP(enabled: boolean): Promise<void>;
async setBypassCSP(): Promise<void> {
throw new Error('Not implemented');
}
abstract setBypassCSP(enabled: boolean): Promise<void>;
/**
* @param type - Changes the CSS media type of the page. The only allowed

View File

@ -155,17 +155,6 @@ export class BidiPage extends Page {
return this.mainFrame().context().cdpSession;
}
override async setUserAgent(
userAgent: string,
userAgentMetadata?: Protocol.Emulation.UserAgentMetadata | undefined
): Promise<void> {
// TODO: handle CDP-specific cases such as mprach.
await this._client().send('Network.setUserAgentOverride', {
userAgent: userAgent,
userAgentMetadata: userAgentMetadata,
});
}
constructor(
browsingContext: BrowsingContext,
browserContext: BidiBrowserContext
@ -214,6 +203,22 @@ export class BidiPage extends Page {
this.#keyboard = new BidiKeyboard(this.mainFrame().context());
}
override async setUserAgent(
userAgent: string,
userAgentMetadata?: Protocol.Emulation.UserAgentMetadata | undefined
): Promise<void> {
// TODO: handle CDP-specific cases such as mprach.
await this._client().send('Network.setUserAgentOverride', {
userAgent: userAgent,
userAgentMetadata: userAgentMetadata,
});
}
override async setBypassCSP(enabled: boolean): Promise<void> {
// TODO: handle CDP-specific cases such as mprach.
await this._client().send('Page.setBypassCSP', {enabled});
}
_setBrowserContext(browserContext: BidiBrowserContext): void {
this.#browserContext = browserContext;
}

View File

@ -3455,24 +3455,48 @@
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass after cross-process navigation",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass CSP header",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass CSP header",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass CSP in iframes as well",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass CSP in iframes as well",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass CSP meta tag",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.setBypassCSP should bypass CSP meta tag",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
},
{
"testIdPattern": "[page.spec] Page Page.setCacheEnabled should enable or disable the cache based on the state passed",
"platforms": ["darwin", "linux", "win32"],