Bin
2025-12-17 611bfe34c3c96199eaaf6cf9e41a75892e44e879
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
declare namespace Cypress {
  interface Thresholdable {
    threshold?: number;
  }
  interface CompareScreenshotOptions extends ScreenshotOptions {
    withHidden: string[];
  }
  interface Chainable {
    /**
     * Custom command to select DOM element by data-cy attribute.
     * @example cy.dataCy('greeting')
     */
    captureScreenshot(
      name: string,
      screenshotCaptureOptions?: Partial<Loggable & Timeoutable & CompareScreenshotOptions>,
    ): Chainable<JQuery<Element>>;
    compareScreenshot(
      name: string,
      assert: "shouldChange" | "shouldNotChange" | "diff",
      screenshotCompareOptions?: Partial<Loggable & Timeoutable & CompareScreenshotOptions & Thresholdable>,
    ): Chainable<JQuery<Element>>;
    matchImageSnapshot(options?: { name?: string; threshold?: number }): Chainable<JQuery<Element>>;
 
    /**
     * Waits for a specified number of frames before continuing execution.
     * Uses `requestAnimationFrame` to ensure synchronization with the browser's refresh rate,
     * providing the right timing regardless of system performance.
     *
     * @param {number} [frameCount=1] - The number of frames to wait for. Defaults to 1 if not specified.
     * @return {Chainable<void>} A chainable instance that progresses after the specified frames are waited.
     */
    waitForFrames(frameCount?: number): Chainable<void>;
 
    /**
     * Throttle CPU performance
     * @param rate - CPU throttling rate (1 = normal, 2 = 2x slower, 4 = 4x slower, etc.)
     */
    throttleCPU(rate: number): Chainable<void>;
 
    /**
     * Reset CPU to normal performance
     */
    resetCPU(): Chainable<void>;
 
    /**
     * Throttle network speed
     * @param downloadThroughput - Download speed in bytes per second
     * @param uploadThroughput - Upload speed in bytes per second
     * @param latency - Network latency in milliseconds (optional, default 0)
     */
    throttleNetwork(downloadThroughput: number, uploadThroughput: number, latency?: number): Chainable<void>;
 
    /**
     * Reset network to normal speed
     */
    resetNetwork(): Chainable<void>;
 
    /**
     * Set network to Slow 3G conditions
     */
    setSlow3GNetwork(): Chainable<void>;
 
    /**
     * Set network to Fast 3G conditions
     */
    setFast3GNetwork(): Chainable<void>;
 
    /**
     * Set network to 4G conditions
     */
    set4GNetwork(): Chainable<void>;
  }
}