chore: BiDi setCacheEnabled (#10961)

This commit is contained in:
Nikolay Vitkov 2023-09-20 16:39:36 +02:00 committed by GitHub
parent a4f13b53af
commit 7b5eabcc37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View File

@ -10,7 +10,7 @@ Toggles ignoring cache for each request based on the enabled state. By default,
```typescript
class Page {
setCacheEnabled(enabled?: boolean): Promise<void>;
abstract setCacheEnabled(enabled?: boolean): Promise<void>;
}
```

View File

@ -2274,10 +2274,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
* @param enabled - sets the `enabled` state of cache
* @defaultValue `true`
*/
async setCacheEnabled(enabled?: boolean): Promise<void>;
async setCacheEnabled(): Promise<void> {
throw new Error('Not implemented');
}
abstract setCacheEnabled(enabled?: boolean): Promise<void>;
/**
* @internal

View File

@ -744,6 +744,13 @@ export class BidiPage extends Page {
override isDragInterceptionEnabled(): boolean {
return false;
}
override async setCacheEnabled(enabled?: boolean): Promise<void> {
// TODO: handle CDP-specific cases such as mprach.
await this._client().send('Network.setCacheDisabled', {
cacheDisabled: !enabled,
});
}
}
function isConsoleLogEntry(

View File

@ -4174,5 +4174,11 @@
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "chrome", "new-headless", "tabTarget"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[page.spec] Page Page.setCacheEnabled should enable or disable the cache based on the state passed",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["chrome", "webDriverBiDi"],
"expectations": ["PASS"]
}
]