Test rate-limiting, stories in mock server
This commit is contained in:
parent
450051e541
commit
f9453c64dd
9 changed files with 212 additions and 10 deletions
|
@ -4,6 +4,11 @@
|
|||
import type { ElectronApplication, Page } from 'playwright';
|
||||
import { _electron as electron } from 'playwright';
|
||||
|
||||
import type {
|
||||
IPCRequest as ChallengeRequestType,
|
||||
IPCResponse as ChallengeResponseType,
|
||||
} from '../challenge';
|
||||
|
||||
export type AppLoadedInfoType = Readonly<{
|
||||
loadTime: number;
|
||||
messagesPerSec: number;
|
||||
|
@ -57,6 +62,18 @@ export class App {
|
|||
return this.waitForEvent('conversation:open');
|
||||
}
|
||||
|
||||
public async waitForChallenge(): Promise<ChallengeRequestType> {
|
||||
return this.waitForEvent('challenge');
|
||||
}
|
||||
|
||||
public async solveChallenge(response: ChallengeResponseType): Promise<void> {
|
||||
const window = await this.getWindow();
|
||||
|
||||
await window.evaluate(
|
||||
`window.CI.solveChallenge(${JSON.stringify(response)})`
|
||||
);
|
||||
}
|
||||
|
||||
public async close(): Promise<void> {
|
||||
await this.app.close();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue